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