added debugging
Fork of BLE_nRF8001 by
BLE_nRF8001/utility/aci_cmds.h@2:7805a5595aab, 2014-11-10 (annotated)
- 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?
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 | * @ingroup aci |
RedBearLab | 0:075ea2812998 | 26 | * |
RedBearLab | 0:075ea2812998 | 27 | * @brief Definitions for the ACI (Application Control Interface) commands |
RedBearLab | 0:075ea2812998 | 28 | * @remarks |
RedBearLab | 0:075ea2812998 | 29 | * |
RedBearLab | 0:075ea2812998 | 30 | */ |
RedBearLab | 0:075ea2812998 | 31 | |
RedBearLab | 0:075ea2812998 | 32 | #ifndef ACI_CMDS_H__ |
RedBearLab | 0:075ea2812998 | 33 | #define ACI_CMDS_H__ |
RedBearLab | 0:075ea2812998 | 34 | |
RedBearLab | 0:075ea2812998 | 35 | #include "aci.h" |
RedBearLab | 0:075ea2812998 | 36 | |
RedBearLab | 0:075ea2812998 | 37 | /** |
RedBearLab | 0:075ea2812998 | 38 | * @enum aci_cmd_opcode_t |
RedBearLab | 0:075ea2812998 | 39 | * @brief ACI command opcodes |
RedBearLab | 0:075ea2812998 | 40 | */ |
RedBearLab | 0:075ea2812998 | 41 | typedef enum |
RedBearLab | 0:075ea2812998 | 42 | { |
RedBearLab | 0:075ea2812998 | 43 | /** |
RedBearLab | 0:075ea2812998 | 44 | * Enter test mode |
RedBearLab | 0:075ea2812998 | 45 | */ |
RedBearLab | 0:075ea2812998 | 46 | ACI_CMD_TEST = 0x01, |
RedBearLab | 0:075ea2812998 | 47 | /** |
RedBearLab | 0:075ea2812998 | 48 | * Echo (loopback) test command |
RedBearLab | 0:075ea2812998 | 49 | */ |
RedBearLab | 0:075ea2812998 | 50 | ACI_CMD_ECHO = 0x02, |
RedBearLab | 0:075ea2812998 | 51 | /** |
RedBearLab | 0:075ea2812998 | 52 | * Send a BTLE DTM command to the radio |
RedBearLab | 0:075ea2812998 | 53 | */ |
RedBearLab | 0:075ea2812998 | 54 | ACI_CMD_DTM_CMD = 0x03, |
RedBearLab | 0:075ea2812998 | 55 | /** |
RedBearLab | 0:075ea2812998 | 56 | * Put the device to sleep |
RedBearLab | 0:075ea2812998 | 57 | */ |
RedBearLab | 0:075ea2812998 | 58 | ACI_CMD_SLEEP = 0x04, |
RedBearLab | 0:075ea2812998 | 59 | /** |
RedBearLab | 0:075ea2812998 | 60 | * Wakeup the device from deep sleep |
RedBearLab | 0:075ea2812998 | 61 | */ |
RedBearLab | 0:075ea2812998 | 62 | ACI_CMD_WAKEUP = 0x05, |
RedBearLab | 0:075ea2812998 | 63 | /** |
RedBearLab | 0:075ea2812998 | 64 | * Replace the contents of the internal database with |
RedBearLab | 0:075ea2812998 | 65 | * user provided data |
RedBearLab | 0:075ea2812998 | 66 | */ |
RedBearLab | 0:075ea2812998 | 67 | ACI_CMD_SETUP = 0x06, |
RedBearLab | 0:075ea2812998 | 68 | /** |
RedBearLab | 0:075ea2812998 | 69 | * Read the portions of memory required to be restored after a power cycle |
RedBearLab | 0:075ea2812998 | 70 | */ |
RedBearLab | 0:075ea2812998 | 71 | ACI_CMD_READ_DYNAMIC_DATA = 0x07, |
RedBearLab | 0:075ea2812998 | 72 | /** |
RedBearLab | 0:075ea2812998 | 73 | * Write back the data retrieved using ACI_CMD_READ_DYNAMIC_DATA |
RedBearLab | 0:075ea2812998 | 74 | */ |
RedBearLab | 0:075ea2812998 | 75 | ACI_CMD_WRITE_DYNAMIC_DATA = 0x08, |
RedBearLab | 0:075ea2812998 | 76 | /** |
RedBearLab | 0:075ea2812998 | 77 | * Retrieve the device's version information |
RedBearLab | 0:075ea2812998 | 78 | */ |
RedBearLab | 0:075ea2812998 | 79 | ACI_CMD_GET_DEVICE_VERSION = 0x09, |
RedBearLab | 0:075ea2812998 | 80 | /** |
RedBearLab | 0:075ea2812998 | 81 | * Request the Bluetooth address and its type |
RedBearLab | 0:075ea2812998 | 82 | */ |
RedBearLab | 0:075ea2812998 | 83 | ACI_CMD_GET_DEVICE_ADDRESS = 0x0A, |
RedBearLab | 0:075ea2812998 | 84 | /** |
RedBearLab | 0:075ea2812998 | 85 | * Request the battery level measured by nRF8001 |
RedBearLab | 0:075ea2812998 | 86 | */ |
RedBearLab | 0:075ea2812998 | 87 | ACI_CMD_GET_BATTERY_LEVEL = 0x0B, |
RedBearLab | 0:075ea2812998 | 88 | /** |
RedBearLab | 0:075ea2812998 | 89 | * Request the temperature value measured by nRF8001 |
RedBearLab | 0:075ea2812998 | 90 | */ |
RedBearLab | 0:075ea2812998 | 91 | ACI_CMD_GET_TEMPERATURE = 0x0C, |
RedBearLab | 0:075ea2812998 | 92 | /** |
RedBearLab | 0:075ea2812998 | 93 | * Write to the local Attribute Database |
RedBearLab | 0:075ea2812998 | 94 | */ |
RedBearLab | 0:075ea2812998 | 95 | ACI_CMD_SET_LOCAL_DATA = 0x0D, |
RedBearLab | 0:075ea2812998 | 96 | /** |
RedBearLab | 0:075ea2812998 | 97 | * Reset the baseband and radio and go back to idle |
RedBearLab | 0:075ea2812998 | 98 | */ |
RedBearLab | 0:075ea2812998 | 99 | ACI_CMD_RADIO_RESET = 0x0E, |
RedBearLab | 0:075ea2812998 | 100 | /** |
RedBearLab | 0:075ea2812998 | 101 | * Start advertising and wait for a master connection |
RedBearLab | 0:075ea2812998 | 102 | */ |
RedBearLab | 0:075ea2812998 | 103 | ACI_CMD_CONNECT = 0x0F, |
RedBearLab | 0:075ea2812998 | 104 | /** |
RedBearLab | 0:075ea2812998 | 105 | * Start advertising and wait for a master connection |
RedBearLab | 0:075ea2812998 | 106 | */ |
RedBearLab | 0:075ea2812998 | 107 | ACI_CMD_BOND = 0x10, |
RedBearLab | 0:075ea2812998 | 108 | /** |
RedBearLab | 0:075ea2812998 | 109 | * Start advertising and wait for a master connection |
RedBearLab | 0:075ea2812998 | 110 | */ |
RedBearLab | 0:075ea2812998 | 111 | ACI_CMD_DISCONNECT = 0x11, |
RedBearLab | 0:075ea2812998 | 112 | /** |
RedBearLab | 0:075ea2812998 | 113 | * Throttles the Radio transmit power |
RedBearLab | 0:075ea2812998 | 114 | */ |
RedBearLab | 0:075ea2812998 | 115 | ACI_CMD_SET_TX_POWER = 0x12, |
RedBearLab | 0:075ea2812998 | 116 | /** |
RedBearLab | 0:075ea2812998 | 117 | * Trigger a connection parameter update |
RedBearLab | 0:075ea2812998 | 118 | */ |
RedBearLab | 0:075ea2812998 | 119 | ACI_CMD_CHANGE_TIMING = 0x13, |
RedBearLab | 0:075ea2812998 | 120 | /** |
RedBearLab | 0:075ea2812998 | 121 | * Open a remote pipe for data reception |
RedBearLab | 0:075ea2812998 | 122 | */ |
RedBearLab | 0:075ea2812998 | 123 | ACI_CMD_OPEN_REMOTE_PIPE = 0x14, |
RedBearLab | 0:075ea2812998 | 124 | /** |
RedBearLab | 0:075ea2812998 | 125 | * Transmit data over an open pipe |
RedBearLab | 0:075ea2812998 | 126 | */ |
RedBearLab | 0:075ea2812998 | 127 | ACI_CMD_SEND_DATA = 0x15, |
RedBearLab | 0:075ea2812998 | 128 | /** |
RedBearLab | 0:075ea2812998 | 129 | * Send an acknowledgment of received data |
RedBearLab | 0:075ea2812998 | 130 | */ |
RedBearLab | 0:075ea2812998 | 131 | ACI_CMD_SEND_DATA_ACK = 0x16, |
RedBearLab | 0:075ea2812998 | 132 | /** |
RedBearLab | 0:075ea2812998 | 133 | * Request data over an open pipe |
RedBearLab | 0:075ea2812998 | 134 | */ |
RedBearLab | 0:075ea2812998 | 135 | ACI_CMD_REQUEST_DATA = 0x17, |
RedBearLab | 0:075ea2812998 | 136 | /** |
RedBearLab | 0:075ea2812998 | 137 | * NACK a data reception |
RedBearLab | 0:075ea2812998 | 138 | */ |
RedBearLab | 0:075ea2812998 | 139 | ACI_CMD_SEND_DATA_NACK = 0x18, |
RedBearLab | 0:075ea2812998 | 140 | /** |
RedBearLab | 0:075ea2812998 | 141 | * Set application latency |
RedBearLab | 0:075ea2812998 | 142 | */ |
RedBearLab | 0:075ea2812998 | 143 | ACI_CMD_SET_APP_LATENCY = 0x19, |
RedBearLab | 0:075ea2812998 | 144 | /** |
RedBearLab | 0:075ea2812998 | 145 | * Set a security key |
RedBearLab | 0:075ea2812998 | 146 | */ |
RedBearLab | 0:075ea2812998 | 147 | ACI_CMD_SET_KEY = 0x1A, |
RedBearLab | 0:075ea2812998 | 148 | /** |
RedBearLab | 0:075ea2812998 | 149 | * Open Advertising Pipes |
RedBearLab | 0:075ea2812998 | 150 | */ |
RedBearLab | 0:075ea2812998 | 151 | ACI_CMD_OPEN_ADV_PIPE = 0x1B, |
RedBearLab | 0:075ea2812998 | 152 | /** |
RedBearLab | 0:075ea2812998 | 153 | * Start non-connectable advertising |
RedBearLab | 0:075ea2812998 | 154 | */ |
RedBearLab | 0:075ea2812998 | 155 | ACI_CMD_BROADCAST = 0x1C, |
RedBearLab | 0:075ea2812998 | 156 | /** |
RedBearLab | 0:075ea2812998 | 157 | * Start a security request in bonding mode |
RedBearLab | 0:075ea2812998 | 158 | */ |
RedBearLab | 0:075ea2812998 | 159 | ACI_CMD_BOND_SECURITY_REQUEST = 0x1D, |
RedBearLab | 0:075ea2812998 | 160 | /** |
RedBearLab | 0:075ea2812998 | 161 | * Start Directed advertising towards a Bonded Peer |
RedBearLab | 0:075ea2812998 | 162 | */ |
RedBearLab | 0:075ea2812998 | 163 | ACI_CMD_CONNECT_DIRECT = 0x1E, |
RedBearLab | 0:075ea2812998 | 164 | /** |
RedBearLab | 0:075ea2812998 | 165 | * Close a previously opened remote pipe |
RedBearLab | 0:075ea2812998 | 166 | */ |
RedBearLab | 0:075ea2812998 | 167 | ACI_CMD_CLOSE_REMOTE_PIPE = 0x1F, |
RedBearLab | 0:075ea2812998 | 168 | /** |
RedBearLab | 0:075ea2812998 | 169 | * Invalid ACI command opcode |
RedBearLab | 0:075ea2812998 | 170 | */ |
RedBearLab | 0:075ea2812998 | 171 | ACI_CMD_INVALID = 0xFF |
RedBearLab | 0:075ea2812998 | 172 | |
RedBearLab | 0:075ea2812998 | 173 | } _aci_packed_ aci_cmd_opcode_t; |
RedBearLab | 0:075ea2812998 | 174 | |
RedBearLab | 0:075ea2812998 | 175 | ACI_ASSERT_SIZE(aci_cmd_opcode_t, 1); |
RedBearLab | 0:075ea2812998 | 176 | |
RedBearLab | 0:075ea2812998 | 177 | /** |
RedBearLab | 0:075ea2812998 | 178 | * @struct aci_cmd_params_test_t |
RedBearLab | 0:075ea2812998 | 179 | * @brief Structure for the ACI_CMD_TEST ACI command parameters |
RedBearLab | 0:075ea2812998 | 180 | */ |
RedBearLab | 0:075ea2812998 | 181 | typedef struct |
RedBearLab | 0:075ea2812998 | 182 | { |
RedBearLab | 0:075ea2812998 | 183 | aci_test_mode_change_t test_mode_change; /**< enum aci_test_mode_change_t */ |
RedBearLab | 0:075ea2812998 | 184 | } _aci_packed_ aci_cmd_params_test_t; |
RedBearLab | 0:075ea2812998 | 185 | |
RedBearLab | 0:075ea2812998 | 186 | ACI_ASSERT_SIZE(aci_cmd_params_test_t, 1); |
RedBearLab | 0:075ea2812998 | 187 | |
RedBearLab | 0:075ea2812998 | 188 | /** |
RedBearLab | 0:075ea2812998 | 189 | * @struct aci_cmd_params_echo_t |
RedBearLab | 0:075ea2812998 | 190 | * @brief Structure for the ACI_CMD_ECHO ACI command parameters |
RedBearLab | 0:075ea2812998 | 191 | */ |
RedBearLab | 0:075ea2812998 | 192 | typedef struct |
RedBearLab | 0:075ea2812998 | 193 | { |
RedBearLab | 0:075ea2812998 | 194 | uint8_t echo_data[ACI_ECHO_DATA_MAX_LEN]; |
RedBearLab | 0:075ea2812998 | 195 | } _aci_packed_ aci_cmd_params_echo_t; |
RedBearLab | 0:075ea2812998 | 196 | |
RedBearLab | 0:075ea2812998 | 197 | ACI_ASSERT_SIZE(aci_cmd_params_echo_t, ACI_ECHO_DATA_MAX_LEN); |
RedBearLab | 0:075ea2812998 | 198 | |
RedBearLab | 0:075ea2812998 | 199 | /** |
RedBearLab | 0:075ea2812998 | 200 | * @struct aci_cmd_params_dtm_cmd_t |
RedBearLab | 0:075ea2812998 | 201 | * @brief Structure for the ACI_CMD_DTM_CMD ACI command parameters |
RedBearLab | 0:075ea2812998 | 202 | */ |
RedBearLab | 0:075ea2812998 | 203 | typedef struct |
RedBearLab | 0:075ea2812998 | 204 | { |
RedBearLab | 0:075ea2812998 | 205 | uint8_t cmd_msb; |
RedBearLab | 0:075ea2812998 | 206 | uint8_t cmd_lsb; |
RedBearLab | 0:075ea2812998 | 207 | } _aci_packed_ aci_cmd_params_dtm_cmd_t; |
RedBearLab | 0:075ea2812998 | 208 | |
RedBearLab | 0:075ea2812998 | 209 | /** |
RedBearLab | 0:075ea2812998 | 210 | * @struct aci_cmd_params_setup_t |
RedBearLab | 0:075ea2812998 | 211 | * @brief Structure for the ACI_CMD_SETUP ACI command parameters |
RedBearLab | 0:075ea2812998 | 212 | */ |
RedBearLab | 0:075ea2812998 | 213 | typedef struct |
RedBearLab | 0:075ea2812998 | 214 | { |
RedBearLab | 0:075ea2812998 | 215 | uint8_t setup_data[1]; |
RedBearLab | 0:075ea2812998 | 216 | } _aci_packed_ aci_cmd_params_setup_t; |
RedBearLab | 0:075ea2812998 | 217 | |
RedBearLab | 0:075ea2812998 | 218 | ACI_ASSERT_SIZE(aci_cmd_params_setup_t, 1); |
RedBearLab | 0:075ea2812998 | 219 | |
RedBearLab | 0:075ea2812998 | 220 | /** |
RedBearLab | 0:075ea2812998 | 221 | * @struct aci_cmd_params_write_dynamic_data_t |
RedBearLab | 0:075ea2812998 | 222 | * @brief Structure for the ACI_CMD_WRITE_DYNAMIC_DATA ACI command parameters |
RedBearLab | 0:075ea2812998 | 223 | * @note Dynamic data chunk size in this command is defined to go up to ACI_PACKET_MAX_LEN - 3 |
RedBearLab | 0:075ea2812998 | 224 | */ |
RedBearLab | 0:075ea2812998 | 225 | typedef struct |
RedBearLab | 0:075ea2812998 | 226 | { |
RedBearLab | 0:075ea2812998 | 227 | uint8_t seq_no; |
RedBearLab | 0:075ea2812998 | 228 | uint8_t dynamic_data[1]; |
RedBearLab | 0:075ea2812998 | 229 | } _aci_packed_ aci_cmd_params_write_dynamic_data_t; |
RedBearLab | 0:075ea2812998 | 230 | |
RedBearLab | 0:075ea2812998 | 231 | /** |
RedBearLab | 0:075ea2812998 | 232 | * @define aci_cmd_params_set_local_data_t |
RedBearLab | 0:075ea2812998 | 233 | * @brief Structure for the ACI_CMD_SET_LOCAL_DATA ACI command parameters |
RedBearLab | 0:075ea2812998 | 234 | */ |
RedBearLab | 0:075ea2812998 | 235 | typedef struct |
RedBearLab | 0:075ea2812998 | 236 | { |
RedBearLab | 0:075ea2812998 | 237 | aci_tx_data_t tx_data; |
RedBearLab | 0:075ea2812998 | 238 | } _aci_packed_ aci_cmd_params_set_local_data_t; |
RedBearLab | 0:075ea2812998 | 239 | |
RedBearLab | 0:075ea2812998 | 240 | /** |
RedBearLab | 0:075ea2812998 | 241 | * @struct aci_cmd_params_connect_t |
RedBearLab | 0:075ea2812998 | 242 | * @brief Structure for the ACI_CMD_CONNECT ACI command parameters |
RedBearLab | 0:075ea2812998 | 243 | */ |
RedBearLab | 0:075ea2812998 | 244 | typedef struct |
RedBearLab | 0:075ea2812998 | 245 | { |
RedBearLab | 0:075ea2812998 | 246 | uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */ |
RedBearLab | 0:075ea2812998 | 247 | uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */ |
RedBearLab | 0:075ea2812998 | 248 | } _aci_packed_ aci_cmd_params_connect_t; |
RedBearLab | 0:075ea2812998 | 249 | |
RedBearLab | 0:075ea2812998 | 250 | ACI_ASSERT_SIZE(aci_cmd_params_connect_t, 4); |
RedBearLab | 0:075ea2812998 | 251 | |
RedBearLab | 0:075ea2812998 | 252 | /** |
RedBearLab | 0:075ea2812998 | 253 | * @define aci_cmd_params_bond_t |
RedBearLab | 0:075ea2812998 | 254 | * @brief Structure for the ACI_CMD_BOND ACI command parameters |
RedBearLab | 0:075ea2812998 | 255 | */ |
RedBearLab | 0:075ea2812998 | 256 | typedef struct |
RedBearLab | 0:075ea2812998 | 257 | { |
RedBearLab | 0:075ea2812998 | 258 | uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */ |
RedBearLab | 0:075ea2812998 | 259 | uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */ |
RedBearLab | 0:075ea2812998 | 260 | } _aci_packed_ aci_cmd_params_bond_t; |
RedBearLab | 0:075ea2812998 | 261 | |
RedBearLab | 0:075ea2812998 | 262 | ACI_ASSERT_SIZE(aci_cmd_params_bond_t, 4); |
RedBearLab | 0:075ea2812998 | 263 | |
RedBearLab | 0:075ea2812998 | 264 | /** |
RedBearLab | 0:075ea2812998 | 265 | * @struct aci_cmd_params_disconnect_t |
RedBearLab | 0:075ea2812998 | 266 | * @brief Structure for the ACI_CMD_DISCONNECT ACI command parameters |
RedBearLab | 0:075ea2812998 | 267 | */ |
RedBearLab | 0:075ea2812998 | 268 | typedef struct |
RedBearLab | 0:075ea2812998 | 269 | { |
RedBearLab | 0:075ea2812998 | 270 | aci_disconnect_reason_t reason; /**< enum aci_disconnect_reason_t */ |
RedBearLab | 0:075ea2812998 | 271 | } _aci_packed_ aci_cmd_params_disconnect_t; |
RedBearLab | 0:075ea2812998 | 272 | |
RedBearLab | 0:075ea2812998 | 273 | ACI_ASSERT_SIZE(aci_cmd_params_disconnect_t, 1); |
RedBearLab | 0:075ea2812998 | 274 | |
RedBearLab | 0:075ea2812998 | 275 | /** |
RedBearLab | 0:075ea2812998 | 276 | * @struct aci_cmd_params_set_tx_power_t |
RedBearLab | 0:075ea2812998 | 277 | * @brief Structure for the ACI_CMD_SET_TX_POWER ACI command parameters |
RedBearLab | 0:075ea2812998 | 278 | */ |
RedBearLab | 0:075ea2812998 | 279 | typedef struct |
RedBearLab | 0:075ea2812998 | 280 | { |
RedBearLab | 0:075ea2812998 | 281 | aci_device_output_power_t device_power; /**< enum aci_device_output_power_t */ |
RedBearLab | 0:075ea2812998 | 282 | } _aci_packed_ aci_cmd_params_set_tx_power_t; |
RedBearLab | 0:075ea2812998 | 283 | |
RedBearLab | 0:075ea2812998 | 284 | ACI_ASSERT_SIZE(aci_cmd_params_set_tx_power_t, 1); |
RedBearLab | 0:075ea2812998 | 285 | /** |
RedBearLab | 0:075ea2812998 | 286 | * @struct aci_cmd_params_change_timing_t |
RedBearLab | 0:075ea2812998 | 287 | * @brief Structure for the ACI_CMD_CHANGE_TIMING ACI command parameters |
RedBearLab | 0:075ea2812998 | 288 | */ |
RedBearLab | 0:075ea2812998 | 289 | typedef struct |
RedBearLab | 0:075ea2812998 | 290 | { |
RedBearLab | 0:075ea2812998 | 291 | aci_ll_conn_params_t conn_params; |
RedBearLab | 0:075ea2812998 | 292 | } _aci_packed_ aci_cmd_params_change_timing_t; |
RedBearLab | 0:075ea2812998 | 293 | |
RedBearLab | 0:075ea2812998 | 294 | ACI_ASSERT_SIZE(aci_cmd_params_change_timing_t, 8); |
RedBearLab | 0:075ea2812998 | 295 | |
RedBearLab | 0:075ea2812998 | 296 | /** |
RedBearLab | 0:075ea2812998 | 297 | * @struct aci_cmd_params_open_remote_pipe_t |
RedBearLab | 0:075ea2812998 | 298 | * @brief Structure for the ACI_CMD_OPEN_REMOTE_PIPE ACI command parameters |
RedBearLab | 0:075ea2812998 | 299 | */ |
RedBearLab | 0:075ea2812998 | 300 | typedef struct |
RedBearLab | 0:075ea2812998 | 301 | { |
RedBearLab | 0:075ea2812998 | 302 | uint8_t pipe_number; |
RedBearLab | 0:075ea2812998 | 303 | } _aci_packed_ aci_cmd_params_open_remote_pipe_t; |
RedBearLab | 0:075ea2812998 | 304 | |
RedBearLab | 0:075ea2812998 | 305 | /** |
RedBearLab | 0:075ea2812998 | 306 | * @struct aci_cmd_params_send_data_t |
RedBearLab | 0:075ea2812998 | 307 | * @brief Structure for the ACI_CMD_SEND_DATA ACI command parameters |
RedBearLab | 0:075ea2812998 | 308 | */ |
RedBearLab | 0:075ea2812998 | 309 | typedef struct |
RedBearLab | 0:075ea2812998 | 310 | { |
RedBearLab | 0:075ea2812998 | 311 | aci_tx_data_t tx_data; |
RedBearLab | 0:075ea2812998 | 312 | } _aci_packed_ aci_cmd_params_send_data_t; |
RedBearLab | 0:075ea2812998 | 313 | |
RedBearLab | 0:075ea2812998 | 314 | /** |
RedBearLab | 0:075ea2812998 | 315 | * @define aci_cmd_params_send_data_ack_t |
RedBearLab | 0:075ea2812998 | 316 | * @brief Structure for the ACI_CMD_SEND_DATA_ACK ACI command parameters |
RedBearLab | 0:075ea2812998 | 317 | */ |
RedBearLab | 0:075ea2812998 | 318 | typedef struct |
RedBearLab | 0:075ea2812998 | 319 | { |
RedBearLab | 0:075ea2812998 | 320 | uint8_t pipe_number; |
RedBearLab | 0:075ea2812998 | 321 | } _aci_packed_ aci_cmd_params_send_data_ack_t; |
RedBearLab | 0:075ea2812998 | 322 | |
RedBearLab | 0:075ea2812998 | 323 | /** |
RedBearLab | 0:075ea2812998 | 324 | * @struct aci_cmd_params_send_data_t |
RedBearLab | 0:075ea2812998 | 325 | * @brief Structure for the ACI_CMD_SEND_DATA ACI command parameters |
RedBearLab | 0:075ea2812998 | 326 | */ |
RedBearLab | 0:075ea2812998 | 327 | typedef struct |
RedBearLab | 0:075ea2812998 | 328 | { |
RedBearLab | 0:075ea2812998 | 329 | uint8_t pipe_number; |
RedBearLab | 0:075ea2812998 | 330 | } _aci_packed_ aci_cmd_params_request_data_t; |
RedBearLab | 0:075ea2812998 | 331 | |
RedBearLab | 0:075ea2812998 | 332 | /** |
RedBearLab | 0:075ea2812998 | 333 | * @define aci_cmd_params_send_data_nack_t |
RedBearLab | 0:075ea2812998 | 334 | * @brief Structure for the ACI_CMD_SEND_DATA_NACK ACI command parameters |
RedBearLab | 0:075ea2812998 | 335 | */ |
RedBearLab | 0:075ea2812998 | 336 | typedef struct |
RedBearLab | 0:075ea2812998 | 337 | { |
RedBearLab | 0:075ea2812998 | 338 | uint8_t pipe_number; |
RedBearLab | 0:075ea2812998 | 339 | uint8_t error_code; |
RedBearLab | 0:075ea2812998 | 340 | } _aci_packed_ aci_cmd_params_send_data_nack_t; |
RedBearLab | 0:075ea2812998 | 341 | |
RedBearLab | 0:075ea2812998 | 342 | ACI_ASSERT_SIZE(aci_cmd_params_send_data_nack_t, 2); |
RedBearLab | 0:075ea2812998 | 343 | |
RedBearLab | 0:075ea2812998 | 344 | /** |
RedBearLab | 0:075ea2812998 | 345 | * @define aci_cmd_params_set_app_latency_t |
RedBearLab | 0:075ea2812998 | 346 | * @brief Structure for the ACI_CMD_SET_APP_LATENCY ACI command parameters |
RedBearLab | 0:075ea2812998 | 347 | */ |
RedBearLab | 0:075ea2812998 | 348 | typedef struct |
RedBearLab | 0:075ea2812998 | 349 | { |
RedBearLab | 0:075ea2812998 | 350 | aci_app_latency_mode_t mode; |
RedBearLab | 0:075ea2812998 | 351 | uint16_t latency; |
RedBearLab | 0:075ea2812998 | 352 | } _aci_packed_ aci_cmd_params_set_app_latency_t; |
RedBearLab | 0:075ea2812998 | 353 | |
RedBearLab | 0:075ea2812998 | 354 | ACI_ASSERT_SIZE(aci_cmd_params_set_app_latency_t, 3); |
RedBearLab | 0:075ea2812998 | 355 | /** |
RedBearLab | 0:075ea2812998 | 356 | * @define aci_cmd_params_set_key_t |
RedBearLab | 0:075ea2812998 | 357 | * @brief Structure for the ACI_CMD_SET_KEY ACI command parameters |
RedBearLab | 0:075ea2812998 | 358 | */ |
RedBearLab | 0:075ea2812998 | 359 | typedef struct |
RedBearLab | 0:075ea2812998 | 360 | { |
RedBearLab | 0:075ea2812998 | 361 | aci_key_type_t key_type; |
RedBearLab | 0:075ea2812998 | 362 | union |
RedBearLab | 0:075ea2812998 | 363 | { |
RedBearLab | 0:075ea2812998 | 364 | uint8_t passkey[6]; |
RedBearLab | 0:075ea2812998 | 365 | uint8_t oob_key[16]; |
RedBearLab | 0:075ea2812998 | 366 | } key; |
RedBearLab | 0:075ea2812998 | 367 | } _aci_packed_ aci_cmd_params_set_key_t; |
RedBearLab | 0:075ea2812998 | 368 | |
RedBearLab | 0:075ea2812998 | 369 | ACI_ASSERT_SIZE(aci_cmd_params_set_key_t, 17); |
RedBearLab | 0:075ea2812998 | 370 | /** |
RedBearLab | 0:075ea2812998 | 371 | * @define aci_cmd_params_open_adv_pipe_t |
RedBearLab | 0:075ea2812998 | 372 | * @brief Structure for the ACI_CMD_OPEN_ADV_PIPE ACI command parameters |
RedBearLab | 0:075ea2812998 | 373 | */ |
RedBearLab | 0:075ea2812998 | 374 | typedef struct |
RedBearLab | 0:075ea2812998 | 375 | { |
RedBearLab | 0:075ea2812998 | 376 | uint8_t pipes[8]; |
RedBearLab | 0:075ea2812998 | 377 | } _aci_packed_ aci_cmd_params_open_adv_pipe_t; |
RedBearLab | 0:075ea2812998 | 378 | |
RedBearLab | 0:075ea2812998 | 379 | /** |
RedBearLab | 0:075ea2812998 | 380 | * @define aci_cmd_params_broadcast_t |
RedBearLab | 0:075ea2812998 | 381 | * @brief Structure for the ACI_CMD_BROADCAST ACI command parameters |
RedBearLab | 0:075ea2812998 | 382 | */ |
RedBearLab | 0:075ea2812998 | 383 | typedef struct |
RedBearLab | 0:075ea2812998 | 384 | { |
RedBearLab | 0:075ea2812998 | 385 | uint16_t timeout; /**< 0x0000 (no timeout) to 0x3FFF */ |
RedBearLab | 0:075ea2812998 | 386 | uint16_t adv_interval; /**< 16 bits of advertising interval for general discovery */ |
RedBearLab | 0:075ea2812998 | 387 | } _aci_packed_ aci_cmd_params_broadcast_t; |
RedBearLab | 0:075ea2812998 | 388 | |
RedBearLab | 0:075ea2812998 | 389 | /** |
RedBearLab | 0:075ea2812998 | 390 | * @struct aci_cmd_params_close_remote_pipe_t |
RedBearLab | 0:075ea2812998 | 391 | * @brief Structure for the ACI_CMD_CLOSE_REMOTE_PIPE ACI command parameters |
RedBearLab | 0:075ea2812998 | 392 | */ |
RedBearLab | 0:075ea2812998 | 393 | typedef struct |
RedBearLab | 0:075ea2812998 | 394 | { |
RedBearLab | 0:075ea2812998 | 395 | uint8_t pipe_number; |
RedBearLab | 0:075ea2812998 | 396 | } _aci_packed_ aci_cmd_params_close_remote_pipe_t; |
RedBearLab | 0:075ea2812998 | 397 | |
RedBearLab | 0:075ea2812998 | 398 | /** |
RedBearLab | 0:075ea2812998 | 399 | * @struct aci_cmd_t |
RedBearLab | 0:075ea2812998 | 400 | * @brief Encapsulates a generic ACI command |
RedBearLab | 0:075ea2812998 | 401 | */ |
RedBearLab | 0:075ea2812998 | 402 | typedef struct |
RedBearLab | 0:075ea2812998 | 403 | { |
RedBearLab | 0:075ea2812998 | 404 | uint8_t len; /**< Length of the ACI command */ |
RedBearLab | 0:075ea2812998 | 405 | aci_cmd_opcode_t cmd_opcode; /**< enum aci_cmd_opcode_t -> Opcode of the ACI command */ |
RedBearLab | 0:075ea2812998 | 406 | union |
RedBearLab | 0:075ea2812998 | 407 | { |
RedBearLab | 0:075ea2812998 | 408 | aci_cmd_params_test_t test; |
RedBearLab | 0:075ea2812998 | 409 | aci_cmd_params_echo_t echo; |
RedBearLab | 0:075ea2812998 | 410 | aci_cmd_params_dtm_cmd_t dtm_cmd; |
RedBearLab | 0:075ea2812998 | 411 | aci_cmd_params_setup_t setup; |
RedBearLab | 0:075ea2812998 | 412 | aci_cmd_params_write_dynamic_data_t write_dynamic_data; |
RedBearLab | 0:075ea2812998 | 413 | aci_cmd_params_set_local_data_t set_local_data; |
RedBearLab | 0:075ea2812998 | 414 | aci_cmd_params_connect_t connect; |
RedBearLab | 0:075ea2812998 | 415 | aci_cmd_params_bond_t bond; |
RedBearLab | 0:075ea2812998 | 416 | aci_cmd_params_disconnect_t disconnect; |
RedBearLab | 0:075ea2812998 | 417 | aci_cmd_params_set_tx_power_t set_tx_power; |
RedBearLab | 0:075ea2812998 | 418 | aci_cmd_params_change_timing_t change_timing; |
RedBearLab | 0:075ea2812998 | 419 | aci_cmd_params_open_remote_pipe_t open_remote_pipe; |
RedBearLab | 0:075ea2812998 | 420 | aci_cmd_params_send_data_t send_data; |
RedBearLab | 0:075ea2812998 | 421 | aci_cmd_params_send_data_ack_t send_data_ack; |
RedBearLab | 0:075ea2812998 | 422 | aci_cmd_params_request_data_t request_data; |
RedBearLab | 0:075ea2812998 | 423 | aci_cmd_params_send_data_nack_t send_data_nack; |
RedBearLab | 0:075ea2812998 | 424 | aci_cmd_params_set_app_latency_t set_app_latency; |
RedBearLab | 0:075ea2812998 | 425 | aci_cmd_params_set_key_t set_key; |
RedBearLab | 0:075ea2812998 | 426 | aci_cmd_params_open_adv_pipe_t open_adv_pipe; |
RedBearLab | 0:075ea2812998 | 427 | aci_cmd_params_broadcast_t broadcast; |
RedBearLab | 0:075ea2812998 | 428 | aci_cmd_params_close_remote_pipe_t close_remote_pipe; |
RedBearLab | 0:075ea2812998 | 429 | |
RedBearLab | 0:075ea2812998 | 430 | } params; |
RedBearLab | 0:075ea2812998 | 431 | } _aci_packed_ aci_cmd_t; |
RedBearLab | 0:075ea2812998 | 432 | |
RedBearLab | 0:075ea2812998 | 433 | #endif // ACI_CMDS_H__ |
RedBearLab | 0:075ea2812998 | 434 |