Maxim Integrated / MaximBLE

Dependents:   BLE_Thermometer MAXWSNENV_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hci_defs.h Source File

hci_defs.h

Go to the documentation of this file.
00001 /*************************************************************************************************/
00002 /*!
00003  *  \file   hci_defs.h
00004  *        
00005  *  \brief  HCI constants and definitions from the Bluetooth specification.
00006  *
00007  *          $Date: 2012-06-26 21:53:53 -0700 (Tue, 26 Jun 2012) $
00008  *          $Revision: 337 $
00009  *  
00010  *  Copyright (c) 2009-2016 ARM Limited. All rights reserved.
00011  *
00012  *  SPDX-License-Identifier: LicenseRef-PBL
00013  *
00014  *  Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
00015  *  this file except in compliance with the License.  You may obtain a copy of the License at
00016  *
00017  *  https://www.mbed.com/licenses/PBL-1.0
00018  *
00019  *  See the License for the specific language governing permissions and limitations under the License.
00020  */
00021 /*************************************************************************************************/
00022 #ifndef HCI_DEFS_H
00023 #define HCI_DEFS_H
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /*! Packet definitions */
00030 #define HCI_CMD_HDR_LEN                   3       /*! Command packet header length */
00031 #define HCI_ACL_HDR_LEN                   4       /*! ACL packet header length */
00032 #define HCI_EVT_HDR_LEN                   2       /*! Event packet header length */
00033 #define HCI_EVT_PARAM_MAX_LEN             255     /*! Maximum length of event packet parameters */
00034 #define HCI_PB_FLAG_MASK                  0x1000  /*! ACL packet boundary flag mask */
00035 #define HCI_PB_START                      0x0000  /*! Packet boundary flag, start */
00036 #define HCI_PB_CONTINUE                   0x1000  /*! Packet boundary flag, continue */
00037 #define HCI_HANDLE_MASK                   0x0FFF  /*! Mask for handle bits in ACL packet */
00038 #define HCI_HANDLE_NONE                   0xFFFF  /*! Value for invalid handle */
00039 
00040 /*! Packet types */
00041 #define HCI_CMD_TYPE                      1       /*! HCI command packet */
00042 #define HCI_ACL_TYPE                      2       /*! HCI ACL data packet */
00043 #define HCI_EVT_TYPE                      4       /*! HCI event packet */
00044 
00045 /*! Error codes */
00046 #define HCI_SUCCESS                       0x00    /*! Success */
00047 #define HCI_ERR_UNKNOWN_CMD               0x01    /*! Unknown HCI command */
00048 #define HCI_ERR_UNKNOWN_HANDLE            0x02    /*! Unknown connection identifier */
00049 #define HCI_ERR_HARDWARE_FAILURE          0x03    /*! Hardware failure */
00050 #define HCI_ERR_PAGE_TIMEOUT              0x04    /*! Page timeout */
00051 #define HCI_ERR_AUTH_FAILURE              0x05    /*! Authentication failure */
00052 #define HCI_ERR_KEY_MISSING               0x06    /*! PIN or key missing */
00053 #define HCI_ERR_MEMORY_EXCEEDED           0x07    /*! Memory capacity exceeded */
00054 #define HCI_ERR_CONN_TIMEOUT              0x08    /*! Connection timeout */
00055 #define HCI_ERR_CONN_LIMIT                0x09    /*! Connection limit exceeded */
00056 #define HCI_ERR_SYNCH_CONN_LIMIT          0x0A    /*! Synchronous connection limit exceeded */
00057 #define HCI_ERR_ACL_CONN_EXISTS           0x0B    /*! ACL connection already exists */
00058 #define HCI_ERR_CMD_DISALLOWED            0x0C    /*! Command disallowed */
00059 #define HCI_ERR_REJ_RESOURCES             0x0D    /*! Connection rejected limited resources */
00060 #define HCI_ERR_REJ_SECURITY              0x0E    /*! Connection rejected security reasons */
00061 #define HCI_ERR_REJ_BD_ADDR               0x0F    /*! Connection rejected unacceptable BD_ADDR */
00062 #define HCI_ERR_ACCEPT_TIMEOUT            0x10    /*! Connection accept timeout exceeded */
00063 #define HCI_ERR_UNSUP_FEAT                0x11    /*! Unsupported feature or parameter value */
00064 #define HCI_ERR_INVALID_PARAM             0x12    /*! Invalid HCI command parameters */
00065 #define HCI_ERR_REMOTE_TERMINATED         0x13    /*! Remote user terminated connection */
00066 #define HCI_ERR_REMOTE_RESOURCES          0x14    /*! Remote device low resources */
00067 #define HCI_ERR_REMOTE_POWER_OFF          0x15    /*! Remote device power off */
00068 #define HCI_ERR_LOCAL_TERMINATED          0x16    /*! Connection terminated by local host */
00069 #define HCI_ERR_REPEATED_ATTEMPTS         0x17    /*! Repeated attempts */
00070 #define HCI_ERR_PAIRING_NOT_ALLOWED       0x18    /*! Pairing not allowed */
00071 #define HCI_ERR_UNKNOWN_LMP_PDU           0x19    /*! Unknown LMP PDU */
00072 #define HCI_ERR_UNSUP_REMOTE_FEAT         0x1A    /*! Unsupported remote feature */
00073 #define HCI_ERR_SCO_OFFSET                0x1B    /*! SCO offset rejected */
00074 #define HCI_ERR_SCO_INTERVAL              0x1C    /*! SCO interval rejected */
00075 #define HCI_ERR_SCO_MODE                  0x1D    /*! SCO air mode rejected */
00076 #define HCI_ERR_LMP_PARAM                 0x1E    /*! Invalid LMP parameters */
00077 #define HCI_ERR_UNSPECIFIED               0x1F    /*! Unspecified error */
00078 #define HCI_ERR_UNSUP_LMP_PARAM           0x20    /*! Unsupported LMP parameter value */
00079 #define HCI_ERR_ROLE_CHANGE               0x21    /*! Role change not allowed */
00080 #define HCI_ERR_LL_RESP_TIMEOUT           0x22    /*! LL response timeout */
00081 #define HCI_ERR_LMP_COLLISION             0x23    /*! LMP error transaction collision */
00082 #define HCI_ERR_LMP_PDU                   0x24    /*! LMP pdu not allowed */
00083 #define HCI_ERR_ENCRYPT_MODE              0x25    /*! Encryption mode not acceptable */
00084 #define HCI_ERR_LINK_KEY                  0x26    /*! Link key can not be changed */
00085 #define HCI_ERR_UNSUP_QOS                 0x27    /*! Requested qos not supported */
00086 #define HCI_ERR_INSTANT_PASSED            0x28    /*! Instant passed */
00087 #define HCI_ERR_UNSUP_UNIT_KEY            0x29    /*! Pairing with unit key not supported */
00088 #define HCI_ERR_TRANSACT_COLLISION        0x2A    /*! Different transaction collision */
00089 #define HCI_ERR_CHANNEL_CLASS             0x2E    /*! Channel classification not supported */
00090 #define HCI_ERR_MEMORY                    0x2F    /*! Insufficient security */
00091 #define HCI_ERR_PARAMETER_RANGE           0x30    /*! Parameter out of mandatory range */
00092 #define HCI_ERR_ROLE_SWITCH_PEND          0x32    /*! Role switch pending */
00093 #define HCI_ERR_RESERVED_SLOT             0x34    /*! Reserved slot violation */
00094 #define HCI_ERR_ROLE_SWITCH               0x35    /*! Role switch failed */
00095 #define HCI_ERR_INQ_TOO_LARGE             0x36    /*! Extended inquiry response too large */
00096 #define HCI_ERR_UNSUP_SSP                 0x37    /*! Secure simple pairing not supported by host */
00097 #define HCI_ERR_HOST_BUSY_PAIRING         0x38    /*! Host busy - pairing */
00098 #define HCI_ERR_NO_CHANNEL                0x39    /*! Connection rejected no suitable channel */
00099 #define HCI_ERR_CONTROLLER_BUSY           0x3A    /*! Controller busy */
00100 #define HCI_ERR_CONN_INTERVAL             0x3B    /*! Unacceptable connection interval */
00101 #define HCI_ERR_ADV_TIMEOUT               0x3C    /*! Directed advertising timeout */
00102 #define HCI_ERR_MIC_FAILURE               0x3D    /*! Connection terminated due to MIC failure */
00103 #define HCI_ERR_CONN_FAIL                 0x3E    /*! Connection failed to be established */
00104 #define HCI_ERR_MAC_CONN_FAIL             0x3F    /*! MAC connection failed */
00105 
00106 /*! Command groups */
00107 #define HCI_OGF_NOP                       0x00    /*! No operation */
00108 #define HCI_OGF_LINK_CONTROL              0x01    /*! Link control */
00109 #define HCI_OGF_LINK_POLICY               0x02    /*! Link policy */
00110 #define HCI_OGF_CONTROLLER                0x03    /*! Controller and baseband */
00111 #define HCI_OGF_INFORMATIONAL             0x04    /*! Informational parameters */
00112 #define HCI_OGF_STATUS                    0x05    /*! Status parameters */
00113 #define HCI_OGF_TESTING                   0x06    /*! Testing */
00114 #define HCI_OGF_LE_CONTROLLER             0x08    /*! LE controller */
00115 #define HCI_OGF_VENDOR_SPEC               0x3F    /*! Vendor specific */
00116 
00117 /*! NOP command */
00118 #define HCI_OCF_NOP                       0x00
00119 
00120 /*! Link control commands */
00121 #define HCI_OCF_DISCONNECT                0x06
00122 #define HCI_OCF_READ_REMOTE_VER_INFO      0x1D
00123 
00124 /*! Link policy commands (none used for LE) */
00125 
00126 /*! Controller and baseband commands */
00127 #define HCI_OCF_SET_EVENT_MASK            0x01
00128 #define HCI_OCF_RESET                     0x03
00129 #define HCI_OCF_READ_TX_PWR_LVL           0x2D
00130 #define HCI_OCF_SET_CONTROLLER_TO_HOST_FC 0x31
00131 #define HCI_OCF_HOST_BUFFER_SIZE          0x33
00132 #define HCI_OCF_HOST_NUM_CMPL_PKTS        0x35
00133 
00134 /*! Informational commands */
00135 #define HCI_OCF_READ_LOCAL_VER_INFO       0x01
00136 #define HCI_OCF_READ_LOCAL_SUP_CMDS       0x02
00137 #define HCI_OCF_READ_LOCAL_SUP_FEAT       0x03
00138 #define HCI_OCF_READ_BUF_SIZE             0x05
00139 #define HCI_OCF_READ_BD_ADDR              0x09
00140 
00141 /*! Status commands */
00142 #define HCI_OCF_READ_RSSI                 0x05
00143 
00144 /*! LE controller commands */
00145 #define HCI_OCF_LE_SET_EVENT_MASK         0x01
00146 #define HCI_OCF_LE_READ_BUF_SIZE          0x02
00147 #define HCI_OCF_LE_READ_LOCAL_SUP_FEAT    0x03
00148 #define HCI_OCF_LE_SET_RAND_ADDR          0x05
00149 #define HCI_OCF_LE_SET_ADV_PARAM          0x06
00150 #define HCI_OCF_LE_READ_ADV_TX_POWER      0x07
00151 #define HCI_OCF_LE_SET_ADV_DATA           0x08
00152 #define HCI_OCF_LE_SET_SCAN_RESP_DATA     0x09
00153 #define HCI_OCF_LE_SET_ADV_ENABLE         0x0A
00154 #define HCI_OCF_LE_SET_SCAN_PARAM         0x0B
00155 #define HCI_OCF_LE_SET_SCAN_ENABLE        0x0C
00156 #define HCI_OCF_LE_CREATE_CONN            0x0D
00157 #define HCI_OCF_LE_CREATE_CONN_CANCEL     0x0E
00158 #define HCI_OCF_LE_READ_WHITE_LIST_SIZE   0x0F
00159 #define HCI_OCF_LE_CLEAR_WHITE_LIST       0x10
00160 #define HCI_OCF_LE_ADD_DEV_WHITE_LIST     0x11
00161 #define HCI_OCF_LE_REMOVE_DEV_WHITE_LIST  0x12
00162 #define HCI_OCF_LE_CONN_UPDATE            0x13
00163 #define HCI_OCF_LE_SET_HOST_CHAN_CLASS    0x14
00164 #define HCI_OCF_LE_READ_CHAN_MAP          0x15
00165 #define HCI_OCF_LE_READ_REMOTE_FEAT       0x16
00166 #define HCI_OCF_LE_ENCRYPT                0x17
00167 #define HCI_OCF_LE_RAND                   0x18
00168 #define HCI_OCF_LE_START_ENCRYPTION       0x19
00169 #define HCI_OCF_LE_LTK_REQ_REPL           0x1A
00170 #define HCI_OCF_LE_LTK_REQ_NEG_REPL       0x1B
00171 #define HCI_OCF_LE_READ_SUP_STATES        0x1C
00172 #define HCI_OCF_LE_RECEIVER_TEST          0x1D
00173 #define HCI_OCF_LE_TRANSMITTER_TEST       0x1E
00174 #define HCI_OCF_LE_TEST_END               0x1F
00175 
00176 /*! Opcode manipulation macros */
00177 #define HCI_OPCODE(ogf, ocf)              (((ogf) << 10) + (ocf))
00178 #define HCI_OGF(opcode)                   ((opcode) >> 10)
00179 #define HCI_OCF(opcode)                   ((opcode) & 0x03FF)
00180 
00181 /*! Command opcodes */
00182 #define HCI_OPCODE_NOP                       HCI_OPCODE(HCI_OGF_NOP, HCI_OCF_NOP)
00183 
00184 #define HCI_OPCODE_DISCONNECT                HCI_OPCODE(HCI_OGF_LINK_CONTROL, HCI_OCF_DISCONNECT)
00185 #define HCI_OPCODE_READ_REMOTE_VER_INFO      HCI_OPCODE(HCI_OGF_LINK_CONTROL, HCI_OCF_READ_REMOTE_VER_INFO)
00186 
00187 #define HCI_OPCODE_SET_EVENT_MASK            HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_SET_EVENT_MASK)
00188 #define HCI_OPCODE_RESET                     HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_RESET)
00189 #define HCI_OPCODE_READ_TX_PWR_LVL           HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_READ_TX_PWR_LVL)
00190 #define HCI_OPCODE_SET_CONTROLLER_TO_HOST_FC HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_SET_CONTROLLER_TO_HOST_FC)
00191 #define HCI_OPCODE_HOST_BUFFER_SIZE          HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_HOST_BUFFER_SIZE)
00192 #define HCI_OPCODE_HOST_NUM_CMPL_PKTS        HCI_OPCODE(HCI_OGF_CONTROLLER, HCI_OCF_HOST_NUM_CMPL_PKTS)
00193 
00194 #define HCI_OPCODE_READ_LOCAL_VER_INFO       HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_LOCAL_VER_INFO)
00195 #define HCI_OPCODE_READ_LOCAL_SUP_CMDS       HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_LOCAL_SUP_CMDS)
00196 #define HCI_OPCODE_READ_LOCAL_SUP_FEAT       HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_LOCAL_SUP_FEAT)
00197 #define HCI_OPCODE_READ_BUF_SIZE             HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_BUF_SIZE)
00198 #define HCI_OPCODE_READ_BD_ADDR              HCI_OPCODE(HCI_OGF_INFORMATIONAL, HCI_OCF_READ_BD_ADDR)
00199 
00200 #define HCI_OPCODE_READ_RSSI                 HCI_OPCODE(HCI_OGF_STATUS, HCI_OCF_READ_RSSI)
00201 
00202 #define HCI_OPCODE_LE_SET_EVENT_MASK         HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_EVENT_MASK)
00203 #define HCI_OPCODE_LE_READ_BUF_SIZE          HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_BUF_SIZE)
00204 #define HCI_OPCODE_LE_READ_LOCAL_SUP_FEAT    HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_LOCAL_SUP_FEAT)
00205 #define HCI_OPCODE_LE_SET_RAND_ADDR          HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_RAND_ADDR)
00206 #define HCI_OPCODE_LE_SET_ADV_PARAM          HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADV_PARAM)
00207 #define HCI_OPCODE_LE_READ_ADV_TX_POWER      HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_ADV_TX_POWER)
00208 #define HCI_OPCODE_LE_SET_ADV_DATA           HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADV_DATA)
00209 #define HCI_OPCODE_LE_SET_SCAN_RESP_DATA     HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_SCAN_RESP_DATA)
00210 #define HCI_OPCODE_LE_SET_ADV_ENABLE         HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_ADV_ENABLE)
00211 #define HCI_OPCODE_LE_SET_SCAN_PARAM         HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_SCAN_PARAM)
00212 #define HCI_OPCODE_LE_SET_SCAN_ENABLE        HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_SCAN_ENABLE)
00213 #define HCI_OPCODE_LE_CREATE_CONN            HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CREATE_CONN)
00214 #define HCI_OPCODE_LE_CREATE_CONN_CANCEL     HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CREATE_CONN_CANCEL)
00215 #define HCI_OPCODE_LE_READ_WHITE_LIST_SIZE   HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_WHITE_LIST_SIZE)
00216 #define HCI_OPCODE_LE_CLEAR_WHITE_LIST       HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CLEAR_WHITE_LIST)
00217 #define HCI_OPCODE_LE_ADD_DEV_WHITE_LIST     HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ADD_DEV_WHITE_LIST)
00218 #define HCI_OPCODE_LE_REMOVE_DEV_WHITE_LIST  HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_REMOVE_DEV_WHITE_LIST)
00219 #define HCI_OPCODE_LE_CONN_UPDATE            HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_CONN_UPDATE)
00220 #define HCI_OPCODE_LE_SET_HOST_CHAN_CLASS    HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_SET_HOST_CHAN_CLASS)
00221 #define HCI_OPCODE_LE_READ_CHAN_MAP          HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_CHAN_MAP)
00222 #define HCI_OPCODE_LE_READ_REMOTE_FEAT       HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_REMOTE_FEAT)
00223 #define HCI_OPCODE_LE_ENCRYPT                HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_ENCRYPT)
00224 #define HCI_OPCODE_LE_RAND                   HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_RAND)
00225 #define HCI_OPCODE_LE_START_ENCRYPTION       HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_START_ENCRYPTION)
00226 #define HCI_OPCODE_LE_LTK_REQ_REPL           HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_LTK_REQ_REPL)
00227 #define HCI_OPCODE_LE_LTK_REQ_NEG_REPL       HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_LTK_REQ_NEG_REPL)
00228 #define HCI_OPCODE_LE_READ_SUP_STATES        HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_READ_SUP_STATES)
00229 #define HCI_OPCODE_LE_RECEIVER_TEST          HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_RECEIVER_TEST)
00230 #define HCI_OPCODE_LE_TRANSMITTER_TEST       HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_TRANSMITTER_TEST)
00231 #define HCI_OPCODE_LE_TEST_END               HCI_OPCODE(HCI_OGF_LE_CONTROLLER, HCI_OCF_LE_TEST_END)
00232 
00233 /*! Command parameter lengths */
00234 #define HCI_LEN_NOP                       0
00235 
00236 #define HCI_LEN_DISCONNECT                3
00237 #define HCI_LEN_READ_REMOTE_VER_INFO      2
00238 
00239 #define HCI_LEN_SET_EVENT_MASK            8
00240 #define HCI_LEN_RESET                     0
00241 #define HCI_LEN_READ_TX_PWR_LVL           3
00242 #define HCI_LEN_SET_CONTROLLER_TO_HOST_FC 1
00243 #define HCI_LEN_HOST_BUFFER_SIZE          8
00244 #define HCI_LEN_HOST_NUM_CMPL_PKTS        1
00245 
00246 #define HCI_LEN_READ_LOCAL_VER_INFO       0
00247 #define HCI_LEN_READ_LOCAL_SUP_CMDS       0
00248 #define HCI_LEN_READ_LOCAL_SUP_FEAT       0
00249 #define HCI_LEN_READ_BUF_SIZE             0
00250 #define HCI_LEN_READ_BD_ADDR              0
00251 
00252 #define HCI_LEN_READ_RSSI                 2
00253 
00254 #define HCI_LEN_LE_SET_EVENT_MASK         8
00255 #define HCI_LEN_LE_READ_BUF_SIZE          0
00256 #define HCI_LEN_LE_READ_LOCAL_SUP_FEAT    0
00257 #define HCI_LEN_LE_SET_RAND_ADDR          6
00258 #define HCI_LEN_LE_SET_ADV_PARAM          15
00259 #define HCI_LEN_LE_READ_ADV_TX_POWER      0
00260 #define HCI_LEN_LE_SET_ADV_DATA           32
00261 #define HCI_LEN_LE_SET_SCAN_RESP_DATA     32
00262 #define HCI_LEN_LE_SET_ADV_ENABLE         1
00263 #define HCI_LEN_LE_SET_SCAN_PARAM         7
00264 #define HCI_LEN_LE_SET_SCAN_ENABLE        2
00265 #define HCI_LEN_LE_CREATE_CONN            25
00266 #define HCI_LEN_LE_CREATE_CONN_CANCEL     0
00267 #define HCI_LEN_LE_READ_WHITE_LIST_SIZE   0
00268 #define HCI_LEN_LE_CLEAR_WHITE_LIST       0
00269 #define HCI_LEN_LE_ADD_DEV_WHITE_LIST     7
00270 #define HCI_LEN_LE_REMOVE_DEV_WHITE_LIST  7
00271 #define HCI_LEN_LE_CONN_UPDATE            14
00272 #define HCI_LEN_LE_SET_HOST_CHAN_CLASS    5
00273 #define HCI_LEN_LE_READ_CHAN_MAP          2
00274 #define HCI_LEN_LE_READ_REMOTE_FEAT       2
00275 #define HCI_LEN_LE_ENCRYPT                32
00276 #define HCI_LEN_LE_RAND                   0
00277 #define HCI_LEN_LE_START_ENCRYPTION       28
00278 #define HCI_LEN_LE_LTK_REQ_REPL           18
00279 #define HCI_LEN_LE_LTK_REQ_NEG_REPL       2
00280 #define HCI_LEN_LE_READ_SUP_STATES        0
00281 #define HCI_LEN_LE_RECEIVER_TEST          1
00282 #define HCI_LEN_LE_TRANSMITTER_TEST       3
00283 #define HCI_LEN_LE_TEST_END               0
00284 
00285 /*! Events */
00286 #define HCI_DISCONNECT_CMPL_EVT           0x05
00287 #define HCI_ENC_CHANGE_EVT                0x08
00288 #define HCI_READ_REMOTE_VER_INFO_CMPL_EVT 0x0C
00289 #define HCI_CMD_CMPL_EVT                  0x0E
00290 #define HCI_CMD_STATUS_EVT                0x0F
00291 #define HCI_HW_ERROR_EVT                  0x10
00292 #define HCI_NUM_CMPL_PKTS_EVT             0x13
00293 #define HCI_DATA_BUF_OVERFLOW_EVT         0x1A
00294 #define HCI_ENC_KEY_REFRESH_CMPL_EVT      0x30
00295 #define HCI_LE_META_EVT                   0x3E
00296 #define HCI_VENDOR_SPEC_EVT               0xFF
00297 
00298 /*! LE Subevents */
00299 #define HCI_LE_CONN_CMPL_EVT              0x01
00300 #define HCI_LE_ADV_REPORT_EVT             0x02
00301 #define HCI_LE_CONN_UPDATE_CMPL_EVT       0x03
00302 #define HCI_LE_READ_REMOTE_FEAT_CMPL_EVT  0x04
00303 #define HCI_LE_LTK_REQ_EVT                0x05
00304 
00305 /*! Event parameter lengths */
00306 #define HCI_LEN_DISCONNECT_CMPL           4
00307 #define HCI_LEN_ENC_CHANGE                5
00308 #define HCI_LEN_LE_CONN_CMPL              19
00309 #define HCI_LEN_LE_CONN_UPDATE_CMPL       9
00310 #define HCI_LEN_LE_READ_REMOTE_FEAT_CMPL  12
00311 #define HCI_LEN_LE_LTK_REQ                13
00312 
00313 /*! Supported commands */
00314 #define HCI_SUP_DISCONNECT                0x20      /*! Byte 0 */
00315 #define HCI_SUP_READ_REMOTE_VER_INFO      0x80      /*! Byte 2 */
00316 #define HCI_SUP_SET_EVENT_MASK            0x40      /*! Byte 5 */
00317 #define HCI_SUP_RESET                     0x80      /*! Byte 5 */
00318 #define HCI_SUP_READ_TX_PWR_LVL           0x04      /*! Byte 10 */
00319 #define HCI_SUP_SET_CONTROLLER_TO_HOST_FC 0x20      /*! Byte 10 */
00320 #define HCI_SUP_HOST_BUFFER_SIZE          0x40      /*! Byte 10 */
00321 #define HCI_SUP_HOST_NUM_CMPL_PKTS        0x80      /*! Byte 10 */
00322 #define HCI_SUP_READ_LOCAL_VER_INFO       0x08      /*! Byte 14 */
00323 #define HCI_SUP_READ_LOCAL_SUP_FEAT       0x20      /*! Byte 14 */
00324 #define HCI_SUP_READ_BD_ADDR              0x02      /*! Byte 15 */
00325 #define HCI_SUP_READ_RSSI                 0x20      /*! Byte 15 */
00326 #define HCI_SUP_LE_SET_EVENT_MASK         0x01      /*! Byte 25 */
00327 #define HCI_SUP_LE_READ_BUF_SIZE          0x02      /*! Byte 25 */
00328 #define HCI_SUP_LE_READ_LOCAL_SUP_FEAT    0x04      /*! Byte 25 */
00329 #define HCI_SUP_LE_SET_RAND_ADDR          0x10      /*! Byte 25 */
00330 #define HCI_SUP_LE_SET_ADV_PARAM          0x20      /*! Byte 25 */
00331 #define HCI_SUP_LE_READ_ADV_TX_POWER      0x40      /*! Byte 25 */
00332 #define HCI_SUP_LE_SET_ADV_DATA           0x80      /*! Byte 25 */
00333 #define HCI_SUP_LE_SET_SCAN_RESP_DATA     0x01      /*! Byte 26 */
00334 #define HCI_SUP_LE_SET_ADV_ENABLE         0x02      /*! Byte 26 */
00335 #define HCI_SUP_LE_SET_SCAN_PARAM         0x04      /*! Byte 26 */
00336 #define HCI_SUP_LE_SET_SCAN_ENABLE        0x08      /*! Byte 26 */
00337 #define HCI_SUP_LE_CREATE_CONN            0x10      /*! Byte 26 */
00338 #define HCI_SUP_LE_CREATE_CONN_CANCEL     0x20      /*! Byte 26 */
00339 #define HCI_SUP_LE_READ_WHITE_LIST_SIZE   0x40      /*! Byte 26 */
00340 #define HCI_SUP_LE_CLEAR_WHITE_LIST       0x80      /*! Byte 26 */
00341 #define HCI_SUP_LE_ADD_DEV_WHITE_LIST     0x01      /*! Byte 27 */
00342 #define HCI_SUP_LE_REMOVE_DEV_WHITE_LIST  0x02      /*! Byte 27 */
00343 #define HCI_SUP_LE_CONN_UPDATE            0x04      /*! Byte 27 */
00344 #define HCI_SUP_LE_SET_HOST_CHAN_CLASS    0x08      /*! Byte 27 */
00345 #define HCI_SUP_LE_READ_CHAN_MAP          0x10      /*! Byte 27 */
00346 #define HCI_SUP_LE_READ_REMOTE_FEAT       0x20      /*! Byte 27 */
00347 #define HCI_SUP_LE_ENCRYPT                0x40      /*! Byte 27 */
00348 #define HCI_SUP_LE_RAND                   0x80      /*! Byte 27 */
00349 #define HCI_SUP_LE_START_ENCRYPTION       0x01      /*! Byte 28 */
00350 #define HCI_SUP_LE_LTK_REQ_REPL           0x02      /*! Byte 28 */
00351 #define HCI_SUP_LE_LTK_REQ_NEG_REPL       0x04      /*! Byte 28 */
00352 #define HCI_SUP_LE_READ_SUP_STATES        0x08      /*! Byte 28 */
00353 #define HCI_SUP_LE_RECEIVER_TEST          0x10      /*! Byte 28 */
00354 #define HCI_SUP_LE_TRANSMITTER_TEST       0x20      /*! Byte 28 */
00355 #define HCI_SUP_LE_TEST_END               0x40      /*! Byte 28 */
00356 
00357 /*! Event mask */
00358 #define HCI_EVT_MASK_DISCONNECT_CMPL            0x10   /*! Byte 0 */
00359 #define HCI_EVT_MASK_ENC_CHANGE                 0x80   /*! Byte 0 */
00360 #define HCI_EVT_MASK_READ_REMOTE_VER_INFO_CMPL  0x08   /*! Byte 1 */
00361 #define HCI_EVT_MASK_HW_ERROR                   0x80   /*! Byte 1 */
00362 #define HCI_EVT_MASK_DATA_BUF_OVERFLOW          0x02   /*! Byte 3 */
00363 #define HCI_EVT_MASK_ENC_KEY_REFRESH_CMPL       0x80   /*! Byte 5 */
00364 #define HCI_EVT_MASK_LE_META                    0x20   /*! Byte 7 */
00365 
00366 /*! LE event mask */
00367 #define HCI_EVT_MASK_LE_CONN_CMPL_EVT              0x01   /*! Byte 0 */
00368 #define HCI_EVT_MASK_LE_ADV_REPORT_EVT             0x02   /*! Byte 0 */
00369 #define HCI_EVT_MASK_LE_CONN_UPDATE_CMPL_EVT       0x04   /*! Byte 0 */
00370 #define HCI_EVT_MASK_LE_READ_REMOTE_FEAT_CMPL_EVT  0x08   /*! Byte 0 */
00371 #define HCI_EVT_MASK_LE_LTK_REQ_EVT                0x10   /*! Byte 0 */
00372 
00373 /*! LE supported features */
00374 #define HCI_LE_SUP_FEAT_ENCRYPTION        0x01
00375 
00376 /*! Advertising command parameters */
00377 #define HCI_ADV_MIN_INTERVAL              0x0020    /*! Minimum advertising interval */
00378 #define HCI_ADV_NONCONN_MIN_INTERVAL      0x00A0    /*! Minimum nonconnectable adv. interval */
00379 #define HCI_ADV_MAX_INTERVAL              0x4000    /*! Maximum advertising interval */
00380 #define HCI_ADV_TYPE_CONN_UNDIRECT        0x00      /*! Connectable undirected advertising */
00381 #define HCI_ADV_TYPE_CONN_DIRECT          0x01      /*! Connectable directed advertising */
00382 #define HCI_ADV_TYPE_DISC_UNDIRECT        0x02      /*! Discoverable undirected advertising */
00383 #define HCI_ADV_TYPE_NONCONN_UNDIRECT     0x03      /*! Nonconnectable undirected advertising */
00384 #define HCI_ADV_CHAN_37                   0x01      /*! Advertising channel 37 */
00385 #define HCI_ADV_CHAN_38                   0x02      /*! Advertising channel 38 */
00386 #define HCI_ADV_CHAN_39                   0x04      /*! Advertising channel 39 */
00387 #define HCI_ADV_FILT_NONE                 0x00      /*! No scan request or connection filtering */
00388 #define HCI_ADV_FILT_SCAN                 0x01      /*! White list filters scan requests */
00389 #define HCI_ADV_FILT_CONN                 0x02      /*! White list filters connections */
00390 #define HCI_ADV_FILT_ALL                  0x03      /*! White list filters scan req. and conn. */
00391 
00392 /*! Scan command parameters */
00393 #define HCI_SCAN_TYPE_PASSIVE             0         /*! Passive scan */
00394 #define HCI_SCAN_TYPE_ACTIVE              1         /*! Active scan */
00395 #define HCI_SCAN_INTERVAL_MIN             0x0004    /*! Minimum scan interval */
00396 #define HCI_SCAN_INTERVAL_MAX             0x4000    /*! Maximum scan interval */
00397 #define HCI_SCAN_INTERVAL_DEFAULT         0x0010    /*! Default scan interval */
00398 #define HCI_SCAN_WINDOW_MIN               0x0004    /*! Minimum scan window */
00399 #define HCI_SCAN_WINDOW_MAX               0x4000    /*! Maximum scan window */
00400 #define HCI_SCAN_WINDOW_DEFAULT           0x0010    /*! Default scan window */
00401 
00402 /*! Connection command parameters */
00403 #define HCI_CONN_INTERVAL_MIN             0x0006    /*! Minimum connection interval */
00404 #define HCI_CONN_INTERVAL_MAX             0x0C80    /*! Maximum connection interval */
00405 #define HCI_CONN_LATENCY_MAX              0x01F3    /*! Maximum connection latency */
00406 #define HCI_SUP_TIMEOUT_MIN               0x000A    /*! Minimum supervision timeout */
00407 #define HCI_SUP_TIMEOUT_MAX               0x0C80    /*! Maximum supervision timeout */
00408 
00409 /*! Connection event parameters */
00410 #define HCI_ROLE_MASTER                   0         /*! Role is master */
00411 #define HCI_ROLE_SLAVE                    1         /*! Role is slave */
00412 #define HCI_CLOCK_500PPM                  0x00      /*! 500 ppm clock accuracy */
00413 #define HCI_CLOCK_250PPM                  0x01      /*! 250 ppm clock accuracy */
00414 #define HCI_CLOCK_150PPM                  0x02      /*! 150 ppm clock accuracy */
00415 #define HCI_CLOCK_100PPM                  0x03      /*! 100 ppm clock accuracy */
00416 #define HCI_CLOCK_75PPM                   0x04      /*! 75 ppm clock accuracy */
00417 #define HCI_CLOCK_50PPM                   0x05      /*! 50 ppm clock accuracy */
00418 #define HCI_CLOCK_30PPM                   0x06      /*! 30 ppm clock accuracy */
00419 #define HCI_CLOCK_20PPM                   0x07      /*! 20 ppm clock accuracy */
00420 
00421 /*! Advertising report event parameters */
00422 #define HCI_ADV_CONN_UNDIRECT             0x00      /*! Connectable undirected advertising */
00423 #define HCI_ADV_CONN_DIRECT               0x01      /*! Connectable directed advertising */
00424 #define HCI_ADV_DISC_UNDIRECT             0x02      /*! Discoverable undirected advertising */
00425 #define HCI_ADV_NONCONN_UNDIRECT          0x03      /*! Non-connectable undirected advertising */
00426 #define HCI_ADV_SCAN_RESPONSE             0x04      /*! Scan response */
00427 
00428 /*! Misc command parameters */
00429 #define HCI_READ_TX_PWR_CURRENT           0         /*! Read current tx power */
00430 #define HCI_READ_TX_PWR_MAX               1         /*! Read maximum tx power */
00431 #define HCI_TX_PWR_MIN                    -30       /*! Minimum tx power dBm */
00432 #define HCI_TX_PWR_MAX                    20        /*! Maximum tx power dBm */
00433 #define HCI_VERSION                       6         /*! HCI specification version */
00434 #define HCI_RSSI_MIN                      -127      /*! Minimum RSSI dBm */
00435 #define HCI_RSSI_MAX                      20        /*! Maximum RSSI dBm */
00436 #define HCI_ADDR_TYPE_PUBLIC              0         /*! Public device address */
00437 #define HCI_ADDR_TYPE_RANDOM              1         /*! Random device address */
00438 #define HCI_FILT_NONE                     0         /*! No white list filtering */
00439 #define HCI_FILT_WHITE_LIST               1         /*! White list filtering */
00440 #define HCI_ROLE_MASTER                   0         /*! Role is master */
00441 #define HCI_ROLE_SLAVE                    1         /*! Role is slave */
00442 
00443 /*! Parameter lengths */
00444 #define HCI_EVT_MASK_LEN                  8         /*! Length of event mask byte array */
00445 #define HCI_LE_EVT_MASK_LEN               8         /*! Length of LE event mask byte array */
00446 #define HCI_FEAT_LEN                      8         /*! Length of features byte array */
00447 #define HCI_ADV_DATA_LEN                  31        /*! Length of advertising data */
00448 #define HCI_SCAN_DATA_LEN                 31        /*! Length of scan response data */
00449 #define HCI_CHAN_MAP_LEN                  5         /*! Length of channel map byte array */
00450 #define HCI_KEY_LEN                       16        /*! Length of encryption key */
00451 #define HCI_ENCRYPT_DATA_LEN              16        /*! Length of data used in encryption */
00452 #define HCI_RAND_LEN                      8         /*! Length of random number */
00453 #define HCI_LE_STATES_LEN                 8         /*! Length of LE states byte array */
00454 
00455 /*! Wicentric company ID */
00456 #define HCI_ID_WICENTRIC                  0x005F
00457 
00458 #ifdef __cplusplus
00459 };
00460 #endif
00461 
00462 #endif /* HCI_DEFS_H */