You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

navilink.h 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. Locosys NaviGPS GT-31/BGT-31 common functions.
  3. Copyright (C) 2008 Rodney Lorrimar <rodney@rodney.id.au>
  4. Copyright (C) 2005 Robert Lipe, robertlipe@usa.net
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
  16. */
  17. #ifndef gpsbabel_navilink_h_included
  18. #define gpsbabel_navilink_h_included
  19. #include <time.h>
  20. #include "defs.h"
  21. #define SBP_RECORD_LEN 32
  22. /* defined in navilink.c */
  23. Waypoint* navilink_decode_logpoint(const unsigned char* buffer);
  24. unsigned navilink_checksum_packet(const unsigned char* packet, unsigned length);
  25. /* defined in sbn.c */
  26. int locosys_decode_file_id(char* header, size_t len);
  27. #ifdef THIS_IS_ONLY_FOR_REFERENCE
  28. /* Locosys SBP and SBN structures */
  29. typedef __packed struct {
  30. UINT8 HDOP; /* HDOP [0..51] with resolution 0.2 */
  31. UINT8 SVIDCnt; /* Number of SVs in solution [0 to 12] */
  32. UINT16 UtcSec; /* UTC Second [0 to 59] in seconds with resolution 0.001 */
  33. UINT32 date_time_UTC_packed; /* refer to protocol doc*/
  34. UINT32 SVIDList; /* SVs in solution: Bit 0=1: SV1, Bit 1=1: SV2, ... , Bit 31=1: SV32 */
  35. INT32 Lat; /* Latitude [-90 to 90] in degrees with resolution 0.0000001 */
  36. INT32 Lon; /* Longitude [-180 to 180] in degrees with resolution 0.0000001 */
  37. INT32 AltCM; /* Altitude from Mean Sea Level in centi meters */
  38. UINT16 Sog; /* Speed Over Ground in m/sec with resolution 0.01 */
  39. UINT16 Cog; /* Course Over Ground [0 to 360] in degrees with resolution 0.01 */
  40. INT16 ClmbRte; /* Climb rate in m/sec with resolution 0.01 */
  41. UINT8 bitFlags; /* bitFlags, default 0x00, bit 0=1 indicate the first point after power on */
  42. UINT8 reserved;
  43. } T_SBP;
  44. typedef struct __packed {
  45. UINT8 Mid;
  46. UINT16 Valid;
  47. UINT16 Mode; /* Nav Mode: bit map as follows:
  48. * Bits 2-0: GPS Fix Type
  49. * 000 = No Nav
  50. * 001 = 1 SV solution
  51. * 010 = 2 SV solution
  52. * 011 = 3 SV solution (2D)
  53. * 100 = 4 or more SV solution (3D)
  54. * 101 = Least Square 2D solution
  55. * 110 = Least Square 3D solution
  56. * 111 = DR solution (no SV)
  57. * Bit 3 : 1 = Trickle Power ON
  58. * Bits 5-4: Altitude Hold
  59. * 00 = No Altitude Hold
  60. * 01 = Altitude Hold using altitude from KF
  61. * 10 = Altitude Hold using altitude from user
  62. * 11 = forced altitude
  63. * Bit 6 : 1 = DOP exceeded
  64. * Bit 7 : 1 = DGPS correction applied
  65. * Bit 8 :
  66. * 1 = Sensor-based DR
  67. * 0 = Velocity DR, if bits 2-0 = 111
  68. * = see bits 15-14, if bits 2-0 != 111
  69. * Bit 9 : 1 = Solution validated
  70. * Bit 10 : 1 = Velocity DR Timeout
  71. * Bit 11 : 1 = Solution edited by UI
  72. * Bit 12 : 1 = Velocity invalid
  73. * Bit 13 : 1 = Altitude Hold disabled
  74. * Bits 15-14: SiRFDrive DR Status (applicable only when bit 8=0)
  75. * 00 = GPS Only
  76. * 01 = Calibrating
  77. * 10 = DR sensor error
  78. * 11 = DR Test mode
  79. */
  80. UINT16 Week; /* Extended Week Number */
  81. UINT32 TOW; /* Time of Week [0 to 604800] in seconds with resolution 0.001 */
  82. UINT16 UtcYr; /* UTC Year [1980 to 3000] */
  83. UINT8 UtcMth; /* UTC Month [1 to 12] */
  84. UINT8 UtcDay; /* UTC Day [1 to 31] */
  85. UINT8 UtcHr; /* UTC Hour [0 to 23] */
  86. UINT8 UtcMin; /* UTC Minute [0 to 59] */
  87. UINT16 UtcSec; /* UTC Second [0 to 59] in seconds with resolution 0.001 */
  88. UINT32 SVIDList; /* SVs in solution: Bit 0=1: SV1, Bit 1=1: SV2, ... , Bit 31=1: SV32 */
  89. INT32 Lat; /* Latitude [-90 to 90] in degrees with resolution 0.0000001 */
  90. INT32 Lon; /* Longitude [-180 to 180] in degrees with resolution 0.0000001 */
  91. INT32 AltE; /* Altitude from Ellipsoid in meters with resolution 0.01 */
  92. INT32 AltM; /* Altitude from Mean Sea Level in meters with resolution 0.01 */
  93. UINT8 Datum; /* Map datum */
  94. UINT16 Sog; /* Speed Over Ground in m/sec with resolution 0.01 */
  95. UINT16 Cog; /* Course Over Ground [0 to 360] in degrees with resolution 0.01 */
  96. INT16 MagVar; /* Magnetic Variation - Reserved */
  97. INT16 ClmbRte; /* Climb rate in m/sec with resolution 0.01 */
  98. INT16 HdRte; /* Heading Rate in deg/sec with resolution 0.01 (SiRFDrive only) */
  99. UINT32 Ehpe; /* Expected Horizontal Position Error in meters with resolution 0.01 */
  100. UINT32 Evpe; /* Expected Horizontal Vertical Error in meters with resolution 0.01 */
  101. UINT32 Ete; /* Expected Time Error in meters with resolution 0.01 (SiRFDrive only) - Reserved */
  102. UINT16 Ehve; /* Expected Horizontal Velocity Error in m/sec with resolution 0.01 (SiRFDrive only) */
  103. INT32 ClkBias; /* Clock Bias in meters with resolution 0.01 */
  104. UINT32 ClkBiasE; /* Clock Bias Error in meters with resolution 0.01 (SiRFDrive only) */
  105. INT32 ClkDrift; /* Clock Drift in m/sec with resolution 0.01 */
  106. UINT32 ClkDriftE; /* Clock Drift in m/sec with resolution 0.01 (SiRFDrive only) */
  107. UINT32 Trvled; /* Distance Traveled since reset in meters (SiRFDrive only) */
  108. UINT16 TrvledE; /* Distance Traveled Error in meters (SiRFDrive only) */
  109. UINT16 HdE; /* Heading Error [0 to 180] in degrees with resolution 0.01 (SiRFDrive only) */
  110. UINT8 SVIDCnt; /* Number of SVs in solution [0 to 12] */
  111. UINT8 HDOP; /* HDOP [0..51] with resolution 0.2 */
  112. UINT8 Reserved; /* Reserved */
  113. UINT16 ufSog; /* Speed Over Ground in m/sec with resolution 0.01 ,unfiltered*/
  114. UINT16 ufCog; /* Course Over Ground [0 to 360] in degrees with resolution 0.01, unfiltered */
  115. } T_SBN_REC;
  116. #endif
  117. #endif /* gpsbabel_navilink_h_included */