upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
aci_evts.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_EVTS_H__
31 #define ACI_EVTS_H__
32 
33 #include "aci.h"
34 
39 typedef enum
40 {
52  ACI_EVT_ECHO = 0x82,
107 
108 } _aci_packed_ aci_evt_opcode_t;
109 
110 ACI_ASSERT_SIZE(aci_evt_opcode_t, 1);
111 
116 typedef struct
117 {
118  aci_device_operation_mode_t device_mode;
119  aci_hw_error_t hw_error;
121 } _aci_packed_ aci_evt_params_device_started_t;
122 
123 ACI_ASSERT_SIZE(aci_evt_params_device_started_t, 3);
124 
129 typedef struct
130 {
131  uint16_t line_num;
132  uint8_t file_name[20];
133 } _aci_packed_ aci_evt_params_hw_error_t;
134 
135 ACI_ASSERT_SIZE(aci_evt_params_hw_error_t, 22);
136 
141 typedef struct
142 {
143  uint8_t evt_msb;
144  uint8_t evt_lsb;
145 } _aci_packed_ aci_evt_cmd_rsp_params_dtm_cmd_t;
146 
152 typedef struct
153 {
154  uint8_t seq_no;
155  uint8_t dynamic_data[1];
156 } _aci_packed_ aci_evt_cmd_rsp_read_dynamic_data_t;
157 
162 typedef struct
163 {
164  uint16_t configuration_id;
165  uint8_t aci_version;
166  uint8_t setup_format;
167  uint32_t setup_id;
168  uint8_t setup_status;
169 } _aci_packed_ aci_evt_cmd_rsp_params_get_device_version_t;
170 
171 ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_version_t, 9);
172 
177 typedef struct
178 {
179  uint8_t bd_addr_own[BTLE_DEVICE_ADDRESS_SIZE];
180  aci_bd_addr_type_t bd_addr_type;
181 } _aci_packed_ aci_evt_cmd_rsp_params_get_device_address_t;
182 
183 ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_address_t, BTLE_DEVICE_ADDRESS_SIZE + 1);
184 
189 typedef struct
190 {
191  uint16_t battery_level;
192 } _aci_packed_ aci_evt_cmd_rsp_params_get_battery_level_t;
193 
198 typedef struct
199 {
200  int16_t temperature_value;
201 } _aci_packed_ aci_evt_cmd_rsp_params_get_temperature_t;
202 
207 typedef struct
208 {
209  aci_cmd_opcode_t cmd_opcode;
210  aci_status_code_t cmd_status;
211  union
212  {
213  aci_evt_cmd_rsp_params_dtm_cmd_t dtm_cmd;
214  aci_evt_cmd_rsp_read_dynamic_data_t read_dynamic_data;
215  aci_evt_cmd_rsp_params_get_device_version_t get_device_version;
216  aci_evt_cmd_rsp_params_get_device_address_t get_device_address;
217  aci_evt_cmd_rsp_params_get_battery_level_t get_battery_level;
218  aci_evt_cmd_rsp_params_get_temperature_t get_temperature;
219  uint8_t padding[29];
220  } params;
221 } _aci_packed_ aci_evt_params_cmd_rsp_t;
222 
223 ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 31);
224 
229 typedef struct
230 {
231  aci_bd_addr_type_t dev_addr_type;
232  uint8_t dev_addr[BTLE_DEVICE_ADDRESS_SIZE];
233  uint16_t conn_rf_interval;
235  uint16_t conn_rf_timeout;
236  aci_clock_accuracy_t master_clock_accuracy;
237 } _aci_packed_ aci_evt_params_connected_t;
238 
239 ACI_ASSERT_SIZE(aci_evt_params_connected_t, 14);
240 
245 typedef struct
246 {
247  aci_status_code_t aci_status;
248  uint8_t btle_status;
249 } _aci_packed_ aci_evt_params_disconnected_t;
250 
251 ACI_ASSERT_SIZE(aci_evt_params_disconnected_t, 2);
252 
257 typedef struct
258 {
259  aci_bond_status_code_t status_code;
260  aci_bond_status_source_t status_source;
261  uint8_t secmode1_bitmap;
262  uint8_t secmode2_bitmap;
263  uint8_t keys_exchanged_slave;
264  uint8_t keys_exchanged_master;
265 } _aci_packed_ aci_evt_params_bond_status_t;
266 
267 ACI_ASSERT_SIZE(aci_evt_params_bond_status_t, 6);
268 
273 typedef struct
274 {
275  uint8_t pipes_open_bitmap[8];
276  uint8_t pipes_closed_bitmap[8];
277 } _aci_packed_ aci_evt_params_pipe_status_t;
278 
279 ACI_ASSERT_SIZE(aci_evt_params_pipe_status_t, 16);
280 
285 typedef struct
286 {
287  uint16_t conn_rf_interval;
288  uint16_t conn_slave_rf_latency;
289  uint16_t conn_rf_timeout;
290 } _aci_packed_ aci_evt_params_timing_t;
291 
292 ACI_ASSERT_SIZE(aci_evt_params_timing_t, 6);
293 
298 typedef struct
299 {
300  uint8_t credit;
301 } _aci_packed_ aci_evt_params_data_credit_t;
302 
307 typedef struct
308 {
309  uint8_t pipe_number;
310 } _aci_packed_ aci_evt_params_data_ack_t;
311 
316 typedef struct
317 {
318  aci_rx_data_t rx_data;
319 } _aci_packed_ aci_evt_params_data_received_t;
320 
321 typedef struct
322 {
323  uint8_t content[1];
324 } _aci_packed_ error_data_t;
325 
330 typedef struct
331 {
332  uint8_t pipe_number;
333  uint8_t error_code;
334  union
335  {
336  error_data_t error_data;
337  } params;
338 } _aci_packed_ aci_evt_params_pipe_error_t;
339 
344 typedef struct
345 {
346  uint8_t passkey[6];
347 } _aci_packed_ aci_evt_params_display_passkey_t;
348 
353 typedef struct
354 {
355  aci_key_type_t key_type;
356 } _aci_packed_ aci_evt_params_key_request_t;
357 
362 typedef struct
363 {
364  uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN];
365 } _aci_packed_ aci_evt_params_echo_t;
366 
371 typedef struct
372 {
373  uint8_t len;
374  aci_evt_opcode_t evt_opcode;
375  union
376  {
377  aci_evt_params_device_started_t device_started;
378  aci_evt_params_echo_t echo;
379  aci_evt_params_hw_error_t hw_error;
380  aci_evt_params_cmd_rsp_t cmd_rsp;
381  aci_evt_params_connected_t connected;
382  aci_evt_params_disconnected_t disconnected;
383  aci_evt_params_bond_status_t bond_status;
384  aci_evt_params_pipe_status_t pipe_status;
385  aci_evt_params_timing_t timing;
386  aci_evt_params_data_credit_t data_credit;
387  aci_evt_params_data_ack_t data_ack;
388  aci_evt_params_data_received_t data_received;
389  aci_evt_params_pipe_error_t pipe_error;
390  aci_evt_params_display_passkey_t display_passkey;
391  aci_evt_params_key_request_t key_request;
392  } params;
393 } _aci_packed_ aci_evt_t;
394 
395 ACI_ASSERT_SIZE(aci_evt_t, 33);
396 
397 #endif // ACI_EVTS_H__
aci_clock_accuracy_t master_clock_accuracy
Definition: aci_evts.h:236
#define BTLE_DEVICE_ADDRESS_SIZE
Size in bytes of a Bluetooth Address.
Definition: aci.h:109
Definition: aci_evts.h:98
#define ACI_ECHO_DATA_MAX_LEN
Maximum length in bytes of the echo data portion.
Definition: aci.h:119
Definition: aci_evts.h:86
uint16_t conn_rf_timeout
Definition: aci_evts.h:235
Definition: aci_evts.h:76
aci_device_operation_mode_t device_mode
Definition: aci_evts.h:118
Definition: aci_evts.h:60
Definition: aci_evts.h:44
Definition: aci_evts.h:106
Definition: aci_evts.h:48
Definition: aci_evts.h:94
uint16_t conn_slave_rf_latency
Definition: aci_evts.h:234
Definition: aci_evts.h:90
Definition: aci_evts.h:52
uint16_t conn_rf_interval
Definition: aci_evts.h:233
Definition: aci_evts.h:81
aci_status_code_t cmd_status
Definition: aci_evts.h:210
Definition: aci_evts.h:56
Definition: aci_evts.h:72
uint8_t credit_available
Definition: aci_evts.h:120
Definition: aci_evts.h:64
aci_hw_error_t hw_error
Definition: aci_evts.h:119
Definition: aci_evts.h:68
Structure for the ACI_CMD_SET_LOCAL_DATA ACI command parameters.
Definition: aci.h:271
Definition: aci_evts.h:102