sentence.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. *
  3. * NMEA library
  4. * URL: http://nmea.sourceforge.net
  5. * Author: Tim (xtimor@gmail.com)
  6. * Licence: http://www.gnu.org/licenses/lgpl.html
  7. * $Id: sentence.h 17 2008-03-11 11:56:11Z xtimor $
  8. *
  9. */
  10. /*! \file */
  11. #ifndef __NMEA_SENTENCE_H__
  12. #define __NMEA_SENTENCE_H__
  13. #include "info.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /**
  18. * NMEA packets type which parsed and generated by library
  19. */
  20. enum nmeaPACKTYPE
  21. {
  22. GPNON = 0x0000, /**< Unknown packet type. */
  23. GPGGA = 0x0001, /**< GGA - Essential fix data which provide 3D location and accuracy data. */
  24. GPGSA = 0x0002, /**< GSA - GPS receiver operating mode, SVs used for navigation, and DOP values. */
  25. GPGSV = 0x0004, /**< GSV - Number of SVs in view, PRN numbers, elevation, azimuth & SNR values. */
  26. GPRMC = 0x0008, /**< RMC - Recommended Minimum Specific GPS/TRANSIT Data. */
  27. GPVTG = 0x0010, /**< VTG - Actual track made good and speed over ground. */
  28. GNGGA = 0x0011,
  29. GNGSA = 0x0020,
  30. GNRMC = 0x0080,
  31. BDGSV = 0x0044 /**< GSV - Number of SVs in view, PRN numbers, elevation, azimuth & SNR values. */
  32. };
  33. /**
  34. * GGA packet information structure (Global Positioning System Fix Data)
  35. */
  36. typedef struct _nmeaGPGGA
  37. {
  38. nmeaTIME utc; /**< UTC of position (just time) */
  39. double lat; /**< Latitude in NDEG - [degree][min].[sec/60] */
  40. char ns; /**< [N]orth or [S]outh */
  41. double lon; /**< Longitude in NDEG - [degree][min].[sec/60] */
  42. char ew; /**< [E]ast or [W]est */
  43. int sig; /**< GPS quality indicator (0 = Invalid; 1 = Fix; 2 = Differential, 3 = Sensitive) */
  44. int satinuse; /**< Number of satellites in use (not those in view) */
  45. double HDOP; /**< Horizontal dilution of precision */
  46. double elv; /**< Antenna altitude above/below mean sea level (geoid) */
  47. char elv_units; /**< [M]eters (Antenna height unit) */
  48. double diff; /**< Geoidal separation (Diff. between WGS-84 earth ellipsoid and mean sea level. '-' = geoid is below WGS-84 ellipsoid) */
  49. char diff_units; /**< [M]eters (Units of geoidal separation) */
  50. double dgps_age; /**< Time in seconds since last DGPS update */
  51. int dgps_sid; /**< DGPS station ID number */
  52. } nmeaGPGGA;
  53. /**
  54. * GSA packet information structure (Satellite status)
  55. */
  56. typedef struct _nmeaGPGSA
  57. {
  58. char fix_mode; /**< Mode (M = Manual, forced to operate in 2D or 3D; A = Automatic, 3D/2D) */
  59. int fix_type; /**< Type, used for navigation (1 = Fix not available; 2 = 2D; 3 = 3D) */
  60. int sat_prn[NMEA_MAXSAT]; /**< PRNs of satellites used in position fix (null for unused fields) */
  61. double PDOP; /**< Dilution of precision */
  62. double HDOP; /**< Horizontal dilution of precision */
  63. double VDOP; /**< Vertical dilution of precision */
  64. int selectedSatellites;
  65. } nmeaGPGSA;
  66. /**
  67. * GSV packet information structure (Satellites in view)
  68. */
  69. typedef struct _nmeaGPGSV
  70. {
  71. int pack_count; /**< Total number of messages of this type in this cycle */
  72. int pack_index; /**< Message number */
  73. int sat_count; /**< Total number of satellites in view */
  74. nmeaSATELLITE sat_data[NMEA_SATINPACK];
  75. } nmeaGPGSV;
  76. /**
  77. * RMC packet information structure (Recommended Minimum sentence C)
  78. */
  79. typedef struct _nmeaGPRMC
  80. {
  81. nmeaTIME utc; /**< UTC of position */
  82. char status; /**< Status (A = active or V = void) */
  83. double lat; /**< Latitude in NDEG - [degree][min].[sec/60] */
  84. char ns; /**< [N]orth or [S]outh */
  85. double lon; /**< Longitude in NDEG - [degree][min].[sec/60] */
  86. char ew; /**< [E]ast or [W]est */
  87. double speed; /**< Speed over the ground in knots */
  88. double direction; /**< Track angle in degrees True */
  89. double declination; /**< Magnetic variation degrees (Easterly var. subtracts from true course) */
  90. char declin_ew; /**< [E]ast or [W]est */
  91. char mode; /**< Mode indicator of fix type (A = autonomous, D = differential, E = estimated, N = not valid, S = simulator) */
  92. } nmeaGPRMC;
  93. /**
  94. * VTG packet information structure (Track made good and ground speed)
  95. */
  96. typedef struct _nmeaGPVTG
  97. {
  98. double dir; /**< True track made good (degrees) */
  99. char dir_t; /**< Fixed text 'T' indicates that track made good is relative to true north */
  100. double dec; /**< Magnetic track made good */
  101. char dec_m; /**< Fixed text 'M' */
  102. double spn; /**< Ground speed, knots */
  103. char spn_n; /**< Fixed text 'N' indicates that speed over ground is in knots */
  104. double spk; /**< Ground speed, kilometers per hour */
  105. char spk_k; /**< Fixed text 'K' indicates that speed over ground is in kilometers/hour */
  106. } nmeaGPVTG;
  107. void nmea_zero_GPGGA(nmeaGPGGA *pack);
  108. void nmea_zero_GPGSA(nmeaGPGSA *pack);
  109. void nmea_zero_GPGSV(nmeaGPGSV *pack);
  110. void nmea_zero_GPRMC(nmeaGPRMC *pack);
  111. void nmea_zero_GPVTG(nmeaGPVTG *pack);
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif /* __NMEA_SENTENCE_H__ */