将辅助数据注入 GPS

发布于 2024-11-09 16:00:30 字数 1324 浏览 0 评论 0原文

我正在尝试开发一个使用 GPS 的应用程序,我想向 GPS 注入 XTRA 数据和时间参考,以便更快地修复。我的代码如下:

Bundle bundle = new Bundle();
boolean xtraInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_xtra_injection",bundle);
boolean timeInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_time_injection",bundle);

无论互联网连接打开还是关闭(没有蜂窝网络,也没有wifi),xtraInjection 和 timeInjection 布尔值始终为真。所以,我无法检测辅助信息是否良好 注入GPS。

启用 wifi 连接后,将出现下一条日志消息(如果 wifi 关闭,则不会出现错误消息):

I/app (  627): timeInjection:true
....
D/GpsLocationProvider(   96): NTP server returned: 1306322421969 (WedMay 25 13:20:21 GMT+02:00 2011) reference: 338139 certainty: 77 systemtime offset: 7162
D/lib_locapi( 96): loc_eng_inject_time, uncertainty = 77

相反,没有与 XTRA 数据相关的日志消息。如果XTRA数据仍然有效,系统不会请求它?如何查看是否注入成功?

为了进行这些测试,我还尝试删除辅助数据,但我知道这做得不好:

我的代码:

boolean reset=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER, "delete_aiding_data", null);

日志:

I/app (  627): reset:false
D/lib_locapi(   96): loc_eng_ioctl for aiding data deletion returned 0, 1 for success

我也尝试过使用 GPS 状态应用程序,注入和删除的结果相同。

简而言之,我不知道问题是出在我的代码中还是驱动程序实现中。除了logcat之外还有什么方法可以获得这些问题的更多信息呢? (我无法root我的设备)。

先感谢您

I am trying to develop an application which uses GPS and I would like to inject XTRA data and time reference to the GPS in order to get a faster fix. My code is the following one:

Bundle bundle = new Bundle();
boolean xtraInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_xtra_injection",bundle);
boolean timeInjection=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER,"force_time_injection",bundle);

No matter whether internet connection is on or off (no cellular neither wifi) the xtraInjection and timeInjection booleans are always true. So, I not able to detect if the assistance information is well
injected into the GPS.

When the wifi connection is enabled, the next log message appears (no error message if wifi is down):

I/app (  627): timeInjection:true
....
D/GpsLocationProvider(   96): NTP server returned: 1306322421969 (WedMay 25 13:20:21 GMT+02:00 2011) reference: 338139 certainty: 77 systemtime offset: 7162
D/lib_locapi( 96): loc_eng_inject_time, uncertainty = 77

In contrast, there is no log message related with XTRA data. If the XTRA data is still valid, the system does not request for it? How can I see if it is injected successfully?

To make these tests I have also tried deleting assistance data but I know that this is not well done:

My code:

boolean reset=locationmanager.sendExtraCommand(LocationManager.GPS_PROVIDER, "delete_aiding_data", null);

log:

I/app (  627): reset:false
D/lib_locapi(   96): loc_eng_ioctl for aiding data deletion returned 0, 1 for success

I have also tried with GPS STATUS application and the results are the same for both, inject and delete.

In short, I do not know whether the problem is in my code or is something in the driver implementation. There is any way to obtain more information about these problems apart from logcat? (I can not root my device).

Thank you in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

裸钻 2024-11-16 16:00:30

如果您查看frameworks/base/services/java/com/android/server/location/GpsLocationProvider.java,您会发现这些命令将始终返回 true。

您应该这样做的原因很少,不应该这样做的原因也有几个:

  • Android 会在启动后网络首次出现时自动注入时间和 XTRA 数据。不需要重新注入时间,因为只要有修复,GPS 芯片就会将其内部时钟与 GPS 同步。 GPS 芯片将在需要时自动请求新的 XTRA 数据。
  • XTRA 仅适用于 Qualcomm GPS 芯片组。其他供应商确实有等效的服务,但这些服务不像 XTRA 那样在 GpsLocationProvider 中公开。
  • 很可能会有互联网连接可用。在这种情况下,GPS 只会在需要时从 SUPL 服务器下载星历表,只有在不可能时才会回退到 XTRA。

If you look at frameworks/base/services/java/com/android/server/location/GpsLocationProvider.java, you'll find that these commands will always return true.

There is very little reason why you should be doing this, and a few reasons why you shouldn't:

  • Android will automatically inject time and XTRA data when the network first comes up after booting. Time should not need to be re-injected as the GPS chip will synchronise its internal clock with GPS whenever it has a fix. The GPS chip will automatically request new XTRA data when needed.
  • XTRA is only applicable to the Qualcomm GPS chipset. The other vendors do have equivalent services but these are not exposed in GpsLocationProvider like XTRA is.
  • Chances are that an Internet connection will be available. In this case, the GPS will just download ephemerides from the SUPL server when needed, only falling back to XTRA when this is not possible.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文