2
0

antmessage.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except
  4. in compliance with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2016
  6. All rights reserved.
  7. */
  8. #ifndef ANTMESSAGE_H
  9. #define ANTMESSAGE_H
  10. #include "types.h"
  11. #include "antdefines.h"
  12. /////////////////////////////////////////////////////////////////////////////
  13. // Message Format
  14. // Messages are in the format:
  15. //
  16. // AX XX YY -------- CK
  17. //
  18. // where: AX is the 1 byte sync byte either transmit or recieve
  19. // XX is the 1 byte size of the message (0-249) NOTE: THIS WILL BE LIMITED BY THE EMBEDDED RECEIVE BUFFER SIZE
  20. // YY is the 1 byte ID of the message (1-255, 0 is invalid)
  21. // ----- is the data of the message (0-249 bytes of data)
  22. // CK is the 1 byte Checksum of the message
  23. /////////////////////////////////////////////////////////////////////////////
  24. #define MESG_TX_SYNC ((UCHAR)0xA4)
  25. #define MESG_RX_SYNC ((UCHAR)0xA5)
  26. #define MESG_SYNC_SIZE ((UCHAR)1)
  27. #define MESG_SIZE_SIZE ((UCHAR)1)
  28. #define MESG_ID_SIZE ((UCHAR)1)
  29. #define MESG_CHANNEL_NUM_SIZE ((UCHAR)1)
  30. #define MESG_EXT_MESG_BF_SIZE ((UCHAR)1) // NOTE: this could increase in the future
  31. #define MESG_CHECKSUM_SIZE ((UCHAR)1)
  32. #define MESG_DATA_SIZE ((UCHAR)9)
  33. // The largest serial message is an ANT data message with all of the extended fields
  34. #define MESG_ANT_MAX_PAYLOAD_SIZE ANT_STANDARD_DATA_PAYLOAD_SIZE
  35. #define MESG_MAX_EXT_DATA_SIZE (ANT_EXT_MESG_DEVICE_ID_FIELD_SIZE + ANT_EXT_STRING_SIZE) // ANT device ID (4 bytes) + Padding for ANT EXT string size(27 bytes)
  36. #define MESG_MAX_DATA_SIZE (MESG_ANT_MAX_PAYLOAD_SIZE + MESG_EXT_MESG_BF_SIZE + MESG_MAX_EXT_DATA_SIZE) // ANT data payload (8 bytes) + extended bitfield (1 byte) + extended data (31 bytes) = 40 bytes
  37. #define MESG_MAX_SIZE_VALUE (MESG_MAX_DATA_SIZE + MESG_CHANNEL_NUM_SIZE) // this is the maximum value that the serial message size value is allowed to be (40 + 1 = 41 bytes)
  38. #define MESG_BUFFER_SIZE (MESG_SIZE_SIZE + MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE + MESG_CHECKSUM_SIZE)
  39. #define MESG_FRAMED_SIZE (MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE)
  40. #define MESG_HEADER_SIZE (MESG_SYNC_SIZE + MESG_SIZE_SIZE + MESG_ID_SIZE)
  41. #define MESG_FRAME_SIZE (MESG_HEADER_SIZE + MESG_CHECKSUM_SIZE)
  42. #define MESG_MAX_SIZE (MESG_MAX_DATA_SIZE + MESG_FRAME_SIZE)
  43. #define MESG_SIZE_OFFSET (MESG_SYNC_SIZE)
  44. #define MESG_ID_OFFSET (MESG_SYNC_SIZE + MESG_SIZE_SIZE)
  45. #define MESG_DATA_OFFSET (MESG_HEADER_SIZE)
  46. #define MESG_RECOMMENDED_BUFFER_SIZE ((UCHAR) 64) // This is the recommended size for serial message buffers if there are no RAM restrictions on the system
  47. //////////////////////////////////////////////
  48. // Message ID's
  49. //////////////////////////////////////////////
  50. #define MESG_INVALID_ID ((UCHAR)0x00)
  51. #define MESG_EVENT_ID ((UCHAR)0x01)
  52. #define MESG_VERSION_ID ((UCHAR)0x3E)
  53. #define MESG_RESPONSE_EVENT_ID ((UCHAR)0x40)
  54. #define MESG_UNASSIGN_CHANNEL_ID ((UCHAR)0x41)
  55. #define MESG_ASSIGN_CHANNEL_ID ((UCHAR)0x42)
  56. #define MESG_CHANNEL_MESG_PERIOD_ID ((UCHAR)0x43)
  57. #define MESG_CHANNEL_SEARCH_TIMEOUT_ID ((UCHAR)0x44)
  58. #define MESG_CHANNEL_RADIO_FREQ_ID ((UCHAR)0x45)
  59. #define MESG_NETWORK_KEY_ID ((UCHAR)0x46)
  60. #define MESG_RADIO_TX_POWER_ID ((UCHAR)0x47)
  61. #define MESG_RADIO_CW_MODE_ID ((UCHAR)0x48)
  62. #define MESG_SYSTEM_RESET_ID ((UCHAR)0x4A)
  63. #define MESG_OPEN_CHANNEL_ID ((UCHAR)0x4B)
  64. #define MESG_CLOSE_CHANNEL_ID ((UCHAR)0x4C)
  65. #define MESG_REQUEST_ID ((UCHAR)0x4D)
  66. #define MESG_BROADCAST_DATA_ID ((UCHAR)0x4E)
  67. #define MESG_ACKNOWLEDGED_DATA_ID ((UCHAR)0x4F)
  68. #define MESG_BURST_DATA_ID ((UCHAR)0x50)
  69. #define MESG_CHANNEL_ID_ID ((UCHAR)0x51)
  70. #define MESG_CHANNEL_STATUS_ID ((UCHAR)0x52)
  71. #define MESG_RADIO_CW_INIT_ID ((UCHAR)0x53)
  72. #define MESG_CAPABILITIES_ID ((UCHAR)0x54)
  73. #define MESG_STACKLIMIT_ID ((UCHAR)0x55)
  74. #define MESG_SCRIPT_DATA_ID ((UCHAR)0x56)
  75. #define MESG_SCRIPT_CMD_ID ((UCHAR)0x57)
  76. #define MESG_ID_LIST_ADD_ID ((UCHAR)0x59)
  77. #define MESG_CRYPTO_ID_LIST_ADD_ID ((UCHAR)0x59)
  78. #define MESG_ID_LIST_CONFIG_ID ((UCHAR)0x5A)
  79. #define MESG_CRYPTO_ID_LIST_CONFIG_ID ((UCHAR)0x5A)
  80. #define MESG_OPEN_RX_SCAN_ID ((UCHAR)0x5B)
  81. #define MESG_EXT_CHANNEL_RADIO_FREQ_ID ((UCHAR)0x5C) // OBSOLETE: (for 905 radio)
  82. #define MESG_EXT_BROADCAST_DATA_ID ((UCHAR)0x5D)
  83. #define MESG_EXT_ACKNOWLEDGED_DATA_ID ((UCHAR)0x5E)
  84. #define MESG_EXT_BURST_DATA_ID ((UCHAR)0x5F)
  85. #define MESG_CHANNEL_RADIO_TX_POWER_ID ((UCHAR)0x60)
  86. #define MESG_GET_SERIAL_NUM_ID ((UCHAR)0x61)
  87. #define MESG_GET_TEMP_CAL_ID ((UCHAR)0x62)
  88. #define MESG_SET_LP_SEARCH_TIMEOUT_ID ((UCHAR)0x63)
  89. #define MESG_SET_TX_SEARCH_ON_NEXT_ID ((UCHAR)0x64)
  90. #define MESG_SERIAL_NUM_SET_CHANNEL_ID_ID ((UCHAR)0x65)
  91. #define MESG_RX_EXT_MESGS_ENABLE_ID ((UCHAR)0x66)
  92. #define MESG_RADIO_CONFIG_ALWAYS_ID ((UCHAR)0x67)
  93. #define MESG_ENABLE_LED_FLASH_ID ((UCHAR)0x68)
  94. #define MESG_XTAL_ENABLE_ID ((UCHAR)0x6D)
  95. #define MESG_ANTLIB_CONFIG_ID ((UCHAR)0x6E)
  96. #define MESG_STARTUP_MESG_ID ((UCHAR)0x6F)
  97. #define MESG_AUTO_FREQ_CONFIG_ID ((UCHAR)0x70)
  98. #define MESG_PROX_SEARCH_CONFIG_ID ((UCHAR)0x71)
  99. #define MESG_ADV_BURST_DATA_ID ((UCHAR)0x72)
  100. #define MESG_EVENT_BUFFERING_CONFIG_ID ((UCHAR)0x74)
  101. #define MESG_SET_SEARCH_CH_PRIORITY_ID ((UCHAR)0x75)
  102. #define MESG_HIGH_DUTY_SEARCH_MODE_ID ((UCHAR)0x77)
  103. #define MESG_CONFIG_ADV_BURST_ID ((UCHAR)0x78)
  104. #define MESG_EVENT_FILTER_CONFIG_ID ((UCHAR)0x79)
  105. #define MESG_SDU_CONFIG_ID ((UCHAR)0x7A)
  106. #define MESG_SDU_SET_MASK_ID ((UCHAR)0x7B)
  107. #define MESG_USER_CONFIG_PAGE_ID ((UCHAR)0x7C)
  108. #define MESG_ENCRYPT_ENABLE_ID ((UCHAR)0x7D)
  109. #define MESG_SET_CRYPTO_KEY_ID ((UCHAR)0x7E)
  110. #define MESG_SET_CRYPTO_INFO_ID ((UCHAR)0x7F)
  111. #define MESG_CUBE_CMD_ID ((UCHAR)0x80)
  112. #define MESG_ACTIVE_SEARCH_SHARING_ID ((UCHAR)0x81)
  113. #define MESG_NVM_CRYPTO_KEY_OPS_ID ((UCHAR)0x83)
  114. #define MESG_GET_PIN_DIODE_CONTROL_ID ((UCHAR)0x8D)
  115. #define MESG_PIN_DIODE_CONTROL_ID ((UCHAR)0x8E)
  116. #define MESG_FIT1_SET_AGC_ID ((UCHAR)0x8F)
  117. #define MESG_FIT1_SET_EQUIP_STATE_ID ((UCHAR)0x91) // *** CONFLICT: w/ Sensrcore, Fit1 will never have sensrcore enabled
  118. // Sensrcore Messages
  119. #define MESG_SET_CHANNEL_INPUT_MASK_ID ((UCHAR)0x90)
  120. #define MESG_SET_CHANNEL_DATA_TYPE_ID ((UCHAR)0x91)
  121. #define MESG_READ_PINS_FOR_SECT_ID ((UCHAR)0x92)
  122. #define MESG_TIMER_SELECT_ID ((UCHAR)0x93)
  123. #define MESG_ATOD_SETTINGS_ID ((UCHAR)0x94)
  124. #define MESG_SET_SHARED_ADDRESS_ID ((UCHAR)0x95)
  125. #define MESG_ATOD_EXTERNAL_ENABLE_ID ((UCHAR)0x96)
  126. #define MESG_ATOD_PIN_SETUP_ID ((UCHAR)0x97)
  127. #define MESG_SETUP_ALARM_ID ((UCHAR)0x98)
  128. #define MESG_ALARM_VARIABLE_MODIFY_TEST_ID ((UCHAR)0x99)
  129. #define MESG_PARTIAL_RESET_ID ((UCHAR)0x9A)
  130. #define MESG_OVERWRITE_TEMP_CAL_ID ((UCHAR)0x9B)
  131. #define MESG_SERIAL_PASSTHRU_SETTINGS_ID ((UCHAR)0x9C)
  132. #define MESG_BIST_ID ((UCHAR)0xAA)
  133. #define MESG_UNLOCK_INTERFACE_ID ((UCHAR)0xAD)
  134. #define MESG_SERIAL_ERROR_ID ((UCHAR)0xAE)
  135. #define MESG_SET_ID_STRING_ID ((UCHAR)0xAF)
  136. #define MESG_PORT_GET_IO_STATE_ID ((UCHAR)0xB4)
  137. #define MESG_PORT_SET_IO_STATE_ID ((UCHAR)0xB5)
  138. #define MESG_RSSI_ID ((UCHAR)0xC0)
  139. #define MESG_RSSI_BROADCAST_DATA_ID ((UCHAR)0xC1)
  140. #define MESG_RSSI_ACKNOWLEDGED_DATA_ID ((UCHAR)0xC2)
  141. #define MESG_RSSI_BURST_DATA_ID ((UCHAR)0xC3)
  142. #define MESG_RSSI_SEARCH_THRESHOLD_ID ((UCHAR)0xC4)
  143. #define MESG_SLEEP_ID ((UCHAR)0xC5)
  144. #define MESG_GET_GRMN_ESN_ID ((UCHAR)0xC6)
  145. #define MESG_SET_USB_INFO_ID ((UCHAR)0xC7)
  146. #define MESG_HCI_COMMAND_COMPLETE ((UCHAR)0xC8)
  147. // 0xE0 - 0xEF reserved for extended ID
  148. #define MESG_EXT_ID_0 ((UCHAR)0xE0)
  149. #define MESG_EXT_ID_1 ((UCHAR)0xE1)
  150. #define MESG_EXT_ID_2 ((UCHAR)0xE2)
  151. // 0xE0 extended IDs
  152. #define MESG_EXT_RESPONSE_ID ((USHORT)0xE000)
  153. // 0xE1 extended IDs
  154. #define MESG_EXT_REQUEST_ID ((USHORT)0xE100)
  155. // 0xE2 extended IDs
  156. #define MESG_FS_INIT_MEMORY_ID ((USHORT)0xE200)
  157. #define MESG_FS_FORMAT_MEMORY_ID ((USHORT)0xE201)
  158. #define MESG_FS_GET_USED_SPACE_ID ((USHORT)0xE202)
  159. #define MESG_FS_GET_FREE_SPACE_ID ((USHORT)0xE203)
  160. #define MESG_FS_FIND_FILE_INDEX_ID ((USHORT)0xE204)
  161. #define MESG_FS_DIRECTORY_READ_ABSOLUTE_ID ((USHORT)0xE205)
  162. #define MESG_FS_DIRECTORY_READ_ENTRY_ID ((USHORT)0xE206)
  163. #define MESG_FS_DIRECTORY_SAVE_ID ((USHORT)0xE207)
  164. #define MESG_FS_DIRECTORY_GET_SIZE_ID ((USHORT)0xE208)
  165. #define MESG_FS_DIRECTORY_REBUILD_ID ((USHORT)0xE209)
  166. #define MESG_FS_FILE_CREATE_ID ((USHORT)0xE20A)
  167. #define MESG_FS_FILE_OPEN_ID ((USHORT)0xE20B)
  168. #define MESG_FS_FILE_DELETE_ID ((USHORT)0xE20C)
  169. #define MESG_FS_FILE_CLOSE_ID ((USHORT)0xE20D)
  170. #define MESG_FS_FILE_READ_ABSOLUTE_ID ((USHORT)0xE20E)
  171. #define MESG_FS_FILE_READ_RELATIVE_ID ((USHORT)0xE20F)
  172. #define MESG_FS_FILE_WRITE_ABSOLUTE_ID ((USHORT)0xE210)
  173. #define MESG_FS_FILE_WRITE_RELATIVE_ID ((USHORT)0xE211)
  174. #define MESG_FS_FILE_SET_SPECIFIC_FLAGS_ID ((USHORT)0xE212)
  175. #define MESG_FS_FILE_GET_SIZE_ID ((USHORT)0xE213)
  176. #define MESG_FS_FILE_GET_SPECIFIC_FILE_FLAGS_ID ((USHORT)0xE214)
  177. #define MESG_FS_FILE_GET_SIZE_IN_MEM_ID ((USHORT)0xE215)
  178. #define MESG_FS_DIRECTORY_READ_LOCK_ID ((USHORT)0xE216)
  179. #define MESG_FS_FILE_SET_GENERAL_FLAGS_ID ((USHORT)0xE21E)
  180. #define MESG_FS_DIRECTORY_WRITE_ABSOLUTE_ID ((USHORT)0xE21F)
  181. // reserved
  182. #define MESG_MEMDEV_EEPROM_INIT_ID ((USHORT)0xE220)
  183. #define MESG_MEMDEV_FLASH_INIT_ID ((USHORT)0xE221)
  184. //reserved
  185. #define MESG_FS_ANTFS_EVENT_ID ((USHORT)0xE230)
  186. #define MESG_FS_ANTFS_OPEN_ID ((USHORT)0xE231)
  187. #define MESG_FS_ANTFS_CLOSE_ID ((USHORT)0xE232)
  188. #define MESG_FS_ANTFS_CONFIG_BEACON_ID ((USHORT)0xE233)
  189. #define MESG_FS_ANTFS_SET_AUTH_STRING_ID ((USHORT)0xE234)
  190. #define MESG_FS_ANTFS_SET_BEACON_STATE_ID ((USHORT)0xE235)
  191. #define MESG_FS_ANTFS_PAIR_RESPONSE_ID ((USHORT)0xE236)
  192. #define MESG_FS_ANTFS_SET_LINK_FREQ_ID ((USHORT)0xE237)
  193. #define MESG_FS_ANTFS_SET_BEACON_TIMEOUT_ID ((USHORT)0xE238)
  194. #define MESG_FS_ANTFS_SET_PAIRING_TIMEOUT_ID ((USHORT)0xE239)
  195. #define MESG_FS_ANTFS_REMOTE_FILE_CREATE_EN_ID ((USHORT)0xE23A)
  196. #define MESG_FS_ANTFS_GET_CMD_PIPE_ID ((USHORT)0xE23B)
  197. #define MESG_FS_ANTFS_SET_CMD_PIPE_ID ((USHORT)0xE23C)
  198. #define MESG_FS_SYSTEM_TIME_ID ((USHORT)0xE23D)
  199. #define MESG_FS_ANTFS_SET_ANTFS_STATE_ID ((USHORT)0xE23E)
  200. // reserved
  201. #define MESG_FS_CRYPTO_ADD_USER_KEY_INDEX_ID ((USHORT)0xE245)
  202. #define MESG_FS_CRYPTO_SET_USER_KEY_INDEX_ID ((USHORT)0xE246)
  203. #define MESG_FS_CRYPTO_SET_USER_KEY_VAL_ID ((USHORT)0xE247)
  204. // reserved
  205. #define MESG_FS_FIT_FILE_INTEGRITY_CHECK_ID ((USHORT)0xE250)
  206. //////////////////////////////////////////////
  207. // Message Sizes
  208. //////////////////////////////////////////////
  209. #define MESG_INVALID_SIZE ((UCHAR)0)
  210. #define MESG_VERSION_SIZE ((UCHAR)13)
  211. #define MESG_RESPONSE_EVENT_SIZE ((UCHAR)3)
  212. #define MESG_CHANNEL_STATUS_SIZE ((UCHAR)2)
  213. #define MESG_UNASSIGN_CHANNEL_SIZE ((UCHAR)1)
  214. #define MESG_ASSIGN_CHANNEL_SIZE ((UCHAR)3)
  215. #define MESG_CHANNEL_ID_SIZE ((UCHAR)5)
  216. #define MESG_CHANNEL_MESG_PERIOD_SIZE ((UCHAR)3)
  217. #define MESG_CHANNEL_SEARCH_TIMEOUT_SIZE ((UCHAR)2)
  218. #define MESG_CHANNEL_RADIO_FREQ_SIZE ((UCHAR)2)
  219. #define MESG_CHANNEL_RADIO_TX_POWER_SIZE ((UCHAR)2)
  220. #define MESG_NETWORK_KEY_SIZE ((UCHAR)9)
  221. #define MESG_RADIO_TX_POWER_SIZE ((UCHAR)2)
  222. #define MESG_RADIO_CW_MODE_SIZE ((UCHAR)3)
  223. #define MESG_RADIO_CW_INIT_SIZE ((UCHAR)1)
  224. #define MESG_SYSTEM_RESET_SIZE ((UCHAR)1)
  225. #define MESG_OPEN_CHANNEL_SIZE ((UCHAR)1)
  226. #define MESG_CLOSE_CHANNEL_SIZE ((UCHAR)1)
  227. #define MESG_REQUEST_SIZE ((UCHAR)2)
  228. #define MESG_REQUEST_USER_NVM_SIZE ((UCHAR)5)
  229. #define MESG_CAPABILITIES_SIZE ((UCHAR)8)
  230. #define MESG_STACKLIMIT_SIZE ((UCHAR)2)
  231. #define MESG_SCRIPT_DATA_SIZE ((UCHAR)10)
  232. #define MESG_SCRIPT_CMD_SIZE ((UCHAR)3)
  233. #define MESG_ID_LIST_ADD_SIZE ((UCHAR)6)
  234. #define MESG_ID_LIST_CONFIG_SIZE ((UCHAR)3)
  235. #define MESG_OPEN_RX_SCAN_SIZE ((UCHAR)1)
  236. #define MESG_EXT_CHANNEL_RADIO_FREQ_SIZE ((UCHAR)3)
  237. #define MESG_RADIO_CONFIG_ALWAYS_SIZE ((UCHAR)2)
  238. #define MESG_RX_EXT_MESGS_ENABLE_SIZE ((UCHAR)2)
  239. #define MESG_SET_TX_SEARCH_ON_NEXT_SIZE ((UCHAR)2)
  240. #define MESG_SET_LP_SEARCH_TIMEOUT_SIZE ((UCHAR)2)
  241. #define MESG_SERIAL_NUM_SET_CHANNEL_ID_SIZE ((UCHAR)3)
  242. #define MESG_ENABLE_LED_FLASH_SIZE ((UCHAR)2)
  243. #define MESG_GET_SERIAL_NUM_SIZE ((UCHAR)4)
  244. #define MESG_GET_TEMP_CAL_SIZE ((UCHAR)4)
  245. #define MESG_CONFIG_ADV_BURST_SIZE ((UCHAR)9)
  246. #define MESG_CONFIG_ADV_BURST_SIZE_EXT ((UCHAR)12)
  247. #define MESG_ANTLIB_CONFIG_SIZE ((UCHAR)2)
  248. #define MESG_XTAL_ENABLE_SIZE ((UCHAR)1)
  249. #define MESG_STARTUP_MESG_SIZE ((UCHAR)1)
  250. #define MESG_AUTO_FREQ_CONFIG_SIZE ((UCHAR)4)
  251. #define MESG_PROX_SEARCH_CONFIG_SIZE ((UCHAR)2)
  252. #define MESG_EVENT_BUFFERING_CONFIG_SIZE ((UCHAR)6)
  253. #define MESG_EVENT_FILTER_CONFIG_SIZE ((UCHAR)3)
  254. #define MESG_HIGH_DUTY_SEARCH_MODE_SIZE ((UCHAR)3)
  255. #define MESG_SDU_CONFIG_SIZE ((UCHAR)3)
  256. #define MESG_SDU_SET_MASK_SIZE ((UCHAR)9)
  257. #define MESG_USER_CONFIG_PAGE_SIZE ((UCHAR)3)
  258. #define MESG_ACTIVE_SEARCH_SHARING_SIZE ((UCHAR)2)
  259. #define MESG_SET_SEARCH_CH_PRIORITY_SIZE ((UCHAR)2)
  260. #define MESG_ENCRYPT_ENABLE_SIZE ((UCHAR)4)
  261. #define MESG_SET_CRYPTO_KEY_SIZE ((UCHAR)17)
  262. #define MESG_SET_CRYPTO_ID_SIZE ((UCHAR)5)
  263. #define MESG_SET_CRYPTO_USER_INFO_SIZE ((UCHAR)20)
  264. #define MESG_SET_CRYPTO_RNG_SEED_SIZE ((UCHAR)17)
  265. #define MESG_NVM_CRYPTO_KEY_LOAD_SIZE ((UCHAR)3)
  266. #define MESG_NVM_CRYPTO_KEY_STORE_SIZE ((UCHAR)18)
  267. #define MESG_CRYPTO_ID_LIST_ADD_SIZE ((UCHAR)6)
  268. #define MESG_CRYPTO_ID_LIST_CONFIG_SIZE ((UCHAR)3)
  269. #define MESG_GET_PIN_DIODE_CONTROL_SIZE ((UCHAR)1)
  270. #define MESG_PIN_DIODE_CONTROL_ID_SIZE ((UCHAR)2)
  271. #define MESG_FIT1_SET_EQUIP_STATE_SIZE ((UCHAR)2)
  272. #define MESG_FIT1_SET_AGC_SIZE ((UCHAR)4)
  273. #define MESG_BIST_SIZE ((UCHAR)6)
  274. #define MESG_UNLOCK_INTERFACE_SIZE ((UCHAR)1)
  275. #define MESG_SET_SHARED_ADDRESS_SIZE ((UCHAR)3)
  276. #define MESG_GET_GRMN_ESN_SIZE ((UCHAR)5)
  277. #define MESG_PORT_SET_IO_STATE_SIZE ((UCHAR)5)
  278. #define MESG_SLEEP_SIZE ((UCHAR)1)
  279. #define MESG_EXT_DATA_SIZE ((UCHAR)13)
  280. #define MESG_RSSI_SIZE ((UCHAR)5)
  281. #define MESG_RSSI_DATA_SIZE ((UCHAR)17)
  282. #define MESG_RSSI_RESPONSE_SIZE ((UCHAR)7)
  283. #define MESG_RSSI_SEARCH_THRESHOLD_SIZE ((UCHAR)2)
  284. #define MESG_MEMDEV_EEPROM_INIT_SIZE ((UCHAR) 0x04)
  285. #define MESG_FS_INIT_MEMORY_SIZE ((UCHAR) 0x01)
  286. #define MESG_FS_FORMAT_MEMORY_SIZE ((UCHAR) 0x05)
  287. #define MESG_FS_DIRECTORY_SAVE_SIZE ((UCHAR) 0x01)
  288. #define MESG_FS_DIRECTORY_REBUILD_SIZE ((UCHAR) 0x01)
  289. #define MESG_FS_FILE_DELETE_SIZE ((UCHAR) 0x02)
  290. #define MESG_FS_FILE_CLOSE_SIZE ((UCHAR) 0x02)
  291. #define MESG_FS_FILE_SET_SPECIFIC_FLAGS_SIZE ((UCHAR) 0x03)
  292. #define MESG_FS_DIRECTORY_READ_LOCK_SIZE ((UCHAR) 0x02)
  293. #define MESG_FS_SYSTEM_TIME_SIZE ((UCHAR) 0x05)
  294. #define MESG_FS_CRYPTO_ADD_USER_KEY_INDEX_SIZE ((UCHAR) 0x34)
  295. #define MESG_FS_CRYPTO_SET_USER_KEY_INDEX_SIZE ((UCHAR) 0x05)
  296. #define MESG_FS_CRYPTO_SET_USER_KEY_VAL_SIZE ((UCHAR) 0x33)
  297. #define MESG_FS_FIT_FILE_INTEGRITY_CHECK_SIZE ((UCHAR) 0x02)
  298. #define MESG_FS_ANTFS_OPEN_SIZE ((UCHAR) 0x01)
  299. #define MESG_FS_ANTFS_CLOSE_SIZE ((UCHAR) 0x01)
  300. #define MESG_FS_ANTFS_CONFIG_BEACON_SIZE ((UCHAR) 0x09)
  301. #define MESG_FS_ANTFS_SET_AUTH_STRING_SIZE ((UCHAR) 0x02)
  302. #define MESG_FS_ANTFS_SET_BEACON_STATE_SIZE ((UCHAR) 0x02)
  303. #define MESG_FS_ANTFS_PAIR_RESPONSE_SIZE ((UCHAR) 0x02)
  304. #define MESG_FS_ANTFS_SET_LINK_FREQ_SIZE ((UCHAR) 0x03)
  305. #define MESG_FS_ANTFS_SET_BEACON_TIMEOUT_SIZE ((UCHAR) 0x02)
  306. #define MESG_FS_ANTFS_SET_PAIRING_TIMEOUT_SIZE ((UCHAR) 0x02)
  307. #define MESG_FS_ANTFS_REMOTE_FILE_CREATE_EN_SIZE ((UCHAR) 0x02)
  308. #define MESG_FS_GET_USED_SPACE_SIZE ((UCHAR) 0x03)
  309. #define MESG_FS_GET_FREE_SPACE_SIZE ((UCHAR) 0x03)
  310. #define MESG_FS_FIND_FILE_INDEX_SIZE ((UCHAR) 0x07)
  311. #define MESG_FS_DIRECTORY_READ_ABSOLUTE_SIZE ((UCHAR) 0x08)
  312. #define MESG_FS_DIRECTORY_READ_ENTRY_SIZE ((UCHAR) 0x05)
  313. #define MESG_FS_DIRECTORY_GET_SIZE_SIZE ((UCHAR) 0x03)
  314. #define MESG_FS_FILE_CREATE_SIZE ((UCHAR) 0x0B)
  315. #define MESG_FS_FILE_OPEN_SIZE ((UCHAR) 0x06)
  316. #define MESG_FS_FILE_READ_ABSOLUTE_SIZE ((UCHAR) 0x09)
  317. #define MESG_FS_FILE_READ_RELATIVE_SIZE ((UCHAR) 0x05)
  318. #define MESG_FS_FILE_WRITE_ABSOLUTE_SIZE ((UCHAR) 0x09)
  319. #define MESG_FS_FILE_WRITE_RELATIVE_SIZE ((UCHAR) 0x05)
  320. #define MESG_FS_FILE_GET_SIZE_SIZE ((UCHAR) 0x04)
  321. #define MESG_FS_FILE_GET_SIZE_IN_MEM_SIZE ((UCHAR) 0x04)
  322. #define MESG_FS_FILE_GET_SPECIFIC_FILE_FLAGS_SIZE ((UCHAR) 0x04)
  323. #define MESG_FS_SYSTEM_TIME_REQUEST_SIZE ((UCHAR) 0x03)
  324. #define MESG_FS_ANTFS_GET_CMD_PIPE_SIZE ((UCHAR) 0x05)
  325. #define MESG_FS_ANTFS_SET_CMD_PIPE_SIZE ((UCHAR) 0x05)
  326. #define MESG_FS_REQUEST_RESPONSE_SIZE ((UCHAR) 0x03)
  327. //////////////////////////////////////////////
  328. // ANT serial message structure
  329. //////////////////////////////////////////////
  330. #if defined (DSI_TYPES_OTHER_OS) || defined(__BORLANDC__) // Nameless unions/struct are not supported by all compilers, remove this if you wish to use the following structures
  331. typedef union
  332. {
  333. UCHAR ucExtMesgBF;
  334. struct
  335. {
  336. BOOL bExtFieldCont : 1;
  337. BOOL : 1;
  338. BOOL : 1;
  339. BOOL : 1;
  340. BOOL : 1;
  341. BOOL bANTTimeStamp : 1;
  342. BOOL bReserved1 : 1;
  343. BOOL bANTDeviceID : 1;
  344. };
  345. } EXT_MESG_BF; // extended message bitfield
  346. typedef union
  347. {
  348. ULONG ulForceAlign; // force the struct to be 4-byte aligned, required for some casting in command.c
  349. UCHAR aucMessage[MESG_BUFFER_SIZE]; // the complete message buffer pointer
  350. struct
  351. {
  352. UCHAR ucSize; // the message size
  353. union
  354. {
  355. UCHAR aucFramedData[MESG_FRAMED_SIZE]; // pointer for serial framer
  356. struct
  357. {
  358. UCHAR ucMesgID; // the message ID
  359. union
  360. {
  361. UCHAR aucMesgData[MESG_MAX_SIZE_VALUE]; // the message data
  362. struct
  363. {
  364. union
  365. {
  366. UCHAR ucChannel; // ANT channel number
  367. UCHAR ucSubID; // subID portion of ext ID message
  368. };
  369. UCHAR aucPayload[ANT_STANDARD_DATA_PAYLOAD_SIZE];// ANT message payload
  370. EXT_MESG_BF sExtMesgBF; // extended message bitfield (NOTE: this will not be here for longer data messages)
  371. UCHAR aucExtData[MESG_MAX_EXT_DATA_SIZE]; // extended message data
  372. };
  373. };
  374. };
  375. };
  376. UCHAR ucCheckSum; // the message checksum
  377. };
  378. } ANT_MESSAGE;
  379. #endif
  380. #endif // !ANTMESSAGE_H