ant-wireless 0.1.0.pre.20210617213631

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,101 @@
1
+ #ifndef ANT_EXT_H_4CFF48F9
2
+ #define ANT_EXT_H_4CFF48F9
3
+
4
+ #include "extconf.h"
5
+
6
+ #include <stdbool.h>
7
+ #include <pthread.h>
8
+ #include <assert.h>
9
+
10
+ #include <ruby.h>
11
+ #include <ruby/intern.h>
12
+ #include <ruby/thread.h>
13
+ #include <ruby/encoding.h>
14
+ #include <ruby/version.h>
15
+
16
+ #include "libant.h"
17
+
18
+ #ifndef TRUE
19
+ # define TRUE 1
20
+ #endif
21
+
22
+ #ifndef FALSE
23
+ # define FALSE 0
24
+ #endif
25
+
26
+ /* --------------------------------------------------------------
27
+ * Datatypes
28
+ * -------------------------------------------------------------- */
29
+
30
+ typedef struct rant_callback_t rant_callback_t;
31
+ struct rant_callback_t {
32
+ void *data;
33
+ VALUE (*fn)( VALUE );
34
+ bool rval;
35
+
36
+ pthread_mutex_t mutex;
37
+ pthread_cond_t cond;
38
+
39
+ bool handled;
40
+ rant_callback_t *next;
41
+ };
42
+
43
+
44
+ typedef struct rant_channel_t rant_channel_t;
45
+ struct rant_channel_t {
46
+ unsigned char channel_num;
47
+ unsigned char buffer[ MESG_MAX_SIZE ];
48
+ VALUE callback;
49
+ };
50
+
51
+
52
+ /* --------------------------------------------------------------
53
+ * Defines
54
+ * -------------------------------------------------------------- */
55
+
56
+ #define DEFAULT_BAUDRATE 57600
57
+
58
+ #ifdef HAVE_STDARG_PROTOTYPES
59
+ #include <stdarg.h>
60
+ #define va_init_list(a,b) va_start(a,b)
61
+ void rant_log_obj( VALUE, const char *, const char *, ... );
62
+ void rant_log( const char *, const char *, ... );
63
+ #else
64
+ #include <varargs.h>
65
+ #define va_init_list(a,b) va_start(a)
66
+ void rant_log_obj( VALUE, const char *, const char *, va_dcl );
67
+ void rant_log( const char *, const char *, va_dcl );
68
+ #endif
69
+
70
+
71
+ /* -------------------------------------------------------
72
+ * Globals
73
+ * ------------------------------------------------------- */
74
+
75
+ extern VALUE rant_mAnt;
76
+
77
+ extern VALUE rant_cAntChannel;
78
+ extern VALUE rant_cAntMessage;
79
+
80
+
81
+ /* --------------------------------------------------------------
82
+ * Type-check macros
83
+ * -------------------------------------------------------------- */
84
+
85
+ #define IsChannel( obj ) rb_obj_is_kind_of( (obj), rant_cAntChannel )
86
+
87
+
88
+ /* -------------------------------------------------------
89
+ * Initializer functions
90
+ * ------------------------------------------------------- */
91
+ extern void Init_ant_ext _(( void ));
92
+
93
+ extern void init_ant_channel _(( void ));
94
+ extern void init_ant_message _(( void ));
95
+
96
+ extern void rant_start_callback_thread _(( void ));
97
+ extern bool rant_callback _(( rant_callback_t * ));
98
+
99
+ extern void rant_channel_clear_registry _(( void ));
100
+
101
+ #endif /* end of include guard: ANT_EXT_H_4CFF48F9 */
@@ -0,0 +1,355 @@
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
+
6
+ Copyright (c) Dynastream Innovations Inc. 2016
7
+ All rights reserved.
8
+ */
9
+ #ifndef ANTDEFINES_H
10
+ #define ANTDEFINES_H
11
+
12
+ #include "types.h"
13
+
14
+
15
+ //////////////////////////////////////////////
16
+ // ANT Message Payload Size
17
+ //////////////////////////////////////////////
18
+ #define ANT_STANDARD_DATA_PAYLOAD_SIZE ((UCHAR)8)
19
+
20
+ //////////////////////////////////////////////
21
+ // ANT LIBRARY Extended Data Message Fields
22
+ // NOTE: You must check the extended message
23
+ // bitfield first to find out which fields
24
+ // are present before accessing them!
25
+ //////////////////////////////////////////////
26
+ #define ANT_EXT_MESG_DEVICE_ID_FIELD_SIZE ((UCHAR)4)
27
+ #define ANT_EXT_STRING_SIZE ((UCHAR)27) // increase buffer size to support longer messages (32 extra bytes after ANT standard payload)
28
+
29
+ //////////////////////////////////////////////
30
+ // ANT Extended Data Message Bifield Definitions
31
+ //////////////////////////////////////////////
32
+ #define ANT_EXT_MESG_BITFIELD_DEVICE_ID ((UCHAR)0x80) // first field after bitfield
33
+
34
+ // 4 bits free reserved set to 0
35
+ #define ANT_EXT_MESG_BIFIELD_EXTENSION ((UCHAR)0x01)
36
+
37
+ // extended message input bitfield defines
38
+ #define ANT_EXT_MESG_BITFIELD_OVERWRITE_SHARED_ADR ((UCHAR)0x10)
39
+ #define ANT_EXT_MESG_BITFIELD_TRANSMISSION_TYPE ((UCHAR)0x08)
40
+
41
+
42
+ //////////////////////////////////////////////
43
+ // ANT Library Config
44
+ //////////////////////////////////////////////
45
+ #define ANT_LIB_CONFIG_MASK_ALL ((UCHAR)0xFF)
46
+ #define ANT_LIB_CONFIG_RADIO_CONFIG_ALWAYS ((UCHAR)0x01)
47
+ #define ANT_LIB_CONFIG_MESG_OUT_INC_TIME_STAMP ((UCHAR)0x20)
48
+ #define ANT_LIB_CONFIG_MESG_OUT_INC_RSSI ((UCHAR)0x40)
49
+ #define ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID ((UCHAR)0x80)
50
+
51
+ //////////////////////////////////////////////
52
+ // ID Definitions
53
+ //////////////////////////////////////////////
54
+ #define ANT_ID_SIZE ((UCHAR)4)
55
+ #define ANT_ID_TRANS_TYPE_OFFSET ((UCHAR)3)
56
+ #define ANT_ID_DEVICE_TYPE_OFFSET ((UCHAR)2)
57
+ #define ANT_ID_DEVICE_NUMBER_HIGH_OFFSET ((UCHAR)1)
58
+ #define ANT_ID_DEVICE_NUMBER_LOW_OFFSET ((UCHAR)0)
59
+ #define ANT_ID_DEVICE_TYPE_PAIRING_FLAG ((UCHAR)0x80)
60
+
61
+ #define ANT_TRANS_TYPE_SHARED_ADDR_MASK ((UCHAR)0x03)
62
+ #define ANT_TRANS_TYPE_1_BYTE_SHARED_ADDRESS ((UCHAR)0x02)
63
+ #define ANT_TRANS_TYPE_2_BYTE_SHARED_ADDRESS ((UCHAR)0x03)
64
+
65
+
66
+ //////////////////////////////////////////////
67
+ // Assign Channel Parameters
68
+ //////////////////////////////////////////////
69
+ #define PARAMETER_RX_NOT_TX ((UCHAR)0x00)
70
+ #define PARAMETER_TX_NOT_RX ((UCHAR)0x10)
71
+ #define PARAMETER_SHARED_CHANNEL ((UCHAR)0x20)
72
+ #define PARAMETER_NO_TX_GUARD_BAND ((UCHAR)0x40)
73
+ #define PARAMETER_ALWAYS_RX_WILD_CARD_SEARCH_ID ((UCHAR)0x40) //Pre-AP2
74
+ #define PARAMETER_RX_ONLY ((UCHAR)0x40)
75
+
76
+ //////////////////////////////////////////////
77
+ // Ext. Assign Channel Parameters
78
+ //////////////////////////////////////////////
79
+ #define EXT_PARAM_ALWAYS_SEARCH ((UCHAR)0x01)
80
+ #define EXT_PARAM_FREQUENCY_AGILITY ((UCHAR)0x04)
81
+
82
+ //////////////////////////////////////////////
83
+ // Radio TX Power Definitions
84
+ //////////////////////////////////////////////
85
+ #define RADIO_TX_POWER_LVL_MASK ((UCHAR)0x03)
86
+
87
+ #define RADIO_TX_POWER_LVL_0 ((UCHAR)0x00) //(formerly: RADIO_TX_POWER_MINUS20DB) lowest
88
+ #define RADIO_TX_POWER_LVL_1 ((UCHAR)0x01) //(formerly: RADIO_TX_POWER_MINUS10DB)
89
+ #define RADIO_TX_POWER_LVL_2 ((UCHAR)0x02) //(formerly: RADIO_TX_POWER_MINUS5DB)
90
+ #define RADIO_TX_POWER_LVL_3 ((UCHAR)0x03) //(formerly: RADIO_TX_POWER_0DB) highest
91
+
92
+ //////////////////////////////////////////////
93
+ // Channel Status
94
+ //////////////////////////////////////////////
95
+ #define STATUS_CHANNEL_STATE_MASK ((UCHAR)0x03)
96
+ #define STATUS_UNASSIGNED_CHANNEL ((UCHAR)0x00)
97
+ #define STATUS_ASSIGNED_CHANNEL ((UCHAR)0x01)
98
+ #define STATUS_SEARCHING_CHANNEL ((UCHAR)0x02)
99
+ #define STATUS_TRACKING_CHANNEL ((UCHAR)0x03)
100
+
101
+ //////////////////////////////////////////////
102
+ // Standard capabilities defines
103
+ //////////////////////////////////////////////
104
+ #define CAPABILITIES_NO_RX_CHANNELS ((UCHAR)0x01)
105
+ #define CAPABILITIES_NO_TX_CHANNELS ((UCHAR)0x02)
106
+ #define CAPABILITIES_NO_RX_MESSAGES ((UCHAR)0x04)
107
+ #define CAPABILITIES_NO_TX_MESSAGES ((UCHAR)0x08)
108
+ #define CAPABILITIES_NO_ACKD_MESSAGES ((UCHAR)0x10)
109
+ #define CAPABILITIES_NO_BURST_TRANSFER ((UCHAR)0x20)
110
+
111
+ //////////////////////////////////////////////
112
+ // Advanced capabilities defines
113
+ //////////////////////////////////////////////
114
+ #define CAPABILITIES_OVERUN_UNDERRUN ((UCHAR)0x01) // Support for this functionality has been dropped
115
+ #define CAPABILITIES_NETWORK_ENABLED ((UCHAR)0x02)
116
+ #define CAPABILITIES_AP1_VERSION_2 ((UCHAR)0x04) // This Version of the AP1 does not support transmit and only had a limited release
117
+ #define CAPABILITIES_SERIAL_NUMBER_ENABLED ((UCHAR)0x08)
118
+ #define CAPABILITIES_PER_CHANNEL_TX_POWER_ENABLED ((UCHAR)0x10)
119
+ #define CAPABILITIES_LOW_PRIORITY_SEARCH_ENABLED ((UCHAR)0x20)
120
+ #define CAPABILITIES_SCRIPT_ENABLED ((UCHAR)0x40)
121
+ #define CAPABILITIES_SEARCH_LIST_ENABLED ((UCHAR)0x80)
122
+
123
+ //////////////////////////////////////////////
124
+ // Advanced capabilities 2 defines
125
+ //////////////////////////////////////////////
126
+ #define CAPABILITIES_LED_ENABLED ((UCHAR)0x01)
127
+ #define CAPABILITIES_EXT_MESSAGE_ENABLED ((UCHAR)0x02)
128
+ #define CAPABILITIES_SCAN_MODE_ENABLED ((UCHAR)0x04)
129
+ #define CAPABILITIES_RESERVED ((UCHAR)0x08)
130
+ #define CAPABILITIES_PROX_SEARCH_ENABLED ((UCHAR)0x10)
131
+ #define CAPABILITIES_EXT_ASSIGN_ENABLED ((UCHAR)0x20)
132
+ #define CAPABILITIES_FS_ANTFS_ENABLED ((UCHAR)0x40)
133
+ #define CAPABILITIES_FIT1_ENABLED ((UCHAR)0x80)
134
+
135
+ //////////////////////////////////////////////
136
+ // Advanced capabilities 3 defines
137
+ //////////////////////////////////////////////
138
+ #define CAPABILITIES_ADVANCED_BURST_ENABLED ((UCHAR)0x01)
139
+ #define CAPABILITIES_EVENT_BUFFERING_ENABLED ((UCHAR)0x02)
140
+ #define CAPABILITIES_EVENT_FILTERING_ENABLED ((UCHAR)0x04)
141
+ #define CAPABILITIES_HIGH_DUTY_SEARCH_MODE_ENABLED ((UCHAR)0x08)
142
+ #define CAPABILITIES_ACTIVE_SEARCH_SHARING_MODE_ENABLED ((UCHAR)0x10)
143
+ #define CAPABILITIES_SELECTIVE_DATA_UPDATE_ENABLED ((UCHAR)0x40)
144
+ #define CAPABILITIES_ENCRYPTED_CHANNEL_ENABLED ((UCHAR)0x80)
145
+
146
+
147
+ //////////////////////////////////////////////
148
+ // Burst Message Sequence
149
+ //////////////////////////////////////////////
150
+ #define CHANNEL_NUMBER_MASK ((UCHAR)0x1F)
151
+ #define SEQUENCE_NUMBER_MASK ((UCHAR)0xE0)
152
+ #define SEQUENCE_NUMBER_ROLLOVER ((UCHAR)0x60)
153
+ #define SEQUENCE_FIRST_MESSAGE ((UCHAR)0x00)
154
+ #define SEQUENCE_LAST_MESSAGE ((UCHAR)0x80)
155
+ #define SEQUENCE_NUMBER_INC ((UCHAR)0x20)
156
+
157
+ //////////////////////////////////////////////
158
+ // Advanced Burst Config defines
159
+ //////////////////////////////////////////////
160
+ #define ADV_BURST_CONFIG_FREQ_HOP ((ULONG)0x00000001)
161
+
162
+ //////////////////////////////////////////////
163
+ // Extended Message ID Mask
164
+ //////////////////////////////////////////////
165
+ #define MSG_EXT_ID_MASK ((UCHAR)0xE0)
166
+
167
+ //////////////////////////////////////////////
168
+ // Control Message Flags
169
+ //////////////////////////////////////////////
170
+ #define BROADCAST_CONTROL_BYTE ((UCHAR)0x00)
171
+ #define ACKNOWLEDGED_CONTROL_BYTE ((UCHAR)0xA0)
172
+
173
+ //////////////////////////////////////////////
174
+ // Response / Event Codes
175
+ //////////////////////////////////////////////
176
+ #define RESPONSE_NO_ERROR ((UCHAR)0x00)
177
+ #define NO_EVENT ((UCHAR)0x00)
178
+
179
+ #define EVENT_RX_SEARCH_TIMEOUT ((UCHAR)0x01)
180
+ #define EVENT_RX_FAIL ((UCHAR)0x02)
181
+ #define EVENT_TX ((UCHAR)0x03)
182
+ #define EVENT_TRANSFER_RX_FAILED ((UCHAR)0x04)
183
+ #define EVENT_TRANSFER_TX_COMPLETED ((UCHAR)0x05)
184
+ #define EVENT_TRANSFER_TX_FAILED ((UCHAR)0x06)
185
+ #define EVENT_CHANNEL_CLOSED ((UCHAR)0x07)
186
+ #define EVENT_RX_FAIL_GO_TO_SEARCH ((UCHAR)0x08)
187
+ #define EVENT_CHANNEL_COLLISION ((UCHAR)0x09)
188
+ #define EVENT_TRANSFER_TX_START ((UCHAR)0x0A) // a pending transmit transfer has begun
189
+
190
+ #define EVENT_CHANNEL_ACTIVE ((UCHAR)0x0F)
191
+
192
+ #define EVENT_TRANSFER_TX_NEXT_MESSAGE ((UCHAR)0x11) // only enabled in FIT1
193
+
194
+ #define CHANNEL_IN_WRONG_STATE ((UCHAR)0x15) // returned on attempt to perform an action from the wrong channel state
195
+ #define CHANNEL_NOT_OPENED ((UCHAR)0x16) // returned on attempt to communicate on a channel that is not open
196
+ #define CHANNEL_ID_NOT_SET ((UCHAR)0x18) // returned on attempt to open a channel without setting the channel ID
197
+ #define CLOSE_ALL_CHANNELS ((UCHAR)0x19) // returned when attempting to start scanning mode, when channels are still open
198
+
199
+ #define TRANSFER_IN_PROGRESS ((UCHAR)0x1F) // returned on attempt to communicate on a channel with a TX transfer in progress
200
+ #define TRANSFER_SEQUENCE_NUMBER_ERROR ((UCHAR)0x20) // returned when sequence number is out of order on a Burst transfer
201
+ #define TRANSFER_IN_ERROR ((UCHAR)0x21)
202
+ #define TRANSFER_BUSY ((UCHAR)0x22)
203
+
204
+ #define INVALID_MESSAGE_CRC ((UCHAR)0x26) // returned if there is a framing error on an incomming message
205
+ #define MESSAGE_SIZE_EXCEEDS_LIMIT ((UCHAR)0x27) // returned if a data message is provided that is too large
206
+ #define INVALID_MESSAGE ((UCHAR)0x28) // returned when the message has an invalid parameter
207
+ #define INVALID_NETWORK_NUMBER ((UCHAR)0x29) // returned when an invalid network number is provided
208
+ #define INVALID_LIST_ID ((UCHAR)0x30) // returned when the provided list ID or size exceeds the limit
209
+ #define INVALID_SCAN_TX_CHANNEL ((UCHAR)0x31) // returned when attempting to transmit on channel 0 when in scan mode
210
+ #define INVALID_PARAMETER_PROVIDED ((UCHAR)0x33) // returned when an invalid parameter is specified in a configuration message
211
+
212
+ #define EVENT_SERIAL_QUE_OVERFLOW ((UCHAR)0x34)
213
+ #define EVENT_QUE_OVERFLOW ((UCHAR)0x35) // ANT event que has overflowed and lost 1 or more events
214
+
215
+ #define EVENT_CLK_ERROR ((UCHAR)0x36) // debug event for XOSC16M on LE1
216
+ #define EVENT_STATE_OVERRUN ((UCHAR)0x37)
217
+
218
+ #define EVENT_ENCRYPT_NEGOTIATION_SUCCESS ((UCHAR)0x38) // ANT stack generated event when connecting to an encrypted channel has succeeded
219
+ #define EVENT_ENCRYPT_NEGOTIATION_FAIL ((UCHAR)0x39) // ANT stack generated event when connecting to an encrypted channel has failed
220
+
221
+ #define SCRIPT_FULL_ERROR ((UCHAR)0x40) // error writing to script, memory is full
222
+ #define SCRIPT_WRITE_ERROR ((UCHAR)0x41) // error writing to script, bytes not written correctly
223
+ #define SCRIPT_INVALID_PAGE_ERROR ((UCHAR)0x42) // error accessing script page
224
+ #define SCRIPT_LOCKED_ERROR ((UCHAR)0x43) // the scripts are locked and can't be dumped
225
+
226
+ #define NO_RESPONSE_MESSAGE ((UCHAR)0x50) // returned to the Command_SerialMessageProcess function, so no reply message is generated
227
+ #define RETURN_TO_MFG ((UCHAR)0x51) // default return to any mesg when the module determines that the mfg procedure has not been fully completed
228
+
229
+ #define FIT_ACTIVE_SEARCH_TIMEOUT ((UCHAR)0x60) // Fit1 only event added for timeout of the pairing state after the Fit module becomes active
230
+ #define FIT_WATCH_PAIR ((UCHAR)0x61) // Fit1 only
231
+ #define FIT_WATCH_UNPAIR ((UCHAR)0x62) // Fit1 only
232
+
233
+ #define USB_STRING_WRITE_FAIL ((UCHAR)0x70)
234
+
235
+ // Internal only events below this point
236
+ #define INTERNAL_ONLY_EVENTS ((UCHAR)0x80)
237
+ #define EVENT_RX ((UCHAR)0x80) // INTERNAL: Event for a receive message
238
+ #define EVENT_NEW_CHANNEL ((UCHAR)0x81) // INTERNAL: EVENT for a new active channel
239
+ #define EVENT_PASS_THRU ((UCHAR)0x82) // INTERNAL: Event to allow an upper stack events to pass through lower stacks
240
+
241
+ #define EVENT_BLOCKED ((UCHAR)0xFF) // INTERNAL: Event to replace any event we do not wish to go out, will also zero the size of the Tx message
242
+
243
+ ///////////////////////////////////////////////////////
244
+ // Script Command Codes
245
+ ///////////////////////////////////////////////////////
246
+ #define SCRIPT_CMD_FORMAT ((UCHAR)0x00)
247
+ #define SCRIPT_CMD_DUMP ((UCHAR)0x01)
248
+ #define SCRIPT_CMD_SET_DEFAULT_SECTOR ((UCHAR)0x02)
249
+ #define SCRIPT_CMD_END_SECTOR ((UCHAR)0x03)
250
+ #define SCRIPT_CMD_END_DUMP ((UCHAR)0x04)
251
+ #define SCRIPT_CMD_LOCK ((UCHAR)0x05)
252
+
253
+ ///////////////////////////////////////////////////////
254
+ // USB Descriptor Strings
255
+ ///////////////////////////////////////////////////////
256
+ #define USB_DESCRIPTOR_VID_PID ((UCHAR) 0x00)
257
+ #define USB_DESCRIPTOR_MANUFACTURER_STRING ((UCHAR) 0x01)
258
+ #define USB_DESCRIPTOR_DEVICE_STRING ((UCHAR) 0x02)
259
+ #define USB_DESCRIPTOR_SERIAL_STRING ((UCHAR) 0x03)
260
+
261
+ ///////////////////////////////////////////////////////
262
+ // Reset Mesg Codes
263
+ ///////////////////////////////////////////////////////
264
+ #define RESET_FLAGS_MASK ((UCHAR)0xE0)
265
+ #define RESET_SUSPEND ((UCHAR)0x80) // this must follow bitfield def
266
+ #define RESET_SYNC ((UCHAR)0x40) // this must follow bitfield def
267
+ #define RESET_CMD ((UCHAR)0x20) // this must follow bitfield def
268
+ #define RESET_WDT ((UCHAR)0x02)
269
+ #define RESET_RST ((UCHAR)0x01)
270
+ #define RESET_POR ((UCHAR)0x00)
271
+
272
+ //////////////////////////////////////////////
273
+ // PC Application Event Codes
274
+ /////////////////////////////////////// ///////
275
+ //NOTE: These events are not generated by the embedded ANT module
276
+
277
+ #define EVENT_RX_BROADCAST ((UCHAR)0x9A) // returned when module receives broadcast data
278
+ #define EVENT_RX_ACKNOWLEDGED ((UCHAR)0x9B) // returned when module receives acknowledged data
279
+ #define EVENT_RX_BURST_PACKET ((UCHAR)0x9C) // returned when module receives burst data
280
+
281
+ #define EVENT_RX_EXT_BROADCAST ((UCHAR)0x9D) // returned when module receives broadcast data
282
+ #define EVENT_RX_EXT_ACKNOWLEDGED ((UCHAR)0x9E) // returned when module receives acknowledged data
283
+ #define EVENT_RX_EXT_BURST_PACKET ((UCHAR)0x9F) // returned when module receives burst data
284
+
285
+ #define EVENT_RX_RSSI_BROADCAST ((UCHAR)0xA0) // returned when module receives broadcast data
286
+ #define EVENT_RX_RSSI_ACKNOWLEDGED ((UCHAR)0xA1) // returned when module receives acknowledged data
287
+ #define EVENT_RX_RSSI_BURST_PACKET ((UCHAR)0xA2) // returned when module receives burst data
288
+
289
+ #define EVENT_RX_FLAG_BROADCAST ((UCHAR)0xA3) // returned when module receives broadcast data with flag attached
290
+ #define EVENT_RX_FLAG_ACKNOWLEDGED ((UCHAR)0xA4) // returned when module receives acknowledged data with flag attached
291
+ #define EVENT_RX_FLAG_BURST_PACKET ((UCHAR)0xA5) // returned when module receives burst data with flag attached
292
+
293
+ //////////////////////////////////////////////
294
+ // Integrated ANT-FS Client Response/Event Codes
295
+ //////////////////////////////////////////////
296
+ #define MESG_FS_ANTFS_EVENT_PAIR_REQUEST ((UCHAR)0x01)
297
+ #define MESG_FS_ANTFS_EVENT_DOWNLOAD_START ((UCHAR)0x02)
298
+ #define MESG_FS_ANTFS_EVENT_UPLOAD_START ((UCHAR)0x03)
299
+ #define MESG_FS_ANTFS_EVENT_DOWNLOAD_COMPLETE ((UCHAR)0x04)
300
+ #define MESG_FS_ANTFS_EVENT_UPLOAD_COMPLETE ((UCHAR)0x05)
301
+ #define MESG_FS_ANTFS_EVENT_ERASE_COMPLETE ((UCHAR)0x06)
302
+ #define MESG_FS_ANTFS_EVENT_LINK_STATE ((UCHAR)0x07)
303
+ #define MESG_FS_ANTFS_EVENT_AUTH_STATE ((UCHAR)0x08)
304
+ #define MESG_FS_ANTFS_EVENT_TRANSPORT_STATE ((UCHAR)0x09)
305
+ #define MESG_FS_ANTFS_EVENT_CMD_RECEIVED ((UCHAR)0x0A)
306
+ #define MESG_FS_ANTFS_EVENT_CMD_PROCESSED ((UCHAR)0x0B)
307
+
308
+ #define FS_NO_ERROR_RESPONSE ((UCHAR) 0x00)
309
+ #define FS_MEMORY_UNFORMATTED_ERROR_RESPONSE ((UCHAR) 0x01)
310
+ #define FS_MEMORY_NO_FREE_SECTORS_ERROR_RESPONSE ((UCHAR) 0x02)
311
+ #define FS_MEMORY_READ_ERROR_RESPONSE ((UCHAR) 0x03)
312
+ #define FS_MEMORY_WRITE_ERROR_RESPONSE ((UCHAR) 0x04)
313
+ #define FS_MEMORY_ERASE_ERROR_RESPONSE ((UCHAR) 0x05)
314
+ #define FS_TOO_MANY_FILES_OPEN_RESPONSE ((UCHAR) 0x06)
315
+ #define FS_FILE_INDEX_INVALID_ERROR_RESPONSE ((UCHAR) 0x07)
316
+ #define FS_FILE_INDEX_EXISTS_ERROR_RESPONSE ((UCHAR) 0x08)
317
+ #define FS_AUTO_INDEX_FAILED_TRY_AGAIN_ERROR_RESPONSE ((UCHAR) 0x09)
318
+ #define FS_FILE_ALREADY_OPEN_ERROR_RESPONSE ((UCHAR) 0x0A)
319
+ #define FS_FILE_NOT_OPEN_ERROR_RESPONSE ((UCHAR) 0x0B)
320
+ #define FS_DIR_CORRUPTED_ERROR_RESPONSE ((UCHAR) 0x0C)
321
+ #define FS_INVALID_OFFSET_ERROR_RESPONSE ((UCHAR) 0x0D)
322
+ #define FS_BAD_PERMISSIONS_ERROR_RESPONSE ((UCHAR) 0x0E)
323
+ #define FS_EOF_REACHED_ERROR_RESPONSE ((UCHAR) 0x0F)
324
+ #define FS_INVALID_FILE_HANDLE_ERROR_RESPONSE ((UCHAR) 0x10)
325
+
326
+ #define FS_CRYPTO_OPEN_PERMISSION_ERROR_RESPONSE ((UCHAR) 0x32)
327
+ #define FS_CRYPTO_HANDLE_ALREADY_IN_USE_RESPONSE ((UCHAR) 0x33)
328
+ #define FS_CRYPTO_USER_KEY_NOT_SPECIFIED_RESPONSE ((UCHAR) 0x34)
329
+ #define FS_CRYPTO_USER_KEY_ADD_ERROR_RESPONSE ((UCHAR) 0x35)
330
+ #define FS_CRYPTO_USER_KEY_FETCH_ERROR_RESPONSE ((UCHAR) 0x36)
331
+ #define FS_CRYPTO_IVNONE_READ_ERROR_RESPONSE ((UCHAR) 0x37)
332
+ #define FS_CRYPTO_BLOCK_OFFSET_ERROR_RESPONSE ((UCHAR) 0x38)
333
+ #define FS_CRYPTO_BLOCK_SIZE_ERROR_RESPONSE ((UCHAR) 0x39)
334
+ #define FS_CRYPTO_CFG_TYPE_NOT_SUPPORTED_RESPONSE ((UCHAR) 0x40)
335
+
336
+ #define FS_FIT_FILE_HEADER_ERROR_RESPONSE ((UCHAR) 0x64)
337
+ #define FS_FIT_FILE_SIZE_INTEGRITY_ERROR_RESPONSE ((UCHAR) 0x65)
338
+ #define FS_FIT_FILE_CRC_ERROR_RESPONSE ((UCHAR) 0x66)
339
+ #define FS_FIT_FILE_CHECK_PERMISSION_ERROR_RESPONSE ((UCHAR) 0x67)
340
+ #define FS_FIT_FILE_CHECK_FILE_TYPE_ERROR_RESPONSE ((UCHAR) 0x68)
341
+ #define FS_FIT_FILE_OP_ABORT_ERROR_RESPONSE ((UCHAR) 0x69)
342
+
343
+ //////////////////////////////////////////////
344
+ // ANT EVENT return structure
345
+ //////////////////////////////////////////////
346
+ typedef struct
347
+ {
348
+ UCHAR ucChannel;
349
+ UCHAR ucEvent;
350
+
351
+ } ANT_EVENT;
352
+
353
+ #endif // !ANTDEFINES_H
354
+
355
+