added debugging
Fork of BLE_nRF8001 by
Embed:
(wiki syntax)
Show/hide line numbers
aci_evts.h
Go to the documentation of this file.
00001 /* Copyright (c) 2014, Nordic Semiconductor ASA 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy 00004 * of this software and associated documentation files (the "Software"), to deal 00005 * in the Software without restriction, including without limitation the rights 00006 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00007 * copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all 00011 * copies or substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00014 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00016 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00017 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00018 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00019 * SOFTWARE. 00020 */ 00021 00022 /** 00023 * @file 00024 * 00025 * @ingroup aci 00026 * 00027 * @brief Definitions for the ACI (Application Control Interface) events 00028 */ 00029 00030 #ifndef ACI_EVTS_H__ 00031 #define ACI_EVTS_H__ 00032 00033 #include "aci.h " 00034 00035 /** 00036 * @enum aci_evt_opcode_t 00037 * @brief ACI event opcodes 00038 */ 00039 typedef enum 00040 { 00041 /** 00042 * Invalid event code 00043 */ 00044 ACI_EVT_INVALID = 0x00, 00045 /** 00046 * Sent every time the device starts 00047 */ 00048 ACI_EVT_DEVICE_STARTED = 0x81, 00049 /** 00050 * Mirrors the ACI_CMD_ECHO 00051 */ 00052 ACI_EVT_ECHO = 0x82, 00053 /** 00054 * Asynchronous hardware error event 00055 */ 00056 ACI_EVT_HW_ERROR = 0x83, 00057 /** 00058 * Event opcode used as a event response for all commands 00059 */ 00060 ACI_EVT_CMD_RSP = 0x84, 00061 /** 00062 * Link connected 00063 */ 00064 ACI_EVT_CONNECTED = 0x85, 00065 /** 00066 * Link disconnected 00067 */ 00068 ACI_EVT_DISCONNECTED = 0x86, 00069 /** 00070 * Bond completion result 00071 */ 00072 ACI_EVT_BOND_STATUS = 0x87, 00073 /** 00074 * Pipe bitmap for available pipes 00075 */ 00076 ACI_EVT_PIPE_STATUS = 0x88, 00077 /** 00078 * Sent to the application when the radio enters a connected state 00079 * or when the timing of the radio connection changes 00080 */ 00081 ACI_EVT_TIMING = 0x89, 00082 /** 00083 * Notification to the application that transmit credits are 00084 * available 00085 */ 00086 ACI_EVT_DATA_CREDIT = 0x8A, 00087 /** 00088 * Data acknowledgement event 00089 */ 00090 ACI_EVT_DATA_ACK = 0x8B, 00091 /** 00092 * Data received notification event 00093 */ 00094 ACI_EVT_DATA_RECEIVED = 0x8C, 00095 /** 00096 * Error notification event 00097 */ 00098 ACI_EVT_PIPE_ERROR = 0x8D, 00099 /** 00100 * Display Passkey Event 00101 */ 00102 ACI_EVT_DISPLAY_PASSKEY = 0x8E, 00103 /** 00104 * Security Key request 00105 */ 00106 ACI_EVT_KEY_REQUEST = 0x8F 00107 00108 } _aci_packed_ aci_evt_opcode_t; 00109 00110 ACI_ASSERT_SIZE(aci_evt_opcode_t, 1); 00111 00112 /** 00113 * @struct aci_evt_params_device_started_t 00114 * @brief Structure for the ACI_EVT_DEVICE_STARTED event return parameters 00115 */ 00116 typedef struct 00117 { 00118 aci_device_operation_mode_t device_mode; /**< Mode in which the device is being started */ 00119 aci_hw_error_t hw_error; /**< Hardware Error if available for the start */ 00120 uint8_t credit_available; /**< Flow control credit available for this specific FW build */ 00121 } _aci_packed_ aci_evt_params_device_started_t; 00122 00123 ACI_ASSERT_SIZE(aci_evt_params_device_started_t, 3); 00124 00125 /** 00126 * @struct aci_evt_params_hw_error_t 00127 * @brief Structure for the ACI_EVT_HW_ERROR event return parameters 00128 */ 00129 typedef struct 00130 { 00131 uint16_t line_num; 00132 uint8_t file_name[20]; 00133 } _aci_packed_ aci_evt_params_hw_error_t; 00134 00135 ACI_ASSERT_SIZE(aci_evt_params_hw_error_t, 22); 00136 00137 /** 00138 * @struct aci_evt_cmd_rsp_params_dtm_cmd_t 00139 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_DTM_CMD event return parameters 00140 */ 00141 typedef struct 00142 { 00143 uint8_t evt_msb; 00144 uint8_t evt_lsb; 00145 } _aci_packed_ aci_evt_cmd_rsp_params_dtm_cmd_t; 00146 00147 /** 00148 * @struct aci_evt_cmd_rsp_read_dynamic_data_t 00149 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_READ_DYNAMIC_DATA event return parameters 00150 * @note Dynamic data chunk size in this event is defined to go up to ACI_PACKET_MAX_LEN - 5 00151 */ 00152 typedef struct 00153 { 00154 uint8_t seq_no; 00155 uint8_t dynamic_data[1]; 00156 } _aci_packed_ aci_evt_cmd_rsp_read_dynamic_data_t; 00157 00158 /** 00159 * @struct aci_evt_cmd_rsp_params_get_device_version_t 00160 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_DEVICE_VERSION event return parameters 00161 */ 00162 typedef struct 00163 { 00164 uint16_t configuration_id; 00165 uint8_t aci_version; 00166 uint8_t setup_format; 00167 uint32_t setup_id; 00168 uint8_t setup_status; 00169 } _aci_packed_ aci_evt_cmd_rsp_params_get_device_version_t; 00170 00171 ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_version_t, 9); 00172 00173 /** 00174 * @struct aci_evt_cmd_rsp_params_get_device_address_t 00175 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_DEVICE_ADDRESS event return parameters 00176 */ 00177 typedef struct 00178 { 00179 uint8_t bd_addr_own[BTLE_DEVICE_ADDRESS_SIZE]; 00180 aci_bd_addr_type_t bd_addr_type; 00181 } _aci_packed_ aci_evt_cmd_rsp_params_get_device_address_t; 00182 00183 ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_address_t, BTLE_DEVICE_ADDRESS_SIZE + 1); 00184 00185 /** 00186 * @struct aci_evt_cmd_rsp_params_get_battery_level_t 00187 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_BATTERY_LEVEL event return parameters 00188 */ 00189 typedef struct 00190 { 00191 uint16_t battery_level; 00192 } _aci_packed_ aci_evt_cmd_rsp_params_get_battery_level_t; 00193 00194 /** 00195 * @struct aci_evt_cmd_rsp_params_get_temperature_t 00196 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_TEMPERATURE event return parameters 00197 */ 00198 typedef struct 00199 { 00200 int16_t temperature_value; 00201 } _aci_packed_ aci_evt_cmd_rsp_params_get_temperature_t; 00202 00203 /** 00204 * @struct aci_evt_params_cmd_rsp_t 00205 * @brief Structure for the ACI_EVT_CMD_RSP event return parameters 00206 */ 00207 typedef struct 00208 { 00209 aci_cmd_opcode_t cmd_opcode; /**< Command opcode for which the event response is being sent */ 00210 aci_status_code_t cmd_status; /**< Status of the command that was sent. Used in the context of the command. */ 00211 union 00212 { 00213 aci_evt_cmd_rsp_params_dtm_cmd_t dtm_cmd; 00214 aci_evt_cmd_rsp_read_dynamic_data_t read_dynamic_data; 00215 aci_evt_cmd_rsp_params_get_device_version_t get_device_version; 00216 aci_evt_cmd_rsp_params_get_device_address_t get_device_address; 00217 aci_evt_cmd_rsp_params_get_battery_level_t get_battery_level; 00218 aci_evt_cmd_rsp_params_get_temperature_t get_temperature; 00219 uint8_t padding[29]; 00220 } params; 00221 } _aci_packed_ aci_evt_params_cmd_rsp_t; 00222 00223 ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 31); 00224 00225 /** 00226 * @struct aci_evt_params_connected_t 00227 * @brief Structure for the ACI_EVT_CONNECTED event return parameters 00228 */ 00229 typedef struct 00230 { 00231 aci_bd_addr_type_t dev_addr_type; 00232 uint8_t dev_addr[BTLE_DEVICE_ADDRESS_SIZE]; 00233 uint16_t conn_rf_interval; /**< rf_interval = conn_rf_interval * 1.25 ms Range:0x0006 to 0x0C80 */ 00234 uint16_t conn_slave_rf_latency; /**< Number of RF events the slave can skip */ 00235 uint16_t conn_rf_timeout; /**< Timeout as a multiple of 10ms i.e timeout = conn_rf_timeout * 10ms Range: 0x000A to 0x0C80 */ 00236 aci_clock_accuracy_t master_clock_accuracy; /**< Clock accuracy of Bluetooth master: Enumerated list of values from 500 ppm to 20 ppm */ 00237 } _aci_packed_ aci_evt_params_connected_t; 00238 00239 ACI_ASSERT_SIZE(aci_evt_params_connected_t, 14); 00240 00241 /** 00242 * @struct aci_evt_params_disconnected_t 00243 * @brief Structure for the ACI_EVT_DISCONNECTED event return parameters 00244 */ 00245 typedef struct 00246 { 00247 aci_status_code_t aci_status; 00248 uint8_t btle_status; 00249 } _aci_packed_ aci_evt_params_disconnected_t; 00250 00251 ACI_ASSERT_SIZE(aci_evt_params_disconnected_t, 2); 00252 00253 /** 00254 * @struct aci_evt_params_bond_status_t 00255 * @brief Structure for the ACI_EVT_BOND_STATUS event return parameters 00256 */ 00257 typedef struct 00258 { 00259 aci_bond_status_code_t status_code; 00260 aci_bond_status_source_t status_source; 00261 uint8_t secmode1_bitmap; 00262 uint8_t secmode2_bitmap; 00263 uint8_t keys_exchanged_slave; 00264 uint8_t keys_exchanged_master; 00265 } _aci_packed_ aci_evt_params_bond_status_t; 00266 00267 ACI_ASSERT_SIZE(aci_evt_params_bond_status_t, 6); 00268 00269 /** 00270 * @struct aci_evt_params_pipe_status_t 00271 * @brief Structure for the ACI_EVT_PIPE_STATUS event return parameters 00272 */ 00273 typedef struct 00274 { 00275 uint8_t pipes_open_bitmap[8]; 00276 uint8_t pipes_closed_bitmap[8]; 00277 } _aci_packed_ aci_evt_params_pipe_status_t; 00278 00279 ACI_ASSERT_SIZE(aci_evt_params_pipe_status_t, 16); 00280 00281 /** 00282 * @struct aci_evt_params_timing_t 00283 * @brief Structure for the ACI_EVT_TIMING event return parameters 00284 */ 00285 typedef struct 00286 { 00287 uint16_t conn_rf_interval; /**< rf_interval = conn_rf_interval * 1.25 ms Range:0x0006 to 0x0C80 */ 00288 uint16_t conn_slave_rf_latency; /**< Number of RF events the slave can skip */ 00289 uint16_t conn_rf_timeout; /**< Timeout as a multiple of 10ms i.e timeout = conn_rf_timeout * 10ms Range: 0x000A to 0x0C80 */ 00290 } _aci_packed_ aci_evt_params_timing_t; 00291 00292 ACI_ASSERT_SIZE(aci_evt_params_timing_t, 6); 00293 00294 /** 00295 * @struct aci_evt_params_data_credit_t 00296 * @brief Structure for the ACI_EVT_DATA_CREDIT event return parameters 00297 */ 00298 typedef struct 00299 { 00300 uint8_t credit; 00301 } _aci_packed_ aci_evt_params_data_credit_t; 00302 00303 /** 00304 * @struct aci_evt_params_data_ack_t 00305 * @brief Structure for the ACI_EVT_DATA_ACK event return parameters 00306 */ 00307 typedef struct 00308 { 00309 uint8_t pipe_number; 00310 } _aci_packed_ aci_evt_params_data_ack_t; 00311 00312 /** 00313 * @struct aci_evt_params_data_received_t 00314 * @brief Structure for the ACI_EVT_DATA_RECEIVED event return parameters 00315 */ 00316 typedef struct 00317 { 00318 aci_rx_data_t rx_data; 00319 } _aci_packed_ aci_evt_params_data_received_t; 00320 00321 typedef struct 00322 { 00323 uint8_t content[1]; 00324 } _aci_packed_ error_data_t; 00325 00326 /** 00327 * @struct aci_evt_params_pipe_error_t 00328 * @brief Structure for the ACI_EVT_PIPE_ERROR event return parameters 00329 */ 00330 typedef struct 00331 { 00332 uint8_t pipe_number; 00333 uint8_t error_code; 00334 union 00335 { 00336 error_data_t error_data; 00337 } params; 00338 } _aci_packed_ aci_evt_params_pipe_error_t; 00339 00340 /** 00341 * @struct aci_evt_params_display_passkey_t 00342 * @brief Structure for the ACI_EVT_DISPLAY_PASSKEY event return parameters 00343 */ 00344 typedef struct 00345 { 00346 uint8_t passkey[6]; 00347 } _aci_packed_ aci_evt_params_display_passkey_t; 00348 00349 /** 00350 * @struct aci_evt_params_key_request_t 00351 * @brief Structure for the ACI_EVT_KEY_REQUEST event return parameters 00352 */ 00353 typedef struct 00354 { 00355 aci_key_type_t key_type; 00356 } _aci_packed_ aci_evt_params_key_request_t; 00357 00358 /** 00359 * @struct aci_event_params_echo_t 00360 * @brief Structure for the ACI_EVT_ECHO ACI event parameters 00361 */ 00362 typedef struct 00363 { 00364 uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN]; 00365 } _aci_packed_ aci_evt_params_echo_t; 00366 00367 /** 00368 * @struct aci_evt_t 00369 * @brief Encapsulates a generic ACI event 00370 */ 00371 typedef struct 00372 { 00373 uint8_t len; 00374 aci_evt_opcode_t evt_opcode; 00375 union 00376 { 00377 aci_evt_params_device_started_t device_started; 00378 aci_evt_params_echo_t echo; 00379 aci_evt_params_hw_error_t hw_error; 00380 aci_evt_params_cmd_rsp_t cmd_rsp; 00381 aci_evt_params_connected_t connected; 00382 aci_evt_params_disconnected_t disconnected; 00383 aci_evt_params_bond_status_t bond_status; 00384 aci_evt_params_pipe_status_t pipe_status; 00385 aci_evt_params_timing_t timing; 00386 aci_evt_params_data_credit_t data_credit; 00387 aci_evt_params_data_ack_t data_ack; 00388 aci_evt_params_data_received_t data_received; 00389 aci_evt_params_pipe_error_t pipe_error; 00390 aci_evt_params_display_passkey_t display_passkey; 00391 aci_evt_params_key_request_t key_request; 00392 } params; 00393 } _aci_packed_ aci_evt_t; 00394 00395 ACI_ASSERT_SIZE(aci_evt_t, 33); 00396 00397 #endif // ACI_EVTS_H__
Generated on Tue Jul 12 2022 15:15:45 by 1.7.2