1 | /* Copyright (c) 2014, Nordic Semiconductor ASA
|
---|
2 | *
|
---|
3 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
4 | * of this software and associated documentation files (the "Software"), to deal
|
---|
5 | * in the Software without restriction, including without limitation the rights
|
---|
6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
7 | * copies of the Software, and to permit persons to whom the Software is
|
---|
8 | * furnished to do so, subject to the following conditions:
|
---|
9 | *
|
---|
10 | * The above copyright notice and this permission notice shall be included in all
|
---|
11 | * copies or substantial portions of the Software.
|
---|
12 | *
|
---|
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
---|
18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
19 | * SOFTWARE.
|
---|
20 | */
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * @file
|
---|
24 | *
|
---|
25 | * @defgroup aci aci
|
---|
26 | * @{
|
---|
27 | * @ingroup lib
|
---|
28 | *
|
---|
29 | * @brief Definitions for the ACI (Application Control Interface)
|
---|
30 | * @remarks
|
---|
31 | *
|
---|
32 | * Flow control from application mcu to nRF8001
|
---|
33 | *
|
---|
34 | * Data flow control:
|
---|
35 | * The flow control is credit based and the credit is initally given using the "device started" event.
|
---|
36 | * A credit of more than 1 is given to the application mcu.
|
---|
37 | * These credits are used only after the "ACI Connected Event" is sent to the application mcu.
|
---|
38 | *
|
---|
39 | * every send_data that is used decrements the credit available by 1. This is to be tracked by the application mcu.
|
---|
40 | * When the credit available reaches 0, the application mcu shall not send any more send_data.
|
---|
41 | * Credit is returned using the "credit event", this returned credit can then be used to send more send_data.
|
---|
42 | * This flow control is not necessary and not available for Broadcast.
|
---|
43 | * The entire credit available with the external mcu expires when a "disconnected" event arrives.
|
---|
44 | *
|
---|
45 | * Command flow control:
|
---|
46 | * When a command is sent over the ACI, the next command shall not be sent until after a response
|
---|
47 | * for the command sent has arrived.
|
---|
48 | *
|
---|
49 | */
|
---|
50 |
|
---|
51 | #ifndef ACI_H__
|
---|
52 | #define ACI_H__
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Define an _aci_packed_ macro we can use in structure and enumerated type
|
---|
56 | * declarations so that the types are sized consistently across different
|
---|
57 | * platforms. In particular Arduino platforms using the GCC compiler and the
|
---|
58 | * Nordic processors using the Keil compiler.
|
---|
59 | *
|
---|
60 | * It's really the GNU compiler platforms that need a special keyword to get
|
---|
61 | * tight packing of values. On GNU platforms we can use the keyword:
|
---|
62 | * __attribute__((__packed__))
|
---|
63 | * The thing is that while this keyword does the right thing with old and new
|
---|
64 | * versions of the gcc (C) compiler it only works right with g++ (C++) compiler
|
---|
65 | * versions that are version 4 or newer.
|
---|
66 | */
|
---|
67 | #ifdef __GNUC__
|
---|
68 | # if __GNUC__ >= 4
|
---|
69 | # define _aci_packed_ __attribute__((__packed__))
|
---|
70 | # else
|
---|
71 | # error "older g++ versions don't handle packed attribute in typedefs"
|
---|
72 | # endif
|
---|
73 | #else
|
---|
74 | # define _aci_packed_
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | /*
|
---|
78 | * Define a macro that compares the size of the first parameter to the integer
|
---|
79 | * value of the second parameter. If they do not match, a compile time error
|
---|
80 | * for negative array size occurs (even gnu chokes on negative array size).
|
---|
81 | *
|
---|
82 | * This compare is done by creating a typedef for an array. No variables are
|
---|
83 | * created and no memory is consumed with this check. The created type is
|
---|
84 | * used for checking only and is not for use by any other code. The value
|
---|
85 | * of 10 in this macro is arbitrary, it just needs to be a value larger
|
---|
86 | * than one to result in a positive number for the array size.
|
---|
87 | */
|
---|
88 | #define ACI_ASSERT_SIZE(x,y) typedef char x ## _assert_size_t[-1+10*(sizeof(x) == (y))]
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * @def ACI_VERSION
|
---|
92 | * @brief Current ACI protocol version. 0 means a device that is not yet released.
|
---|
93 | * A numer greater than 0 refers to a specific ACI version documented and released.
|
---|
94 | * The ACI consists of the ACI commands, ACI events and error codes.
|
---|
95 | */
|
---|
96 | #define ACI_VERSION (0x02)
|
---|
97 | /**
|
---|
98 | * @def BTLE_DEVICE_ADDRESS_SIZE
|
---|
99 | * @brief Size in bytes of a Bluetooth Address
|
---|
100 | */
|
---|
101 | #define BTLE_DEVICE_ADDRESS_SIZE (6)
|
---|
102 | /**
|
---|
103 | * @def ACI_PACKET_MAX_LEN
|
---|
104 | * @brief Maximum length in bytes of a full ACI packet, including length prefix, opcode and payload
|
---|
105 | */
|
---|
106 | #define ACI_PACKET_MAX_LEN (32)
|
---|
107 | /**
|
---|
108 | * @def ACI_ECHO_DATA_MAX_LEN
|
---|
109 | * @brief Maximum length in bytes of the echo data portion
|
---|
110 | */
|
---|
111 | #define ACI_ECHO_DATA_MAX_LEN (ACI_PACKET_MAX_LEN - 3)
|
---|
112 | /**
|
---|
113 | * @def ACI_DEVICE_MAX_PIPES
|
---|
114 | * @brief Maximum number of ACI pipes
|
---|
115 | */
|
---|
116 | #define ACI_DEVICE_MAX_PIPES (62)
|
---|
117 | /**
|
---|
118 | * @def ACI_PIPE_TX_DATA_MAX_LEN
|
---|
119 | * @brief Maximum length in bytes of a transmission data pipe packet
|
---|
120 | */
|
---|
121 | #define ACI_PIPE_TX_DATA_MAX_LEN (20)
|
---|
122 | /**
|
---|
123 | * @def ACI_PIPE_RX_DATA_MAX_LEN
|
---|
124 | * @brief Maximum length in bytes of a reception data pipe packet
|
---|
125 | */
|
---|
126 | #define ACI_PIPE_RX_DATA_MAX_LEN (22)
|
---|
127 | /**
|
---|
128 | * @def ACI_GAP_DEVNAME_MAX_LEN
|
---|
129 | * @brief Maximum length in bytes of the GAP device name
|
---|
130 | */
|
---|
131 | #define ACI_GAP_DEVNAME_MAX_LEN (20)
|
---|
132 | /**
|
---|
133 | * @def ACI_AD_PACKET_MAX_LEN
|
---|
134 | * @brief Maximum length in bytes of an AD packet
|
---|
135 | */
|
---|
136 | #define ACI_AD_PACKET_MAX_LEN (31)
|
---|
137 | /**
|
---|
138 | * @def ACI_AD_PACKET_MAX_USER_LEN
|
---|
139 | * @brief Maximum usable length in bytes of an AD packet
|
---|
140 | */
|
---|
141 | #define ACI_AD_PACKET_MAX_USER_LEN (31 - 3)
|
---|
142 | /**
|
---|
143 | * @def ACI_PIPE_INVALID
|
---|
144 | * @brief Invalid pipe number
|
---|
145 | */
|
---|
146 | #define ACI_PIPE_INVALID (0xFF)
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * @enum aci_pipe_store_t
|
---|
150 | * @brief Storage type identifiers: local and remote
|
---|
151 | */
|
---|
152 | typedef enum
|
---|
153 | {
|
---|
154 | ACI_STORE_INVALID = 0x0,
|
---|
155 | ACI_STORE_LOCAL= 0x01,
|
---|
156 | ACI_STORE_REMOTE= 0x02
|
---|
157 | } _aci_packed_ aci_pipe_store_t;
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * @enum aci_pipe_type_t
|
---|
161 | * @brief Pipe types
|
---|
162 | */
|
---|
163 | typedef enum
|
---|
164 | {
|
---|
165 | ACI_TX_BROADCAST = 0x0001,
|
---|
166 | ACI_TX = 0x0002,
|
---|
167 | ACI_TX_ACK = 0x0004,
|
---|
168 | ACI_RX = 0x0008,
|
---|
169 | ACI_RX_ACK = 0x0010,
|
---|
170 | ACI_TX_REQ = 0x0020,
|
---|
171 | ACI_RX_REQ = 0x0040,
|
---|
172 | ACI_SET = 0x0080,
|
---|
173 | ACI_TX_SIGN = 0x0100,
|
---|
174 | ACI_RX_SIGN = 0x0200,
|
---|
175 | ACI_RX_ACK_AUTO = 0x0400
|
---|
176 | } _aci_packed_ aci_pipe_type_t;
|
---|
177 |
|
---|
178 | ACI_ASSERT_SIZE(aci_pipe_type_t, 2);
|
---|
179 |
|
---|
180 | /**
|
---|
181 | * @enum aci_bd_addr_type_t
|
---|
182 | * @brief Bluetooth Address types
|
---|
183 | */
|
---|
184 | typedef enum
|
---|
185 | {
|
---|
186 | ACI_BD_ADDR_TYPE_INVALID = 0x00,
|
---|
187 | ACI_BD_ADDR_TYPE_PUBLIC = 0x01,
|
---|
188 | ACI_BD_ADDR_TYPE_RANDOM_STATIC = 0x02,
|
---|
189 | ACI_BD_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE = 0x03,
|
---|
190 | ACI_BD_ADDR_TYPE_RANDOM_PRIVATE_UNRESOLVABLE = 0x04
|
---|
191 | } _aci_packed_ aci_bd_addr_type_t;
|
---|
192 |
|
---|
193 | /**
|
---|
194 | * @enum aci_device_output_power_t
|
---|
195 | * @brief Radio output power levels
|
---|
196 | */
|
---|
197 | typedef enum
|
---|
198 | {
|
---|
199 | ACI_DEVICE_OUTPUT_POWER_MINUS_18DBM = 0x00, /**< Output power set to -18dBm */
|
---|
200 | ACI_DEVICE_OUTPUT_POWER_MINUS_12DBM = 0x01, /**< Output power set to -12dBm */
|
---|
201 | ACI_DEVICE_OUTPUT_POWER_MINUS_6DBM = 0x02, /**< Output power set to -6dBm */
|
---|
202 | ACI_DEVICE_OUTPUT_POWER_0DBM = 0x03 /**< Output power set to 0dBm - DEFAULT*/
|
---|
203 | } _aci_packed_ aci_device_output_power_t;
|
---|
204 |
|
---|
205 | /**
|
---|
206 | * @enum aci_device_operation_mode_t
|
---|
207 | * @brief Device operation modes
|
---|
208 | */
|
---|
209 | typedef enum
|
---|
210 | {
|
---|
211 | ACI_DEVICE_INVALID =0x00,
|
---|
212 | ACI_DEVICE_TEST =0x01,
|
---|
213 | ACI_DEVICE_SETUP =0x02,
|
---|
214 | ACI_DEVICE_STANDBY =0x03,
|
---|
215 | ACI_DEVICE_SLEEP =0x04
|
---|
216 | } _aci_packed_ aci_device_operation_mode_t;
|
---|
217 |
|
---|
218 | /**
|
---|
219 | * @enum aci_disconnect_reason_t
|
---|
220 | * @brief Reason enumeration for ACI_CMD_DISCONNECT
|
---|
221 | */
|
---|
222 | typedef enum
|
---|
223 | {
|
---|
224 | ACI_REASON_TERMINATE =0x01, /**< Use this to disconnect (does a terminate request), you need to wait for the "disconnected" event */
|
---|
225 | ACI_REASON_BAD_TIMING =0x02 /*<Use this to disconnect and inform the peer, that the timing on the link is not acceptable for the device, you need to wait for the "disconnected" event */
|
---|
226 | } _aci_packed_ aci_disconnect_reason_t;
|
---|
227 |
|
---|
228 | /**
|
---|
229 | * @enum aci_test_mode_change_t
|
---|
230 | * @brief Device test mode control
|
---|
231 | */
|
---|
232 | typedef enum
|
---|
233 | {
|
---|
234 | ACI_TEST_MODE_DTM_UART = 0x01,
|
---|
235 | ACI_TEST_MODE_DTM_ACI = 0x02,
|
---|
236 | ACI_TEST_MODE_EXIT = 0xFF
|
---|
237 |
|
---|
238 | } _aci_packed_ aci_test_mode_change_t;
|
---|
239 |
|
---|
240 | ACI_ASSERT_SIZE(aci_test_mode_change_t, 1);
|
---|
241 |
|
---|
242 | /**
|
---|
243 | * @enum aci_permissions_t
|
---|
244 | * @brief Data store permissions
|
---|
245 | */
|
---|
246 | typedef enum
|
---|
247 | {
|
---|
248 | ACI_PERMISSIONS_NONE =0x00,
|
---|
249 | ACI_PERMISSIONS_LINK_AUTHENTICATED =0x01
|
---|
250 | } _aci_packed_ aci_permissions_t;
|
---|
251 |
|
---|
252 | /**
|
---|
253 | * @def ACI_VS_UUID_128_MAX_COUNT
|
---|
254 | * @brief Maximum number of 128-bit Vendor Specific
|
---|
255 | * UUIDs that can be set
|
---|
256 | */
|
---|
257 | #define ACI_VS_UUID_128_MAX_COUNT 64 /** #0 reserved for invalid, #1 reservered for BT SIG and a maximum of 1024 bytes (16*64) */
|
---|
258 |
|
---|
259 | /**
|
---|
260 | * @struct aci_ll_conn_params_t
|
---|
261 | * @brief Link Layer Connection Parameters
|
---|
262 | */
|
---|
263 | typedef struct
|
---|
264 | {
|
---|
265 | uint16_t min_conn_interval; /**< Minimum connection interval requested from peer */
|
---|
266 | #define ACI_PPCP_MIN_CONN_INTVL_NONE 0xFFFF
|
---|
267 | #define ACI_PPCP_MIN_CONN_INTVL_MIN 0x0006
|
---|
268 | #define ACI_PPCP_MIN_CONN_INTVL_MAX 0x0C80
|
---|
269 | uint16_t max_conn_interval; /**< Maximum connection interval requested from peer */
|
---|
270 | #define ACI_PPCP_MAX_CONN_INTVL_NONE 0xFFFF
|
---|
271 | #define ACI_PPCP_MAX_CONN_INTVL_MIN 0x0006
|
---|
272 | #define ACI_PPCP_MAX_CONN_INTVL_MAX 0x0C80
|
---|
273 | uint16_t slave_latency; /**< Connection interval latency requested from peer */
|
---|
274 | #define ACI_PPCP_SLAVE_LATENCY_MAX 0x03E8
|
---|
275 | uint16_t timeout_mult; /**< Link supervisor timeout multiplier requested from peer */
|
---|
276 | #define ACI_PPCP_TIMEOUT_MULT_NONE 0xFFFF
|
---|
277 | #define ACI_PPCP_TIMEOUT_MULT_MIN 0x000A
|
---|
278 | #define ACI_PPCP_TIMEOUT_MULT_MAX 0x0C80
|
---|
279 | } _aci_packed_ aci_ll_conn_params_t;
|
---|
280 |
|
---|
281 | /**
|
---|
282 | * @def aci_gap_ppcp_t
|
---|
283 | * @brief GAP Peripheral Preferred Connection Parameters
|
---|
284 | */
|
---|
285 | #define aci_gap_ppcp_t aci_ll_conn_params_t
|
---|
286 |
|
---|
287 | /**
|
---|
288 | * @def ACI_AD_LOC_SVCUUID_16_MAX_COUNT
|
---|
289 | * @brief Maximum number of 16-bit UUIDs that can
|
---|
290 | * be inserted in the Services tag of AD
|
---|
291 | */
|
---|
292 | #define ACI_AD_LOC_SVCUUID_16_MAX_COUNT 5
|
---|
293 |
|
---|
294 | /**
|
---|
295 | * @def ACI_AD_LOC_SVCUUID_128_MAX_COUNT
|
---|
296 | * @brief Maximum number of 128-bit UUIDs that can
|
---|
297 | * be inserted in the Services tag of AD
|
---|
298 | */
|
---|
299 | #define ACI_AD_LOC_SVCUUID_128_MAX_COUNT 1
|
---|
300 |
|
---|
301 | /**
|
---|
302 | * @def ACI_AD_SOL_SVCUUID_16_MAX_COUNT
|
---|
303 | * @brief Maximum number of UUIDs that can
|
---|
304 | * be inserted in the Solicited Services tag of AD
|
---|
305 | */
|
---|
306 | #define ACI_AD_SOL_SVCUUID_16_MAX_COUNT 5
|
---|
307 |
|
---|
308 | /**
|
---|
309 | * @def ACI_AD_SOL_SVCUUID_128_MAX_COUNT
|
---|
310 | * @brief Maximum number of UUIDs that can
|
---|
311 | * be inserted in the Solicited Services tag of AD
|
---|
312 | */
|
---|
313 | #define ACI_AD_SOL_SVCUUID_128_MAX_COUNT 1
|
---|
314 |
|
---|
315 | /**
|
---|
316 | * @def ACI_SEC_ENCKEY_SIZE_MIN
|
---|
317 | * @brief Minimum encryption key size
|
---|
318 | */
|
---|
319 | #define ACI_SEC_ENCKEY_SIZE_MIN 7
|
---|
320 | /**
|
---|
321 | * @def ACI_SEC_ENCKEY_SIZE_MAX
|
---|
322 | * @brief Maximum encryption key size
|
---|
323 | */
|
---|
324 | #define ACI_SEC_ENCKEY_SIZE_MAX 16
|
---|
325 | /**
|
---|
326 | * @def ACI_CUSTOM_AD_TYPE_MAX_COUNT
|
---|
327 | * @brief Maximum number of custom ad types
|
---|
328 | */
|
---|
329 | #define ACI_CUSTOM_AD_TYPE_MAX_COUNT 8
|
---|
330 | /**
|
---|
331 | * @def ACI_CUSTOM_AD_TYPE_MAX_DATA_LENGTH
|
---|
332 | * @brief Maximum custom ad type data size
|
---|
333 | */
|
---|
334 | #define ACI_CUSTOM_AD_TYPE_MAX_DATA_LENGTH 20
|
---|
335 |
|
---|
336 | /**
|
---|
337 | * @struct aci_tx_data_t
|
---|
338 | * @brief Generic ACI transmit data structure
|
---|
339 | */
|
---|
340 | typedef struct
|
---|
341 | {
|
---|
342 | uint8_t pipe_number;
|
---|
343 | uint8_t aci_data[ACI_PIPE_TX_DATA_MAX_LEN];
|
---|
344 | } _aci_packed_ aci_tx_data_t;
|
---|
345 |
|
---|
346 | ACI_ASSERT_SIZE(aci_tx_data_t, ACI_PIPE_TX_DATA_MAX_LEN + 1);
|
---|
347 |
|
---|
348 | /**
|
---|
349 | * @struct aci_rx_data_t
|
---|
350 | * @brief Generic ACI receive data structure
|
---|
351 | */
|
---|
352 | typedef struct
|
---|
353 | {
|
---|
354 | uint8_t pipe_number;
|
---|
355 | uint8_t aci_data[ACI_PIPE_RX_DATA_MAX_LEN];
|
---|
356 | } _aci_packed_ aci_rx_data_t;
|
---|
357 |
|
---|
358 | ACI_ASSERT_SIZE(aci_rx_data_t, ACI_PIPE_RX_DATA_MAX_LEN + 1);
|
---|
359 |
|
---|
360 | /**
|
---|
361 | * @enum aci_hw_error_t
|
---|
362 | * @brief Hardware Error codes
|
---|
363 | */
|
---|
364 | typedef enum
|
---|
365 | {
|
---|
366 | ACI_HW_ERROR_NONE = 0x00,
|
---|
367 | ACI_HW_ERROR_FATAL = 0x01
|
---|
368 | } _aci_packed_ aci_hw_error_t;
|
---|
369 |
|
---|
370 | /**
|
---|
371 | * @enum aci_clock_accuracy_t
|
---|
372 | * @brief Bluetooth Low Energy Clock Accuracy
|
---|
373 | */
|
---|
374 | typedef enum
|
---|
375 | {
|
---|
376 | ACI_CLOCK_ACCURACY_500_PPM = 0x00,
|
---|
377 | ACI_CLOCK_ACCURACY_250_PPM = 0x01,
|
---|
378 | ACI_CLOCK_ACCURACY_150_PPM = 0x02,
|
---|
379 | ACI_CLOCK_ACCURACY_100_PPM = 0x03,
|
---|
380 | ACI_CLOCK_ACCURACY_75_PPM = 0x04,
|
---|
381 | ACI_CLOCK_ACCURACY_50_PPM = 0x05,
|
---|
382 | ACI_CLOCK_ACCURACY_30_PPM = 0x06,
|
---|
383 | ACI_CLOCK_ACCURACY_20_PPM = 0x07
|
---|
384 | } _aci_packed_ aci_clock_accuracy_t;
|
---|
385 |
|
---|
386 | /**
|
---|
387 | * @enum aci_app_latency_mode_t
|
---|
388 | * @brief Application latency modes
|
---|
389 | */
|
---|
390 | typedef enum
|
---|
391 | {
|
---|
392 | ACI_APP_LATENCY_DISABLE = 0,
|
---|
393 | ACI_APP_LATENCY_ENABLE = 1
|
---|
394 | } _aci_packed_ aci_app_latency_mode_t;
|
---|
395 |
|
---|
396 | /**
|
---|
397 | * @enum gatt_format_t
|
---|
398 | * @brief GATT format definitions
|
---|
399 | */
|
---|
400 | typedef enum
|
---|
401 | {
|
---|
402 | ACI_GATT_FORMAT_NONE = 0x00, /**< No characteristic format available */
|
---|
403 | ACI_GATT_FORMAT_BOOLEAN = 0x01, /**< Not Supported */
|
---|
404 | ACI_GATT_FORMAT_2BIT = 0x02, /**< Not Supported */
|
---|
405 | ACI_GATT_FORMAT_NIBBLE = 0x03, /**< Not Supported */
|
---|
406 | ACI_GATT_FORMAT_UINT8 = 0x04,
|
---|
407 | ACI_GATT_FORMAT_UINT12 = 0x05,
|
---|
408 | ACI_GATT_FORMAT_UINT16 = 0x06,
|
---|
409 | ACI_GATT_FORMAT_UINT24 = 0x07,
|
---|
410 | ACI_GATT_FORMAT_UINT32 = 0x08,
|
---|
411 | ACI_GATT_FORMAT_UINT48 = 0x09,
|
---|
412 | ACI_GATT_FORMAT_UINT64 = 0x0A,
|
---|
413 | ACI_GATT_FORMAT_UINT128 = 0x0B,
|
---|
414 | ACI_GATT_FORMAT_SINT8 = 0x0C,
|
---|
415 | ACI_GATT_FORMAT_SINT12 = 0x0D,
|
---|
416 | ACI_GATT_FORMAT_SINT16 = 0x0E,
|
---|
417 | ACI_GATT_FORMAT_SINT24 = 0x0F,
|
---|
418 | ACI_GATT_FORMAT_SINT32 = 0x10,
|
---|
419 | ACI_GATT_FORMAT_SINT48 = 0x11,
|
---|
420 | ACI_GATT_FORMAT_SINT64 = 0x12,
|
---|
421 | ACI_GATT_FORMAT_SINT128 = 0x13,
|
---|
422 | ACI_GATT_FORMAT_FLOAT32 = 0x14,
|
---|
423 | ACI_GATT_FORMAT_FLOAT64 = 0x15,
|
---|
424 | ACI_GATT_FORMAT_SFLOAT = 0x16,
|
---|
425 | ACI_GATT_FORMAT_FLOAT = 0x17,
|
---|
426 | ACI_GATT_FORMAT_DUINT16 = 0x18,
|
---|
427 | ACI_GATT_FORMAT_UTF8S = 0x19,
|
---|
428 | ACI_GATT_FORMAT_UTF16S = 0x1A,
|
---|
429 | ACI_GATT_FORMAT_STRUCT = 0x1B
|
---|
430 | } _aci_packed_ aci_gatt_format_t;
|
---|
431 |
|
---|
432 | /**
|
---|
433 | * @brief GATT Bluetooth namespace
|
---|
434 | */
|
---|
435 | typedef enum
|
---|
436 | {
|
---|
437 | ACI_GATT_NAMESPACE_INVALID = 0x00,
|
---|
438 | ACI_GATT_NAMESPACE_BTSIG = 0x01 /**< Bluetooth SIG */
|
---|
439 | } _aci_packed_ aci_gatt_namespace_t;
|
---|
440 |
|
---|
441 | /**
|
---|
442 | * @brief Security key types
|
---|
443 | */
|
---|
444 | typedef enum
|
---|
445 | {
|
---|
446 | ACI_KEY_TYPE_INVALID = 0x00,
|
---|
447 | ACI_KEY_TYPE_PASSKEY = 0x01
|
---|
448 | } _aci_packed_ aci_key_type_t;
|
---|
449 |
|
---|
450 | /**
|
---|
451 | * @enum aci_bond_status_code_t
|
---|
452 | * @brief Bond status code
|
---|
453 | */
|
---|
454 | typedef enum
|
---|
455 | {
|
---|
456 | /**
|
---|
457 | * Bonding succeeded
|
---|
458 | */
|
---|
459 | ACI_BOND_STATUS_SUCCESS = 0x00,
|
---|
460 | /**
|
---|
461 | * Bonding failed
|
---|
462 | */
|
---|
463 | ACI_BOND_STATUS_FAILED = 0x01,
|
---|
464 | /**
|
---|
465 | * Bonding error: Timeout can occur when link termination is unexpected or did not get connected OR SMP timer expired
|
---|
466 | */
|
---|
467 | ACI_BOND_STATUS_FAILED_TIMED_OUT = 0x02,
|
---|
468 | /**
|
---|
469 | * Bonding error: Passkey entry failed
|
---|
470 | */
|
---|
471 | ACI_BOND_STATUS_FAILED_PASSKEY_ENTRY_FAILED = 0x81,
|
---|
472 | /**
|
---|
473 | * Bonding error: OOB unavailable
|
---|
474 | */
|
---|
475 | ACI_BOND_STATUS_FAILED_OOB_UNAVAILABLE = 0x82,
|
---|
476 | /**
|
---|
477 | * Bonding error: Authentication request failed
|
---|
478 | */
|
---|
479 | ACI_BOND_STATUS_FAILED_AUTHENTICATION_REQ = 0x83,
|
---|
480 | /**
|
---|
481 | * Bonding error: Confirm value failed
|
---|
482 | */
|
---|
483 | ACI_BOND_STATUS_FAILED_CONFIRM_VALUE = 0x84,
|
---|
484 | /**
|
---|
485 | * Bonding error: Pairing unsupported
|
---|
486 | */
|
---|
487 | ACI_BOND_STATUS_FAILED_PAIRING_UNSUPPORTED = 0x85,
|
---|
488 | /**
|
---|
489 | * Bonding error: Invalid encryption key size
|
---|
490 | */
|
---|
491 | ACI_BOND_STATUS_FAILED_ENCRYPTION_KEY_SIZE = 0x86,
|
---|
492 | /**
|
---|
493 | * Bonding error: Unsupported SMP command
|
---|
494 | */
|
---|
495 | ACI_BOND_STATUS_FAILED_SMP_CMD_UNSUPPORTED = 0x87,
|
---|
496 | /**
|
---|
497 | * Bonding error: Unspecified reason
|
---|
498 | */
|
---|
499 | ACI_BOND_STATUS_FAILED_UNSPECIFIED_REASON = 0x88,
|
---|
500 | /**
|
---|
501 | * Bonding error: Too many attempts
|
---|
502 | */
|
---|
503 | ACI_BOND_STATUS_FAILED_REPEATED_ATTEMPTS = 0x89,
|
---|
504 | /**
|
---|
505 | * Bonding error: Invalid parameters
|
---|
506 | */
|
---|
507 | ACI_BOND_STATUS_FAILED_INVALID_PARAMETERS = 0x8A
|
---|
508 |
|
---|
509 | } _aci_packed_ aci_bond_status_code_t;
|
---|
510 |
|
---|
511 | ACI_ASSERT_SIZE(aci_bond_status_code_t, 1);
|
---|
512 |
|
---|
513 | /**
|
---|
514 | * @enum aci_bond_status_source_t
|
---|
515 | * @brief Source of a bond status code
|
---|
516 | */
|
---|
517 | typedef enum
|
---|
518 | {
|
---|
519 | ACI_BOND_STATUS_SOURCE_INVALID = 0x00,
|
---|
520 | ACI_BOND_STATUS_SOURCE_LOCAL = 0x01,
|
---|
521 | ACI_BOND_STATUS_SOURCE_REMOTE = 0x02
|
---|
522 |
|
---|
523 | } _aci_packed_ aci_bond_status_source_t;
|
---|
524 |
|
---|
525 | /**
|
---|
526 | * @enum aci_status_code_t
|
---|
527 | * @brief ACI status codes
|
---|
528 | */
|
---|
529 | typedef enum
|
---|
530 | {
|
---|
531 | /**
|
---|
532 | * Success
|
---|
533 | */
|
---|
534 | ACI_STATUS_SUCCESS = 0x00,
|
---|
535 | /**
|
---|
536 | * Transaction continuation status
|
---|
537 | */
|
---|
538 | ACI_STATUS_TRANSACTION_CONTINUE = 0x01,
|
---|
539 | /**
|
---|
540 | * Transaction completed
|
---|
541 | */
|
---|
542 | ACI_STATUS_TRANSACTION_COMPLETE = 0x02,
|
---|
543 | /**
|
---|
544 | * Extended status, further checks needed
|
---|
545 | */
|
---|
546 | ACI_STATUS_EXTENDED = 0x03,
|
---|
547 | /**
|
---|
548 | * Unknown error.
|
---|
549 | */
|
---|
550 | ACI_STATUS_ERROR_UNKNOWN = 0x80,
|
---|
551 | /**
|
---|
552 | * Internal error.
|
---|
553 | */
|
---|
554 | ACI_STATUS_ERROR_INTERNAL = 0x81,
|
---|
555 | /**
|
---|
556 | * Unknown command
|
---|
557 | */
|
---|
558 | ACI_STATUS_ERROR_CMD_UNKNOWN = 0x82,
|
---|
559 | /**
|
---|
560 | * Command invalid in the current device state
|
---|
561 | */
|
---|
562 | ACI_STATUS_ERROR_DEVICE_STATE_INVALID = 0x83,
|
---|
563 | /**
|
---|
564 | * Invalid length
|
---|
565 | */
|
---|
566 | ACI_STATUS_ERROR_INVALID_LENGTH = 0x84,
|
---|
567 | /**
|
---|
568 | * Invalid input parameters
|
---|
569 | */
|
---|
570 | ACI_STATUS_ERROR_INVALID_PARAMETER = 0x85,
|
---|
571 | /**
|
---|
572 | * Busy
|
---|
573 | */
|
---|
574 | ACI_STATUS_ERROR_BUSY = 0x86,
|
---|
575 | /**
|
---|
576 | * Invalid data format or contents
|
---|
577 | */
|
---|
578 | ACI_STATUS_ERROR_INVALID_DATA = 0x87,
|
---|
579 | /**
|
---|
580 | * CRC mismatch
|
---|
581 | */
|
---|
582 | ACI_STATUS_ERROR_CRC_MISMATCH = 0x88,
|
---|
583 | /**
|
---|
584 | * Unsupported setup format
|
---|
585 | */
|
---|
586 | ACI_STATUS_ERROR_UNSUPPORTED_SETUP_FORMAT = 0x89,
|
---|
587 | /**
|
---|
588 | * Invalid sequence number during a write dynamic data sequence
|
---|
589 | */
|
---|
590 | ACI_STATUS_ERROR_INVALID_SEQ_NO = 0x8A,
|
---|
591 | /**
|
---|
592 | * Setup data is locked and cannot be modified
|
---|
593 | */
|
---|
594 | ACI_STATUS_ERROR_SETUP_LOCKED = 0x8B,
|
---|
595 | /**
|
---|
596 | * Setup error due to lock verification failure
|
---|
597 | */
|
---|
598 | ACI_STATUS_ERROR_LOCK_FAILED = 0x8C,
|
---|
599 | /**
|
---|
600 | * Bond required: Local Pipes need bonded/trusted peer
|
---|
601 | */
|
---|
602 | ACI_STATUS_ERROR_BOND_REQUIRED = 0x8D,
|
---|
603 | /**
|
---|
604 | * Command rejected as a transaction is still pending
|
---|
605 | */
|
---|
606 | ACI_STATUS_ERROR_REJECTED = 0x8E,
|
---|
607 | /**
|
---|
608 | * Pipe Error Event : Data size exceeds size specified for pipe : Transmit failed
|
---|
609 | */
|
---|
610 | ACI_STATUS_ERROR_DATA_SIZE = 0x8F,
|
---|
611 | /**
|
---|
612 | * Pipe Error Event : Invalid pipe
|
---|
613 | */
|
---|
614 | ACI_STATUS_ERROR_PIPE_INVALID = 0x90,
|
---|
615 | /**
|
---|
616 | * Pipe Error Event : Credit not available
|
---|
617 | */
|
---|
618 | ACI_STATUS_ERROR_CREDIT_NOT_AVAILABLE = 0x91,
|
---|
619 | /**
|
---|
620 | * Pipe Error Event : Peer device has sent an error on an pipe operation on the remote characteristic
|
---|
621 | */
|
---|
622 | ACI_STATUS_ERROR_PEER_ATT_ERROR = 0x92,
|
---|
623 | /**
|
---|
624 | * Connection was not established before the BTLE advertising was stopped
|
---|
625 | */
|
---|
626 | ACI_STATUS_ERROR_ADVT_TIMEOUT = 0x93,
|
---|
627 | /**
|
---|
628 | * Peer has triggered a Security Manager Protocol Error
|
---|
629 | */
|
---|
630 | ACI_STATUS_ERROR_PEER_SMP_ERROR = 0x94,
|
---|
631 | /**
|
---|
632 | * Pipe Error Event : Pipe type invalid for the selected operation
|
---|
633 | */
|
---|
634 | ACI_STATUS_ERROR_PIPE_TYPE_INVALID = 0x95,
|
---|
635 | /**
|
---|
636 | * Pipe Error Event : Pipe state invalid for the selected operation
|
---|
637 | */
|
---|
638 | ACI_STATUS_ERROR_PIPE_STATE_INVALID = 0x96,
|
---|
639 | /**
|
---|
640 | * Invalid key size provided
|
---|
641 | */
|
---|
642 | ACI_STATUS_ERROR_INVALID_KEY_SIZE = 0x97,
|
---|
643 | /**
|
---|
644 | * Invalid key data provided
|
---|
645 | */
|
---|
646 | ACI_STATUS_ERROR_INVALID_KEY_DATA = 0x98,
|
---|
647 | /**
|
---|
648 | * Reserved range start
|
---|
649 | */
|
---|
650 | ACI_STATUS_RESERVED_START = 0xF0,
|
---|
651 | /**
|
---|
652 | * Reserved range end
|
---|
653 | */
|
---|
654 | ACI_STATUS_RESERVED_END = 0xFF
|
---|
655 |
|
---|
656 | } _aci_packed_ aci_status_code_t;
|
---|
657 |
|
---|
658 | ACI_ASSERT_SIZE(aci_status_code_t, 1);
|
---|
659 |
|
---|
660 | /**
|
---|
661 | * @}
|
---|
662 | */
|
---|
663 |
|
---|
664 | #endif // ACI_H__
|
---|