packet_states.h 11 KB

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