source: azure_iot_hub_f767zi/trunk/asp_baseplatform/gdic/ble_shield2.1/utility/aci_cmds.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 11.7 KB
Line 
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 * @ingroup aci
26 *
27 * @brief Definitions for the ACI (Application Control Interface) commands
28 * @remarks
29 *
30 */
31
32#ifndef ACI_CMDS_H__
33#define ACI_CMDS_H__
34
35#include "aci.h"
36
37/**
38 * @enum aci_cmd_opcode_t
39 * @brief ACI command opcodes
40 */
41typedef enum
42{
43 /**
44 * Enter test mode
45 */
46 ACI_CMD_TEST = 0x01,
47 /**
48 * Echo (loopback) test command
49 */
50 ACI_CMD_ECHO = 0x02,
51 /**
52 * Send a BTLE DTM command to the radio
53 */
54 ACI_CMD_DTM_CMD = 0x03,
55 /**
56 * Put the device to sleep
57 */
58 ACI_CMD_SLEEP = 0x04,
59 /**
60 * Wakeup the device from deep sleep
61 */
62 ACI_CMD_WAKEUP = 0x05,
63 /**
64 * Replace the contents of the internal database with
65 * user provided data
66 */
67 ACI_CMD_SETUP = 0x06,
68 /**
69 * Read the portions of memory required to be restored after a power cycle
70 */
71 ACI_CMD_READ_DYNAMIC_DATA = 0x07,
72 /**
73 * Write back the data retrieved using ACI_CMD_READ_DYNAMIC_DATA
74 */
75 ACI_CMD_WRITE_DYNAMIC_DATA = 0x08,
76 /**
77 * Retrieve the device's version information
78 */
79 ACI_CMD_GET_DEVICE_VERSION = 0x09,
80 /**
81 * Request the Bluetooth address and its type
82 */
83 ACI_CMD_GET_DEVICE_ADDRESS = 0x0A,
84 /**
85 * Request the battery level measured by nRF8001
86 */
87 ACI_CMD_GET_BATTERY_LEVEL = 0x0B,
88 /**
89 * Request the temperature value measured by nRF8001
90 */
91 ACI_CMD_GET_TEMPERATURE = 0x0C,
92 /**
93 * Write to the local Attribute Database
94 */
95 ACI_CMD_SET_LOCAL_DATA = 0x0D,
96 /**
97 * Reset the baseband and radio and go back to idle
98 */
99 ACI_CMD_RADIO_RESET = 0x0E,
100 /**
101 * Start advertising and wait for a master connection
102 */
103 ACI_CMD_CONNECT = 0x0F,
104 /**
105 * Start advertising and wait for a master connection
106 */
107 ACI_CMD_BOND = 0x10,
108 /**
109 * Start advertising and wait for a master connection
110 */
111 ACI_CMD_DISCONNECT = 0x11,
112 /**
113 * Throttles the Radio transmit power
114 */
115 ACI_CMD_SET_TX_POWER = 0x12,
116 /**
117 * Trigger a connection parameter update
118 */
119 ACI_CMD_CHANGE_TIMING = 0x13,
120 /**
121 * Open a remote pipe for data reception
122 */
123 ACI_CMD_OPEN_REMOTE_PIPE = 0x14,
124 /**
125 * Transmit data over an open pipe
126 */
127 ACI_CMD_SEND_DATA = 0x15,
128 /**
129 * Send an acknowledgment of received data
130 */
131 ACI_CMD_SEND_DATA_ACK = 0x16,
132 /**
133 * Request data over an open pipe
134 */
135 ACI_CMD_REQUEST_DATA = 0x17,
136 /**
137 * NACK a data reception
138 */
139 ACI_CMD_SEND_DATA_NACK = 0x18,
140 /**
141 * Set application latency
142 */
143 ACI_CMD_SET_APP_LATENCY = 0x19,
144 /**
145 * Set a security key
146 */
147 ACI_CMD_SET_KEY = 0x1A,
148 /**
149 * Open Advertising Pipes
150 */
151 ACI_CMD_OPEN_ADV_PIPE = 0x1B,
152 /**
153 * Start non-connectable advertising
154 */
155 ACI_CMD_BROADCAST = 0x1C,
156 /**
157 * Start a security request in bonding mode
158 */
159 ACI_CMD_BOND_SECURITY_REQUEST = 0x1D,
160 /**
161 * Start Directed advertising towards a Bonded Peer
162 */
163 ACI_CMD_CONNECT_DIRECT = 0x1E,
164 /**
165 * Close a previously opened remote pipe
166 */
167 ACI_CMD_CLOSE_REMOTE_PIPE = 0x1F,
168 /**
169 * Invalid ACI command opcode
170 */
171 ACI_CMD_INVALID = 0xFF
172
173} _aci_packed_ aci_cmd_opcode_t;
174
175ACI_ASSERT_SIZE(aci_cmd_opcode_t, 1);
176
177/**
178 * @struct aci_cmd_params_test_t
179 * @brief Structure for the ACI_CMD_TEST ACI command parameters
180 */
181typedef struct
182{
183 aci_test_mode_change_t test_mode_change; /**< enum aci_test_mode_change_t */
184} _aci_packed_ aci_cmd_params_test_t;
185
186ACI_ASSERT_SIZE(aci_cmd_params_test_t, 1);
187
188/**
189 * @struct aci_cmd_params_echo_t
190 * @brief Structure for the ACI_CMD_ECHO ACI command parameters
191 */
192typedef struct
193{
194 uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN];
195} _aci_packed_ aci_cmd_params_echo_t;
196
197ACI_ASSERT_SIZE(aci_cmd_params_echo_t, ACI_ECHO_DATA_MAX_LEN);
198
199/**
200 * @struct aci_cmd_params_dtm_cmd_t
201 * @brief Structure for the ACI_CMD_DTM_CMD ACI command parameters
202 */
203typedef struct
204{
205 uint8_t cmd_msb;
206 uint8_t cmd_lsb;
207} _aci_packed_ aci_cmd_params_dtm_cmd_t;
208
209/**
210 * @struct aci_cmd_params_setup_t
211 * @brief Structure for the ACI_CMD_SETUP ACI command parameters
212 */
213typedef struct
214{
215 uint8_t setup_data[1];
216} _aci_packed_ aci_cmd_params_setup_t;
217
218ACI_ASSERT_SIZE(aci_cmd_params_setup_t, 1);
219
220/**
221 * @struct aci_cmd_params_write_dynamic_data_t
222 * @brief Structure for the ACI_CMD_WRITE_DYNAMIC_DATA ACI command parameters
223 * @note Dynamic data chunk size in this command is defined to go up to ACI_PACKET_MAX_LEN - 3
224 */
225typedef struct
226{
227 uint8_t seq_no;
228 uint8_t dynamic_data[1];
229} _aci_packed_ aci_cmd_params_write_dynamic_data_t;
230
231/**
232 * @define aci_cmd_params_set_local_data_t
233 * @brief Structure for the ACI_CMD_SET_LOCAL_DATA ACI command parameters
234 */
235typedef struct
236{
237 aci_tx_data_t tx_data;
238} _aci_packed_ aci_cmd_params_set_local_data_t;
239
240/**
241 * @struct aci_cmd_params_connect_t
242 * @brief Structure for the ACI_CMD_CONNECT ACI command parameters
243 */
244typedef struct
245{
246 uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */
247 uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */
248} _aci_packed_ aci_cmd_params_connect_t;
249
250ACI_ASSERT_SIZE(aci_cmd_params_connect_t, 4);
251
252/**
253 * @define aci_cmd_params_bond_t
254 * @brief Structure for the ACI_CMD_BOND ACI command parameters
255 */
256typedef struct
257{
258 uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */
259 uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */
260} _aci_packed_ aci_cmd_params_bond_t;
261
262ACI_ASSERT_SIZE(aci_cmd_params_bond_t, 4);
263
264/**
265 * @struct aci_cmd_params_disconnect_t
266 * @brief Structure for the ACI_CMD_DISCONNECT ACI command parameters
267 */
268typedef struct
269{
270 aci_disconnect_reason_t reason; /**< enum aci_disconnect_reason_t */
271} _aci_packed_ aci_cmd_params_disconnect_t;
272
273ACI_ASSERT_SIZE(aci_cmd_params_disconnect_t, 1);
274
275/**
276 * @struct aci_cmd_params_set_tx_power_t
277 * @brief Structure for the ACI_CMD_SET_TX_POWER ACI command parameters
278 */
279typedef struct
280{
281 aci_device_output_power_t device_power; /**< enum aci_device_output_power_t */
282} _aci_packed_ aci_cmd_params_set_tx_power_t;
283
284ACI_ASSERT_SIZE(aci_cmd_params_set_tx_power_t, 1);
285/**
286 * @struct aci_cmd_params_change_timing_t
287 * @brief Structure for the ACI_CMD_CHANGE_TIMING ACI command parameters
288 */
289typedef struct
290{
291 aci_ll_conn_params_t conn_params;
292} _aci_packed_ aci_cmd_params_change_timing_t;
293
294ACI_ASSERT_SIZE(aci_cmd_params_change_timing_t, 8);
295
296/**
297 * @struct aci_cmd_params_open_remote_pipe_t
298 * @brief Structure for the ACI_CMD_OPEN_REMOTE_PIPE ACI command parameters
299 */
300typedef struct
301{
302 uint8_t pipe_number;
303} _aci_packed_ aci_cmd_params_open_remote_pipe_t;
304
305/**
306 * @struct aci_cmd_params_send_data_t
307 * @brief Structure for the ACI_CMD_SEND_DATA ACI command parameters
308 */
309typedef struct
310{
311 aci_tx_data_t tx_data;
312} _aci_packed_ aci_cmd_params_send_data_t;
313
314/**
315 * @define aci_cmd_params_send_data_ack_t
316 * @brief Structure for the ACI_CMD_SEND_DATA_ACK ACI command parameters
317 */
318typedef struct
319{
320 uint8_t pipe_number;
321} _aci_packed_ aci_cmd_params_send_data_ack_t;
322
323/**
324 * @struct aci_cmd_params_send_data_t
325 * @brief Structure for the ACI_CMD_SEND_DATA ACI command parameters
326 */
327typedef struct
328{
329 uint8_t pipe_number;
330} _aci_packed_ aci_cmd_params_request_data_t;
331
332/**
333 * @define aci_cmd_params_send_data_nack_t
334 * @brief Structure for the ACI_CMD_SEND_DATA_NACK ACI command parameters
335 */
336typedef struct
337{
338 uint8_t pipe_number;
339 uint8_t error_code;
340} _aci_packed_ aci_cmd_params_send_data_nack_t;
341
342ACI_ASSERT_SIZE(aci_cmd_params_send_data_nack_t, 2);
343
344/**
345 * @define aci_cmd_params_set_app_latency_t
346 * @brief Structure for the ACI_CMD_SET_APP_LATENCY ACI command parameters
347 */
348typedef struct
349{
350 aci_app_latency_mode_t mode;
351 uint16_t latency;
352} _aci_packed_ aci_cmd_params_set_app_latency_t;
353
354ACI_ASSERT_SIZE(aci_cmd_params_set_app_latency_t, 3);
355/**
356 * @define aci_cmd_params_set_key_t
357 * @brief Structure for the ACI_CMD_SET_KEY ACI command parameters
358 */
359typedef struct
360{
361 aci_key_type_t key_type;
362 union
363 {
364 uint8_t passkey[6];
365 uint8_t oob_key[16];
366 } key;
367} _aci_packed_ aci_cmd_params_set_key_t;
368
369ACI_ASSERT_SIZE(aci_cmd_params_set_key_t, 17);
370/**
371 * @define aci_cmd_params_open_adv_pipe_t
372 * @brief Structure for the ACI_CMD_OPEN_ADV_PIPE ACI command parameters
373 */
374typedef struct
375{
376 uint8_t pipes[8];
377} _aci_packed_ aci_cmd_params_open_adv_pipe_t;
378
379/**
380 * @define aci_cmd_params_broadcast_t
381 * @brief Structure for the ACI_CMD_BROADCAST ACI command parameters
382 */
383typedef struct
384{
385 uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */
386 uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */
387} _aci_packed_ aci_cmd_params_broadcast_t;
388
389/**
390 * @struct aci_cmd_params_close_remote_pipe_t
391 * @brief Structure for the ACI_CMD_CLOSE_REMOTE_PIPE ACI command parameters
392 */
393typedef struct
394{
395 uint8_t pipe_number;
396} _aci_packed_ aci_cmd_params_close_remote_pipe_t;
397
398/**
399 * @struct aci_cmd_t
400 * @brief Encapsulates a generic ACI command
401 */
402typedef struct
403{
404 uint8_t len; /**< Length of the ACI command */
405 aci_cmd_opcode_t cmd_opcode; /**< enum aci_cmd_opcode_t -> Opcode of the ACI command */
406 union
407 {
408 aci_cmd_params_test_t test;
409 aci_cmd_params_echo_t echo;
410 aci_cmd_params_dtm_cmd_t dtm_cmd;
411 aci_cmd_params_setup_t setup;
412 aci_cmd_params_write_dynamic_data_t write_dynamic_data;
413 aci_cmd_params_set_local_data_t set_local_data;
414 aci_cmd_params_connect_t connect;
415 aci_cmd_params_bond_t bond;
416 aci_cmd_params_disconnect_t disconnect;
417 aci_cmd_params_set_tx_power_t set_tx_power;
418 aci_cmd_params_change_timing_t change_timing;
419 aci_cmd_params_open_remote_pipe_t open_remote_pipe;
420 aci_cmd_params_send_data_t send_data;
421 aci_cmd_params_send_data_ack_t send_data_ack;
422 aci_cmd_params_request_data_t request_data;
423 aci_cmd_params_send_data_nack_t send_data_nack;
424 aci_cmd_params_set_app_latency_t set_app_latency;
425 aci_cmd_params_set_key_t set_key;
426 aci_cmd_params_open_adv_pipe_t open_adv_pipe;
427 aci_cmd_params_broadcast_t broadcast;
428 aci_cmd_params_close_remote_pipe_t close_remote_pipe;
429
430 } params;
431} _aci_packed_ aci_cmd_t;
432
433#endif // ACI_CMDS_H__
434
435
Note: See TracBrowser for help on using the repository browser.