如何在Android上解析GPS导航消息

时间:2017-08-10 18:42:27

标签: java android gps

您好,我是这个领域的新手,需要您的帮助。 我想在Android中获取GNSS星历表数据。我不想从任何网站下载它。 这就是我目前正在做的事情:

我使用GnssNavigationMessage.java(https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/location/java/android/location/GnssNavigationMessage.java)在Android上记录GNSS导航消息。

在我的记录器中,我使用以下命令获取数据: byte [] data = navigationMessage.getData();

现在我得到的数据看起来像这样:

导航,103,769,1,2,1,8,16,-4,19,66,-112,-126,-42,25,20,-8,后跟标题

导航,SVID,类型,状态,的MessageId,子MESSAGEID,数据量(字节)

我想获得以下参数以供进一步计算:

  1. PRN%SV PRN号码
  2. Toc%时钟时间(秒)
  3. af0%SV时钟偏差(秒)
  4. af1%SV时钟漂移(秒/秒)
  5. af2%SV时钟漂移率(秒/秒2)
  6. IODE%数据问题,星历
  7. Crs%正弦谐波校正到轨道半径(米)
  8. Delta_n%与计算值(弧度/秒)的平均运动差异
  9. M0%参考时间的平均异常(弧度)
  10. Cuc%余弦谐波校正到lat(弧度)的参数
  11. e%偏心率(无量纲)
  12. Cus%对纬度参数的正弦谐波校正  (弧度)
  13. Asqrt%半长轴的平方根(米^ 1/2)
  14. Toe%星历的参考时间(秒)
  15. Cic%对倾斜角度的正弦谐波校正  (弧度)
  16. OMEGA%每周纪元(弧度)上升节点的经度
  17. 顺式%对倾斜角度的正弦谐波校正  (弧度)
  18. i0%参考时间的倾角(弧度)
  19. Crc%余弦谐波校正到轨道半径  (米)
  20. omega%近地点的参数(弧度)
  21. OMEGA_DOT%右上升率(弧度/秒)
  22. IDOT%倾斜角度(弧度/秒)
  23. L2通道上的codeL2%代码
  24. GPS_Week%GPS周(与脚趾一起使用),(非Mod 1024)
  25. L2Pdata%L2 P数据标志
  26. 准确度%SV用户范围精度(米)
  27. 健康%卫星健康
  28. TGD%群延迟(秒)
  29. IODC%数据,时钟
  30. ttx%消息的传输时间(秒)
  31. Fit_interval%fit interval(hours),如果不知道则为零
  32. 如果有办法将我收到的导航消息解析为这些参数,请告诉我。 如果我朝错误的方向走,请告诉我。 任何领导将不胜感激。 感谢。

1 个答案:

答案 0 :(得分:0)

Google已实现了将导航消息作为其GNSSLogger app的一部分进行解析的代码:

https://github.com/google/gps-measurement-tools/blob/master/GNSSLogger/pseudorange/src/main/java/com/google/location/lbs/gnss/gps/pseudorange/GpsNavigationMessageStore.java

GpsNavigationMessageStore类描述说:

/**
 * A class to extract the fields of the GPS navigation message from the raw bytes received from the
 * GPS receiver.
 *
 * <p>Raw bytes are passed by calling the method
 * {@link #onNavMessageReported(byte, byte, short, byte[])}
 *
 * <p>A {@link GpsNavMessageProto} containing the extracted field is obtained by calling the method
 * {@link #createDecodedNavMessage()}
 *
 * <p>References:
 * http://www.gps.gov/technical/icwg/IS-GPS-200D.pdf and
 * http://www.gps.gov/technical/ps/1995-SPS-signal-specification.pdf
 *
 */