upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
aci_cmds.h
Go to the documentation of this file.
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 
30 #ifndef ACI_CMDS_H__
31 #define ACI_CMDS_H__
32 
33 #include "aci.h"
34 
39 typedef enum
40 {
44  ACI_CMD_TEST = 0x01,
48  ACI_CMD_ECHO = 0x02,
56  ACI_CMD_SLEEP = 0x04,
65  ACI_CMD_SETUP = 0x06,
105  ACI_CMD_BOND = 0x10,
170 
171 } _aci_packed_ aci_cmd_opcode_t;
172 
173 ACI_ASSERT_SIZE(aci_cmd_opcode_t, 1);
174 
179 typedef struct
180 {
181  aci_test_mode_change_t test_mode_change;
182 } _aci_packed_ aci_cmd_params_test_t;
183 
184 ACI_ASSERT_SIZE(aci_cmd_params_test_t, 1);
185 
190 typedef struct
191 {
192  uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN];
193 } _aci_packed_ aci_cmd_params_echo_t;
194 
195 ACI_ASSERT_SIZE(aci_cmd_params_echo_t, ACI_ECHO_DATA_MAX_LEN);
196 
201 typedef struct
202 {
203  uint8_t cmd_msb;
204  uint8_t cmd_lsb;
205 } _aci_packed_ aci_cmd_params_dtm_cmd_t;
206 
211 typedef struct
212 {
213  uint8_t setup_data[1];
214 } _aci_packed_ aci_cmd_params_setup_t;
215 
216 ACI_ASSERT_SIZE(aci_cmd_params_setup_t, 1);
217 
223 typedef struct
224 {
225  uint8_t seq_no;
226  uint8_t dynamic_data[1];
227 } _aci_packed_ aci_cmd_params_write_dynamic_data_t;
228 
233 typedef struct
234 {
235  aci_tx_data_t tx_data;
236 } _aci_packed_ aci_cmd_params_set_local_data_t;
237 
242 typedef struct
243 {
244  uint16_t timeout;
245  uint16_t adv_interval;
246 } _aci_packed_ aci_cmd_params_connect_t;
247 
248 ACI_ASSERT_SIZE(aci_cmd_params_connect_t, 4);
249 
254 typedef struct
255 {
256  uint16_t timeout;
257  uint16_t adv_interval;
258 } _aci_packed_ aci_cmd_params_bond_t;
259 
260 ACI_ASSERT_SIZE(aci_cmd_params_bond_t, 4);
261 
266 typedef struct
267 {
268  aci_disconnect_reason_t reason;
269 } _aci_packed_ aci_cmd_params_disconnect_t;
270 
271 ACI_ASSERT_SIZE(aci_cmd_params_disconnect_t, 1);
272 
277 typedef struct
278 {
279  aci_device_output_power_t device_power;
280 } _aci_packed_ aci_cmd_params_set_tx_power_t;
281 
282 ACI_ASSERT_SIZE(aci_cmd_params_set_tx_power_t, 1);
287 typedef struct
288 {
289  aci_ll_conn_params_t conn_params;
290 } _aci_packed_ aci_cmd_params_change_timing_t;
291 
292 ACI_ASSERT_SIZE(aci_cmd_params_change_timing_t, 8);
293 
298 typedef struct
299 {
300  uint8_t pipe_number;
301 } _aci_packed_ aci_cmd_params_open_remote_pipe_t;
302 
307 typedef struct
308 {
309  aci_tx_data_t tx_data;
310 } _aci_packed_ aci_cmd_params_send_data_t;
311 
316 typedef struct
317 {
318  uint8_t pipe_number;
319 } _aci_packed_ aci_cmd_params_send_data_ack_t;
320 
325 typedef struct
326 {
327  uint8_t pipe_number;
328 } _aci_packed_ aci_cmd_params_request_data_t;
329 
334 typedef struct
335 {
336  uint8_t pipe_number;
337  uint8_t error_code;
338 } _aci_packed_ aci_cmd_params_send_data_nack_t;
339 
340 ACI_ASSERT_SIZE(aci_cmd_params_send_data_nack_t, 2);
341 
346 typedef struct
347 {
348  aci_app_latency_mode_t mode;
349  uint16_t latency;
350 } _aci_packed_ aci_cmd_params_set_app_latency_t;
351 
352 ACI_ASSERT_SIZE(aci_cmd_params_set_app_latency_t, 3);
357 typedef struct
358 {
359  aci_key_type_t key_type;
360  union
361  {
362  uint8_t passkey[6];
363  uint8_t oob_key[16];
364  } key;
365 } _aci_packed_ aci_cmd_params_set_key_t;
366 
367 ACI_ASSERT_SIZE(aci_cmd_params_set_key_t, 17);
372 typedef struct
373 {
374  uint8_t pipes[8];
375 } _aci_packed_ aci_cmd_params_open_adv_pipe_t;
376 
381 typedef struct
382 {
383  uint16_t timeout;
384  uint16_t adv_interval;
385 } _aci_packed_ aci_cmd_params_broadcast_t;
386 
391 typedef struct
392 {
393  uint8_t pipe_number;
394 } _aci_packed_ aci_cmd_params_close_remote_pipe_t;
395 
400 typedef struct
401 {
402  uint8_t len;
403  aci_cmd_opcode_t cmd_opcode;
404  union
405  {
406  aci_cmd_params_test_t test;
407  aci_cmd_params_echo_t echo;
408  aci_cmd_params_dtm_cmd_t dtm_cmd;
409  aci_cmd_params_setup_t setup;
410  aci_cmd_params_write_dynamic_data_t write_dynamic_data;
411  aci_cmd_params_set_local_data_t set_local_data;
412  aci_cmd_params_connect_t connect;
413  aci_cmd_params_bond_t bond;
414  aci_cmd_params_disconnect_t disconnect;
415  aci_cmd_params_set_tx_power_t set_tx_power;
416  aci_cmd_params_change_timing_t change_timing;
417  aci_cmd_params_open_remote_pipe_t open_remote_pipe;
418  aci_cmd_params_send_data_t send_data;
419  aci_cmd_params_send_data_ack_t send_data_ack;
420  aci_cmd_params_request_data_t request_data;
421  aci_cmd_params_send_data_nack_t send_data_nack;
422  aci_cmd_params_set_app_latency_t set_app_latency;
423  aci_cmd_params_set_key_t set_key;
424  aci_cmd_params_open_adv_pipe_t open_adv_pipe;
425  aci_cmd_params_broadcast_t broadcast;
426  aci_cmd_params_close_remote_pipe_t close_remote_pipe;
427 
428  } params;
429 } _aci_packed_ aci_cmd_t;
430 
431 #endif // ACI_CMDS_H__
432 
433 
aci_test_mode_change_t test_mode_change
Definition: aci_cmds.h:181
Definition: aci_cmds.h:157
Definition: aci_cmds.h:169
aci_device_output_power_t device_power
Definition: aci_cmds.h:279
Definition: aci_cmds.h:73
uint16_t adv_interval
Definition: aci_cmds.h:245
Definition: aci_cmds.h:109
Definition: aci_cmds.h:105
Definition: aci_cmds.h:129
#define ACI_ECHO_DATA_MAX_LEN
Maximum length in bytes of the echo data portion.
Definition: aci.h:119
Definition: aci_cmds.h:101
Definition: aci_cmds.h:89
Definition: aci_cmds.h:81
Definition: aci_cmds.h:117
Definition: aci_cmds.h:48
Definition: aci_cmds.h:145
aci_disconnect_reason_t reason
Definition: aci_cmds.h:268
Definition: aci_cmds.h:69
Definition: aci_cmds.h:137
Definition: aci_cmds.h:52
Definition: aci_cmds.h:149
Definition: aci_cmds.h:97
Definition: aci_cmds.h:125
Definition: aci_cmds.h:161
Definition: aci_cmds.h:56
Definition: aci_cmds.h:113
Definition: aci_cmds.h:60
Definition: aci_cmds.h:133
Definition: aci_cmds.h:165
Definition: aci_cmds.h:93
Definition: aci_cmds.h:141
aci_cmd_opcode_t cmd_opcode
Definition: aci_cmds.h:403
Definition: aci_cmds.h:121
uint8_t len
Definition: aci_cmds.h:402
uint16_t timeout
Definition: aci_cmds.h:244
Definition: aci_cmds.h:153
Definition: aci_cmds.h:65
Definition: aci_cmds.h:44
Definition: aci_cmds.h:85
Structure for the ACI_CMD_SET_LOCAL_DATA ACI command parameters.
Definition: aci.h:271
Definition: aci_cmds.h:77