packet_states.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. // edit packet_states.h to add new packet types
  2. GROUND_STATE, // we don't know what packet type to expect
  3. COMMENT_BODY, // pound comment for a test load
  4. COMMENT_RECOGNIZED, // comment recognized
  5. NMEA_DOLLAR, // we've seen first character of NMEA leader
  6. NMEA_BANG, // we've seen first character of an AIS message '!'
  7. NMEA_PUB_LEAD, // seen second character of NMEA G leader
  8. NMEA_VENDOR_LEAD, // seen second character of NMEA P leader
  9. NMEA_LEADER_END, // seen end char of NMEA leader, in body
  10. NMEA_PASHR_A, // grind through recognizing $PASHR
  11. NMEA_PASHR_S, // grind through recognizing $PASHR
  12. NMEA_PASHR_H, // grind through recognizing $PASHR
  13. NMEA_BINARY_BODY, // Ashtech-style binary packet body, skip until \r\n
  14. NMEA_BINARY_CR, // \r on end of Ashtech-style binary packet
  15. NMEA_BINARY_NL, // \n on end of Ashtech-style binary packet
  16. NMEA_CR, // seen terminating \r of NMEA packet
  17. NMEA_RECOGNIZED, // saw trailing \n of NMEA packet
  18. SIRF_ACK_LEAD_1, // seen A of possible SiRF Ack
  19. SIRF_ACK_LEAD_2, // seen c of possible SiRF Ack
  20. AIS_LEAD_1, // seen initial A of possible AIS message
  21. AIS_LEAD_2, // seen second I/B/N/X of possible AIS message
  22. AIS_LEAD_ALT1, // seen initial B of possible AIS message
  23. AIS_LEAD_ALT2, // seen second S of possible AIS message
  24. AIS_LEAD_ALT3, // seen initial S of possible AIS message
  25. AIS_LEAD_ALT4, // seen second A of possible AIS message
  26. SEATALK_LEAD_1, // SeaTalk/Garmin packet leader 'I'
  27. WEATHER_LEAD_1, // Weather instrument packet leader 'W'
  28. HEADCOMP_LEAD_1, // Heading/compass packet leader 'H'
  29. TURN_LEAD_1, // Turn indicator packet leader 'T'
  30. ECDIS_LEAD_1, // ECDIS packet leader 'E'
  31. SOUNDER_LEAD_1, // Depth sounder packet leader 'S'
  32. TRANSDUCER_LEAD_1, // Generic transducer packet leader 'Y'
  33. BEIDOU_LEAD_1, // Beidou leader
  34. QZSS_LEAD_1, // Quasi-Zenith Satellite System leader
  35. DLE_LEADER, // we've seen the TSIP/EverMore leader (DLE)
  36. #ifdef TRIPMATE_ENABLE
  37. ASTRAL_1, /* ASTRAL leader A */
  38. ASTRAL_2, /* ASTRAL leader S */
  39. ASTRAL_3, /* ASTRAL leader T */
  40. ASTRAL_4, /* ASTRAL leader R */
  41. ASTRAL_5, /* ASTRAL leader A */
  42. #endif /* TRIPMATE_ENABLE */
  43. #ifdef EARTHMATE_ENABLE
  44. EARTHA_1, /* EARTHA leader E */
  45. EARTHA_2, /* EARTHA leader A */
  46. EARTHA_3, /* EARTHA leader R */
  47. EARTHA_4, /* EARTHA leader T */
  48. EARTHA_5, /* EARTHA leader H */
  49. #endif /* EARTHMATE_ENABLE */
  50. #if defined(SIRF_ENABLE) || defined(SKYTRAQ_ENABLE)
  51. SIRF_LEADER_1, /* seen first character of SiRF/Skytraq leader <0x0A> */
  52. #endif /* SIRF_ENABLE || SKYTRAQ_ENABLE */
  53. #ifdef SIRF_ENABLE
  54. SIRF_LEADER_2, /* seen second character of SiRF leader */
  55. SIRF_LENGTH_1, /* seen first byte of SiRF length */
  56. SIRF_PAYLOAD, /* we're in a SiRF payload part */
  57. SIRF_DELIVERED, /* saw last byte of SiRF payload/checksum */
  58. SIRF_TRAILER_1, /* saw first byte of SiRF trailer */
  59. SIRF_RECOGNIZED, /* saw second byte of SiRF trailer */
  60. #endif /* SIRF_ENABLE */
  61. #ifdef SKYTRAQ_ENABLE
  62. /* <0xA0,0xA1><Len><Message ID><Message Body><csum><0x0D,0x0A> */
  63. /* Len is two bytes, is the length of Message ID and Message Body */
  64. /* Skytraq leader 1 same as SIRF_LEADER_1 */
  65. SKY_LEADER_2, /* saw leader 2 <0xA1> */
  66. SKY_LENGTH_1, /* saw first byte of packet length */
  67. SKY_LENGTH_2, /* saw second byte of packet length */
  68. SKY_PAYLOAD, /* we're in a Skytraq payload */
  69. SKY_DELIVERED, /* saw last byte of Skytraq payload */
  70. SKY_CSUM, /* saw Skytraq checksum */
  71. SKY_TRAILER_1, /* saw first byte of Skytraq trailer <0x0D> */
  72. SKY_RECOGNIZED, /* found end of the Skytraq packet */
  73. #endif /* SKYTRAQ_ENABLE */
  74. #ifdef ZODIAC_ENABLE
  75. ZODIAC_EXPECTED, /* expecting Zodiac packet */
  76. ZODIAC_LEADER_1, /* saw leading 0xff */
  77. ZODIAC_LEADER_2, /* saw leading 0x81 */
  78. ZODIAC_ID_1, /* saw first byte of ID */
  79. ZODIAC_ID_2, /* saw second byte of ID */
  80. ZODIAC_LENGTH_1, /* saw first byte of Zodiac packet length */
  81. ZODIAC_LENGTH_2, /* saw second byte of Zodiac packet length */
  82. ZODIAC_FLAGS_1, /* saw first byte of FLAGS */
  83. ZODIAC_FLAGS_2, /* saw second byte of FLAGS */
  84. ZODIAC_HSUM_1, /* saw first byte of Header sum */
  85. ZODIAC_PAYLOAD, /* we're in a Zodiac payload */
  86. ZODIAC_RECOGNIZED, /* found end of the Zodiac packet */
  87. #endif /* ZODIAC_ENABLE */
  88. #if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) || defined(ONCORE_ENABLE)
  89. AT1_LEADER, /* saw True North status leader '@' */
  90. /* Garmin Simple Text starts with @ leader */
  91. /* Oncore starts with @ leader */
  92. GTXT_RECOGNIZED, /* */
  93. #endif
  94. #ifdef EVERMORE_ENABLE
  95. EVERMORE_LEADER_1, /* a DLE after having seen EverMore data */
  96. EVERMORE_LEADER_2, /* seen opening STX of EverMore packet */
  97. EVERMORE_PAYLOAD, /* in payload part of EverMore packet */
  98. EVERMORE_PAYLOAD_DLE,/* DLE in payload part of EverMore packet */
  99. EVERMORE_RECOGNIZED, /* found end of EverMore packet */
  100. #endif /* EVERMORE_ENABLE */
  101. #ifdef ITRAX_ENABLE
  102. ITALK_LEADER_1, /* saw leading < of iTalk packet */
  103. ITALK_LEADER_2, /* saw leading ! of iTalk packet */
  104. ITALK_LENGTH, /* saw packet length */
  105. ITALK_PAYLOAD, /* in payload part of iTalk Packet */
  106. ITALK_DELIVERED, /* seen end of payload */
  107. ITALK_TRAILER, /* saw iTalk trailer byte */
  108. ITALK_RECOGNIZED, /* found end of the iTalk packet */
  109. #endif /* ITRAX_ENABLE */
  110. #ifdef NAVCOM_ENABLE
  111. NAVCOM_EXPECTED, /* expecting Navcom NCT packet */
  112. NAVCOM_LEADER_1, /* saw leading 0x02 */
  113. NAVCOM_LEADER_2, /* saw leading 0x99 */
  114. NAVCOM_LEADER_3, /* saw leading 0x66 */
  115. NAVCOM_ID, /* saw message ID */
  116. NAVCOM_LENGTH_1, /* saw first byte of Navcom packet length */
  117. NAVCOM_LENGTH_2, /* saw second byte of Navcom packet length */
  118. NAVCOM_PAYLOAD, /* we're in a Navcom payload */
  119. NAVCOM_CSUM, /* saw checksum */
  120. NAVCOM_RECOGNIZED, /* found end of the Navcom packet */
  121. #endif /* NAVCOM_ENABLE */
  122. #ifdef UBLOX_ENABLE
  123. UBX_LEADER_1, /* first constant leader byte found */
  124. UBX_LEADER_2, /* second constant leader byte found */
  125. UBX_CLASS_ID, /* classid read */
  126. UBX_MESSAGE_ID, /* message id read */
  127. UBX_LENGTH_1, /* first length byte read (le) */
  128. UBX_LENGTH_2, /* second length byte read (le) */
  129. UBX_PAYLOAD, /* payload eating */
  130. UBX_CHECKSUM_A, /* checksum A byte (tcp checksum) */
  131. UBX_RECOGNIZED, /* this is also UBX_CHECKSUM_B */
  132. #endif
  133. #ifdef SUPERSTAR2_ENABLE
  134. SUPERSTAR2_LEADER, /* leading SOH */
  135. SUPERSTAR2_ID1, /* message type */
  136. SUPERSTAR2_ID2, /* message type xor 0xff */
  137. SUPERSTAR2_PAYLOAD, /* length of the actual packet data */
  138. SUPERSTAR2_CKSUM1,
  139. SUPERSTAR2_CKSUM2,
  140. SUPERSTAR2_RECOGNIZED,
  141. #endif
  142. #ifdef ONCORE_ENABLE
  143. ONCORE_AT2, /* second @ */
  144. ONCORE_ID1, /* first character of command type */
  145. ONCORE_PAYLOAD, /* payload eating */
  146. ONCORE_CHECKSUM, /* checksum byte */
  147. ONCORE_CR, /* closing CR */
  148. ONCORE_RECOGNIZED, /* closing LF */
  149. #endif
  150. #ifdef GEOSTAR_ENABLE
  151. GEOSTAR_LEADER_1, /* first constant leader byte found */
  152. GEOSTAR_LEADER_2, /* second constant leader byte found */
  153. GEOSTAR_LEADER_3, /* third constant leader byte found */
  154. GEOSTAR_LEADER_4, /* forth constant leader byte found */
  155. GEOSTAR_MESSAGE_ID_1, /* first message id read */
  156. GEOSTAR_MESSAGE_ID_2, /* second message id read */
  157. GEOSTAR_LENGTH_1, /* first length byte read */
  158. GEOSTAR_LENGTH_2, /* second length byte read */
  159. GEOSTAR_PAYLOAD, /* payload eating */
  160. GEOSTAR_CHECKSUM_A, /* checksum A byte (xor checksum) */
  161. GEOSTAR_CHECKSUM_B, /* checksum B byte (xor checksum) */
  162. GEOSTAR_CHECKSUM_C, /* checksum C byte (xor checksum) */
  163. GEOSTAR_RECOGNIZED, /* this is also GEOSTAR_CHECKSUM_D */
  164. #endif
  165. #ifdef GREIS_ENABLE
  166. GREIS_EXPECTED, /* expecting GREIS packet */
  167. GREIS_REPLY_1, /* saw first byte of a reply */
  168. GREIS_REPLY_2, /* saw second byte of a reply */
  169. GREIS_ID_1, /* saw first byte of ID */
  170. GREIS_ID_2, /* saw second byte of ID */
  171. GREIS_LENGTH_1, /* saw first length byte */
  172. GREIS_LENGTH_2, /* saw second length byte */
  173. GREIS_PAYLOAD, /* we're in a GREIS payload */
  174. GREIS_RECOGNIZED, /* found end of the GREIS packet */
  175. #endif
  176. /*
  177. * Packet formats without checksums start here. We list them last so
  178. * that if a format with a conflicting structure *and* a checksum can
  179. * be recognized, that will be preferred.
  180. */
  181. #if defined(TSIP_ENABLE) || defined(GARMIN_ENABLE)
  182. TSIP_LEADER, /* a DLE after having seen TSIP data */
  183. TSIP_PAYLOAD, /* we're in TSIP payload */
  184. TSIP_DLE, /* we've seen a DLE in TSIP payload */
  185. TSIP_RECOGNIZED, /* found end of the TSIP packet */
  186. GARMIN_RECOGNIZED, /* found end of Garmin packet */
  187. #endif /* TSIP_ENABLE GARMIN_ENABLE */
  188. #ifdef RTCM104V2_ENABLE
  189. RTCM2_SYNC_STATE, /* we have sync lock */
  190. RTCM2_SKIP_STATE, /* we have sync lock, but this character is bad */
  191. RTCM2_RECOGNIZED, /* we have an RTCM packet */
  192. #endif /* RTCM104V2_ENABLE */
  193. #ifdef RTCM104V3_ENABLE
  194. RTCM3_LEADER_1, /* constant leader byte found */
  195. RTCM3_LEADER_2, /* second leader byte found (high 6 bits zero) */
  196. RTCM3_PAYLOAD, /* gathering payload */
  197. RTCM3_RECOGNIZED, /* RTCM3 packet recognized */
  198. #endif
  199. JSON_LEADER, /* JSON leading { found */
  200. JSON_STRINGLITERAL, /* start of JSON string literal seen */
  201. JSON_STRING_SOLIDUS, /* backslash in string */
  202. JSON_END_ATTRIBUTE, /* end of JSON attribute */
  203. JSON_EXPECT_VALUE, /* just after colon */
  204. JSON_END_VALUE, /* end of JSON value */
  205. JSON_NUMBER, /* inside a JSON numeric literal */
  206. JSON_SPECIAL, /* inside a JSON special literal (true,false,null) */
  207. JSON_RECOGNIZED, /* JSON packet recognized */
  208. #ifdef STASH_ENABLE
  209. STASH_RECOGNIZED, /* stashable prefix recognized */
  210. #endif
  211. /* end of packet_states.h */