ant-wireless 0.1.0.pre.20210617213631
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.md +5 -0
- data/LICENSE.txt +20 -0
- data/README.md +79 -0
- data/ext/ant_ext/ant_ext.c +791 -0
- data/ext/ant_ext/ant_ext.h +101 -0
- data/ext/ant_ext/antdefines.h +355 -0
- data/ext/ant_ext/antmessage.h +445 -0
- data/ext/ant_ext/build_version.h +18 -0
- data/ext/ant_ext/callbacks.c +233 -0
- data/ext/ant_ext/channel.c +524 -0
- data/ext/ant_ext/defines.h +40 -0
- data/ext/ant_ext/extconf.rb +22 -0
- data/ext/ant_ext/message.c +377 -0
- data/ext/ant_ext/types.h +202 -0
- data/ext/ant_ext/version.h +41 -0
- data/lib/ant.rb +138 -0
- data/lib/ant/channel.rb +66 -0
- data/lib/ant/channel/event_callbacks.rb +207 -0
- data/lib/ant/message.rb +10 -0
- data/lib/ant/mixins.rb +34 -0
- data/lib/ant/response_callbacks.rb +528 -0
- data/lib/ant/wireless.rb +5 -0
- data/spec/ant_spec.rb +88 -0
- data/spec/spec_helper.rb +37 -0
- metadata +131 -0
@@ -0,0 +1,40 @@
|
|
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 DSI_DEFINES_H
|
10
|
+
#define DSI_DEFINES_H
|
11
|
+
|
12
|
+
#include "types.h"
|
13
|
+
|
14
|
+
|
15
|
+
//////////////////////////////////////////////////////////////////////////////////
|
16
|
+
// Public Definitions
|
17
|
+
//////////////////////////////////////////////////////////////////////////////////
|
18
|
+
|
19
|
+
#define KELVIN 273.15F
|
20
|
+
#define G 9.80665F // m/s2
|
21
|
+
#define PI 3.14159265359F
|
22
|
+
#define RADTODEG(x) ((x) * 360.0F / (2.0F * PI))
|
23
|
+
#define DEGTORAD(x) ((x) * (2.0F * PI) / 360.0F)
|
24
|
+
#define CTOK(x) ((x) + KELVIN)
|
25
|
+
#define KTOC(x) ((x) - KELVIN)
|
26
|
+
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
27
|
+
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
28
|
+
#define SQR(x) ((x) * (x))
|
29
|
+
#define UINTDIV(x, y) (((x) + (y) / 2) / (y)) // Unsigned integer division, x / y rounded to the nearest integer
|
30
|
+
|
31
|
+
#define ROUND_BIAS(x) ((x) < 0 ? -0.5F : 0.5F)
|
32
|
+
#define ROUND_FLOAT(x) ((x) + ROUND_BIAS(x))
|
33
|
+
|
34
|
+
// The following macro computes offset (in bytes) of a member in a
|
35
|
+
// structure. This compiles to a constant if a constant member is
|
36
|
+
// supplied as arg.
|
37
|
+
#define STRUCT_OFFSET(MEMBER, STRUCT_TYPE) ( ((UCHAR *) &(((STRUCT_TYPE *) NULL)->MEMBER)) - ((UCHAR *) (NULL)) )
|
38
|
+
|
39
|
+
#endif // defined(DSI_DEFINES_H)
|
40
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
require 'mkmf'
|
5
|
+
|
6
|
+
dir_config( 'libant' )
|
7
|
+
|
8
|
+
have_library( 'ant' ) or
|
9
|
+
abort "No ant library!"
|
10
|
+
|
11
|
+
have_header( 'libant.h' ) or
|
12
|
+
abort "No libant.h header!"
|
13
|
+
have_header( 'ruby/thread.h' ) or
|
14
|
+
abort "Your Ruby is too old!"
|
15
|
+
|
16
|
+
have_func( 'ANT_Init', 'libant.h' )
|
17
|
+
have_func( 'ANT_LibVersion', 'libant.h' )
|
18
|
+
have_func( 'ANT_GetDeviceSerialNumber', 'libant.h' )
|
19
|
+
|
20
|
+
create_header()
|
21
|
+
create_makefile( 'ant_ext' )
|
22
|
+
|
@@ -0,0 +1,377 @@
|
|
1
|
+
/*
|
2
|
+
* message.c - Ant::Message class
|
3
|
+
* $Id$
|
4
|
+
*
|
5
|
+
* Authors:
|
6
|
+
* * Michael Granger <ged@FaerieMUD.org>
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
#include "ant_ext.h"
|
11
|
+
|
12
|
+
VALUE rant_cAntMessage;
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
void
|
18
|
+
init_ant_message()
|
19
|
+
{
|
20
|
+
|
21
|
+
#ifdef FOR_RDOC
|
22
|
+
rb_cData = rb_define_class( "Data" );
|
23
|
+
rant_mAnt = rb_define_module( "Ant" );
|
24
|
+
#endif
|
25
|
+
|
26
|
+
rant_cAntMessage = rb_define_class_under( rant_mAnt, "Message", rb_cObject );
|
27
|
+
|
28
|
+
#define EXPOSE_CONST( name ) \
|
29
|
+
rb_define_const( rant_cAntMessage, #name, INT2FIX( (name) ) )
|
30
|
+
|
31
|
+
EXPOSE_CONST( MESG_TX_SYNC );
|
32
|
+
EXPOSE_CONST( MESG_RX_SYNC );
|
33
|
+
EXPOSE_CONST( MESG_SYNC_SIZE );
|
34
|
+
EXPOSE_CONST( MESG_SIZE_SIZE );
|
35
|
+
EXPOSE_CONST( MESG_ID_SIZE );
|
36
|
+
EXPOSE_CONST( MESG_CHANNEL_NUM_SIZE );
|
37
|
+
EXPOSE_CONST( MESG_EXT_MESG_BF_SIZE );
|
38
|
+
EXPOSE_CONST( MESG_CHECKSUM_SIZE );
|
39
|
+
EXPOSE_CONST( MESG_DATA_SIZE );
|
40
|
+
|
41
|
+
EXPOSE_CONST( MESG_ANT_MAX_PAYLOAD_SIZE );
|
42
|
+
|
43
|
+
EXPOSE_CONST( MESG_MAX_EXT_DATA_SIZE );
|
44
|
+
|
45
|
+
EXPOSE_CONST( MESG_MAX_DATA_SIZE );
|
46
|
+
EXPOSE_CONST( MESG_MAX_SIZE_VALUE );
|
47
|
+
EXPOSE_CONST( MESG_BUFFER_SIZE );
|
48
|
+
EXPOSE_CONST( MESG_FRAMED_SIZE );
|
49
|
+
EXPOSE_CONST( MESG_HEADER_SIZE );
|
50
|
+
EXPOSE_CONST( MESG_FRAME_SIZE );
|
51
|
+
EXPOSE_CONST( MESG_MAX_SIZE );
|
52
|
+
|
53
|
+
EXPOSE_CONST( MESG_SIZE_OFFSET );
|
54
|
+
EXPOSE_CONST( MESG_ID_OFFSET );
|
55
|
+
EXPOSE_CONST( MESG_DATA_OFFSET );
|
56
|
+
EXPOSE_CONST( MESG_RECOMMENDED_BUFFER_SIZE );
|
57
|
+
|
58
|
+
EXPOSE_CONST( MESG_INVALID_ID );
|
59
|
+
EXPOSE_CONST( MESG_EVENT_ID );
|
60
|
+
|
61
|
+
EXPOSE_CONST( MESG_VERSION_ID );
|
62
|
+
EXPOSE_CONST( MESG_RESPONSE_EVENT_ID );
|
63
|
+
|
64
|
+
EXPOSE_CONST( MESG_UNASSIGN_CHANNEL_ID );
|
65
|
+
EXPOSE_CONST( MESG_ASSIGN_CHANNEL_ID );
|
66
|
+
EXPOSE_CONST( MESG_CHANNEL_MESG_PERIOD_ID );
|
67
|
+
EXPOSE_CONST( MESG_CHANNEL_SEARCH_TIMEOUT_ID );
|
68
|
+
EXPOSE_CONST( MESG_CHANNEL_RADIO_FREQ_ID );
|
69
|
+
EXPOSE_CONST( MESG_NETWORK_KEY_ID );
|
70
|
+
EXPOSE_CONST( MESG_RADIO_TX_POWER_ID );
|
71
|
+
EXPOSE_CONST( MESG_RADIO_CW_MODE_ID );
|
72
|
+
EXPOSE_CONST( MESG_SYSTEM_RESET_ID );
|
73
|
+
EXPOSE_CONST( MESG_OPEN_CHANNEL_ID );
|
74
|
+
EXPOSE_CONST( MESG_CLOSE_CHANNEL_ID );
|
75
|
+
EXPOSE_CONST( MESG_REQUEST_ID );
|
76
|
+
|
77
|
+
EXPOSE_CONST( MESG_BROADCAST_DATA_ID );
|
78
|
+
EXPOSE_CONST( MESG_ACKNOWLEDGED_DATA_ID );
|
79
|
+
EXPOSE_CONST( MESG_BURST_DATA_ID );
|
80
|
+
|
81
|
+
EXPOSE_CONST( MESG_CHANNEL_ID_ID );
|
82
|
+
EXPOSE_CONST( MESG_CHANNEL_STATUS_ID );
|
83
|
+
EXPOSE_CONST( MESG_RADIO_CW_INIT_ID );
|
84
|
+
EXPOSE_CONST( MESG_CAPABILITIES_ID );
|
85
|
+
|
86
|
+
EXPOSE_CONST( MESG_STACKLIMIT_ID );
|
87
|
+
|
88
|
+
EXPOSE_CONST( MESG_SCRIPT_DATA_ID );
|
89
|
+
EXPOSE_CONST( MESG_SCRIPT_CMD_ID );
|
90
|
+
|
91
|
+
EXPOSE_CONST( MESG_ID_LIST_ADD_ID );
|
92
|
+
EXPOSE_CONST( MESG_CRYPTO_ID_LIST_ADD_ID );
|
93
|
+
EXPOSE_CONST( MESG_ID_LIST_CONFIG_ID );
|
94
|
+
EXPOSE_CONST( MESG_CRYPTO_ID_LIST_CONFIG_ID );
|
95
|
+
EXPOSE_CONST( MESG_OPEN_RX_SCAN_ID );
|
96
|
+
|
97
|
+
EXPOSE_CONST( MESG_EXT_CHANNEL_RADIO_FREQ_ID );
|
98
|
+
EXPOSE_CONST( MESG_EXT_BROADCAST_DATA_ID );
|
99
|
+
EXPOSE_CONST( MESG_EXT_ACKNOWLEDGED_DATA_ID );
|
100
|
+
EXPOSE_CONST( MESG_EXT_BURST_DATA_ID );
|
101
|
+
|
102
|
+
EXPOSE_CONST( MESG_CHANNEL_RADIO_TX_POWER_ID );
|
103
|
+
EXPOSE_CONST( MESG_GET_SERIAL_NUM_ID );
|
104
|
+
EXPOSE_CONST( MESG_GET_TEMP_CAL_ID );
|
105
|
+
EXPOSE_CONST( MESG_SET_LP_SEARCH_TIMEOUT_ID );
|
106
|
+
EXPOSE_CONST( MESG_SET_TX_SEARCH_ON_NEXT_ID );
|
107
|
+
EXPOSE_CONST( MESG_SERIAL_NUM_SET_CHANNEL_ID_ID );
|
108
|
+
EXPOSE_CONST( MESG_RX_EXT_MESGS_ENABLE_ID );
|
109
|
+
EXPOSE_CONST( MESG_RADIO_CONFIG_ALWAYS_ID );
|
110
|
+
EXPOSE_CONST( MESG_ENABLE_LED_FLASH_ID );
|
111
|
+
EXPOSE_CONST( MESG_XTAL_ENABLE_ID );
|
112
|
+
EXPOSE_CONST( MESG_ANTLIB_CONFIG_ID );
|
113
|
+
EXPOSE_CONST( MESG_STARTUP_MESG_ID );
|
114
|
+
EXPOSE_CONST( MESG_AUTO_FREQ_CONFIG_ID );
|
115
|
+
EXPOSE_CONST( MESG_PROX_SEARCH_CONFIG_ID );
|
116
|
+
|
117
|
+
EXPOSE_CONST( MESG_ADV_BURST_DATA_ID );
|
118
|
+
EXPOSE_CONST( MESG_EVENT_BUFFERING_CONFIG_ID );
|
119
|
+
|
120
|
+
EXPOSE_CONST( MESG_SET_SEARCH_CH_PRIORITY_ID );
|
121
|
+
|
122
|
+
EXPOSE_CONST( MESG_HIGH_DUTY_SEARCH_MODE_ID );
|
123
|
+
EXPOSE_CONST( MESG_CONFIG_ADV_BURST_ID );
|
124
|
+
EXPOSE_CONST( MESG_EVENT_FILTER_CONFIG_ID );
|
125
|
+
EXPOSE_CONST( MESG_SDU_CONFIG_ID );
|
126
|
+
EXPOSE_CONST( MESG_SDU_SET_MASK_ID );
|
127
|
+
EXPOSE_CONST( MESG_USER_CONFIG_PAGE_ID );
|
128
|
+
EXPOSE_CONST( MESG_ENCRYPT_ENABLE_ID );
|
129
|
+
EXPOSE_CONST( MESG_SET_CRYPTO_KEY_ID );
|
130
|
+
EXPOSE_CONST( MESG_SET_CRYPTO_INFO_ID );
|
131
|
+
EXPOSE_CONST( MESG_CUBE_CMD_ID );
|
132
|
+
|
133
|
+
EXPOSE_CONST( MESG_ACTIVE_SEARCH_SHARING_ID );
|
134
|
+
EXPOSE_CONST( MESG_NVM_CRYPTO_KEY_OPS_ID );
|
135
|
+
|
136
|
+
EXPOSE_CONST( MESG_GET_PIN_DIODE_CONTROL_ID );
|
137
|
+
EXPOSE_CONST( MESG_PIN_DIODE_CONTROL_ID );
|
138
|
+
EXPOSE_CONST( MESG_FIT1_SET_AGC_ID );
|
139
|
+
|
140
|
+
EXPOSE_CONST( MESG_FIT1_SET_EQUIP_STATE_ID );
|
141
|
+
|
142
|
+
EXPOSE_CONST( MESG_SET_CHANNEL_INPUT_MASK_ID );
|
143
|
+
EXPOSE_CONST( MESG_SET_CHANNEL_DATA_TYPE_ID );
|
144
|
+
EXPOSE_CONST( MESG_READ_PINS_FOR_SECT_ID );
|
145
|
+
EXPOSE_CONST( MESG_TIMER_SELECT_ID );
|
146
|
+
EXPOSE_CONST( MESG_ATOD_SETTINGS_ID );
|
147
|
+
EXPOSE_CONST( MESG_SET_SHARED_ADDRESS_ID );
|
148
|
+
EXPOSE_CONST( MESG_ATOD_EXTERNAL_ENABLE_ID );
|
149
|
+
EXPOSE_CONST( MESG_ATOD_PIN_SETUP_ID );
|
150
|
+
EXPOSE_CONST( MESG_SETUP_ALARM_ID );
|
151
|
+
EXPOSE_CONST( MESG_ALARM_VARIABLE_MODIFY_TEST_ID );
|
152
|
+
EXPOSE_CONST( MESG_PARTIAL_RESET_ID );
|
153
|
+
EXPOSE_CONST( MESG_OVERWRITE_TEMP_CAL_ID );
|
154
|
+
EXPOSE_CONST( MESG_SERIAL_PASSTHRU_SETTINGS_ID );
|
155
|
+
|
156
|
+
EXPOSE_CONST( MESG_BIST_ID );
|
157
|
+
EXPOSE_CONST( MESG_UNLOCK_INTERFACE_ID );
|
158
|
+
EXPOSE_CONST( MESG_SERIAL_ERROR_ID );
|
159
|
+
EXPOSE_CONST( MESG_SET_ID_STRING_ID );
|
160
|
+
|
161
|
+
EXPOSE_CONST( MESG_PORT_GET_IO_STATE_ID );
|
162
|
+
EXPOSE_CONST( MESG_PORT_SET_IO_STATE_ID );
|
163
|
+
|
164
|
+
EXPOSE_CONST( MESG_RSSI_ID );
|
165
|
+
EXPOSE_CONST( MESG_RSSI_BROADCAST_DATA_ID );
|
166
|
+
EXPOSE_CONST( MESG_RSSI_ACKNOWLEDGED_DATA_ID );
|
167
|
+
EXPOSE_CONST( MESG_RSSI_BURST_DATA_ID );
|
168
|
+
EXPOSE_CONST( MESG_RSSI_SEARCH_THRESHOLD_ID );
|
169
|
+
EXPOSE_CONST( MESG_SLEEP_ID );
|
170
|
+
EXPOSE_CONST( MESG_GET_GRMN_ESN_ID );
|
171
|
+
EXPOSE_CONST( MESG_SET_USB_INFO_ID );
|
172
|
+
|
173
|
+
EXPOSE_CONST( MESG_HCI_COMMAND_COMPLETE );
|
174
|
+
|
175
|
+
EXPOSE_CONST( MESG_EXT_ID_0 );
|
176
|
+
EXPOSE_CONST( MESG_EXT_ID_1 );
|
177
|
+
EXPOSE_CONST( MESG_EXT_ID_2 );
|
178
|
+
|
179
|
+
EXPOSE_CONST( MESG_EXT_RESPONSE_ID );
|
180
|
+
|
181
|
+
EXPOSE_CONST( MESG_EXT_REQUEST_ID );
|
182
|
+
|
183
|
+
EXPOSE_CONST( MESG_FS_INIT_MEMORY_ID );
|
184
|
+
EXPOSE_CONST( MESG_FS_FORMAT_MEMORY_ID );
|
185
|
+
EXPOSE_CONST( MESG_FS_GET_USED_SPACE_ID );
|
186
|
+
EXPOSE_CONST( MESG_FS_GET_FREE_SPACE_ID );
|
187
|
+
EXPOSE_CONST( MESG_FS_FIND_FILE_INDEX_ID );
|
188
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_READ_ABSOLUTE_ID );
|
189
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_READ_ENTRY_ID );
|
190
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_SAVE_ID );
|
191
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_GET_SIZE_ID );
|
192
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_REBUILD_ID );
|
193
|
+
EXPOSE_CONST( MESG_FS_FILE_CREATE_ID );
|
194
|
+
EXPOSE_CONST( MESG_FS_FILE_OPEN_ID );
|
195
|
+
EXPOSE_CONST( MESG_FS_FILE_DELETE_ID );
|
196
|
+
EXPOSE_CONST( MESG_FS_FILE_CLOSE_ID );
|
197
|
+
EXPOSE_CONST( MESG_FS_FILE_READ_ABSOLUTE_ID );
|
198
|
+
EXPOSE_CONST( MESG_FS_FILE_READ_RELATIVE_ID );
|
199
|
+
EXPOSE_CONST( MESG_FS_FILE_WRITE_ABSOLUTE_ID );
|
200
|
+
EXPOSE_CONST( MESG_FS_FILE_WRITE_RELATIVE_ID );
|
201
|
+
EXPOSE_CONST( MESG_FS_FILE_SET_SPECIFIC_FLAGS_ID );
|
202
|
+
EXPOSE_CONST( MESG_FS_FILE_GET_SIZE_ID );
|
203
|
+
EXPOSE_CONST( MESG_FS_FILE_GET_SPECIFIC_FILE_FLAGS_ID );
|
204
|
+
EXPOSE_CONST( MESG_FS_FILE_GET_SIZE_IN_MEM_ID );
|
205
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_READ_LOCK_ID );
|
206
|
+
|
207
|
+
EXPOSE_CONST( MESG_FS_FILE_SET_GENERAL_FLAGS_ID );
|
208
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_WRITE_ABSOLUTE_ID );
|
209
|
+
|
210
|
+
EXPOSE_CONST( MESG_MEMDEV_EEPROM_INIT_ID );
|
211
|
+
EXPOSE_CONST( MESG_MEMDEV_FLASH_INIT_ID );
|
212
|
+
|
213
|
+
EXPOSE_CONST( MESG_FS_ANTFS_EVENT_ID );
|
214
|
+
EXPOSE_CONST( MESG_FS_ANTFS_OPEN_ID );
|
215
|
+
EXPOSE_CONST( MESG_FS_ANTFS_CLOSE_ID );
|
216
|
+
EXPOSE_CONST( MESG_FS_ANTFS_CONFIG_BEACON_ID );
|
217
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_AUTH_STRING_ID );
|
218
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_BEACON_STATE_ID );
|
219
|
+
EXPOSE_CONST( MESG_FS_ANTFS_PAIR_RESPONSE_ID );
|
220
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_LINK_FREQ_ID );
|
221
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_BEACON_TIMEOUT_ID );
|
222
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_PAIRING_TIMEOUT_ID );
|
223
|
+
EXPOSE_CONST( MESG_FS_ANTFS_REMOTE_FILE_CREATE_EN_ID );
|
224
|
+
EXPOSE_CONST( MESG_FS_ANTFS_GET_CMD_PIPE_ID );
|
225
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_CMD_PIPE_ID );
|
226
|
+
EXPOSE_CONST( MESG_FS_SYSTEM_TIME_ID );
|
227
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_ANTFS_STATE_ID );
|
228
|
+
|
229
|
+
EXPOSE_CONST( MESG_FS_CRYPTO_ADD_USER_KEY_INDEX_ID );
|
230
|
+
EXPOSE_CONST( MESG_FS_CRYPTO_SET_USER_KEY_INDEX_ID );
|
231
|
+
EXPOSE_CONST( MESG_FS_CRYPTO_SET_USER_KEY_VAL_ID );
|
232
|
+
|
233
|
+
EXPOSE_CONST( MESG_FS_FIT_FILE_INTEGRITY_CHECK_ID );
|
234
|
+
|
235
|
+
EXPOSE_CONST( MESG_INVALID_SIZE );
|
236
|
+
|
237
|
+
EXPOSE_CONST( MESG_VERSION_SIZE );
|
238
|
+
EXPOSE_CONST( MESG_RESPONSE_EVENT_SIZE );
|
239
|
+
EXPOSE_CONST( MESG_CHANNEL_STATUS_SIZE );
|
240
|
+
|
241
|
+
EXPOSE_CONST( MESG_UNASSIGN_CHANNEL_SIZE );
|
242
|
+
EXPOSE_CONST( MESG_ASSIGN_CHANNEL_SIZE );
|
243
|
+
EXPOSE_CONST( MESG_CHANNEL_ID_SIZE );
|
244
|
+
EXPOSE_CONST( MESG_CHANNEL_MESG_PERIOD_SIZE );
|
245
|
+
EXPOSE_CONST( MESG_CHANNEL_SEARCH_TIMEOUT_SIZE );
|
246
|
+
EXPOSE_CONST( MESG_CHANNEL_RADIO_FREQ_SIZE );
|
247
|
+
EXPOSE_CONST( MESG_CHANNEL_RADIO_TX_POWER_SIZE );
|
248
|
+
EXPOSE_CONST( MESG_NETWORK_KEY_SIZE );
|
249
|
+
EXPOSE_CONST( MESG_RADIO_TX_POWER_SIZE );
|
250
|
+
EXPOSE_CONST( MESG_RADIO_CW_MODE_SIZE );
|
251
|
+
EXPOSE_CONST( MESG_RADIO_CW_INIT_SIZE );
|
252
|
+
EXPOSE_CONST( MESG_SYSTEM_RESET_SIZE );
|
253
|
+
EXPOSE_CONST( MESG_OPEN_CHANNEL_SIZE );
|
254
|
+
EXPOSE_CONST( MESG_CLOSE_CHANNEL_SIZE );
|
255
|
+
EXPOSE_CONST( MESG_REQUEST_SIZE );
|
256
|
+
EXPOSE_CONST( MESG_REQUEST_USER_NVM_SIZE );
|
257
|
+
|
258
|
+
EXPOSE_CONST( MESG_CAPABILITIES_SIZE );
|
259
|
+
EXPOSE_CONST( MESG_STACKLIMIT_SIZE );
|
260
|
+
|
261
|
+
EXPOSE_CONST( MESG_SCRIPT_DATA_SIZE );
|
262
|
+
EXPOSE_CONST( MESG_SCRIPT_CMD_SIZE );
|
263
|
+
|
264
|
+
EXPOSE_CONST( MESG_ID_LIST_ADD_SIZE );
|
265
|
+
EXPOSE_CONST( MESG_ID_LIST_CONFIG_SIZE );
|
266
|
+
EXPOSE_CONST( MESG_OPEN_RX_SCAN_SIZE );
|
267
|
+
EXPOSE_CONST( MESG_EXT_CHANNEL_RADIO_FREQ_SIZE );
|
268
|
+
|
269
|
+
EXPOSE_CONST( MESG_RADIO_CONFIG_ALWAYS_SIZE );
|
270
|
+
EXPOSE_CONST( MESG_RX_EXT_MESGS_ENABLE_SIZE );
|
271
|
+
EXPOSE_CONST( MESG_SET_TX_SEARCH_ON_NEXT_SIZE );
|
272
|
+
EXPOSE_CONST( MESG_SET_LP_SEARCH_TIMEOUT_SIZE );
|
273
|
+
|
274
|
+
EXPOSE_CONST( MESG_SERIAL_NUM_SET_CHANNEL_ID_SIZE );
|
275
|
+
EXPOSE_CONST( MESG_ENABLE_LED_FLASH_SIZE );
|
276
|
+
EXPOSE_CONST( MESG_GET_SERIAL_NUM_SIZE );
|
277
|
+
EXPOSE_CONST( MESG_GET_TEMP_CAL_SIZE );
|
278
|
+
EXPOSE_CONST( MESG_CONFIG_ADV_BURST_SIZE );
|
279
|
+
EXPOSE_CONST( MESG_CONFIG_ADV_BURST_SIZE_EXT );
|
280
|
+
EXPOSE_CONST( MESG_ANTLIB_CONFIG_SIZE );
|
281
|
+
EXPOSE_CONST( MESG_XTAL_ENABLE_SIZE );
|
282
|
+
EXPOSE_CONST( MESG_STARTUP_MESG_SIZE );
|
283
|
+
EXPOSE_CONST( MESG_AUTO_FREQ_CONFIG_SIZE );
|
284
|
+
EXPOSE_CONST( MESG_PROX_SEARCH_CONFIG_SIZE );
|
285
|
+
EXPOSE_CONST( MESG_EVENT_BUFFERING_CONFIG_SIZE );
|
286
|
+
EXPOSE_CONST( MESG_EVENT_FILTER_CONFIG_SIZE );
|
287
|
+
EXPOSE_CONST( MESG_HIGH_DUTY_SEARCH_MODE_SIZE );
|
288
|
+
EXPOSE_CONST( MESG_SDU_CONFIG_SIZE );
|
289
|
+
EXPOSE_CONST( MESG_SDU_SET_MASK_SIZE );
|
290
|
+
|
291
|
+
EXPOSE_CONST( MESG_USER_CONFIG_PAGE_SIZE );
|
292
|
+
|
293
|
+
EXPOSE_CONST( MESG_ACTIVE_SEARCH_SHARING_SIZE );
|
294
|
+
|
295
|
+
EXPOSE_CONST( MESG_SET_SEARCH_CH_PRIORITY_SIZE );
|
296
|
+
|
297
|
+
EXPOSE_CONST( MESG_ENCRYPT_ENABLE_SIZE );
|
298
|
+
EXPOSE_CONST( MESG_SET_CRYPTO_KEY_SIZE );
|
299
|
+
EXPOSE_CONST( MESG_SET_CRYPTO_ID_SIZE );
|
300
|
+
EXPOSE_CONST( MESG_SET_CRYPTO_USER_INFO_SIZE );
|
301
|
+
EXPOSE_CONST( MESG_SET_CRYPTO_RNG_SEED_SIZE );
|
302
|
+
EXPOSE_CONST( MESG_NVM_CRYPTO_KEY_LOAD_SIZE );
|
303
|
+
EXPOSE_CONST( MESG_NVM_CRYPTO_KEY_STORE_SIZE );
|
304
|
+
EXPOSE_CONST( MESG_CRYPTO_ID_LIST_ADD_SIZE );
|
305
|
+
EXPOSE_CONST( MESG_CRYPTO_ID_LIST_CONFIG_SIZE );
|
306
|
+
|
307
|
+
EXPOSE_CONST( MESG_GET_PIN_DIODE_CONTROL_SIZE );
|
308
|
+
EXPOSE_CONST( MESG_PIN_DIODE_CONTROL_ID_SIZE );
|
309
|
+
EXPOSE_CONST( MESG_FIT1_SET_EQUIP_STATE_SIZE );
|
310
|
+
EXPOSE_CONST( MESG_FIT1_SET_AGC_SIZE );
|
311
|
+
|
312
|
+
EXPOSE_CONST( MESG_BIST_SIZE );
|
313
|
+
EXPOSE_CONST( MESG_UNLOCK_INTERFACE_SIZE );
|
314
|
+
EXPOSE_CONST( MESG_SET_SHARED_ADDRESS_SIZE );
|
315
|
+
|
316
|
+
EXPOSE_CONST( MESG_GET_GRMN_ESN_SIZE );
|
317
|
+
|
318
|
+
EXPOSE_CONST( MESG_PORT_SET_IO_STATE_SIZE );
|
319
|
+
|
320
|
+
EXPOSE_CONST( MESG_SLEEP_SIZE );
|
321
|
+
|
322
|
+
EXPOSE_CONST( MESG_EXT_DATA_SIZE );
|
323
|
+
|
324
|
+
EXPOSE_CONST( MESG_RSSI_SIZE );
|
325
|
+
EXPOSE_CONST( MESG_RSSI_DATA_SIZE );
|
326
|
+
EXPOSE_CONST( MESG_RSSI_RESPONSE_SIZE );
|
327
|
+
EXPOSE_CONST( MESG_RSSI_SEARCH_THRESHOLD_SIZE );
|
328
|
+
|
329
|
+
EXPOSE_CONST( MESG_MEMDEV_EEPROM_INIT_SIZE );
|
330
|
+
EXPOSE_CONST( MESG_FS_INIT_MEMORY_SIZE );
|
331
|
+
EXPOSE_CONST( MESG_FS_FORMAT_MEMORY_SIZE );
|
332
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_SAVE_SIZE );
|
333
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_REBUILD_SIZE );
|
334
|
+
EXPOSE_CONST( MESG_FS_FILE_DELETE_SIZE );
|
335
|
+
EXPOSE_CONST( MESG_FS_FILE_CLOSE_SIZE );
|
336
|
+
EXPOSE_CONST( MESG_FS_FILE_SET_SPECIFIC_FLAGS_SIZE );
|
337
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_READ_LOCK_SIZE );
|
338
|
+
EXPOSE_CONST( MESG_FS_SYSTEM_TIME_SIZE );
|
339
|
+
EXPOSE_CONST( MESG_FS_CRYPTO_ADD_USER_KEY_INDEX_SIZE );
|
340
|
+
EXPOSE_CONST( MESG_FS_CRYPTO_SET_USER_KEY_INDEX_SIZE );
|
341
|
+
EXPOSE_CONST( MESG_FS_CRYPTO_SET_USER_KEY_VAL_SIZE );
|
342
|
+
EXPOSE_CONST( MESG_FS_FIT_FILE_INTEGRITY_CHECK_SIZE );
|
343
|
+
EXPOSE_CONST( MESG_FS_ANTFS_OPEN_SIZE );
|
344
|
+
EXPOSE_CONST( MESG_FS_ANTFS_CLOSE_SIZE );
|
345
|
+
EXPOSE_CONST( MESG_FS_ANTFS_CONFIG_BEACON_SIZE );
|
346
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_AUTH_STRING_SIZE );
|
347
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_BEACON_STATE_SIZE );
|
348
|
+
EXPOSE_CONST( MESG_FS_ANTFS_PAIR_RESPONSE_SIZE );
|
349
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_LINK_FREQ_SIZE );
|
350
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_BEACON_TIMEOUT_SIZE );
|
351
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_PAIRING_TIMEOUT_SIZE );
|
352
|
+
EXPOSE_CONST( MESG_FS_ANTFS_REMOTE_FILE_CREATE_EN_SIZE );
|
353
|
+
EXPOSE_CONST( MESG_FS_GET_USED_SPACE_SIZE );
|
354
|
+
EXPOSE_CONST( MESG_FS_GET_FREE_SPACE_SIZE );
|
355
|
+
EXPOSE_CONST( MESG_FS_FIND_FILE_INDEX_SIZE );
|
356
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_READ_ABSOLUTE_SIZE );
|
357
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_READ_ENTRY_SIZE );
|
358
|
+
EXPOSE_CONST( MESG_FS_DIRECTORY_GET_SIZE_SIZE );
|
359
|
+
EXPOSE_CONST( MESG_FS_FILE_CREATE_SIZE );
|
360
|
+
EXPOSE_CONST( MESG_FS_FILE_OPEN_SIZE );
|
361
|
+
EXPOSE_CONST( MESG_FS_FILE_READ_ABSOLUTE_SIZE );
|
362
|
+
EXPOSE_CONST( MESG_FS_FILE_READ_RELATIVE_SIZE );
|
363
|
+
EXPOSE_CONST( MESG_FS_FILE_WRITE_ABSOLUTE_SIZE );
|
364
|
+
EXPOSE_CONST( MESG_FS_FILE_WRITE_RELATIVE_SIZE );
|
365
|
+
EXPOSE_CONST( MESG_FS_FILE_GET_SIZE_SIZE );
|
366
|
+
EXPOSE_CONST( MESG_FS_FILE_GET_SIZE_IN_MEM_SIZE );
|
367
|
+
EXPOSE_CONST( MESG_FS_FILE_GET_SPECIFIC_FILE_FLAGS_SIZE );
|
368
|
+
EXPOSE_CONST( MESG_FS_SYSTEM_TIME_REQUEST_SIZE );
|
369
|
+
EXPOSE_CONST( MESG_FS_ANTFS_GET_CMD_PIPE_SIZE );
|
370
|
+
EXPOSE_CONST( MESG_FS_ANTFS_SET_CMD_PIPE_SIZE );
|
371
|
+
EXPOSE_CONST( MESG_FS_REQUEST_RESPONSE_SIZE );
|
372
|
+
#undef EXPOSE_CONST
|
373
|
+
|
374
|
+
rb_require( "ant/message" );
|
375
|
+
}
|
376
|
+
|
377
|
+
|
data/ext/ant_ext/types.h
ADDED
@@ -0,0 +1,202 @@
|
|
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 DSI_TYPES_H
|
10
|
+
#define DSI_TYPES_H
|
11
|
+
|
12
|
+
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(__TOS_WIN__) || defined(__WINDOWS__) //Windows Platform
|
13
|
+
#define DSI_TYPES_WINDOWS
|
14
|
+
|
15
|
+
#if defined(_WIN32_WINNT)
|
16
|
+
#if (_WIN32_WINNT < 0x501)
|
17
|
+
#undef _WIN32_WINNT
|
18
|
+
#define _WIN32_WINNT 0x0501
|
19
|
+
#endif
|
20
|
+
#else
|
21
|
+
#define _WIN32_WINNT 0X0501
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#include <windows.h>
|
25
|
+
|
26
|
+
#elif defined(macintosh) || defined (Macintosh) || defined(__APPLE__) || defined(__MACH__)
|
27
|
+
// Apple platform (first two defines are for Mac OS 9; last two are for Mac OS X)
|
28
|
+
#define DSI_TYPES_MACINTOSH
|
29
|
+
#elif defined(linux) || defined (__linux) // Linux platform
|
30
|
+
#define DSI_TYPES_LINUX
|
31
|
+
#else
|
32
|
+
#define DSI_TYPES_OTHER_OS
|
33
|
+
#endif
|
34
|
+
|
35
|
+
|
36
|
+
//////////////////////////////////////////////////////////////////////////////////
|
37
|
+
// Public Definitions
|
38
|
+
//////////////////////////////////////////////////////////////////////////////////
|
39
|
+
|
40
|
+
#if !defined(TRUE)
|
41
|
+
#define TRUE ((BOOL) 1)
|
42
|
+
#endif
|
43
|
+
#if !defined(FALSE)
|
44
|
+
#define FALSE ((BOOL) 0)
|
45
|
+
#endif
|
46
|
+
|
47
|
+
#if !defined(NULL) // <windef.h> compatibility.
|
48
|
+
#define NULL ((void *) 0)
|
49
|
+
#endif
|
50
|
+
|
51
|
+
#define NUL '\0'
|
52
|
+
|
53
|
+
#define MAX_SCHAR ((SCHAR) 0x7F)
|
54
|
+
#define MIN_SCHAR ((SCHAR) 0x80)
|
55
|
+
#define MAX_UCHAR ((UCHAR) 0xFF)
|
56
|
+
#define MIN_UCHAR ((UCHAR) 0)
|
57
|
+
|
58
|
+
#define MAX_SSHORT ((SSHORT) 0x7FFF)
|
59
|
+
#define MIN_SSHORT ((SSHORT) 0x8000)
|
60
|
+
#define MAX_USHORT ((USHORT) 0xFFFF)
|
61
|
+
#define MIN_USHORT ((USHORT) 0)
|
62
|
+
|
63
|
+
#define MAX_SLONG ((SLONG) 0x7FFFFFFF)
|
64
|
+
#define MIN_SLONG ((SLONG) 0x80000000)
|
65
|
+
#define MAX_ULONG ((ULONG) 0xFFFFFFFF)
|
66
|
+
#define MIN_ULONG ((ULONG) 0)
|
67
|
+
|
68
|
+
#if defined (__ICC8051__)
|
69
|
+
#define C_TYPE __code
|
70
|
+
#define MEM_TYPE __xdata
|
71
|
+
#define MEM_TYPE_S static __xdata
|
72
|
+
#define MEM_TYPE_P __xdata *
|
73
|
+
#define BIT_TYPE __bdata
|
74
|
+
#define DIR_TYPE __data
|
75
|
+
#else
|
76
|
+
#define C_TYPE
|
77
|
+
#define MEM_TYPE
|
78
|
+
#define MEM_TYPE_S
|
79
|
+
#define MEM_TYPE_P
|
80
|
+
#define BIT_TYPE
|
81
|
+
#define DIR_TYPE
|
82
|
+
#endif
|
83
|
+
|
84
|
+
#if defined(__IAR_SYSTEMS_ICC__)
|
85
|
+
#define BITFIELD_START struct {
|
86
|
+
#define BITFIELD_END }
|
87
|
+
#define BITS_1 : 1
|
88
|
+
#define BITS_2 : 2
|
89
|
+
#define BITS_3 : 3
|
90
|
+
#define BITS_4 : 4
|
91
|
+
#define BITS_5 : 5
|
92
|
+
#define BITS_6 : 6
|
93
|
+
#define BITS_7 : 7
|
94
|
+
#else
|
95
|
+
#define BITFIELD_START
|
96
|
+
#define BITFIELD_END
|
97
|
+
#define BITS_1
|
98
|
+
#define BITS_2
|
99
|
+
#define BITS_3
|
100
|
+
#define BITS_4
|
101
|
+
#define BITS_5
|
102
|
+
#define BITS_6
|
103
|
+
#define BITS_7
|
104
|
+
#endif
|
105
|
+
|
106
|
+
#if !defined(DSI_TYPES_WINDOWS)
|
107
|
+
#if !defined(BASETYPES) && !defined(_WinToMac_h_)
|
108
|
+
#if !defined(OBJC_BOOL_DEFINED)
|
109
|
+
typedef signed char BOOL;
|
110
|
+
#endif
|
111
|
+
typedef char BYTE; // 1-byte int. Sign is processor/compiler-dependent.
|
112
|
+
#endif
|
113
|
+
#endif
|
114
|
+
|
115
|
+
typedef unsigned char BOOL_SAFE; // BOOL that doesn't get redefined to signed int in windows to result in TRUE=-1 when used in bit fields.
|
116
|
+
|
117
|
+
typedef signed char SCHAR; // Signed 1-byte int.
|
118
|
+
typedef unsigned char UCHAR; // Unsigned 1-byte int.
|
119
|
+
|
120
|
+
typedef signed short SSHORT; // Signed 2-byte int.
|
121
|
+
typedef unsigned short USHORT; // Unsigned 2-byte int.
|
122
|
+
|
123
|
+
#if !defined(__LP64__)
|
124
|
+
typedef signed long SLONG; // Signed 4-byte int.
|
125
|
+
typedef unsigned long ULONG; // Unsigned 4-byte int.
|
126
|
+
|
127
|
+
// 4-byte int. Sign is processor/compiler-dependent. Commonly assumed
|
128
|
+
// to be signed, however this is not guaranteed. Suggested use for
|
129
|
+
// this type is for efficient data passing and bit manipulation.
|
130
|
+
// Assuming any sign for math may be problematic, especially on code
|
131
|
+
// intended to be cross-platform.
|
132
|
+
typedef long LONG;
|
133
|
+
|
134
|
+
#else
|
135
|
+
// __LP64__ is defined when compilation is for a target in which
|
136
|
+
// integers are 32-bit quantities, and long integers and pointers are 64-bit quantities
|
137
|
+
// For example: Mac OS X, 64-Bit
|
138
|
+
// https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/64bitPorting/transition/transition.html
|
139
|
+
typedef signed int SLONG; // Signed 4-byte int.
|
140
|
+
typedef unsigned int ULONG; // Unsigned 4-byte int.
|
141
|
+
typedef int LONG;
|
142
|
+
#endif
|
143
|
+
|
144
|
+
#if !defined(__BORLANDC__)
|
145
|
+
typedef signed long long SLLONG; // Signed 8-byte int.
|
146
|
+
typedef unsigned long long ULLONG; // Unsigned 8-byte int.
|
147
|
+
#endif
|
148
|
+
|
149
|
+
typedef float FLOAT; // 2-byte floating point.
|
150
|
+
typedef double DOUBLE; // 4-byte floating point.
|
151
|
+
|
152
|
+
///////////////////////////////////////////////////////////////////////
|
153
|
+
// !!NOTE: The structures below assume little endian architecture!!
|
154
|
+
///////////////////////////////////////////////////////////////////////
|
155
|
+
typedef union
|
156
|
+
{
|
157
|
+
USHORT usData;
|
158
|
+
struct
|
159
|
+
{
|
160
|
+
UCHAR ucLow;
|
161
|
+
UCHAR ucHigh;
|
162
|
+
} stBytes;
|
163
|
+
} USHORT_UNION;
|
164
|
+
|
165
|
+
#define USHORT_HIGH(X) (((USHORT_UNION *)(X))->stBytes.ucHigh)
|
166
|
+
#define USHORT_LOW(X) (((USHORT_UNION *)(X))->stBytes.ucLow)
|
167
|
+
|
168
|
+
typedef union
|
169
|
+
{
|
170
|
+
signed short ssData;
|
171
|
+
struct
|
172
|
+
{
|
173
|
+
UCHAR ucLow;
|
174
|
+
UCHAR ucHigh;
|
175
|
+
} stBytes;
|
176
|
+
} SSHORT_UNION;
|
177
|
+
|
178
|
+
#define SSHORT_HIGH(X) (((SSHORT_UNION *)(X))->stBytes.ucHigh)
|
179
|
+
#define SSHORT_LOW(X) (((SSHORT_UNION *)(X))->stBytes.ucLow)
|
180
|
+
|
181
|
+
typedef union
|
182
|
+
{
|
183
|
+
UCHAR aucData[4];
|
184
|
+
ULONG ulData;
|
185
|
+
struct
|
186
|
+
{
|
187
|
+
// The least significant byte of the ULONG in this structure is
|
188
|
+
// referenced by ucByte0.
|
189
|
+
UCHAR ucByte0;
|
190
|
+
UCHAR ucByte1;
|
191
|
+
UCHAR ucByte2;
|
192
|
+
UCHAR ucByte3;
|
193
|
+
} stBytes;
|
194
|
+
} ULONG_UNION;
|
195
|
+
|
196
|
+
#define ULONG_LOW_0(X) (((ULONG_UNION *)(X))->stBytes.ucByte0)
|
197
|
+
#define ULONG_MID_1(X) (((ULONG_UNION *)(X))->stBytes.ucByte1)
|
198
|
+
#define ULONG_MID_2(X) (((ULONG_UNION *)(X))->stBytes.ucByte2)
|
199
|
+
#define ULONG_HIGH_3(X) (((ULONG_UNION *)(X))->stBytes.ucByte3)
|
200
|
+
|
201
|
+
|
202
|
+
#endif // defined(DSI_TYPES_H)
|