added debugging

Fork of BLE_nRF8001 by RedBearLab

Committer:
jn80842
Date:
Mon Nov 10 01:24:23 2014 +0000
Revision:
2:7805a5595aab
Parent:
0:075ea2812998
just added debugging

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RedBearLab 0:075ea2812998 1 /* Copyright (c) 2014, Nordic Semiconductor ASA
RedBearLab 0:075ea2812998 2 *
RedBearLab 0:075ea2812998 3 * Permission is hereby granted, free of charge, to any person obtaining a copy
RedBearLab 0:075ea2812998 4 * of this software and associated documentation files (the "Software"), to deal
RedBearLab 0:075ea2812998 5 * in the Software without restriction, including without limitation the rights
RedBearLab 0:075ea2812998 6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
RedBearLab 0:075ea2812998 7 * copies of the Software, and to permit persons to whom the Software is
RedBearLab 0:075ea2812998 8 * furnished to do so, subject to the following conditions:
RedBearLab 0:075ea2812998 9 *
RedBearLab 0:075ea2812998 10 * The above copyright notice and this permission notice shall be included in all
RedBearLab 0:075ea2812998 11 * copies or substantial portions of the Software.
RedBearLab 0:075ea2812998 12 *
RedBearLab 0:075ea2812998 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
RedBearLab 0:075ea2812998 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
RedBearLab 0:075ea2812998 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
RedBearLab 0:075ea2812998 16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
RedBearLab 0:075ea2812998 17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
RedBearLab 0:075ea2812998 18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
RedBearLab 0:075ea2812998 19 * SOFTWARE.
RedBearLab 0:075ea2812998 20 */
RedBearLab 0:075ea2812998 21
RedBearLab 0:075ea2812998 22 /**
RedBearLab 0:075ea2812998 23 * @file
RedBearLab 0:075ea2812998 24 *
RedBearLab 0:075ea2812998 25 * @ingroup aci
RedBearLab 0:075ea2812998 26 *
RedBearLab 0:075ea2812998 27 * @brief Definitions for the ACI (Application Control Interface) events
RedBearLab 0:075ea2812998 28 */
RedBearLab 0:075ea2812998 29
RedBearLab 0:075ea2812998 30 #ifndef ACI_EVTS_H__
RedBearLab 0:075ea2812998 31 #define ACI_EVTS_H__
RedBearLab 0:075ea2812998 32
RedBearLab 0:075ea2812998 33 #include "aci.h"
RedBearLab 0:075ea2812998 34
RedBearLab 0:075ea2812998 35 /**
RedBearLab 0:075ea2812998 36 * @enum aci_evt_opcode_t
RedBearLab 0:075ea2812998 37 * @brief ACI event opcodes
RedBearLab 0:075ea2812998 38 */
RedBearLab 0:075ea2812998 39 typedef enum
RedBearLab 0:075ea2812998 40 {
RedBearLab 0:075ea2812998 41 /**
RedBearLab 0:075ea2812998 42 * Invalid event code
RedBearLab 0:075ea2812998 43 */
RedBearLab 0:075ea2812998 44 ACI_EVT_INVALID = 0x00,
RedBearLab 0:075ea2812998 45 /**
RedBearLab 0:075ea2812998 46 * Sent every time the device starts
RedBearLab 0:075ea2812998 47 */
RedBearLab 0:075ea2812998 48 ACI_EVT_DEVICE_STARTED = 0x81,
RedBearLab 0:075ea2812998 49 /**
RedBearLab 0:075ea2812998 50 * Mirrors the ACI_CMD_ECHO
RedBearLab 0:075ea2812998 51 */
RedBearLab 0:075ea2812998 52 ACI_EVT_ECHO = 0x82,
RedBearLab 0:075ea2812998 53 /**
RedBearLab 0:075ea2812998 54 * Asynchronous hardware error event
RedBearLab 0:075ea2812998 55 */
RedBearLab 0:075ea2812998 56 ACI_EVT_HW_ERROR = 0x83,
RedBearLab 0:075ea2812998 57 /**
RedBearLab 0:075ea2812998 58 * Event opcode used as a event response for all commands
RedBearLab 0:075ea2812998 59 */
RedBearLab 0:075ea2812998 60 ACI_EVT_CMD_RSP = 0x84,
RedBearLab 0:075ea2812998 61 /**
RedBearLab 0:075ea2812998 62 * Link connected
RedBearLab 0:075ea2812998 63 */
RedBearLab 0:075ea2812998 64 ACI_EVT_CONNECTED = 0x85,
RedBearLab 0:075ea2812998 65 /**
RedBearLab 0:075ea2812998 66 * Link disconnected
RedBearLab 0:075ea2812998 67 */
RedBearLab 0:075ea2812998 68 ACI_EVT_DISCONNECTED = 0x86,
RedBearLab 0:075ea2812998 69 /**
RedBearLab 0:075ea2812998 70 * Bond completion result
RedBearLab 0:075ea2812998 71 */
RedBearLab 0:075ea2812998 72 ACI_EVT_BOND_STATUS = 0x87,
RedBearLab 0:075ea2812998 73 /**
RedBearLab 0:075ea2812998 74 * Pipe bitmap for available pipes
RedBearLab 0:075ea2812998 75 */
RedBearLab 0:075ea2812998 76 ACI_EVT_PIPE_STATUS = 0x88,
RedBearLab 0:075ea2812998 77 /**
RedBearLab 0:075ea2812998 78 * Sent to the application when the radio enters a connected state
RedBearLab 0:075ea2812998 79 * or when the timing of the radio connection changes
RedBearLab 0:075ea2812998 80 */
RedBearLab 0:075ea2812998 81 ACI_EVT_TIMING = 0x89,
RedBearLab 0:075ea2812998 82 /**
RedBearLab 0:075ea2812998 83 * Notification to the application that transmit credits are
RedBearLab 0:075ea2812998 84 * available
RedBearLab 0:075ea2812998 85 */
RedBearLab 0:075ea2812998 86 ACI_EVT_DATA_CREDIT = 0x8A,
RedBearLab 0:075ea2812998 87 /**
RedBearLab 0:075ea2812998 88 * Data acknowledgement event
RedBearLab 0:075ea2812998 89 */
RedBearLab 0:075ea2812998 90 ACI_EVT_DATA_ACK = 0x8B,
RedBearLab 0:075ea2812998 91 /**
RedBearLab 0:075ea2812998 92 * Data received notification event
RedBearLab 0:075ea2812998 93 */
RedBearLab 0:075ea2812998 94 ACI_EVT_DATA_RECEIVED = 0x8C,
RedBearLab 0:075ea2812998 95 /**
RedBearLab 0:075ea2812998 96 * Error notification event
RedBearLab 0:075ea2812998 97 */
RedBearLab 0:075ea2812998 98 ACI_EVT_PIPE_ERROR = 0x8D,
RedBearLab 0:075ea2812998 99 /**
RedBearLab 0:075ea2812998 100 * Display Passkey Event
RedBearLab 0:075ea2812998 101 */
RedBearLab 0:075ea2812998 102 ACI_EVT_DISPLAY_PASSKEY = 0x8E,
RedBearLab 0:075ea2812998 103 /**
RedBearLab 0:075ea2812998 104 * Security Key request
RedBearLab 0:075ea2812998 105 */
RedBearLab 0:075ea2812998 106 ACI_EVT_KEY_REQUEST = 0x8F
RedBearLab 0:075ea2812998 107
RedBearLab 0:075ea2812998 108 } _aci_packed_ aci_evt_opcode_t;
RedBearLab 0:075ea2812998 109
RedBearLab 0:075ea2812998 110 ACI_ASSERT_SIZE(aci_evt_opcode_t, 1);
RedBearLab 0:075ea2812998 111
RedBearLab 0:075ea2812998 112 /**
RedBearLab 0:075ea2812998 113 * @struct aci_evt_params_device_started_t
RedBearLab 0:075ea2812998 114 * @brief Structure for the ACI_EVT_DEVICE_STARTED event return parameters
RedBearLab 0:075ea2812998 115 */
RedBearLab 0:075ea2812998 116 typedef struct
RedBearLab 0:075ea2812998 117 {
RedBearLab 0:075ea2812998 118 aci_device_operation_mode_t device_mode; /**< Mode in which the device is being started */
RedBearLab 0:075ea2812998 119 aci_hw_error_t hw_error; /**< Hardware Error if available for the start */
RedBearLab 0:075ea2812998 120 uint8_t credit_available; /**< Flow control credit available for this specific FW build */
RedBearLab 0:075ea2812998 121 } _aci_packed_ aci_evt_params_device_started_t;
RedBearLab 0:075ea2812998 122
RedBearLab 0:075ea2812998 123 ACI_ASSERT_SIZE(aci_evt_params_device_started_t, 3);
RedBearLab 0:075ea2812998 124
RedBearLab 0:075ea2812998 125 /**
RedBearLab 0:075ea2812998 126 * @struct aci_evt_params_hw_error_t
RedBearLab 0:075ea2812998 127 * @brief Structure for the ACI_EVT_HW_ERROR event return parameters
RedBearLab 0:075ea2812998 128 */
RedBearLab 0:075ea2812998 129 typedef struct
RedBearLab 0:075ea2812998 130 {
RedBearLab 0:075ea2812998 131 uint16_t line_num;
RedBearLab 0:075ea2812998 132 uint8_t file_name[20];
RedBearLab 0:075ea2812998 133 } _aci_packed_ aci_evt_params_hw_error_t;
RedBearLab 0:075ea2812998 134
RedBearLab 0:075ea2812998 135 ACI_ASSERT_SIZE(aci_evt_params_hw_error_t, 22);
RedBearLab 0:075ea2812998 136
RedBearLab 0:075ea2812998 137 /**
RedBearLab 0:075ea2812998 138 * @struct aci_evt_cmd_rsp_params_dtm_cmd_t
RedBearLab 0:075ea2812998 139 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_DTM_CMD event return parameters
RedBearLab 0:075ea2812998 140 */
RedBearLab 0:075ea2812998 141 typedef struct
RedBearLab 0:075ea2812998 142 {
RedBearLab 0:075ea2812998 143 uint8_t evt_msb;
RedBearLab 0:075ea2812998 144 uint8_t evt_lsb;
RedBearLab 0:075ea2812998 145 } _aci_packed_ aci_evt_cmd_rsp_params_dtm_cmd_t;
RedBearLab 0:075ea2812998 146
RedBearLab 0:075ea2812998 147 /**
RedBearLab 0:075ea2812998 148 * @struct aci_evt_cmd_rsp_read_dynamic_data_t
RedBearLab 0:075ea2812998 149 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_READ_DYNAMIC_DATA event return parameters
RedBearLab 0:075ea2812998 150 * @note Dynamic data chunk size in this event is defined to go up to ACI_PACKET_MAX_LEN - 5
RedBearLab 0:075ea2812998 151 */
RedBearLab 0:075ea2812998 152 typedef struct
RedBearLab 0:075ea2812998 153 {
RedBearLab 0:075ea2812998 154 uint8_t seq_no;
RedBearLab 0:075ea2812998 155 uint8_t dynamic_data[1];
RedBearLab 0:075ea2812998 156 } _aci_packed_ aci_evt_cmd_rsp_read_dynamic_data_t;
RedBearLab 0:075ea2812998 157
RedBearLab 0:075ea2812998 158 /**
RedBearLab 0:075ea2812998 159 * @struct aci_evt_cmd_rsp_params_get_device_version_t
RedBearLab 0:075ea2812998 160 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_DEVICE_VERSION event return parameters
RedBearLab 0:075ea2812998 161 */
RedBearLab 0:075ea2812998 162 typedef struct
RedBearLab 0:075ea2812998 163 {
RedBearLab 0:075ea2812998 164 uint16_t configuration_id;
RedBearLab 0:075ea2812998 165 uint8_t aci_version;
RedBearLab 0:075ea2812998 166 uint8_t setup_format;
RedBearLab 0:075ea2812998 167 uint32_t setup_id;
RedBearLab 0:075ea2812998 168 uint8_t setup_status;
RedBearLab 0:075ea2812998 169 } _aci_packed_ aci_evt_cmd_rsp_params_get_device_version_t;
RedBearLab 0:075ea2812998 170
RedBearLab 0:075ea2812998 171 ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_version_t, 9);
RedBearLab 0:075ea2812998 172
RedBearLab 0:075ea2812998 173 /**
RedBearLab 0:075ea2812998 174 * @struct aci_evt_cmd_rsp_params_get_device_address_t
RedBearLab 0:075ea2812998 175 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_DEVICE_ADDRESS event return parameters
RedBearLab 0:075ea2812998 176 */
RedBearLab 0:075ea2812998 177 typedef struct
RedBearLab 0:075ea2812998 178 {
RedBearLab 0:075ea2812998 179 uint8_t bd_addr_own[BTLE_DEVICE_ADDRESS_SIZE];
RedBearLab 0:075ea2812998 180 aci_bd_addr_type_t bd_addr_type;
RedBearLab 0:075ea2812998 181 } _aci_packed_ aci_evt_cmd_rsp_params_get_device_address_t;
RedBearLab 0:075ea2812998 182
RedBearLab 0:075ea2812998 183 ACI_ASSERT_SIZE(aci_evt_cmd_rsp_params_get_device_address_t, BTLE_DEVICE_ADDRESS_SIZE + 1);
RedBearLab 0:075ea2812998 184
RedBearLab 0:075ea2812998 185 /**
RedBearLab 0:075ea2812998 186 * @struct aci_evt_cmd_rsp_params_get_battery_level_t
RedBearLab 0:075ea2812998 187 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_BATTERY_LEVEL event return parameters
RedBearLab 0:075ea2812998 188 */
RedBearLab 0:075ea2812998 189 typedef struct
RedBearLab 0:075ea2812998 190 {
RedBearLab 0:075ea2812998 191 uint16_t battery_level;
RedBearLab 0:075ea2812998 192 } _aci_packed_ aci_evt_cmd_rsp_params_get_battery_level_t;
RedBearLab 0:075ea2812998 193
RedBearLab 0:075ea2812998 194 /**
RedBearLab 0:075ea2812998 195 * @struct aci_evt_cmd_rsp_params_get_temperature_t
RedBearLab 0:075ea2812998 196 * @brief Structure for the ACI_EVT_CMD_RSP event with opcode=ACI_CMD_GET_TEMPERATURE event return parameters
RedBearLab 0:075ea2812998 197 */
RedBearLab 0:075ea2812998 198 typedef struct
RedBearLab 0:075ea2812998 199 {
RedBearLab 0:075ea2812998 200 int16_t temperature_value;
RedBearLab 0:075ea2812998 201 } _aci_packed_ aci_evt_cmd_rsp_params_get_temperature_t;
RedBearLab 0:075ea2812998 202
RedBearLab 0:075ea2812998 203 /**
RedBearLab 0:075ea2812998 204 * @struct aci_evt_params_cmd_rsp_t
RedBearLab 0:075ea2812998 205 * @brief Structure for the ACI_EVT_CMD_RSP event return parameters
RedBearLab 0:075ea2812998 206 */
RedBearLab 0:075ea2812998 207 typedef struct
RedBearLab 0:075ea2812998 208 {
RedBearLab 0:075ea2812998 209 aci_cmd_opcode_t cmd_opcode; /**< Command opcode for which the event response is being sent */
RedBearLab 0:075ea2812998 210 aci_status_code_t cmd_status; /**< Status of the command that was sent. Used in the context of the command. */
RedBearLab 0:075ea2812998 211 union
RedBearLab 0:075ea2812998 212 {
RedBearLab 0:075ea2812998 213 aci_evt_cmd_rsp_params_dtm_cmd_t dtm_cmd;
RedBearLab 0:075ea2812998 214 aci_evt_cmd_rsp_read_dynamic_data_t read_dynamic_data;
RedBearLab 0:075ea2812998 215 aci_evt_cmd_rsp_params_get_device_version_t get_device_version;
RedBearLab 0:075ea2812998 216 aci_evt_cmd_rsp_params_get_device_address_t get_device_address;
RedBearLab 0:075ea2812998 217 aci_evt_cmd_rsp_params_get_battery_level_t get_battery_level;
RedBearLab 0:075ea2812998 218 aci_evt_cmd_rsp_params_get_temperature_t get_temperature;
RedBearLab 0:075ea2812998 219 uint8_t padding[29];
RedBearLab 0:075ea2812998 220 } params;
RedBearLab 0:075ea2812998 221 } _aci_packed_ aci_evt_params_cmd_rsp_t;
RedBearLab 0:075ea2812998 222
RedBearLab 0:075ea2812998 223 ACI_ASSERT_SIZE(aci_evt_params_cmd_rsp_t, 31);
RedBearLab 0:075ea2812998 224
RedBearLab 0:075ea2812998 225 /**
RedBearLab 0:075ea2812998 226 * @struct aci_evt_params_connected_t
RedBearLab 0:075ea2812998 227 * @brief Structure for the ACI_EVT_CONNECTED event return parameters
RedBearLab 0:075ea2812998 228 */
RedBearLab 0:075ea2812998 229 typedef struct
RedBearLab 0:075ea2812998 230 {
RedBearLab 0:075ea2812998 231 aci_bd_addr_type_t dev_addr_type;
RedBearLab 0:075ea2812998 232 uint8_t dev_addr[BTLE_DEVICE_ADDRESS_SIZE];
RedBearLab 0:075ea2812998 233 uint16_t conn_rf_interval; /**< rf_interval = conn_rf_interval * 1.25 ms Range:0x0006 to 0x0C80 */
RedBearLab 0:075ea2812998 234 uint16_t conn_slave_rf_latency; /**< Number of RF events the slave can skip */
RedBearLab 0:075ea2812998 235 uint16_t conn_rf_timeout; /**< Timeout as a multiple of 10ms i.e timeout = conn_rf_timeout * 10ms Range: 0x000A to 0x0C80 */
RedBearLab 0:075ea2812998 236 aci_clock_accuracy_t master_clock_accuracy; /**< Clock accuracy of Bluetooth master: Enumerated list of values from 500 ppm to 20 ppm */
RedBearLab 0:075ea2812998 237 } _aci_packed_ aci_evt_params_connected_t;
RedBearLab 0:075ea2812998 238
RedBearLab 0:075ea2812998 239 ACI_ASSERT_SIZE(aci_evt_params_connected_t, 14);
RedBearLab 0:075ea2812998 240
RedBearLab 0:075ea2812998 241 /**
RedBearLab 0:075ea2812998 242 * @struct aci_evt_params_disconnected_t
RedBearLab 0:075ea2812998 243 * @brief Structure for the ACI_EVT_DISCONNECTED event return parameters
RedBearLab 0:075ea2812998 244 */
RedBearLab 0:075ea2812998 245 typedef struct
RedBearLab 0:075ea2812998 246 {
RedBearLab 0:075ea2812998 247 aci_status_code_t aci_status;
RedBearLab 0:075ea2812998 248 uint8_t btle_status;
RedBearLab 0:075ea2812998 249 } _aci_packed_ aci_evt_params_disconnected_t;
RedBearLab 0:075ea2812998 250
RedBearLab 0:075ea2812998 251 ACI_ASSERT_SIZE(aci_evt_params_disconnected_t, 2);
RedBearLab 0:075ea2812998 252
RedBearLab 0:075ea2812998 253 /**
RedBearLab 0:075ea2812998 254 * @struct aci_evt_params_bond_status_t
RedBearLab 0:075ea2812998 255 * @brief Structure for the ACI_EVT_BOND_STATUS event return parameters
RedBearLab 0:075ea2812998 256 */
RedBearLab 0:075ea2812998 257 typedef struct
RedBearLab 0:075ea2812998 258 {
RedBearLab 0:075ea2812998 259 aci_bond_status_code_t status_code;
RedBearLab 0:075ea2812998 260 aci_bond_status_source_t status_source;
RedBearLab 0:075ea2812998 261 uint8_t secmode1_bitmap;
RedBearLab 0:075ea2812998 262 uint8_t secmode2_bitmap;
RedBearLab 0:075ea2812998 263 uint8_t keys_exchanged_slave;
RedBearLab 0:075ea2812998 264 uint8_t keys_exchanged_master;
RedBearLab 0:075ea2812998 265 } _aci_packed_ aci_evt_params_bond_status_t;
RedBearLab 0:075ea2812998 266
RedBearLab 0:075ea2812998 267 ACI_ASSERT_SIZE(aci_evt_params_bond_status_t, 6);
RedBearLab 0:075ea2812998 268
RedBearLab 0:075ea2812998 269 /**
RedBearLab 0:075ea2812998 270 * @struct aci_evt_params_pipe_status_t
RedBearLab 0:075ea2812998 271 * @brief Structure for the ACI_EVT_PIPE_STATUS event return parameters
RedBearLab 0:075ea2812998 272 */
RedBearLab 0:075ea2812998 273 typedef struct
RedBearLab 0:075ea2812998 274 {
RedBearLab 0:075ea2812998 275 uint8_t pipes_open_bitmap[8];
RedBearLab 0:075ea2812998 276 uint8_t pipes_closed_bitmap[8];
RedBearLab 0:075ea2812998 277 } _aci_packed_ aci_evt_params_pipe_status_t;
RedBearLab 0:075ea2812998 278
RedBearLab 0:075ea2812998 279 ACI_ASSERT_SIZE(aci_evt_params_pipe_status_t, 16);
RedBearLab 0:075ea2812998 280
RedBearLab 0:075ea2812998 281 /**
RedBearLab 0:075ea2812998 282 * @struct aci_evt_params_timing_t
RedBearLab 0:075ea2812998 283 * @brief Structure for the ACI_EVT_TIMING event return parameters
RedBearLab 0:075ea2812998 284 */
RedBearLab 0:075ea2812998 285 typedef struct
RedBearLab 0:075ea2812998 286 {
RedBearLab 0:075ea2812998 287 uint16_t conn_rf_interval; /**< rf_interval = conn_rf_interval * 1.25 ms Range:0x0006 to 0x0C80 */
RedBearLab 0:075ea2812998 288 uint16_t conn_slave_rf_latency; /**< Number of RF events the slave can skip */
RedBearLab 0:075ea2812998 289 uint16_t conn_rf_timeout; /**< Timeout as a multiple of 10ms i.e timeout = conn_rf_timeout * 10ms Range: 0x000A to 0x0C80 */
RedBearLab 0:075ea2812998 290 } _aci_packed_ aci_evt_params_timing_t;
RedBearLab 0:075ea2812998 291
RedBearLab 0:075ea2812998 292 ACI_ASSERT_SIZE(aci_evt_params_timing_t, 6);
RedBearLab 0:075ea2812998 293
RedBearLab 0:075ea2812998 294 /**
RedBearLab 0:075ea2812998 295 * @struct aci_evt_params_data_credit_t
RedBearLab 0:075ea2812998 296 * @brief Structure for the ACI_EVT_DATA_CREDIT event return parameters
RedBearLab 0:075ea2812998 297 */
RedBearLab 0:075ea2812998 298 typedef struct
RedBearLab 0:075ea2812998 299 {
RedBearLab 0:075ea2812998 300 uint8_t credit;
RedBearLab 0:075ea2812998 301 } _aci_packed_ aci_evt_params_data_credit_t;
RedBearLab 0:075ea2812998 302
RedBearLab 0:075ea2812998 303 /**
RedBearLab 0:075ea2812998 304 * @struct aci_evt_params_data_ack_t
RedBearLab 0:075ea2812998 305 * @brief Structure for the ACI_EVT_DATA_ACK event return parameters
RedBearLab 0:075ea2812998 306 */
RedBearLab 0:075ea2812998 307 typedef struct
RedBearLab 0:075ea2812998 308 {
RedBearLab 0:075ea2812998 309 uint8_t pipe_number;
RedBearLab 0:075ea2812998 310 } _aci_packed_ aci_evt_params_data_ack_t;
RedBearLab 0:075ea2812998 311
RedBearLab 0:075ea2812998 312 /**
RedBearLab 0:075ea2812998 313 * @struct aci_evt_params_data_received_t
RedBearLab 0:075ea2812998 314 * @brief Structure for the ACI_EVT_DATA_RECEIVED event return parameters
RedBearLab 0:075ea2812998 315 */
RedBearLab 0:075ea2812998 316 typedef struct
RedBearLab 0:075ea2812998 317 {
RedBearLab 0:075ea2812998 318 aci_rx_data_t rx_data;
RedBearLab 0:075ea2812998 319 } _aci_packed_ aci_evt_params_data_received_t;
RedBearLab 0:075ea2812998 320
RedBearLab 0:075ea2812998 321 typedef struct
RedBearLab 0:075ea2812998 322 {
RedBearLab 0:075ea2812998 323 uint8_t content[1];
RedBearLab 0:075ea2812998 324 } _aci_packed_ error_data_t;
RedBearLab 0:075ea2812998 325
RedBearLab 0:075ea2812998 326 /**
RedBearLab 0:075ea2812998 327 * @struct aci_evt_params_pipe_error_t
RedBearLab 0:075ea2812998 328 * @brief Structure for the ACI_EVT_PIPE_ERROR event return parameters
RedBearLab 0:075ea2812998 329 */
RedBearLab 0:075ea2812998 330 typedef struct
RedBearLab 0:075ea2812998 331 {
RedBearLab 0:075ea2812998 332 uint8_t pipe_number;
RedBearLab 0:075ea2812998 333 uint8_t error_code;
RedBearLab 0:075ea2812998 334 union
RedBearLab 0:075ea2812998 335 {
RedBearLab 0:075ea2812998 336 error_data_t error_data;
RedBearLab 0:075ea2812998 337 } params;
RedBearLab 0:075ea2812998 338 } _aci_packed_ aci_evt_params_pipe_error_t;
RedBearLab 0:075ea2812998 339
RedBearLab 0:075ea2812998 340 /**
RedBearLab 0:075ea2812998 341 * @struct aci_evt_params_display_passkey_t
RedBearLab 0:075ea2812998 342 * @brief Structure for the ACI_EVT_DISPLAY_PASSKEY event return parameters
RedBearLab 0:075ea2812998 343 */
RedBearLab 0:075ea2812998 344 typedef struct
RedBearLab 0:075ea2812998 345 {
RedBearLab 0:075ea2812998 346 uint8_t passkey[6];
RedBearLab 0:075ea2812998 347 } _aci_packed_ aci_evt_params_display_passkey_t;
RedBearLab 0:075ea2812998 348
RedBearLab 0:075ea2812998 349 /**
RedBearLab 0:075ea2812998 350 * @struct aci_evt_params_key_request_t
RedBearLab 0:075ea2812998 351 * @brief Structure for the ACI_EVT_KEY_REQUEST event return parameters
RedBearLab 0:075ea2812998 352 */
RedBearLab 0:075ea2812998 353 typedef struct
RedBearLab 0:075ea2812998 354 {
RedBearLab 0:075ea2812998 355 aci_key_type_t key_type;
RedBearLab 0:075ea2812998 356 } _aci_packed_ aci_evt_params_key_request_t;
RedBearLab 0:075ea2812998 357
RedBearLab 0:075ea2812998 358 /**
RedBearLab 0:075ea2812998 359 * @struct aci_event_params_echo_t
RedBearLab 0:075ea2812998 360 * @brief Structure for the ACI_EVT_ECHO ACI event parameters
RedBearLab 0:075ea2812998 361 */
RedBearLab 0:075ea2812998 362 typedef struct
RedBearLab 0:075ea2812998 363 {
RedBearLab 0:075ea2812998 364 uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN];
RedBearLab 0:075ea2812998 365 } _aci_packed_ aci_evt_params_echo_t;
RedBearLab 0:075ea2812998 366
RedBearLab 0:075ea2812998 367 /**
RedBearLab 0:075ea2812998 368 * @struct aci_evt_t
RedBearLab 0:075ea2812998 369 * @brief Encapsulates a generic ACI event
RedBearLab 0:075ea2812998 370 */
RedBearLab 0:075ea2812998 371 typedef struct
RedBearLab 0:075ea2812998 372 {
RedBearLab 0:075ea2812998 373 uint8_t len;
RedBearLab 0:075ea2812998 374 aci_evt_opcode_t evt_opcode;
RedBearLab 0:075ea2812998 375 union
RedBearLab 0:075ea2812998 376 {
RedBearLab 0:075ea2812998 377 aci_evt_params_device_started_t device_started;
RedBearLab 0:075ea2812998 378 aci_evt_params_echo_t echo;
RedBearLab 0:075ea2812998 379 aci_evt_params_hw_error_t hw_error;
RedBearLab 0:075ea2812998 380 aci_evt_params_cmd_rsp_t cmd_rsp;
RedBearLab 0:075ea2812998 381 aci_evt_params_connected_t connected;
RedBearLab 0:075ea2812998 382 aci_evt_params_disconnected_t disconnected;
RedBearLab 0:075ea2812998 383 aci_evt_params_bond_status_t bond_status;
RedBearLab 0:075ea2812998 384 aci_evt_params_pipe_status_t pipe_status;
RedBearLab 0:075ea2812998 385 aci_evt_params_timing_t timing;
RedBearLab 0:075ea2812998 386 aci_evt_params_data_credit_t data_credit;
RedBearLab 0:075ea2812998 387 aci_evt_params_data_ack_t data_ack;
RedBearLab 0:075ea2812998 388 aci_evt_params_data_received_t data_received;
RedBearLab 0:075ea2812998 389 aci_evt_params_pipe_error_t pipe_error;
RedBearLab 0:075ea2812998 390 aci_evt_params_display_passkey_t display_passkey;
RedBearLab 0:075ea2812998 391 aci_evt_params_key_request_t key_request;
RedBearLab 0:075ea2812998 392 } params;
RedBearLab 0:075ea2812998 393 } _aci_packed_ aci_evt_t;
RedBearLab 0:075ea2812998 394
RedBearLab 0:075ea2812998 395 ACI_ASSERT_SIZE(aci_evt_t, 33);
RedBearLab 0:075ea2812998 396
RedBearLab 0:075ea2812998 397 #endif // ACI_EVTS_H__