added debugging
Fork of BLE_nRF8001 by
BLE_nRF8001/utility/aci.h@0:075ea2812998, 2014-10-17 (annotated)
- Committer:
- RedBearLab
- Date:
- Fri Oct 17 22:40:32 2014 +0800
- Revision:
- 0:075ea2812998
BLE_nRF8001 library first commit
Who changed what in which revision?
User | Revision | Line number | New 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 | * @defgroup aci aci |
RedBearLab | 0:075ea2812998 | 26 | * @{ |
RedBearLab | 0:075ea2812998 | 27 | * @ingroup lib |
RedBearLab | 0:075ea2812998 | 28 | * |
RedBearLab | 0:075ea2812998 | 29 | * @brief Definitions for the ACI (Application Control Interface) |
RedBearLab | 0:075ea2812998 | 30 | * @remarks |
RedBearLab | 0:075ea2812998 | 31 | * |
RedBearLab | 0:075ea2812998 | 32 | * Flow control from application mcu to nRF8001 |
RedBearLab | 0:075ea2812998 | 33 | * |
RedBearLab | 0:075ea2812998 | 34 | * Data flow control: |
RedBearLab | 0:075ea2812998 | 35 | * The flow control is credit based and the credit is initally given using the "device started" event. |
RedBearLab | 0:075ea2812998 | 36 | * A credit of more than 1 is given to the application mcu. |
RedBearLab | 0:075ea2812998 | 37 | * These credits are used only after the "ACI Connected Event" is sent to the application mcu. |
RedBearLab | 0:075ea2812998 | 38 | * |
RedBearLab | 0:075ea2812998 | 39 | * every send_data that is used decrements the credit available by 1. This is to be tracked by the application mcu. |
RedBearLab | 0:075ea2812998 | 40 | * When the credit available reaches 0, the application mcu shall not send any more send_data. |
RedBearLab | 0:075ea2812998 | 41 | * Credit is returned using the "credit event", this returned credit can then be used to send more send_data. |
RedBearLab | 0:075ea2812998 | 42 | * This flow control is not necessary and not available for Broadcast. |
RedBearLab | 0:075ea2812998 | 43 | * The entire credit available with the external mcu expires when a "disconnected" event arrives. |
RedBearLab | 0:075ea2812998 | 44 | * |
RedBearLab | 0:075ea2812998 | 45 | * Command flow control: |
RedBearLab | 0:075ea2812998 | 46 | * When a command is sent over the ACI, the next command shall not be sent until after a response |
RedBearLab | 0:075ea2812998 | 47 | * for the command sent has arrived. |
RedBearLab | 0:075ea2812998 | 48 | * |
RedBearLab | 0:075ea2812998 | 49 | */ |
RedBearLab | 0:075ea2812998 | 50 | |
RedBearLab | 0:075ea2812998 | 51 | #ifndef ACI_H__ |
RedBearLab | 0:075ea2812998 | 52 | #define ACI_H__ |
RedBearLab | 0:075ea2812998 | 53 | |
RedBearLab | 0:075ea2812998 | 54 | /** |
RedBearLab | 0:075ea2812998 | 55 | * Define an _aci_packed_ macro we can use in structure and enumerated type |
RedBearLab | 0:075ea2812998 | 56 | * declarations so that the types are sized consistently across different |
RedBearLab | 0:075ea2812998 | 57 | * platforms. In particular Arduino platforms using the GCC compiler and the |
RedBearLab | 0:075ea2812998 | 58 | * Nordic processors using the Keil compiler. |
RedBearLab | 0:075ea2812998 | 59 | * |
RedBearLab | 0:075ea2812998 | 60 | * It's really the GNU compiler platforms that need a special keyword to get |
RedBearLab | 0:075ea2812998 | 61 | * tight packing of values. On GNU platforms we can use the keyword: |
RedBearLab | 0:075ea2812998 | 62 | * __attribute__((__packed__)) |
RedBearLab | 0:075ea2812998 | 63 | * The thing is that while this keyword does the right thing with old and new |
RedBearLab | 0:075ea2812998 | 64 | * versions of the gcc (C) compiler it only works right with g++ (C++) compiler |
RedBearLab | 0:075ea2812998 | 65 | * versions that are version 4 or newer. |
RedBearLab | 0:075ea2812998 | 66 | */ |
RedBearLab | 0:075ea2812998 | 67 | #ifdef __GNUC__ |
RedBearLab | 0:075ea2812998 | 68 | # if __GNUC__ >= 4 |
RedBearLab | 0:075ea2812998 | 69 | # define _aci_packed_ __attribute__((__packed__)) |
RedBearLab | 0:075ea2812998 | 70 | # else |
RedBearLab | 0:075ea2812998 | 71 | # error "older g++ versions don't handle packed attribute in typedefs" |
RedBearLab | 0:075ea2812998 | 72 | # endif |
RedBearLab | 0:075ea2812998 | 73 | #else |
RedBearLab | 0:075ea2812998 | 74 | # define _aci_packed_ |
RedBearLab | 0:075ea2812998 | 75 | #endif |
RedBearLab | 0:075ea2812998 | 76 | |
RedBearLab | 0:075ea2812998 | 77 | /* |
RedBearLab | 0:075ea2812998 | 78 | * Define a macro that compares the size of the first parameter to the integer |
RedBearLab | 0:075ea2812998 | 79 | * value of the second parameter. If they do not match, a compile time error |
RedBearLab | 0:075ea2812998 | 80 | * for negative array size occurs (even gnu chokes on negative array size). |
RedBearLab | 0:075ea2812998 | 81 | * |
RedBearLab | 0:075ea2812998 | 82 | * This compare is done by creating a typedef for an array. No variables are |
RedBearLab | 0:075ea2812998 | 83 | * created and no memory is consumed with this check. The created type is |
RedBearLab | 0:075ea2812998 | 84 | * used for checking only and is not for use by any other code. The value |
RedBearLab | 0:075ea2812998 | 85 | * of 10 in this macro is arbitrary, it just needs to be a value larger |
RedBearLab | 0:075ea2812998 | 86 | * than one to result in a positive number for the array size. |
RedBearLab | 0:075ea2812998 | 87 | */ |
RedBearLab | 0:075ea2812998 | 88 | #define ACI_ASSERT_SIZE(x,y) typedef char x ## _assert_size_t[-1+10*(sizeof(x) == (y))] |
RedBearLab | 0:075ea2812998 | 89 | |
RedBearLab | 0:075ea2812998 | 90 | /** |
RedBearLab | 0:075ea2812998 | 91 | * @def ACI_VERSION |
RedBearLab | 0:075ea2812998 | 92 | * @brief Current ACI protocol version. 0 means a device that is not yet released. |
RedBearLab | 0:075ea2812998 | 93 | * A numer greater than 0 refers to a specific ACI version documented and released. |
RedBearLab | 0:075ea2812998 | 94 | * The ACI consists of the ACI commands, ACI events and error codes. |
RedBearLab | 0:075ea2812998 | 95 | */ |
RedBearLab | 0:075ea2812998 | 96 | #define ACI_VERSION (0x02) |
RedBearLab | 0:075ea2812998 | 97 | /** |
RedBearLab | 0:075ea2812998 | 98 | * @def BTLE_DEVICE_ADDRESS_SIZE |
RedBearLab | 0:075ea2812998 | 99 | * @brief Size in bytes of a Bluetooth Address |
RedBearLab | 0:075ea2812998 | 100 | */ |
RedBearLab | 0:075ea2812998 | 101 | #define BTLE_DEVICE_ADDRESS_SIZE (6) |
RedBearLab | 0:075ea2812998 | 102 | /** |
RedBearLab | 0:075ea2812998 | 103 | * @def ACI_PACKET_MAX_LEN |
RedBearLab | 0:075ea2812998 | 104 | * @brief Maximum length in bytes of a full ACI packet, including length prefix, opcode and payload |
RedBearLab | 0:075ea2812998 | 105 | */ |
RedBearLab | 0:075ea2812998 | 106 | #define ACI_PACKET_MAX_LEN (32) |
RedBearLab | 0:075ea2812998 | 107 | /** |
RedBearLab | 0:075ea2812998 | 108 | * @def ACI_ECHO_DATA_MAX_LEN |
RedBearLab | 0:075ea2812998 | 109 | * @brief Maximum length in bytes of the echo data portion |
RedBearLab | 0:075ea2812998 | 110 | */ |
RedBearLab | 0:075ea2812998 | 111 | #define ACI_ECHO_DATA_MAX_LEN (ACI_PACKET_MAX_LEN - 3) |
RedBearLab | 0:075ea2812998 | 112 | /** |
RedBearLab | 0:075ea2812998 | 113 | * @def ACI_DEVICE_MAX_PIPES |
RedBearLab | 0:075ea2812998 | 114 | * @brief Maximum number of ACI pipes |
RedBearLab | 0:075ea2812998 | 115 | */ |
RedBearLab | 0:075ea2812998 | 116 | #define ACI_DEVICE_MAX_PIPES (62) |
RedBearLab | 0:075ea2812998 | 117 | /** |
RedBearLab | 0:075ea2812998 | 118 | * @def ACI_PIPE_TX_DATA_MAX_LEN |
RedBearLab | 0:075ea2812998 | 119 | * @brief Maximum length in bytes of a transmission data pipe packet |
RedBearLab | 0:075ea2812998 | 120 | */ |
RedBearLab | 0:075ea2812998 | 121 | #define ACI_PIPE_TX_DATA_MAX_LEN (20) |
RedBearLab | 0:075ea2812998 | 122 | /** |
RedBearLab | 0:075ea2812998 | 123 | * @def ACI_PIPE_RX_DATA_MAX_LEN |
RedBearLab | 0:075ea2812998 | 124 | * @brief Maximum length in bytes of a reception data pipe packet |
RedBearLab | 0:075ea2812998 | 125 | */ |
RedBearLab | 0:075ea2812998 | 126 | #define ACI_PIPE_RX_DATA_MAX_LEN (22) |
RedBearLab | 0:075ea2812998 | 127 | /** |
RedBearLab | 0:075ea2812998 | 128 | * @def ACI_GAP_DEVNAME_MAX_LEN |
RedBearLab | 0:075ea2812998 | 129 | * @brief Maximum length in bytes of the GAP device name |
RedBearLab | 0:075ea2812998 | 130 | */ |
RedBearLab | 0:075ea2812998 | 131 | #define ACI_GAP_DEVNAME_MAX_LEN (20) |
RedBearLab | 0:075ea2812998 | 132 | /** |
RedBearLab | 0:075ea2812998 | 133 | * @def ACI_AD_PACKET_MAX_LEN |
RedBearLab | 0:075ea2812998 | 134 | * @brief Maximum length in bytes of an AD packet |
RedBearLab | 0:075ea2812998 | 135 | */ |
RedBearLab | 0:075ea2812998 | 136 | #define ACI_AD_PACKET_MAX_LEN (31) |
RedBearLab | 0:075ea2812998 | 137 | /** |
RedBearLab | 0:075ea2812998 | 138 | * @def ACI_AD_PACKET_MAX_USER_LEN |
RedBearLab | 0:075ea2812998 | 139 | * @brief Maximum usable length in bytes of an AD packet |
RedBearLab | 0:075ea2812998 | 140 | */ |
RedBearLab | 0:075ea2812998 | 141 | #define ACI_AD_PACKET_MAX_USER_LEN (31 - 3) |
RedBearLab | 0:075ea2812998 | 142 | /** |
RedBearLab | 0:075ea2812998 | 143 | * @def ACI_PIPE_INVALID |
RedBearLab | 0:075ea2812998 | 144 | * @brief Invalid pipe number |
RedBearLab | 0:075ea2812998 | 145 | */ |
RedBearLab | 0:075ea2812998 | 146 | #define ACI_PIPE_INVALID (0xFF) |
RedBearLab | 0:075ea2812998 | 147 | |
RedBearLab | 0:075ea2812998 | 148 | /** |
RedBearLab | 0:075ea2812998 | 149 | * @enum aci_pipe_store_t |
RedBearLab | 0:075ea2812998 | 150 | * @brief Storage type identifiers: local and remote |
RedBearLab | 0:075ea2812998 | 151 | */ |
RedBearLab | 0:075ea2812998 | 152 | typedef enum |
RedBearLab | 0:075ea2812998 | 153 | { |
RedBearLab | 0:075ea2812998 | 154 | ACI_STORE_INVALID = 0x0, |
RedBearLab | 0:075ea2812998 | 155 | ACI_STORE_LOCAL= 0x01, |
RedBearLab | 0:075ea2812998 | 156 | ACI_STORE_REMOTE= 0x02 |
RedBearLab | 0:075ea2812998 | 157 | } _aci_packed_ aci_pipe_store_t; |
RedBearLab | 0:075ea2812998 | 158 | |
RedBearLab | 0:075ea2812998 | 159 | /** |
RedBearLab | 0:075ea2812998 | 160 | * @enum aci_pipe_type_t |
RedBearLab | 0:075ea2812998 | 161 | * @brief Pipe types |
RedBearLab | 0:075ea2812998 | 162 | */ |
RedBearLab | 0:075ea2812998 | 163 | typedef enum |
RedBearLab | 0:075ea2812998 | 164 | { |
RedBearLab | 0:075ea2812998 | 165 | ACI_TX_BROADCAST = 0x0001, |
RedBearLab | 0:075ea2812998 | 166 | ACI_TX = 0x0002, |
RedBearLab | 0:075ea2812998 | 167 | ACI_TX_ACK = 0x0004, |
RedBearLab | 0:075ea2812998 | 168 | ACI_RX = 0x0008, |
RedBearLab | 0:075ea2812998 | 169 | ACI_RX_ACK = 0x0010, |
RedBearLab | 0:075ea2812998 | 170 | ACI_TX_REQ = 0x0020, |
RedBearLab | 0:075ea2812998 | 171 | ACI_RX_REQ = 0x0040, |
RedBearLab | 0:075ea2812998 | 172 | ACI_SET = 0x0080, |
RedBearLab | 0:075ea2812998 | 173 | ACI_TX_SIGN = 0x0100, |
RedBearLab | 0:075ea2812998 | 174 | ACI_RX_SIGN = 0x0200, |
RedBearLab | 0:075ea2812998 | 175 | ACI_RX_ACK_AUTO = 0x0400 |
RedBearLab | 0:075ea2812998 | 176 | } _aci_packed_ aci_pipe_type_t; |
RedBearLab | 0:075ea2812998 | 177 | |
RedBearLab | 0:075ea2812998 | 178 | ACI_ASSERT_SIZE(aci_pipe_type_t, 2); |
RedBearLab | 0:075ea2812998 | 179 | |
RedBearLab | 0:075ea2812998 | 180 | /** |
RedBearLab | 0:075ea2812998 | 181 | * @enum aci_bd_addr_type_t |
RedBearLab | 0:075ea2812998 | 182 | * @brief Bluetooth Address types |
RedBearLab | 0:075ea2812998 | 183 | */ |
RedBearLab | 0:075ea2812998 | 184 | typedef enum |
RedBearLab | 0:075ea2812998 | 185 | { |
RedBearLab | 0:075ea2812998 | 186 | ACI_BD_ADDR_TYPE_INVALID = 0x00, |
RedBearLab | 0:075ea2812998 | 187 | ACI_BD_ADDR_TYPE_PUBLIC = 0x01, |
RedBearLab | 0:075ea2812998 | 188 | ACI_BD_ADDR_TYPE_RANDOM_STATIC = 0x02, |
RedBearLab | 0:075ea2812998 | 189 | ACI_BD_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE = 0x03, |
RedBearLab | 0:075ea2812998 | 190 | ACI_BD_ADDR_TYPE_RANDOM_PRIVATE_UNRESOLVABLE = 0x04 |
RedBearLab | 0:075ea2812998 | 191 | } _aci_packed_ aci_bd_addr_type_t; |
RedBearLab | 0:075ea2812998 | 192 | |
RedBearLab | 0:075ea2812998 | 193 | /** |
RedBearLab | 0:075ea2812998 | 194 | * @enum aci_device_output_power_t |
RedBearLab | 0:075ea2812998 | 195 | * @brief Radio output power levels |
RedBearLab | 0:075ea2812998 | 196 | */ |
RedBearLab | 0:075ea2812998 | 197 | typedef enum |
RedBearLab | 0:075ea2812998 | 198 | { |
RedBearLab | 0:075ea2812998 | 199 | ACI_DEVICE_OUTPUT_POWER_MINUS_18DBM = 0x00, /**< Output power set to -18dBm */ |
RedBearLab | 0:075ea2812998 | 200 | ACI_DEVICE_OUTPUT_POWER_MINUS_12DBM = 0x01, /**< Output power set to -12dBm */ |
RedBearLab | 0:075ea2812998 | 201 | ACI_DEVICE_OUTPUT_POWER_MINUS_6DBM = 0x02, /**< Output power set to -6dBm */ |
RedBearLab | 0:075ea2812998 | 202 | ACI_DEVICE_OUTPUT_POWER_0DBM = 0x03 /**< Output power set to 0dBm - DEFAULT*/ |
RedBearLab | 0:075ea2812998 | 203 | } _aci_packed_ aci_device_output_power_t; |
RedBearLab | 0:075ea2812998 | 204 | |
RedBearLab | 0:075ea2812998 | 205 | /** |
RedBearLab | 0:075ea2812998 | 206 | * @enum aci_device_operation_mode_t |
RedBearLab | 0:075ea2812998 | 207 | * @brief Device operation modes |
RedBearLab | 0:075ea2812998 | 208 | */ |
RedBearLab | 0:075ea2812998 | 209 | typedef enum |
RedBearLab | 0:075ea2812998 | 210 | { |
RedBearLab | 0:075ea2812998 | 211 | ACI_DEVICE_INVALID =0x00, |
RedBearLab | 0:075ea2812998 | 212 | ACI_DEVICE_TEST =0x01, |
RedBearLab | 0:075ea2812998 | 213 | ACI_DEVICE_SETUP =0x02, |
RedBearLab | 0:075ea2812998 | 214 | ACI_DEVICE_STANDBY =0x03, |
RedBearLab | 0:075ea2812998 | 215 | ACI_DEVICE_SLEEP =0x04 |
RedBearLab | 0:075ea2812998 | 216 | } _aci_packed_ aci_device_operation_mode_t; |
RedBearLab | 0:075ea2812998 | 217 | |
RedBearLab | 0:075ea2812998 | 218 | /** |
RedBearLab | 0:075ea2812998 | 219 | * @enum aci_disconnect_reason_t |
RedBearLab | 0:075ea2812998 | 220 | * @brief Reason enumeration for ACI_CMD_DISCONNECT |
RedBearLab | 0:075ea2812998 | 221 | */ |
RedBearLab | 0:075ea2812998 | 222 | typedef enum |
RedBearLab | 0:075ea2812998 | 223 | { |
RedBearLab | 0:075ea2812998 | 224 | ACI_REASON_TERMINATE =0x01, /**< Use this to disconnect (does a terminate request), you need to wait for the "disconnected" event */ |
RedBearLab | 0:075ea2812998 | 225 | ACI_REASON_BAD_TIMING =0x02 /*<Use this to disconnect and inform the peer, that the timing on the link is not acceptable for the device, you need to wait for the "disconnected" event */ |
RedBearLab | 0:075ea2812998 | 226 | } _aci_packed_ aci_disconnect_reason_t; |
RedBearLab | 0:075ea2812998 | 227 | |
RedBearLab | 0:075ea2812998 | 228 | /** |
RedBearLab | 0:075ea2812998 | 229 | * @enum aci_test_mode_change_t |
RedBearLab | 0:075ea2812998 | 230 | * @brief Device test mode control |
RedBearLab | 0:075ea2812998 | 231 | */ |
RedBearLab | 0:075ea2812998 | 232 | typedef enum |
RedBearLab | 0:075ea2812998 | 233 | { |
RedBearLab | 0:075ea2812998 | 234 | ACI_TEST_MODE_DTM_UART = 0x01, |
RedBearLab | 0:075ea2812998 | 235 | ACI_TEST_MODE_DTM_ACI = 0x02, |
RedBearLab | 0:075ea2812998 | 236 | ACI_TEST_MODE_EXIT = 0xFF |
RedBearLab | 0:075ea2812998 | 237 | |
RedBearLab | 0:075ea2812998 | 238 | } _aci_packed_ aci_test_mode_change_t; |
RedBearLab | 0:075ea2812998 | 239 | |
RedBearLab | 0:075ea2812998 | 240 | ACI_ASSERT_SIZE(aci_test_mode_change_t, 1); |
RedBearLab | 0:075ea2812998 | 241 | |
RedBearLab | 0:075ea2812998 | 242 | /** |
RedBearLab | 0:075ea2812998 | 243 | * @enum aci_permissions_t |
RedBearLab | 0:075ea2812998 | 244 | * @brief Data store permissions |
RedBearLab | 0:075ea2812998 | 245 | */ |
RedBearLab | 0:075ea2812998 | 246 | typedef enum |
RedBearLab | 0:075ea2812998 | 247 | { |
RedBearLab | 0:075ea2812998 | 248 | ACI_PERMISSIONS_NONE =0x00, |
RedBearLab | 0:075ea2812998 | 249 | ACI_PERMISSIONS_LINK_AUTHENTICATED =0x01 |
RedBearLab | 0:075ea2812998 | 250 | } _aci_packed_ aci_permissions_t; |
RedBearLab | 0:075ea2812998 | 251 | |
RedBearLab | 0:075ea2812998 | 252 | /** |
RedBearLab | 0:075ea2812998 | 253 | * @def ACI_VS_UUID_128_MAX_COUNT |
RedBearLab | 0:075ea2812998 | 254 | * @brief Maximum number of 128-bit Vendor Specific |
RedBearLab | 0:075ea2812998 | 255 | * UUIDs that can be set |
RedBearLab | 0:075ea2812998 | 256 | */ |
RedBearLab | 0:075ea2812998 | 257 | #define ACI_VS_UUID_128_MAX_COUNT 64 /** #0 reserved for invalid, #1 reservered for BT SIG and a maximum of 1024 bytes (16*64) */ |
RedBearLab | 0:075ea2812998 | 258 | |
RedBearLab | 0:075ea2812998 | 259 | /** |
RedBearLab | 0:075ea2812998 | 260 | * @struct aci_ll_conn_params_t |
RedBearLab | 0:075ea2812998 | 261 | * @brief Link Layer Connection Parameters |
RedBearLab | 0:075ea2812998 | 262 | */ |
RedBearLab | 0:075ea2812998 | 263 | typedef struct |
RedBearLab | 0:075ea2812998 | 264 | { |
RedBearLab | 0:075ea2812998 | 265 | uint16_t min_conn_interval; /**< Minimum connection interval requested from peer */ |
RedBearLab | 0:075ea2812998 | 266 | #define ACI_PPCP_MIN_CONN_INTVL_NONE 0xFFFF |
RedBearLab | 0:075ea2812998 | 267 | #define ACI_PPCP_MIN_CONN_INTVL_MIN 0x0006 |
RedBearLab | 0:075ea2812998 | 268 | #define ACI_PPCP_MIN_CONN_INTVL_MAX 0x0C80 |
RedBearLab | 0:075ea2812998 | 269 | uint16_t max_conn_interval; /**< Maximum connection interval requested from peer */ |
RedBearLab | 0:075ea2812998 | 270 | #define ACI_PPCP_MAX_CONN_INTVL_NONE 0xFFFF |
RedBearLab | 0:075ea2812998 | 271 | #define ACI_PPCP_MAX_CONN_INTVL_MIN 0x0006 |
RedBearLab | 0:075ea2812998 | 272 | #define ACI_PPCP_MAX_CONN_INTVL_MAX 0x0C80 |
RedBearLab | 0:075ea2812998 | 273 | uint16_t slave_latency; /**< Connection interval latency requested from peer */ |
RedBearLab | 0:075ea2812998 | 274 | #define ACI_PPCP_SLAVE_LATENCY_MAX 0x03E8 |
RedBearLab | 0:075ea2812998 | 275 | uint16_t timeout_mult; /**< Link supervisor timeout multiplier requested from peer */ |
RedBearLab | 0:075ea2812998 | 276 | #define ACI_PPCP_TIMEOUT_MULT_NONE 0xFFFF |
RedBearLab | 0:075ea2812998 | 277 | #define ACI_PPCP_TIMEOUT_MULT_MIN 0x000A |
RedBearLab | 0:075ea2812998 | 278 | #define ACI_PPCP_TIMEOUT_MULT_MAX 0x0C80 |
RedBearLab | 0:075ea2812998 | 279 | } _aci_packed_ aci_ll_conn_params_t; |
RedBearLab | 0:075ea2812998 | 280 | |
RedBearLab | 0:075ea2812998 | 281 | /** |
RedBearLab | 0:075ea2812998 | 282 | * @def aci_gap_ppcp_t |
RedBearLab | 0:075ea2812998 | 283 | * @brief GAP Peripheral Preferred Connection Parameters |
RedBearLab | 0:075ea2812998 | 284 | */ |
RedBearLab | 0:075ea2812998 | 285 | #define aci_gap_ppcp_t aci_ll_conn_params_t |
RedBearLab | 0:075ea2812998 | 286 | |
RedBearLab | 0:075ea2812998 | 287 | /** |
RedBearLab | 0:075ea2812998 | 288 | * @def ACI_AD_LOC_SVCUUID_16_MAX_COUNT |
RedBearLab | 0:075ea2812998 | 289 | * @brief Maximum number of 16-bit UUIDs that can |
RedBearLab | 0:075ea2812998 | 290 | * be inserted in the Services tag of AD |
RedBearLab | 0:075ea2812998 | 291 | */ |
RedBearLab | 0:075ea2812998 | 292 | #define ACI_AD_LOC_SVCUUID_16_MAX_COUNT 5 |
RedBearLab | 0:075ea2812998 | 293 | |
RedBearLab | 0:075ea2812998 | 294 | /** |
RedBearLab | 0:075ea2812998 | 295 | * @def ACI_AD_LOC_SVCUUID_128_MAX_COUNT |
RedBearLab | 0:075ea2812998 | 296 | * @brief Maximum number of 128-bit UUIDs that can |
RedBearLab | 0:075ea2812998 | 297 | * be inserted in the Services tag of AD |
RedBearLab | 0:075ea2812998 | 298 | */ |
RedBearLab | 0:075ea2812998 | 299 | #define ACI_AD_LOC_SVCUUID_128_MAX_COUNT 1 |
RedBearLab | 0:075ea2812998 | 300 | |
RedBearLab | 0:075ea2812998 | 301 | /** |
RedBearLab | 0:075ea2812998 | 302 | * @def ACI_AD_SOL_SVCUUID_16_MAX_COUNT |
RedBearLab | 0:075ea2812998 | 303 | * @brief Maximum number of UUIDs that can |
RedBearLab | 0:075ea2812998 | 304 | * be inserted in the Solicited Services tag of AD |
RedBearLab | 0:075ea2812998 | 305 | */ |
RedBearLab | 0:075ea2812998 | 306 | #define ACI_AD_SOL_SVCUUID_16_MAX_COUNT 5 |
RedBearLab | 0:075ea2812998 | 307 | |
RedBearLab | 0:075ea2812998 | 308 | /** |
RedBearLab | 0:075ea2812998 | 309 | * @def ACI_AD_SOL_SVCUUID_128_MAX_COUNT |
RedBearLab | 0:075ea2812998 | 310 | * @brief Maximum number of UUIDs that can |
RedBearLab | 0:075ea2812998 | 311 | * be inserted in the Solicited Services tag of AD |
RedBearLab | 0:075ea2812998 | 312 | */ |
RedBearLab | 0:075ea2812998 | 313 | #define ACI_AD_SOL_SVCUUID_128_MAX_COUNT 1 |
RedBearLab | 0:075ea2812998 | 314 | |
RedBearLab | 0:075ea2812998 | 315 | /** |
RedBearLab | 0:075ea2812998 | 316 | * @def ACI_SEC_ENCKEY_SIZE_MIN |
RedBearLab | 0:075ea2812998 | 317 | * @brief Minimum encryption key size |
RedBearLab | 0:075ea2812998 | 318 | */ |
RedBearLab | 0:075ea2812998 | 319 | #define ACI_SEC_ENCKEY_SIZE_MIN 7 |
RedBearLab | 0:075ea2812998 | 320 | /** |
RedBearLab | 0:075ea2812998 | 321 | * @def ACI_SEC_ENCKEY_SIZE_MAX |
RedBearLab | 0:075ea2812998 | 322 | * @brief Maximum encryption key size |
RedBearLab | 0:075ea2812998 | 323 | */ |
RedBearLab | 0:075ea2812998 | 324 | #define ACI_SEC_ENCKEY_SIZE_MAX 16 |
RedBearLab | 0:075ea2812998 | 325 | /** |
RedBearLab | 0:075ea2812998 | 326 | * @def ACI_CUSTOM_AD_TYPE_MAX_COUNT |
RedBearLab | 0:075ea2812998 | 327 | * @brief Maximum number of custom ad types |
RedBearLab | 0:075ea2812998 | 328 | */ |
RedBearLab | 0:075ea2812998 | 329 | #define ACI_CUSTOM_AD_TYPE_MAX_COUNT 8 |
RedBearLab | 0:075ea2812998 | 330 | /** |
RedBearLab | 0:075ea2812998 | 331 | * @def ACI_CUSTOM_AD_TYPE_MAX_DATA_LENGTH |
RedBearLab | 0:075ea2812998 | 332 | * @brief Maximum custom ad type data size |
RedBearLab | 0:075ea2812998 | 333 | */ |
RedBearLab | 0:075ea2812998 | 334 | #define ACI_CUSTOM_AD_TYPE_MAX_DATA_LENGTH 20 |
RedBearLab | 0:075ea2812998 | 335 | |
RedBearLab | 0:075ea2812998 | 336 | /** |
RedBearLab | 0:075ea2812998 | 337 | * @struct aci_tx_data_t |
RedBearLab | 0:075ea2812998 | 338 | * @brief Generic ACI transmit data structure |
RedBearLab | 0:075ea2812998 | 339 | */ |
RedBearLab | 0:075ea2812998 | 340 | typedef struct |
RedBearLab | 0:075ea2812998 | 341 | { |
RedBearLab | 0:075ea2812998 | 342 | uint8_t pipe_number; |
RedBearLab | 0:075ea2812998 | 343 | uint8_t aci_data[ACI_PIPE_TX_DATA_MAX_LEN]; |
RedBearLab | 0:075ea2812998 | 344 | } _aci_packed_ aci_tx_data_t; |
RedBearLab | 0:075ea2812998 | 345 | |
RedBearLab | 0:075ea2812998 | 346 | ACI_ASSERT_SIZE(aci_tx_data_t, ACI_PIPE_TX_DATA_MAX_LEN + 1); |
RedBearLab | 0:075ea2812998 | 347 | |
RedBearLab | 0:075ea2812998 | 348 | /** |
RedBearLab | 0:075ea2812998 | 349 | * @struct aci_rx_data_t |
RedBearLab | 0:075ea2812998 | 350 | * @brief Generic ACI receive data structure |
RedBearLab | 0:075ea2812998 | 351 | */ |
RedBearLab | 0:075ea2812998 | 352 | typedef struct |
RedBearLab | 0:075ea2812998 | 353 | { |
RedBearLab | 0:075ea2812998 | 354 | uint8_t pipe_number; |
RedBearLab | 0:075ea2812998 | 355 | uint8_t aci_data[ACI_PIPE_RX_DATA_MAX_LEN]; |
RedBearLab | 0:075ea2812998 | 356 | } _aci_packed_ aci_rx_data_t; |
RedBearLab | 0:075ea2812998 | 357 | |
RedBearLab | 0:075ea2812998 | 358 | ACI_ASSERT_SIZE(aci_rx_data_t, ACI_PIPE_RX_DATA_MAX_LEN + 1); |
RedBearLab | 0:075ea2812998 | 359 | |
RedBearLab | 0:075ea2812998 | 360 | /** |
RedBearLab | 0:075ea2812998 | 361 | * @enum aci_hw_error_t |
RedBearLab | 0:075ea2812998 | 362 | * @brief Hardware Error codes |
RedBearLab | 0:075ea2812998 | 363 | */ |
RedBearLab | 0:075ea2812998 | 364 | typedef enum |
RedBearLab | 0:075ea2812998 | 365 | { |
RedBearLab | 0:075ea2812998 | 366 | ACI_HW_ERROR_NONE = 0x00, |
RedBearLab | 0:075ea2812998 | 367 | ACI_HW_ERROR_FATAL = 0x01 |
RedBearLab | 0:075ea2812998 | 368 | } _aci_packed_ aci_hw_error_t; |
RedBearLab | 0:075ea2812998 | 369 | |
RedBearLab | 0:075ea2812998 | 370 | /** |
RedBearLab | 0:075ea2812998 | 371 | * @enum aci_clock_accuracy_t |
RedBearLab | 0:075ea2812998 | 372 | * @brief Bluetooth Low Energy Clock Accuracy |
RedBearLab | 0:075ea2812998 | 373 | */ |
RedBearLab | 0:075ea2812998 | 374 | typedef enum |
RedBearLab | 0:075ea2812998 | 375 | { |
RedBearLab | 0:075ea2812998 | 376 | ACI_CLOCK_ACCURACY_500_PPM = 0x00, |
RedBearLab | 0:075ea2812998 | 377 | ACI_CLOCK_ACCURACY_250_PPM = 0x01, |
RedBearLab | 0:075ea2812998 | 378 | ACI_CLOCK_ACCURACY_150_PPM = 0x02, |
RedBearLab | 0:075ea2812998 | 379 | ACI_CLOCK_ACCURACY_100_PPM = 0x03, |
RedBearLab | 0:075ea2812998 | 380 | ACI_CLOCK_ACCURACY_75_PPM = 0x04, |
RedBearLab | 0:075ea2812998 | 381 | ACI_CLOCK_ACCURACY_50_PPM = 0x05, |
RedBearLab | 0:075ea2812998 | 382 | ACI_CLOCK_ACCURACY_30_PPM = 0x06, |
RedBearLab | 0:075ea2812998 | 383 | ACI_CLOCK_ACCURACY_20_PPM = 0x07 |
RedBearLab | 0:075ea2812998 | 384 | } _aci_packed_ aci_clock_accuracy_t; |
RedBearLab | 0:075ea2812998 | 385 | |
RedBearLab | 0:075ea2812998 | 386 | /** |
RedBearLab | 0:075ea2812998 | 387 | * @enum aci_app_latency_mode_t |
RedBearLab | 0:075ea2812998 | 388 | * @brief Application latency modes |
RedBearLab | 0:075ea2812998 | 389 | */ |
RedBearLab | 0:075ea2812998 | 390 | typedef enum |
RedBearLab | 0:075ea2812998 | 391 | { |
RedBearLab | 0:075ea2812998 | 392 | ACI_APP_LATENCY_DISABLE = 0, |
RedBearLab | 0:075ea2812998 | 393 | ACI_APP_LATENCY_ENABLE = 1 |
RedBearLab | 0:075ea2812998 | 394 | } _aci_packed_ aci_app_latency_mode_t; |
RedBearLab | 0:075ea2812998 | 395 | |
RedBearLab | 0:075ea2812998 | 396 | /** |
RedBearLab | 0:075ea2812998 | 397 | * @enum gatt_format_t |
RedBearLab | 0:075ea2812998 | 398 | * @brief GATT format definitions |
RedBearLab | 0:075ea2812998 | 399 | */ |
RedBearLab | 0:075ea2812998 | 400 | typedef enum |
RedBearLab | 0:075ea2812998 | 401 | { |
RedBearLab | 0:075ea2812998 | 402 | ACI_GATT_FORMAT_NONE = 0x00, /**< No characteristic format available */ |
RedBearLab | 0:075ea2812998 | 403 | ACI_GATT_FORMAT_BOOLEAN = 0x01, /**< Not Supported */ |
RedBearLab | 0:075ea2812998 | 404 | ACI_GATT_FORMAT_2BIT = 0x02, /**< Not Supported */ |
RedBearLab | 0:075ea2812998 | 405 | ACI_GATT_FORMAT_NIBBLE = 0x03, /**< Not Supported */ |
RedBearLab | 0:075ea2812998 | 406 | ACI_GATT_FORMAT_UINT8 = 0x04, |
RedBearLab | 0:075ea2812998 | 407 | ACI_GATT_FORMAT_UINT12 = 0x05, |
RedBearLab | 0:075ea2812998 | 408 | ACI_GATT_FORMAT_UINT16 = 0x06, |
RedBearLab | 0:075ea2812998 | 409 | ACI_GATT_FORMAT_UINT24 = 0x07, |
RedBearLab | 0:075ea2812998 | 410 | ACI_GATT_FORMAT_UINT32 = 0x08, |
RedBearLab | 0:075ea2812998 | 411 | ACI_GATT_FORMAT_UINT48 = 0x09, |
RedBearLab | 0:075ea2812998 | 412 | ACI_GATT_FORMAT_UINT64 = 0x0A, |
RedBearLab | 0:075ea2812998 | 413 | ACI_GATT_FORMAT_UINT128 = 0x0B, |
RedBearLab | 0:075ea2812998 | 414 | ACI_GATT_FORMAT_SINT8 = 0x0C, |
RedBearLab | 0:075ea2812998 | 415 | ACI_GATT_FORMAT_SINT12 = 0x0D, |
RedBearLab | 0:075ea2812998 | 416 | ACI_GATT_FORMAT_SINT16 = 0x0E, |
RedBearLab | 0:075ea2812998 | 417 | ACI_GATT_FORMAT_SINT24 = 0x0F, |
RedBearLab | 0:075ea2812998 | 418 | ACI_GATT_FORMAT_SINT32 = 0x10, |
RedBearLab | 0:075ea2812998 | 419 | ACI_GATT_FORMAT_SINT48 = 0x11, |
RedBearLab | 0:075ea2812998 | 420 | ACI_GATT_FORMAT_SINT64 = 0x12, |
RedBearLab | 0:075ea2812998 | 421 | ACI_GATT_FORMAT_SINT128 = 0x13, |
RedBearLab | 0:075ea2812998 | 422 | ACI_GATT_FORMAT_FLOAT32 = 0x14, |
RedBearLab | 0:075ea2812998 | 423 | ACI_GATT_FORMAT_FLOAT64 = 0x15, |
RedBearLab | 0:075ea2812998 | 424 | ACI_GATT_FORMAT_SFLOAT = 0x16, |
RedBearLab | 0:075ea2812998 | 425 | ACI_GATT_FORMAT_FLOAT = 0x17, |
RedBearLab | 0:075ea2812998 | 426 | ACI_GATT_FORMAT_DUINT16 = 0x18, |
RedBearLab | 0:075ea2812998 | 427 | ACI_GATT_FORMAT_UTF8S = 0x19, |
RedBearLab | 0:075ea2812998 | 428 | ACI_GATT_FORMAT_UTF16S = 0x1A, |
RedBearLab | 0:075ea2812998 | 429 | ACI_GATT_FORMAT_STRUCT = 0x1B |
RedBearLab | 0:075ea2812998 | 430 | } _aci_packed_ aci_gatt_format_t; |
RedBearLab | 0:075ea2812998 | 431 | |
RedBearLab | 0:075ea2812998 | 432 | /** |
RedBearLab | 0:075ea2812998 | 433 | * @brief GATT Bluetooth namespace |
RedBearLab | 0:075ea2812998 | 434 | */ |
RedBearLab | 0:075ea2812998 | 435 | typedef enum |
RedBearLab | 0:075ea2812998 | 436 | { |
RedBearLab | 0:075ea2812998 | 437 | ACI_GATT_NAMESPACE_INVALID = 0x00, |
RedBearLab | 0:075ea2812998 | 438 | ACI_GATT_NAMESPACE_BTSIG = 0x01 /**< Bluetooth SIG */ |
RedBearLab | 0:075ea2812998 | 439 | } _aci_packed_ aci_gatt_namespace_t; |
RedBearLab | 0:075ea2812998 | 440 | |
RedBearLab | 0:075ea2812998 | 441 | /** |
RedBearLab | 0:075ea2812998 | 442 | * @brief Security key types |
RedBearLab | 0:075ea2812998 | 443 | */ |
RedBearLab | 0:075ea2812998 | 444 | typedef enum |
RedBearLab | 0:075ea2812998 | 445 | { |
RedBearLab | 0:075ea2812998 | 446 | ACI_KEY_TYPE_INVALID = 0x00, |
RedBearLab | 0:075ea2812998 | 447 | ACI_KEY_TYPE_PASSKEY = 0x01 |
RedBearLab | 0:075ea2812998 | 448 | } _aci_packed_ aci_key_type_t; |
RedBearLab | 0:075ea2812998 | 449 | |
RedBearLab | 0:075ea2812998 | 450 | /** |
RedBearLab | 0:075ea2812998 | 451 | * @enum aci_bond_status_code_t |
RedBearLab | 0:075ea2812998 | 452 | * @brief Bond status code |
RedBearLab | 0:075ea2812998 | 453 | */ |
RedBearLab | 0:075ea2812998 | 454 | typedef enum |
RedBearLab | 0:075ea2812998 | 455 | { |
RedBearLab | 0:075ea2812998 | 456 | /** |
RedBearLab | 0:075ea2812998 | 457 | * Bonding succeeded |
RedBearLab | 0:075ea2812998 | 458 | */ |
RedBearLab | 0:075ea2812998 | 459 | ACI_BOND_STATUS_SUCCESS = 0x00, |
RedBearLab | 0:075ea2812998 | 460 | /** |
RedBearLab | 0:075ea2812998 | 461 | * Bonding failed |
RedBearLab | 0:075ea2812998 | 462 | */ |
RedBearLab | 0:075ea2812998 | 463 | ACI_BOND_STATUS_FAILED = 0x01, |
RedBearLab | 0:075ea2812998 | 464 | /** |
RedBearLab | 0:075ea2812998 | 465 | * Bonding error: Timeout can occur when link termination is unexpected or did not get connected OR SMP timer expired |
RedBearLab | 0:075ea2812998 | 466 | */ |
RedBearLab | 0:075ea2812998 | 467 | ACI_BOND_STATUS_FAILED_TIMED_OUT = 0x02, |
RedBearLab | 0:075ea2812998 | 468 | /** |
RedBearLab | 0:075ea2812998 | 469 | * Bonding error: Passkey entry failed |
RedBearLab | 0:075ea2812998 | 470 | */ |
RedBearLab | 0:075ea2812998 | 471 | ACI_BOND_STATUS_FAILED_PASSKEY_ENTRY_FAILED = 0x81, |
RedBearLab | 0:075ea2812998 | 472 | /** |
RedBearLab | 0:075ea2812998 | 473 | * Bonding error: OOB unavailable |
RedBearLab | 0:075ea2812998 | 474 | */ |
RedBearLab | 0:075ea2812998 | 475 | ACI_BOND_STATUS_FAILED_OOB_UNAVAILABLE = 0x82, |
RedBearLab | 0:075ea2812998 | 476 | /** |
RedBearLab | 0:075ea2812998 | 477 | * Bonding error: Authentication request failed |
RedBearLab | 0:075ea2812998 | 478 | */ |
RedBearLab | 0:075ea2812998 | 479 | ACI_BOND_STATUS_FAILED_AUTHENTICATION_REQ = 0x83, |
RedBearLab | 0:075ea2812998 | 480 | /** |
RedBearLab | 0:075ea2812998 | 481 | * Bonding error: Confirm value failed |
RedBearLab | 0:075ea2812998 | 482 | */ |
RedBearLab | 0:075ea2812998 | 483 | ACI_BOND_STATUS_FAILED_CONFIRM_VALUE = 0x84, |
RedBearLab | 0:075ea2812998 | 484 | /** |
RedBearLab | 0:075ea2812998 | 485 | * Bonding error: Pairing unsupported |
RedBearLab | 0:075ea2812998 | 486 | */ |
RedBearLab | 0:075ea2812998 | 487 | ACI_BOND_STATUS_FAILED_PAIRING_UNSUPPORTED = 0x85, |
RedBearLab | 0:075ea2812998 | 488 | /** |
RedBearLab | 0:075ea2812998 | 489 | * Bonding error: Invalid encryption key size |
RedBearLab | 0:075ea2812998 | 490 | */ |
RedBearLab | 0:075ea2812998 | 491 | ACI_BOND_STATUS_FAILED_ENCRYPTION_KEY_SIZE = 0x86, |
RedBearLab | 0:075ea2812998 | 492 | /** |
RedBearLab | 0:075ea2812998 | 493 | * Bonding error: Unsupported SMP command |
RedBearLab | 0:075ea2812998 | 494 | */ |
RedBearLab | 0:075ea2812998 | 495 | ACI_BOND_STATUS_FAILED_SMP_CMD_UNSUPPORTED = 0x87, |
RedBearLab | 0:075ea2812998 | 496 | /** |
RedBearLab | 0:075ea2812998 | 497 | * Bonding error: Unspecified reason |
RedBearLab | 0:075ea2812998 | 498 | */ |
RedBearLab | 0:075ea2812998 | 499 | ACI_BOND_STATUS_FAILED_UNSPECIFIED_REASON = 0x88, |
RedBearLab | 0:075ea2812998 | 500 | /** |
RedBearLab | 0:075ea2812998 | 501 | * Bonding error: Too many attempts |
RedBearLab | 0:075ea2812998 | 502 | */ |
RedBearLab | 0:075ea2812998 | 503 | ACI_BOND_STATUS_FAILED_REPEATED_ATTEMPTS = 0x89, |
RedBearLab | 0:075ea2812998 | 504 | /** |
RedBearLab | 0:075ea2812998 | 505 | * Bonding error: Invalid parameters |
RedBearLab | 0:075ea2812998 | 506 | */ |
RedBearLab | 0:075ea2812998 | 507 | ACI_BOND_STATUS_FAILED_INVALID_PARAMETERS = 0x8A |
RedBearLab | 0:075ea2812998 | 508 | |
RedBearLab | 0:075ea2812998 | 509 | } _aci_packed_ aci_bond_status_code_t; |
RedBearLab | 0:075ea2812998 | 510 | |
RedBearLab | 0:075ea2812998 | 511 | ACI_ASSERT_SIZE(aci_bond_status_code_t, 1); |
RedBearLab | 0:075ea2812998 | 512 | |
RedBearLab | 0:075ea2812998 | 513 | /** |
RedBearLab | 0:075ea2812998 | 514 | * @enum aci_bond_status_source_t |
RedBearLab | 0:075ea2812998 | 515 | * @brief Source of a bond status code |
RedBearLab | 0:075ea2812998 | 516 | */ |
RedBearLab | 0:075ea2812998 | 517 | typedef enum |
RedBearLab | 0:075ea2812998 | 518 | { |
RedBearLab | 0:075ea2812998 | 519 | ACI_BOND_STATUS_SOURCE_INVALID = 0x00, |
RedBearLab | 0:075ea2812998 | 520 | ACI_BOND_STATUS_SOURCE_LOCAL = 0x01, |
RedBearLab | 0:075ea2812998 | 521 | ACI_BOND_STATUS_SOURCE_REMOTE = 0x02 |
RedBearLab | 0:075ea2812998 | 522 | |
RedBearLab | 0:075ea2812998 | 523 | } _aci_packed_ aci_bond_status_source_t; |
RedBearLab | 0:075ea2812998 | 524 | |
RedBearLab | 0:075ea2812998 | 525 | /** |
RedBearLab | 0:075ea2812998 | 526 | * @enum aci_status_code_t |
RedBearLab | 0:075ea2812998 | 527 | * @brief ACI status codes |
RedBearLab | 0:075ea2812998 | 528 | */ |
RedBearLab | 0:075ea2812998 | 529 | typedef enum |
RedBearLab | 0:075ea2812998 | 530 | { |
RedBearLab | 0:075ea2812998 | 531 | /** |
RedBearLab | 0:075ea2812998 | 532 | * Success |
RedBearLab | 0:075ea2812998 | 533 | */ |
RedBearLab | 0:075ea2812998 | 534 | ACI_STATUS_SUCCESS = 0x00, |
RedBearLab | 0:075ea2812998 | 535 | /** |
RedBearLab | 0:075ea2812998 | 536 | * Transaction continuation status |
RedBearLab | 0:075ea2812998 | 537 | */ |
RedBearLab | 0:075ea2812998 | 538 | ACI_STATUS_TRANSACTION_CONTINUE = 0x01, |
RedBearLab | 0:075ea2812998 | 539 | /** |
RedBearLab | 0:075ea2812998 | 540 | * Transaction completed |
RedBearLab | 0:075ea2812998 | 541 | */ |
RedBearLab | 0:075ea2812998 | 542 | ACI_STATUS_TRANSACTION_COMPLETE = 0x02, |
RedBearLab | 0:075ea2812998 | 543 | /** |
RedBearLab | 0:075ea2812998 | 544 | * Extended status, further checks needed |
RedBearLab | 0:075ea2812998 | 545 | */ |
RedBearLab | 0:075ea2812998 | 546 | ACI_STATUS_EXTENDED = 0x03, |
RedBearLab | 0:075ea2812998 | 547 | /** |
RedBearLab | 0:075ea2812998 | 548 | * Unknown error. |
RedBearLab | 0:075ea2812998 | 549 | */ |
RedBearLab | 0:075ea2812998 | 550 | ACI_STATUS_ERROR_UNKNOWN = 0x80, |
RedBearLab | 0:075ea2812998 | 551 | /** |
RedBearLab | 0:075ea2812998 | 552 | * Internal error. |
RedBearLab | 0:075ea2812998 | 553 | */ |
RedBearLab | 0:075ea2812998 | 554 | ACI_STATUS_ERROR_INTERNAL = 0x81, |
RedBearLab | 0:075ea2812998 | 555 | /** |
RedBearLab | 0:075ea2812998 | 556 | * Unknown command |
RedBearLab | 0:075ea2812998 | 557 | */ |
RedBearLab | 0:075ea2812998 | 558 | ACI_STATUS_ERROR_CMD_UNKNOWN = 0x82, |
RedBearLab | 0:075ea2812998 | 559 | /** |
RedBearLab | 0:075ea2812998 | 560 | * Command invalid in the current device state |
RedBearLab | 0:075ea2812998 | 561 | */ |
RedBearLab | 0:075ea2812998 | 562 | ACI_STATUS_ERROR_DEVICE_STATE_INVALID = 0x83, |
RedBearLab | 0:075ea2812998 | 563 | /** |
RedBearLab | 0:075ea2812998 | 564 | * Invalid length |
RedBearLab | 0:075ea2812998 | 565 | */ |
RedBearLab | 0:075ea2812998 | 566 | ACI_STATUS_ERROR_INVALID_LENGTH = 0x84, |
RedBearLab | 0:075ea2812998 | 567 | /** |
RedBearLab | 0:075ea2812998 | 568 | * Invalid input parameters |
RedBearLab | 0:075ea2812998 | 569 | */ |
RedBearLab | 0:075ea2812998 | 570 | ACI_STATUS_ERROR_INVALID_PARAMETER = 0x85, |
RedBearLab | 0:075ea2812998 | 571 | /** |
RedBearLab | 0:075ea2812998 | 572 | * Busy |
RedBearLab | 0:075ea2812998 | 573 | */ |
RedBearLab | 0:075ea2812998 | 574 | ACI_STATUS_ERROR_BUSY = 0x86, |
RedBearLab | 0:075ea2812998 | 575 | /** |
RedBearLab | 0:075ea2812998 | 576 | * Invalid data format or contents |
RedBearLab | 0:075ea2812998 | 577 | */ |
RedBearLab | 0:075ea2812998 | 578 | ACI_STATUS_ERROR_INVALID_DATA = 0x87, |
RedBearLab | 0:075ea2812998 | 579 | /** |
RedBearLab | 0:075ea2812998 | 580 | * CRC mismatch |
RedBearLab | 0:075ea2812998 | 581 | */ |
RedBearLab | 0:075ea2812998 | 582 | ACI_STATUS_ERROR_CRC_MISMATCH = 0x88, |
RedBearLab | 0:075ea2812998 | 583 | /** |
RedBearLab | 0:075ea2812998 | 584 | * Unsupported setup format |
RedBearLab | 0:075ea2812998 | 585 | */ |
RedBearLab | 0:075ea2812998 | 586 | ACI_STATUS_ERROR_UNSUPPORTED_SETUP_FORMAT = 0x89, |
RedBearLab | 0:075ea2812998 | 587 | /** |
RedBearLab | 0:075ea2812998 | 588 | * Invalid sequence number during a write dynamic data sequence |
RedBearLab | 0:075ea2812998 | 589 | */ |
RedBearLab | 0:075ea2812998 | 590 | ACI_STATUS_ERROR_INVALID_SEQ_NO = 0x8A, |
RedBearLab | 0:075ea2812998 | 591 | /** |
RedBearLab | 0:075ea2812998 | 592 | * Setup data is locked and cannot be modified |
RedBearLab | 0:075ea2812998 | 593 | */ |
RedBearLab | 0:075ea2812998 | 594 | ACI_STATUS_ERROR_SETUP_LOCKED = 0x8B, |
RedBearLab | 0:075ea2812998 | 595 | /** |
RedBearLab | 0:075ea2812998 | 596 | * Setup error due to lock verification failure |
RedBearLab | 0:075ea2812998 | 597 | */ |
RedBearLab | 0:075ea2812998 | 598 | ACI_STATUS_ERROR_LOCK_FAILED = 0x8C, |
RedBearLab | 0:075ea2812998 | 599 | /** |
RedBearLab | 0:075ea2812998 | 600 | * Bond required: Local Pipes need bonded/trusted peer |
RedBearLab | 0:075ea2812998 | 601 | */ |
RedBearLab | 0:075ea2812998 | 602 | ACI_STATUS_ERROR_BOND_REQUIRED = 0x8D, |
RedBearLab | 0:075ea2812998 | 603 | /** |
RedBearLab | 0:075ea2812998 | 604 | * Command rejected as a transaction is still pending |
RedBearLab | 0:075ea2812998 | 605 | */ |
RedBearLab | 0:075ea2812998 | 606 | ACI_STATUS_ERROR_REJECTED = 0x8E, |
RedBearLab | 0:075ea2812998 | 607 | /** |
RedBearLab | 0:075ea2812998 | 608 | * Pipe Error Event : Data size exceeds size specified for pipe : Transmit failed |
RedBearLab | 0:075ea2812998 | 609 | */ |
RedBearLab | 0:075ea2812998 | 610 | ACI_STATUS_ERROR_DATA_SIZE = 0x8F, |
RedBearLab | 0:075ea2812998 | 611 | /** |
RedBearLab | 0:075ea2812998 | 612 | * Pipe Error Event : Invalid pipe |
RedBearLab | 0:075ea2812998 | 613 | */ |
RedBearLab | 0:075ea2812998 | 614 | ACI_STATUS_ERROR_PIPE_INVALID = 0x90, |
RedBearLab | 0:075ea2812998 | 615 | /** |
RedBearLab | 0:075ea2812998 | 616 | * Pipe Error Event : Credit not available |
RedBearLab | 0:075ea2812998 | 617 | */ |
RedBearLab | 0:075ea2812998 | 618 | ACI_STATUS_ERROR_CREDIT_NOT_AVAILABLE = 0x91, |
RedBearLab | 0:075ea2812998 | 619 | /** |
RedBearLab | 0:075ea2812998 | 620 | * Pipe Error Event : Peer device has sent an error on an pipe operation on the remote characteristic |
RedBearLab | 0:075ea2812998 | 621 | */ |
RedBearLab | 0:075ea2812998 | 622 | ACI_STATUS_ERROR_PEER_ATT_ERROR = 0x92, |
RedBearLab | 0:075ea2812998 | 623 | /** |
RedBearLab | 0:075ea2812998 | 624 | * Connection was not established before the BTLE advertising was stopped |
RedBearLab | 0:075ea2812998 | 625 | */ |
RedBearLab | 0:075ea2812998 | 626 | ACI_STATUS_ERROR_ADVT_TIMEOUT = 0x93, |
RedBearLab | 0:075ea2812998 | 627 | /** |
RedBearLab | 0:075ea2812998 | 628 | * Peer has triggered a Security Manager Protocol Error |
RedBearLab | 0:075ea2812998 | 629 | */ |
RedBearLab | 0:075ea2812998 | 630 | ACI_STATUS_ERROR_PEER_SMP_ERROR = 0x94, |
RedBearLab | 0:075ea2812998 | 631 | /** |
RedBearLab | 0:075ea2812998 | 632 | * Pipe Error Event : Pipe type invalid for the selected operation |
RedBearLab | 0:075ea2812998 | 633 | */ |
RedBearLab | 0:075ea2812998 | 634 | ACI_STATUS_ERROR_PIPE_TYPE_INVALID = 0x95, |
RedBearLab | 0:075ea2812998 | 635 | /** |
RedBearLab | 0:075ea2812998 | 636 | * Pipe Error Event : Pipe state invalid for the selected operation |
RedBearLab | 0:075ea2812998 | 637 | */ |
RedBearLab | 0:075ea2812998 | 638 | ACI_STATUS_ERROR_PIPE_STATE_INVALID = 0x96, |
RedBearLab | 0:075ea2812998 | 639 | /** |
RedBearLab | 0:075ea2812998 | 640 | * Invalid key size provided |
RedBearLab | 0:075ea2812998 | 641 | */ |
RedBearLab | 0:075ea2812998 | 642 | ACI_STATUS_ERROR_INVALID_KEY_SIZE = 0x97, |
RedBearLab | 0:075ea2812998 | 643 | /** |
RedBearLab | 0:075ea2812998 | 644 | * Invalid key data provided |
RedBearLab | 0:075ea2812998 | 645 | */ |
RedBearLab | 0:075ea2812998 | 646 | ACI_STATUS_ERROR_INVALID_KEY_DATA = 0x98, |
RedBearLab | 0:075ea2812998 | 647 | /** |
RedBearLab | 0:075ea2812998 | 648 | * Reserved range start |
RedBearLab | 0:075ea2812998 | 649 | */ |
RedBearLab | 0:075ea2812998 | 650 | ACI_STATUS_RESERVED_START = 0xF0, |
RedBearLab | 0:075ea2812998 | 651 | /** |
RedBearLab | 0:075ea2812998 | 652 | * Reserved range end |
RedBearLab | 0:075ea2812998 | 653 | */ |
RedBearLab | 0:075ea2812998 | 654 | ACI_STATUS_RESERVED_END = 0xFF |
RedBearLab | 0:075ea2812998 | 655 | |
RedBearLab | 0:075ea2812998 | 656 | } _aci_packed_ aci_status_code_t; |
RedBearLab | 0:075ea2812998 | 657 | |
RedBearLab | 0:075ea2812998 | 658 | ACI_ASSERT_SIZE(aci_status_code_t, 1); |
RedBearLab | 0:075ea2812998 | 659 | |
RedBearLab | 0:075ea2812998 | 660 | /** |
RedBearLab | 0:075ea2812998 | 661 | * @} |
RedBearLab | 0:075ea2812998 | 662 | */ |
RedBearLab | 0:075ea2812998 | 663 | |
RedBearLab | 0:075ea2812998 | 664 | #endif // ACI_H__ |