The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 1999-2012 Broadcom Corporation |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | ******************************************************************************/ |
| 18 | |
| 19 | /****************************************************************************** |
| 20 | * |
| 21 | * This file contains the Bluetooth Manager (BTM) API function external |
| 22 | * definitions. |
| 23 | * |
| 24 | ******************************************************************************/ |
| 25 | #ifndef BTM_API_H |
| 26 | #define BTM_API_H |
| 27 | |
| 28 | #include "bt_target.h" |
| 29 | #include "sdp_api.h" |
| 30 | #include "hcidefs.h" |
| 31 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 32 | #include "smp_api.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 33 | /***************************************************************************** |
| 34 | ** DEVICE CONTROL and COMMON |
| 35 | *****************************************************************************/ |
| 36 | /***************************** |
| 37 | ** Device Control Constants |
| 38 | ******************************/ |
| 39 | /* Maximum number of bytes allowed for vendor specific command parameters */ |
| 40 | #define BTM_MAX_VENDOR_SPECIFIC_LEN HCI_COMMAND_SIZE |
| 41 | |
| 42 | /* BTM application return status codes */ |
| 43 | enum |
| 44 | { |
| 45 | BTM_SUCCESS = 0, /* 0 Command succeeded */ |
| 46 | BTM_CMD_STARTED, /* 1 Command started OK. */ |
| 47 | BTM_BUSY, /* 2 Device busy with another command */ |
| 48 | BTM_NO_RESOURCES, /* 3 No resources to issue command */ |
| 49 | BTM_MODE_UNSUPPORTED, /* 4 Request for 1 or more unsupported modes */ |
| 50 | BTM_ILLEGAL_VALUE, /* 5 Illegal parameter value */ |
| 51 | BTM_WRONG_MODE, /* 6 Device in wrong mode for request */ |
| 52 | BTM_UNKNOWN_ADDR, /* 7 Unknown remote BD address */ |
| 53 | BTM_DEVICE_TIMEOUT, /* 8 Device timeout */ |
| 54 | BTM_BAD_VALUE_RET, /* 9 A bad value was received from HCI */ |
| 55 | BTM_ERR_PROCESSING, /* 10 Generic error */ |
| 56 | BTM_NOT_AUTHORIZED, /* 11 Authorization failed */ |
| 57 | BTM_DEV_RESET, /* 12 Device has been reset */ |
| 58 | BTM_CMD_STORED, /* 13 request is stored in control block */ |
| 59 | BTM_ILLEGAL_ACTION, /* 14 state machine gets illegal command */ |
| 60 | BTM_DELAY_CHECK, /* 15 delay the check on encryption */ |
| 61 | BTM_SCO_BAD_LENGTH, /* 16 Bad SCO over HCI data length */ |
| 62 | BTM_SUCCESS_NO_SECURITY, /* 17 security passed, no security set */ |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 63 | BTM_FAILED_ON_SECURITY, /* 18 security failed */ |
| 64 | BTM_REPEATED_ATTEMPTS, /* 19 repeated attempts for LE security requests */ |
| 65 | BTM_MODE4_LEVEL4_NOT_SUPPORTED /* 20 Secure Connections Only Mode can't be supported */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 66 | }; |
Satya Calloji | 5725fc6 | 2015-03-31 13:24:32 -0700 | [diff] [blame] | 67 | |
| 68 | typedef uint8_t tBTM_STATUS; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 69 | |
Matthew Xie | 7f3e429 | 2013-09-30 12:44:10 -0700 | [diff] [blame] | 70 | #if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE) |
| 71 | typedef enum |
| 72 | { |
| 73 | BTM_BR_ONE, /*0 First state or BR/EDR scan 1*/ |
| 74 | BTM_BLE_ONE, /*1BLE scan 1*/ |
| 75 | BTM_BR_TWO, /*2 BR/EDR scan 2*/ |
| 76 | BTM_BLE_TWO, /*3 BLE scan 2*/ |
| 77 | BTM_FINISH, /*4 End of Interleave Scan, or normal scan*/ |
| 78 | BTM_NO_INTERLEAVING /*5 No Interleaving*/ |
| 79 | }btm_inq_state; |
| 80 | #endif |
| 81 | |
| 82 | |
| 83 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 84 | /************************* |
| 85 | ** Device Control Types |
| 86 | **************************/ |
| 87 | #define BTM_DEVICE_ROLE_BR 0x01 |
| 88 | #define BTM_DEVICE_ROLE_DUAL 0x02 |
| 89 | #define BTM_MAX_DEVICE_ROLE BTM_DEVICE_ROLE_DUAL |
| 90 | typedef UINT8 tBTM_DEVICE_ROLE; |
| 91 | |
| 92 | /* Device name of peer (may be truncated to save space in BTM database) */ |
| 93 | typedef UINT8 tBTM_BD_NAME[BTM_MAX_REM_BD_NAME_LEN + 1]; |
| 94 | |
| 95 | /* Structure returned with local version information */ |
| 96 | typedef struct |
| 97 | { |
| 98 | UINT8 hci_version; |
| 99 | UINT16 hci_revision; |
| 100 | UINT8 lmp_version; |
| 101 | UINT16 manufacturer; |
| 102 | UINT16 lmp_subversion; |
| 103 | } tBTM_VERSION_INFO; |
| 104 | |
| 105 | /* Structure returned with Vendor Specific Command complete callback */ |
| 106 | typedef struct |
| 107 | { |
| 108 | UINT16 opcode; |
| 109 | UINT16 param_len; |
| 110 | UINT8 *p_param_buf; |
| 111 | } tBTM_VSC_CMPL; |
| 112 | |
| 113 | #define BTM_VSC_CMPL_DATA_SIZE (BTM_MAX_VENDOR_SPECIFIC_LEN + sizeof(tBTM_VSC_CMPL)) |
| 114 | /************************************************** |
| 115 | ** Device Control and General Callback Functions |
| 116 | ***************************************************/ |
| 117 | /* Callback function for when device status changes. Appl must poll for |
| 118 | ** what the new state is (BTM_IsDeviceUp). The event occurs whenever the stack |
| 119 | ** has detected that the controller status has changed. This asynchronous event |
| 120 | ** is enabled/disabled by calling BTM_RegisterForDeviceStatusNotif(). |
| 121 | */ |
| 122 | enum |
| 123 | { |
| 124 | BTM_DEV_STATUS_UP, |
| 125 | BTM_DEV_STATUS_DOWN, |
| 126 | BTM_DEV_STATUS_CMD_TOUT |
| 127 | }; |
| 128 | |
| 129 | typedef UINT8 tBTM_DEV_STATUS; |
| 130 | |
| 131 | |
| 132 | typedef void (tBTM_DEV_STATUS_CB) (tBTM_DEV_STATUS status); |
| 133 | |
| 134 | |
| 135 | /* Callback function for when a vendor specific event occurs. The length and |
| 136 | ** array of returned parameter bytes are included. This asynchronous event |
| 137 | ** is enabled/disabled by calling BTM_RegisterForVSEvents(). |
| 138 | */ |
| 139 | typedef void (tBTM_VS_EVT_CB) (UINT8 len, UINT8 *p); |
| 140 | |
| 141 | |
| 142 | /* General callback function for notifying an application that a synchronous |
| 143 | ** BTM function is complete. The pointer contains the address of any returned data. |
| 144 | */ |
| 145 | typedef void (tBTM_CMPL_CB) (void *p1); |
| 146 | |
| 147 | /* VSC callback function for notifying an application that a synchronous |
| 148 | ** BTM function is complete. The pointer contains the address of any returned data. |
| 149 | */ |
| 150 | typedef void (tBTM_VSC_CMPL_CB) (tBTM_VSC_CMPL *p1); |
| 151 | |
| 152 | /* Callback for apps to check connection and inquiry filters. |
| 153 | ** Parameters are the BD Address of remote and the Dev Class of remote. |
| 154 | ** If the app returns none zero, the connection or inquiry result will be dropped. |
| 155 | */ |
| 156 | typedef UINT8 (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc); |
| 157 | |
| 158 | /***************************************************************************** |
| 159 | ** DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device |
| 160 | *****************************************************************************/ |
| 161 | /******************************* |
| 162 | ** Device Discovery Constants |
| 163 | ********************************/ |
| 164 | /* Discoverable modes */ |
| 165 | #define BTM_NON_DISCOVERABLE 0 |
| 166 | #define BTM_LIMITED_DISCOVERABLE 1 |
| 167 | #define BTM_GENERAL_DISCOVERABLE 2 |
| 168 | #define BTM_DISCOVERABLE_MASK (BTM_LIMITED_DISCOVERABLE|BTM_GENERAL_DISCOVERABLE) |
| 169 | #define BTM_MAX_DISCOVERABLE BTM_GENERAL_DISCOVERABLE |
| 170 | /* high byte for BLE Discoverable modes */ |
| 171 | #define BTM_BLE_NON_DISCOVERABLE 0x0000 |
| 172 | #define BTM_BLE_LIMITED_DISCOVERABLE 0x0100 |
| 173 | #define BTM_BLE_GENERAL_DISCOVERABLE 0x0200 |
| 174 | #define BTM_BLE_MAX_DISCOVERABLE BTM_BLE_GENERAL_DISCOVERABLE |
| 175 | #define BTM_BLE_DISCOVERABLE_MASK (BTM_BLE_NON_DISCOVERABLE|BTM_BLE_LIMITED_DISCOVERABLE|BTM_BLE_GENERAL_DISCOVERABLE) |
| 176 | |
| 177 | /* Connectable modes */ |
| 178 | #define BTM_NON_CONNECTABLE 0 |
| 179 | #define BTM_CONNECTABLE 1 |
| 180 | #define BTM_CONNECTABLE_MASK (BTM_NON_CONNECTABLE | BTM_CONNECTABLE) |
| 181 | /* high byte for BLE Connectable modes */ |
| 182 | #define BTM_BLE_NON_CONNECTABLE 0x0000 |
| 183 | #define BTM_BLE_CONNECTABLE 0x0100 |
| 184 | #define BTM_BLE_MAX_CONNECTABLE BTM_BLE_CONNECTABLE |
| 185 | #define BTM_BLE_CONNECTABLE_MASK (BTM_BLE_NON_CONNECTABLE | BTM_BLE_CONNECTABLE) |
| 186 | |
| 187 | /* Inquiry modes |
| 188 | * Note: These modes are associated with the inquiry active values (BTM_*ACTIVE) */ |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 189 | #define BTM_INQUIRY_NONE 0 |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 190 | #define BTM_GENERAL_INQUIRY 0x01 |
| 191 | #define BTM_LIMITED_INQUIRY 0x02 |
| 192 | #define BTM_BR_INQUIRY_MASK (BTM_GENERAL_INQUIRY | BTM_LIMITED_INQUIRY) |
| 193 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 194 | /* high byte of inquiry mode for BLE inquiry mode */ |
| 195 | #define BTM_BLE_INQUIRY_NONE 0x00 |
| 196 | #define BTM_BLE_GENERAL_INQUIRY 0x10 |
| 197 | #define BTM_BLE_LIMITED_INQUIRY 0x20 |
| 198 | #define BTM_BLE_INQUIRY_MASK (BTM_BLE_GENERAL_INQUIRY|BTM_BLE_LIMITED_INQUIRY) |
| 199 | |
| 200 | /* BTM_IsInquiryActive return values (Bit Mask) |
| 201 | * Note: These bit masks are associated with the inquiry modes (BTM_*_INQUIRY) */ |
| 202 | #define BTM_INQUIRY_INACTIVE 0x0 /* no inquiry in progress */ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 203 | #define BTM_GENERAL_INQUIRY_ACTIVE BTM_GENERAL_INQUIRY /* a general inquiry is in progress */ |
| 204 | #define BTM_LIMITED_INQUIRY_ACTIVE BTM_LIMITED_INQUIRY /* a limited inquiry is in progress */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 205 | #define BTM_PERIODIC_INQUIRY_ACTIVE 0x8 /* a periodic inquiry is active */ |
| 206 | #define BTM_SSP_INQUIRY_ACTIVE 0x4 /* SSP is active, so inquiry is disallowed (work around for FW bug) */ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 207 | #define BTM_LE_GENERAL_INQUIRY_ACTIVE BTM_BLE_GENERAL_INQUIRY /* a general inquiry is in progress */ |
| 208 | #define BTM_LE_LIMITED_INQUIRY_ACTIVE BTM_BLE_LIMITED_INQUIRY /* a limited inquiry is in progress */ |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 209 | |
| 210 | /* inquiry activity mask */ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 211 | #define BTM_BR_INQ_ACTIVE_MASK (BTM_GENERAL_INQUIRY_ACTIVE|BTM_LIMITED_INQUIRY_ACTIVE|BTM_PERIODIC_INQUIRY_ACTIVE) /* BR/EDR inquiry activity mask */ |
| 212 | #define BTM_BLE_SCAN_ACTIVE_MASK 0xF0 /* LE scan activity mask */ |
| 213 | #define BTM_BLE_INQ_ACTIVE_MASK (BTM_LE_GENERAL_INQUIRY_ACTIVE|BTM_LE_LIMITED_INQUIRY_ACTIVE) /* LE inquiry activity mask*/ |
| 214 | #define BTM_INQUIRY_ACTIVE_MASK (BTM_BR_INQ_ACTIVE_MASK | BTM_BLE_INQ_ACTIVE_MASK) /* inquiry activity mask */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 215 | |
| 216 | /* Define scan types */ |
| 217 | #define BTM_SCAN_TYPE_STANDARD 0 |
| 218 | #define BTM_SCAN_TYPE_INTERLACED 1 /* 1.2 devices only */ |
| 219 | |
| 220 | /* Define inquiry results mode */ |
| 221 | #define BTM_INQ_RESULT_STANDARD 0 |
| 222 | #define BTM_INQ_RESULT_WITH_RSSI 1 |
| 223 | #define BTM_INQ_RESULT_EXTENDED 2 |
| 224 | |
| 225 | #define BTM_INQ_RES_IGNORE_RSSI 0x7f /* RSSI value not supplied (ignore it) */ |
| 226 | |
| 227 | /* Inquiry Filter Condition types (see tBTM_INQ_PARMS) */ |
| 228 | #define BTM_CLR_INQUIRY_FILTER 0 /* Inquiry Filtering is turned off */ |
| 229 | #define BTM_FILTER_COND_DEVICE_CLASS HCI_FILTER_COND_DEVICE_CLASS /* Filter on device class */ |
| 230 | #define BTM_FILTER_COND_BD_ADDR HCI_FILTER_COND_BD_ADDR /* Filter on device addr */ |
| 231 | |
| 232 | /* State of the remote name retrieval during inquiry operations. |
| 233 | ** Used in the tBTM_INQ_INFO structure, and returned in the |
| 234 | ** BTM_InqDbRead, BTM_InqDbFirst, and BTM_InqDbNext functions. |
| 235 | ** The name field is valid when the state returned is |
| 236 | ** BTM_INQ_RMT_NAME_DONE */ |
| 237 | #define BTM_INQ_RMT_NAME_EMPTY 0 |
| 238 | #define BTM_INQ_RMT_NAME_PENDING 1 |
| 239 | #define BTM_INQ_RMT_NAME_DONE 2 |
| 240 | #define BTM_INQ_RMT_NAME_FAILED 3 |
| 241 | |
| 242 | /********************************* |
| 243 | *** Class of Device constants *** |
| 244 | *********************************/ |
| 245 | #define BTM_FORMAT_TYPE_1 0x00 |
| 246 | |
| 247 | /**************************** |
| 248 | ** minor device class field |
| 249 | *****************************/ |
| 250 | |
| 251 | /* 0x00 is used as unclassified for all minor device classes */ |
| 252 | #define BTM_COD_MINOR_UNCLASSIFIED 0x00 |
| 253 | |
| 254 | /* minor device class field for Computer Major Class */ |
| 255 | /* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */ |
| 256 | #define BTM_COD_MINOR_DESKTOP_WORKSTATION 0x04 |
| 257 | #define BTM_COD_MINOR_SERVER_COMPUTER 0x08 |
| 258 | #define BTM_COD_MINOR_LAPTOP 0x0C |
| 259 | #define BTM_COD_MINOR_HANDHELD_PC_PDA 0x10 /* clam shell */ |
| 260 | #define BTM_COD_MINOR_PALM_SIZE_PC_PDA 0x14 |
| 261 | #define BTM_COD_MINOR_WEARABLE_COMPUTER 0x18 /* watch sized */ |
| 262 | |
| 263 | /* minor device class field for Phone Major Class */ |
| 264 | /* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */ |
| 265 | #define BTM_COD_MINOR_CELLULAR 0x04 |
| 266 | #define BTM_COD_MINOR_CORDLESS 0x08 |
| 267 | #define BTM_COD_MINOR_SMART_PHONE 0x0C |
| 268 | #define BTM_COD_MINOR_WIRED_MDM_V_GTWY 0x10 /* wired modem or voice gatway */ |
| 269 | #define BTM_COD_MINOR_ISDN_ACCESS 0x14 |
| 270 | |
| 271 | /* minor device class field for LAN Access Point Major Class */ |
| 272 | /* Load Factor Field bit 5-7 */ |
| 273 | #define BTM_COD_MINOR_FULLY_AVAILABLE 0x00 |
| 274 | #define BTM_COD_MINOR_1_17_UTILIZED 0x20 |
| 275 | #define BTM_COD_MINOR_17_33_UTILIZED 0x40 |
| 276 | #define BTM_COD_MINOR_33_50_UTILIZED 0x60 |
| 277 | #define BTM_COD_MINOR_50_67_UTILIZED 0x80 |
| 278 | #define BTM_COD_MINOR_67_83_UTILIZED 0xA0 |
| 279 | #define BTM_COD_MINOR_83_99_UTILIZED 0xC0 |
| 280 | #define BTM_COD_MINOR_NO_SERVICE_AVAILABLE 0xE0 |
| 281 | /* sub-Field bit 2-4 */ |
| 282 | /* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */ |
| 283 | |
| 284 | /* minor device class field for Audio/Video Major Class */ |
| 285 | /* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */ |
| 286 | #define BTM_COD_MINOR_CONFM_HEADSET 0x04 |
| 287 | #define BTM_COD_MINOR_CONFM_HANDSFREE 0x08 |
| 288 | #define BTM_COD_MINOR_MICROPHONE 0x10 |
| 289 | #define BTM_COD_MINOR_LOUDSPEAKER 0x14 |
| 290 | #define BTM_COD_MINOR_HEADPHONES 0x18 |
| 291 | #define BTM_COD_MINOR_PORTABLE_AUDIO 0x1C |
| 292 | #define BTM_COD_MINOR_CAR_AUDIO 0x20 |
| 293 | #define BTM_COD_MINOR_SET_TOP_BOX 0x24 |
| 294 | #define BTM_COD_MINOR_HIFI_AUDIO 0x28 |
| 295 | #define BTM_COD_MINOR_VCR 0x2C |
| 296 | #define BTM_COD_MINOR_VIDEO_CAMERA 0x30 |
| 297 | #define BTM_COD_MINOR_CAMCORDER 0x34 |
| 298 | #define BTM_COD_MINOR_VIDEO_MONITOR 0x38 |
| 299 | #define BTM_COD_MINOR_VIDDISP_LDSPKR 0x3C |
| 300 | #define BTM_COD_MINOR_VIDEO_CONFERENCING 0x40 |
| 301 | #define BTM_COD_MINOR_GAMING_TOY 0x48 |
| 302 | |
| 303 | /* minor device class field for Peripheral Major Class */ |
| 304 | /* Bits 6-7 independently specify mouse, keyboard, or combo mouse/keyboard */ |
| 305 | #define BTM_COD_MINOR_KEYBOARD 0x40 |
| 306 | #define BTM_COD_MINOR_POINTING 0x80 |
| 307 | #define BTM_COD_MINOR_COMBO 0xC0 |
| 308 | /* Bits 2-5 OR'd with selection from bits 6-7 */ |
| 309 | /* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */ |
| 310 | #define BTM_COD_MINOR_JOYSTICK 0x04 |
| 311 | #define BTM_COD_MINOR_GAMEPAD 0x08 |
| 312 | #define BTM_COD_MINOR_REMOTE_CONTROL 0x0C |
| 313 | #define BTM_COD_MINOR_SENSING_DEVICE 0x10 |
| 314 | #define BTM_COD_MINOR_DIGITIZING_TABLET 0x14 |
| 315 | #define BTM_COD_MINOR_CARD_READER 0x18 /* e.g. SIM card reader */ |
| 316 | #define BTM_COD_MINOR_DIGITAL_PAN 0x1C |
| 317 | #define BTM_COD_MINOR_HAND_SCANNER 0x20 |
| 318 | #define BTM_COD_MINOR_HAND_GESTURAL_INPUT 0x24 |
| 319 | |
| 320 | /* minor device class field for Imaging Major Class */ |
| 321 | /* Bits 5-7 independently specify display, camera, scanner, or printer */ |
| 322 | #define BTM_COD_MINOR_DISPLAY 0x10 |
| 323 | #define BTM_COD_MINOR_CAMERA 0x20 |
| 324 | #define BTM_COD_MINOR_SCANNER 0x40 |
| 325 | #define BTM_COD_MINOR_PRINTER 0x80 |
| 326 | /* Bits 2-3 Reserved */ |
| 327 | /* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */ |
| 328 | |
| 329 | /* minor device class field for Wearable Major Class */ |
| 330 | /* Bits 2-7 meaningful */ |
| 331 | #define BTM_COD_MINOR_WRIST_WATCH 0x04 |
| 332 | #define BTM_COD_MINOR_PAGER 0x08 |
| 333 | #define BTM_COD_MINOR_JACKET 0x0C |
| 334 | #define BTM_COD_MINOR_HELMET 0x10 |
| 335 | #define BTM_COD_MINOR_GLASSES 0x14 |
| 336 | |
| 337 | /* minor device class field for Toy Major Class */ |
| 338 | /* Bits 2-7 meaningful */ |
| 339 | #define BTM_COD_MINOR_ROBOT 0x04 |
| 340 | #define BTM_COD_MINOR_VEHICLE 0x08 |
| 341 | #define BTM_COD_MINOR_DOLL_ACTION_FIGURE 0x0C |
| 342 | #define BTM_COD_MINOR_CONTROLLER 0x10 |
| 343 | #define BTM_COD_MINOR_GAME 0x14 |
| 344 | |
| 345 | /* minor device class field for Health Major Class */ |
| 346 | /* Bits 2-7 meaningful */ |
| 347 | #define BTM_COD_MINOR_BLOOD_MONITOR 0x04 |
| 348 | #define BTM_COD_MINOR_THERMOMETER 0x08 |
| 349 | #define BTM_COD_MINOR_WEIGHING_SCALE 0x0C |
| 350 | #define BTM_COD_MINOR_GLUCOSE_METER 0x10 |
| 351 | #define BTM_COD_MINOR_PULSE_OXIMETER 0x14 |
| 352 | #define BTM_COD_MINOR_HEART_PULSE_MONITOR 0x18 |
| 353 | #define BTM_COD_MINOR_HEALTH_DATA_DISPLAY 0x1C |
| 354 | #define BTM_COD_MINOR_STEP_COUNTER 0x20 |
| 355 | #define BTM_COD_MINOR_BODY_COM_ANALYZER 0x24 |
| 356 | #define BTM_COD_MINOR_PEAK_FLOW_MONITOR 0x28 |
| 357 | #define BTM_COD_MINOR_MEDICATION_MONITOR 0x2C |
| 358 | #define BTM_COD_MINOR_KNEE_PROSTHESIS 0x30 |
| 359 | #define BTM_COD_MINOR_ANKLE_PROSTHESIS 0x34 |
| 360 | |
| 361 | |
| 362 | /*************************** |
| 363 | ** major device class field |
| 364 | ****************************/ |
| 365 | #define BTM_COD_MAJOR_MISCELLANEOUS 0x00 |
| 366 | #define BTM_COD_MAJOR_COMPUTER 0x01 |
| 367 | #define BTM_COD_MAJOR_PHONE 0x02 |
| 368 | #define BTM_COD_MAJOR_LAN_ACCESS_PT 0x03 |
| 369 | #define BTM_COD_MAJOR_AUDIO 0x04 |
| 370 | #define BTM_COD_MAJOR_PERIPHERAL 0x05 |
| 371 | #define BTM_COD_MAJOR_IMAGING 0x06 |
| 372 | #define BTM_COD_MAJOR_WEARABLE 0x07 |
| 373 | #define BTM_COD_MAJOR_TOY 0x08 |
| 374 | #define BTM_COD_MAJOR_HEALTH 0x09 |
| 375 | #define BTM_COD_MAJOR_UNCLASSIFIED 0x1F |
| 376 | |
| 377 | /*************************** |
| 378 | ** service class fields |
| 379 | ****************************/ |
| 380 | #define BTM_COD_SERVICE_LMTD_DISCOVER 0x0020 |
| 381 | #define BTM_COD_SERVICE_POSITIONING 0x0100 |
| 382 | #define BTM_COD_SERVICE_NETWORKING 0x0200 |
| 383 | #define BTM_COD_SERVICE_RENDERING 0x0400 |
| 384 | #define BTM_COD_SERVICE_CAPTURING 0x0800 |
| 385 | #define BTM_COD_SERVICE_OBJ_TRANSFER 0x1000 |
| 386 | #define BTM_COD_SERVICE_AUDIO 0x2000 |
| 387 | #define BTM_COD_SERVICE_TELEPHONY 0x4000 |
| 388 | #define BTM_COD_SERVICE_INFORMATION 0x8000 |
| 389 | |
| 390 | /* class of device field macros */ |
| 391 | #define BTM_COD_FORMAT_TYPE(u8, pd) {u8 = pd[2]&0x03;} |
| 392 | #define BTM_COD_MINOR_CLASS(u8, pd) {u8 = pd[2]&0xFC;} |
| 393 | #define BTM_COD_MAJOR_CLASS(u8, pd) {u8 = pd[1]&0x1F;} |
| 394 | #define BTM_COD_SERVICE_CLASS(u16, pd) {u16 = pd[0]; u16<<=8; u16 += pd[1]&0xE0;} |
| 395 | |
| 396 | /* to set the fields (assumes that format type is always 0) */ |
| 397 | #define FIELDS_TO_COD(pd, mn, mj, sv) {pd[2] = mn; pd[1] = \ |
| 398 | mj+ ((sv)&BTM_COD_SERVICE_CLASS_LO_B); \ |
| 399 | pd[0] = (sv) >> 8;} |
| 400 | |
| 401 | /* the COD masks */ |
| 402 | #define BTM_COD_FORMAT_TYPE_MASK 0x03 |
| 403 | #define BTM_COD_MINOR_CLASS_MASK 0xFC |
| 404 | #define BTM_COD_MAJOR_CLASS_MASK 0x1F |
| 405 | #define BTM_COD_SERVICE_CLASS_LO_B 0x00E0 |
| 406 | #define BTM_COD_SERVICE_CLASS_MASK 0xFFE0 |
| 407 | |
| 408 | |
| 409 | /* BTM service definitions |
| 410 | ** Used for storing EIR data to bit mask |
| 411 | */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 412 | enum |
| 413 | { |
| 414 | BTM_EIR_UUID_SERVCLASS_SERVICE_DISCOVERY_SERVER, |
| 415 | /* BTM_EIR_UUID_SERVCLASS_BROWSE_GROUP_DESCRIPTOR, */ |
| 416 | /* BTM_EIR_UUID_SERVCLASS_PUBLIC_BROWSE_GROUP, */ |
| 417 | BTM_EIR_UUID_SERVCLASS_SERIAL_PORT, |
| 418 | BTM_EIR_UUID_SERVCLASS_LAN_ACCESS_USING_PPP, |
| 419 | BTM_EIR_UUID_SERVCLASS_DIALUP_NETWORKING, |
| 420 | BTM_EIR_UUID_SERVCLASS_IRMC_SYNC, |
| 421 | BTM_EIR_UUID_SERVCLASS_OBEX_OBJECT_PUSH, |
| 422 | BTM_EIR_UUID_SERVCLASS_OBEX_FILE_TRANSFER, |
| 423 | BTM_EIR_UUID_SERVCLASS_IRMC_SYNC_COMMAND, |
| 424 | BTM_EIR_UUID_SERVCLASS_HEADSET, |
| 425 | BTM_EIR_UUID_SERVCLASS_CORDLESS_TELEPHONY, |
| 426 | BTM_EIR_UUID_SERVCLASS_AUDIO_SOURCE, |
| 427 | BTM_EIR_UUID_SERVCLASS_AUDIO_SINK, |
| 428 | BTM_EIR_UUID_SERVCLASS_AV_REM_CTRL_TARGET, |
| 429 | /* BTM_EIR_UUID_SERVCLASS_ADV_AUDIO_DISTRIBUTION, */ |
| 430 | BTM_EIR_UUID_SERVCLASS_AV_REMOTE_CONTROL, |
| 431 | /* BTM_EIR_UUID_SERVCLASS_VIDEO_CONFERENCING, */ |
| 432 | BTM_EIR_UUID_SERVCLASS_INTERCOM, |
| 433 | BTM_EIR_UUID_SERVCLASS_FAX, |
| 434 | BTM_EIR_UUID_SERVCLASS_HEADSET_AUDIO_GATEWAY, |
| 435 | /* BTM_EIR_UUID_SERVCLASS_WAP, */ |
| 436 | /* BTM_EIR_UUID_SERVCLASS_WAP_CLIENT, */ |
| 437 | BTM_EIR_UUID_SERVCLASS_PANU, |
| 438 | BTM_EIR_UUID_SERVCLASS_NAP, |
| 439 | BTM_EIR_UUID_SERVCLASS_GN, |
| 440 | BTM_EIR_UUID_SERVCLASS_DIRECT_PRINTING, |
| 441 | /* BTM_EIR_UUID_SERVCLASS_REFERENCE_PRINTING, */ |
| 442 | BTM_EIR_UUID_SERVCLASS_IMAGING, |
| 443 | BTM_EIR_UUID_SERVCLASS_IMAGING_RESPONDER, |
| 444 | BTM_EIR_UUID_SERVCLASS_IMAGING_AUTO_ARCHIVE, |
| 445 | BTM_EIR_UUID_SERVCLASS_IMAGING_REF_OBJECTS, |
| 446 | BTM_EIR_UUID_SERVCLASS_HF_HANDSFREE, |
| 447 | BTM_EIR_UUID_SERVCLASS_AG_HANDSFREE, |
| 448 | BTM_EIR_UUID_SERVCLASS_DIR_PRT_REF_OBJ_SERVICE, |
| 449 | /* BTM_EIR_UUID_SERVCLASS_REFLECTED_UI, */ |
| 450 | BTM_EIR_UUID_SERVCLASS_BASIC_PRINTING, |
| 451 | BTM_EIR_UUID_SERVCLASS_PRINTING_STATUS, |
| 452 | BTM_EIR_UUID_SERVCLASS_HUMAN_INTERFACE, |
| 453 | BTM_EIR_UUID_SERVCLASS_CABLE_REPLACEMENT, |
| 454 | BTM_EIR_UUID_SERVCLASS_HCRP_PRINT, |
| 455 | BTM_EIR_UUID_SERVCLASS_HCRP_SCAN, |
| 456 | /* BTM_EIR_UUID_SERVCLASS_COMMON_ISDN_ACCESS, */ |
| 457 | /* BTM_EIR_UUID_SERVCLASS_VIDEO_CONFERENCING_GW, */ |
| 458 | /* BTM_EIR_UUID_SERVCLASS_UDI_MT, */ |
| 459 | /* BTM_EIR_UUID_SERVCLASS_UDI_TA, */ |
| 460 | /* BTM_EIR_UUID_SERVCLASS_VCP, */ |
| 461 | BTM_EIR_UUID_SERVCLASS_SAP, |
| 462 | BTM_EIR_UUID_SERVCLASS_PBAP_PCE, |
| 463 | BTM_EIR_UUID_SERVCLASS_PBAP_PSE, |
| 464 | /* BTM_EIR_UUID_SERVCLASS_TE_PHONE_ACCESS, */ |
| 465 | /* BTM_EIR_UUID_SERVCLASS_ME_PHONE_ACCESS, */ |
| 466 | BTM_EIR_UUID_SERVCLASS_PHONE_ACCESS, |
| 467 | BTM_EIR_UUID_SERVCLASS_HEADSET_HS, |
| 468 | BTM_EIR_UUID_SERVCLASS_PNP_INFORMATION, |
| 469 | /* BTM_EIR_UUID_SERVCLASS_GENERIC_NETWORKING, */ |
| 470 | /* BTM_EIR_UUID_SERVCLASS_GENERIC_FILETRANSFER, */ |
| 471 | /* BTM_EIR_UUID_SERVCLASS_GENERIC_AUDIO, */ |
| 472 | /* BTM_EIR_UUID_SERVCLASS_GENERIC_TELEPHONY, */ |
| 473 | /* BTM_EIR_UUID_SERVCLASS_UPNP_SERVICE, */ |
| 474 | /* BTM_EIR_UUID_SERVCLASS_UPNP_IP_SERVICE, */ |
| 475 | /* BTM_EIR_UUID_SERVCLASS_ESDP_UPNP_IP_PAN, */ |
| 476 | /* BTM_EIR_UUID_SERVCLASS_ESDP_UPNP_IP_LAP, */ |
| 477 | /* BTM_EIR_UUID_SERVCLASS_ESDP_UPNP_IP_L2CAP, */ |
| 478 | BTM_EIR_UUID_SERVCLASS_VIDEO_SOURCE, |
| 479 | BTM_EIR_UUID_SERVCLASS_VIDEO_SINK, |
| 480 | /* BTM_EIR_UUID_SERVCLASS_VIDEO_DISTRIBUTION */ |
| 481 | /* BTM_EIR_UUID_SERVCLASS_HDP_PROFILE */ |
| 482 | BTM_EIR_UUID_SERVCLASS_MESSAGE_ACCESS, |
| 483 | BTM_EIR_UUID_SERVCLASS_MESSAGE_NOTIFICATION, |
| 484 | BTM_EIR_UUID_SERVCLASS_HDP_SOURCE, |
| 485 | BTM_EIR_UUID_SERVCLASS_HDP_SINK, |
| 486 | BTM_EIR_MAX_SERVICES |
| 487 | }; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 488 | |
| 489 | /* search result in EIR of inquiry database */ |
| 490 | #define BTM_EIR_FOUND 0 |
| 491 | #define BTM_EIR_NOT_FOUND 1 |
| 492 | #define BTM_EIR_UNKNOWN 2 |
| 493 | |
| 494 | typedef UINT8 tBTM_EIR_SEARCH_RESULT; |
| 495 | |
| 496 | #define BTM_EIR_FLAGS_TYPE HCI_EIR_FLAGS_TYPE /* 0x01 */ |
| 497 | #define BTM_EIR_MORE_16BITS_UUID_TYPE HCI_EIR_MORE_16BITS_UUID_TYPE /* 0x02 */ |
| 498 | #define BTM_EIR_COMPLETE_16BITS_UUID_TYPE HCI_EIR_COMPLETE_16BITS_UUID_TYPE /* 0x03 */ |
| 499 | #define BTM_EIR_MORE_32BITS_UUID_TYPE HCI_EIR_MORE_32BITS_UUID_TYPE /* 0x04 */ |
| 500 | #define BTM_EIR_COMPLETE_32BITS_UUID_TYPE HCI_EIR_COMPLETE_32BITS_UUID_TYPE /* 0x05 */ |
| 501 | #define BTM_EIR_MORE_128BITS_UUID_TYPE HCI_EIR_MORE_128BITS_UUID_TYPE /* 0x06 */ |
| 502 | #define BTM_EIR_COMPLETE_128BITS_UUID_TYPE HCI_EIR_COMPLETE_128BITS_UUID_TYPE /* 0x07 */ |
| 503 | #define BTM_EIR_SHORTENED_LOCAL_NAME_TYPE HCI_EIR_SHORTENED_LOCAL_NAME_TYPE /* 0x08 */ |
| 504 | #define BTM_EIR_COMPLETE_LOCAL_NAME_TYPE HCI_EIR_COMPLETE_LOCAL_NAME_TYPE /* 0x09 */ |
| 505 | #define BTM_EIR_TX_POWER_LEVEL_TYPE HCI_EIR_TX_POWER_LEVEL_TYPE /* 0x0A */ |
| 506 | #define BTM_EIR_MANUFACTURER_SPECIFIC_TYPE HCI_EIR_MANUFACTURER_SPECIFIC_TYPE /* 0xFF */ |
| 507 | |
| 508 | /* the following EIR tags are defined to OOB, not regular EIR data */ |
| 509 | #define BTM_EIR_OOB_BD_ADDR_TYPE HCI_EIR_OOB_BD_ADDR_TYPE /* 6 bytes */ |
| 510 | #define BTM_EIR_OOB_COD_TYPE HCI_EIR_OOB_COD_TYPE /* 3 bytes */ |
| 511 | #define BTM_EIR_OOB_SSP_HASH_C_TYPE HCI_EIR_OOB_SSP_HASH_C_TYPE /* 16 bytes */ |
| 512 | #define BTM_EIR_OOB_SSP_RAND_R_TYPE HCI_EIR_OOB_SSP_RAND_R_TYPE /* 16 bytes */ |
| 513 | |
| 514 | #define BTM_OOB_MANDATORY_SIZE 8 /* include 2 bytes length & 6 bytes bd_addr */ |
| 515 | #define BTM_OOB_DATA_LEN_SIZE 2 |
| 516 | #define BTM_OOB_BD_ADDR_SIZE 6 |
| 517 | #define BTM_OOB_COD_SIZE BT_OOB_COD_SIZE |
| 518 | #define BTM_OOB_HASH_C_SIZE BT_OOB_HASH_C_SIZE |
| 519 | #define BTM_OOB_RAND_R_SIZE BT_OOB_RAND_R_SIZE |
| 520 | |
| 521 | |
| 522 | #if BLE_INCLUDED == TRUE |
| 523 | #define BTM_BLE_SEC_NONE 0 |
| 524 | #define BTM_BLE_SEC_ENCRYPT 1 /* encrypt the link using current key */ |
| 525 | #define BTM_BLE_SEC_ENCRYPT_NO_MITM 2 |
| 526 | #define BTM_BLE_SEC_ENCRYPT_MITM 3 |
| 527 | typedef UINT8 tBTM_BLE_SEC_ACT; |
| 528 | #endif |
| 529 | /************************************************************************************************ |
| 530 | ** BTM Services MACROS handle array of UINT32 bits for more than 32 services |
| 531 | *************************************************************************************************/ |
| 532 | /* Determine the number of UINT32's necessary for services */ |
| 533 | #define BTM_EIR_ARRAY_BITS 32 /* Number of bits in each array element */ |
| 534 | #define BTM_EIR_SERVICE_ARRAY_SIZE (((UINT32)BTM_EIR_MAX_SERVICES / BTM_EIR_ARRAY_BITS) + \ |
| 535 | (((UINT32)BTM_EIR_MAX_SERVICES % BTM_EIR_ARRAY_BITS) ? 1 : 0)) |
| 536 | |
| 537 | /* MACRO to set the service bit mask in a bit stream */ |
| 538 | #define BTM_EIR_SET_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] |= \ |
| 539 | ((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS))) |
| 540 | |
| 541 | |
| 542 | /* MACRO to clear the service bit mask in a bit stream */ |
| 543 | #define BTM_EIR_CLR_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] &= \ |
| 544 | ~((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS))) |
| 545 | |
| 546 | /* MACRO to check the service bit mask in a bit stream */ |
| 547 | #define BTM_EIR_HAS_SERVICE(p, service) ((((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] & \ |
| 548 | ((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS))) >> (((UINT32)(service)) % BTM_EIR_ARRAY_BITS)) |
| 549 | |
| 550 | /* start of EIR in HCI buffer, 4 bytes = HCI Command(2) + Length(1) + FEC_Req(1) */ |
| 551 | #define BTM_HCI_EIR_OFFSET (BT_HDR_SIZE + 4) |
| 552 | |
| 553 | /*************************** |
| 554 | ** Device Discovery Types |
| 555 | ****************************/ |
| 556 | /* Definitions of the parameters passed to BTM_StartInquiry and |
| 557 | ** BTM_SetPeriodicInquiryMode. |
| 558 | */ |
| 559 | typedef struct /* contains the two device class condition fields */ |
| 560 | { |
| 561 | DEV_CLASS dev_class; |
| 562 | DEV_CLASS dev_class_mask; |
| 563 | } tBTM_COD_COND; |
| 564 | |
| 565 | |
| 566 | typedef union /* contains the inquiry filter condition */ |
| 567 | { |
| 568 | BD_ADDR bdaddr_cond; |
| 569 | tBTM_COD_COND cod_cond; |
| 570 | } tBTM_INQ_FILT_COND; |
| 571 | |
| 572 | |
| 573 | typedef struct /* contains the parameters passed to the inquiry functions */ |
| 574 | { |
| 575 | UINT8 mode; /* general or limited */ |
| 576 | UINT8 duration; /* duration of the inquiry (1.28 sec increments) */ |
| 577 | UINT8 max_resps; /* maximum number of responses to return */ |
| 578 | BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */ |
| 579 | UINT8 filter_cond_type; /* new devices, BD ADDR, COD, or No filtering */ |
| 580 | tBTM_INQ_FILT_COND filter_cond; /* filter value based on filter cond type */ |
Matthew Xie | 7f3e429 | 2013-09-30 12:44:10 -0700 | [diff] [blame] | 581 | #if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE) |
| 582 | UINT8 intl_duration[4]; /*duration array storing the interleave scan's time portions*/ |
| 583 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 584 | } tBTM_INQ_PARMS; |
| 585 | |
| 586 | #define BTM_INQ_RESULT_BR 0x01 |
| 587 | #define BTM_INQ_RESULT_BLE 0x02 |
| 588 | |
| 589 | #if (BLE_INCLUDED == TRUE) |
| 590 | #define BTM_BLE_EVT_CONN_ADV 0x00 |
| 591 | #define BTM_BLE_EVT_CONN_DIR_ADV 0x01 |
| 592 | #define BTM_BLE_EVT_DISC_ADV 0x02 |
| 593 | #define BTM_BLE_EVT_NON_CONN_ADV 0x03 |
| 594 | #define BTM_BLE_EVT_SCAN_RSP 0x04 |
| 595 | typedef UINT8 tBTM_BLE_EVT_TYPE; |
| 596 | #endif |
| 597 | |
| 598 | /* These are the fields returned in each device's response to the inquiry. It |
| 599 | ** is returned in the results callback if registered. |
| 600 | */ |
| 601 | typedef struct |
| 602 | { |
| 603 | UINT16 clock_offset; |
| 604 | BD_ADDR remote_bd_addr; |
| 605 | DEV_CLASS dev_class; |
| 606 | UINT8 page_scan_rep_mode; |
| 607 | UINT8 page_scan_per_mode; |
| 608 | UINT8 page_scan_mode; |
| 609 | INT8 rssi; /* Set to BTM_INQ_RES_IGNORE_RSSI if not valid */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 610 | UINT32 eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE]; |
| 611 | BOOLEAN eir_complete_list; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 612 | #if (BLE_INCLUDED == TRUE) |
| 613 | tBT_DEVICE_TYPE device_type; |
| 614 | UINT8 inq_result_type; |
| 615 | UINT8 ble_addr_type; |
| 616 | tBTM_BLE_EVT_TYPE ble_evt_type; |
| 617 | UINT8 flag; |
| 618 | #endif |
| 619 | } tBTM_INQ_RESULTS; |
| 620 | |
| 621 | |
| 622 | /* This is the inquiry response information held in its database by BTM, and available |
| 623 | ** to applications via BTM_InqDbRead, BTM_InqDbFirst, and BTM_InqDbNext. |
| 624 | */ |
| 625 | typedef struct |
| 626 | { |
| 627 | tBTM_INQ_RESULTS results; |
| 628 | |
| 629 | BOOLEAN appl_knows_rem_name; /* set by application if it knows the remote name of the peer device. |
| 630 | This is later used by application to determine if remote name request is |
| 631 | required to be done. Having the flag here avoid duplicate store of inquiry results */ |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 632 | #if ( BLE_INCLUDED == TRUE) |
| 633 | UINT16 remote_name_len; |
| 634 | tBTM_BD_NAME remote_name; |
| 635 | UINT8 remote_name_state; |
| 636 | UINT8 remote_name_type; |
| 637 | #endif |
| 638 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 639 | } tBTM_INQ_INFO; |
| 640 | |
| 641 | |
| 642 | /* Structure returned with inquiry complete callback */ |
| 643 | typedef struct |
| 644 | { |
| 645 | tBTM_STATUS status; |
| 646 | UINT8 num_resp; /* Number of results from the current inquiry */ |
| 647 | } tBTM_INQUIRY_CMPL; |
| 648 | |
| 649 | |
| 650 | /* Structure returned with remote name request */ |
| 651 | typedef struct |
| 652 | { |
| 653 | UINT16 status; |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 654 | BD_ADDR bd_addr; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 655 | UINT16 length; |
| 656 | BD_NAME remote_bd_name; |
| 657 | } tBTM_REMOTE_DEV_NAME; |
| 658 | |
| 659 | typedef struct |
| 660 | { |
| 661 | UINT8 pcm_intf_rate; /* PCM interface rate: 0: 128kbps, 1: 256 kbps; |
| 662 | 2:512 bps; 3: 1024kbps; 4: 2048kbps */ |
| 663 | UINT8 frame_type; /* frame type: 0: short; 1: long */ |
| 664 | UINT8 sync_mode; /* sync mode: 0: slave; 1: master */ |
| 665 | UINT8 clock_mode; /* clock mode: 0: slave; 1: master */ |
| 666 | |
| 667 | }tBTM_SCO_PCM_PARAM; |
| 668 | |
| 669 | /**************************************** |
| 670 | ** Device Discovery Callback Functions |
| 671 | *****************************************/ |
| 672 | /* Callback function for asynchronous notifications when the BTM inquiry DB |
| 673 | ** changes. First param is inquiry database, second is if added to or removed |
| 674 | ** from the inquiry database. |
| 675 | */ |
| 676 | typedef void (tBTM_INQ_DB_CHANGE_CB) (void *p1, BOOLEAN is_new); |
| 677 | |
| 678 | /* Callback function for notifications when the BTM gets inquiry response. |
| 679 | ** First param is inquiry results database, second is pointer of EIR. |
| 680 | */ |
| 681 | typedef void (tBTM_INQ_RESULTS_CB) (tBTM_INQ_RESULTS *p_inq_results, UINT8 *p_eir); |
| 682 | |
| 683 | /***************************************************************************** |
| 684 | ** ACL CHANNEL MANAGEMENT |
| 685 | *****************************************************************************/ |
| 686 | /****************** |
| 687 | ** ACL Constants |
| 688 | *******************/ |
| 689 | |
| 690 | /* ACL modes */ |
| 691 | #define BTM_ACL_MODE_NORMAL HCI_MODE_ACTIVE |
| 692 | #define BTM_ACL_MODE_HOLD HCI_MODE_HOLD |
| 693 | #define BTM_ACL_MODE_SNIFF HCI_MODE_SNIFF |
| 694 | #define BTM_ACL_MODE_PARK HCI_MODE_PARK |
| 695 | |
| 696 | /* Returned with structure in role switch callback (tBTM_ROLE_SWITCH_CMPL) */ |
| 697 | #define BTM_ROLE_MASTER HCI_ROLE_MASTER |
| 698 | #define BTM_ROLE_SLAVE HCI_ROLE_SLAVE |
| 699 | #define BTM_ROLE_UNDEFINED 0xff /* undefined value (error status) */ |
| 700 | |
| 701 | /* ACL Packet Types */ |
| 702 | #define BTM_ACL_PKT_TYPES_MASK_DM1 HCI_PKT_TYPES_MASK_DM1 |
| 703 | #define BTM_ACL_PKT_TYPES_MASK_DH1 HCI_PKT_TYPES_MASK_DH1 |
| 704 | #define BTM_ACL_PKT_TYPES_MASK_DM3 HCI_PKT_TYPES_MASK_DM3 |
| 705 | #define BTM_ACL_PKT_TYPES_MASK_DH3 HCI_PKT_TYPES_MASK_DH3 |
| 706 | #define BTM_ACL_PKT_TYPES_MASK_DM5 HCI_PKT_TYPES_MASK_DM5 |
| 707 | #define BTM_ACL_PKT_TYPES_MASK_DH5 HCI_PKT_TYPES_MASK_DH5 |
| 708 | #define BTM_ACL_PKT_TYPES_MASK_NO_2_DH1 HCI_PKT_TYPES_MASK_NO_2_DH1 |
| 709 | #define BTM_ACL_PKT_TYPES_MASK_NO_3_DH1 HCI_PKT_TYPES_MASK_NO_3_DH1 |
| 710 | #define BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 HCI_PKT_TYPES_MASK_NO_2_DH3 |
| 711 | #define BTM_ACL_PKT_TYPES_MASK_NO_3_DH3 HCI_PKT_TYPES_MASK_NO_3_DH3 |
| 712 | #define BTM_ACL_PKT_TYPES_MASK_NO_2_DH5 HCI_PKT_TYPES_MASK_NO_2_DH5 |
| 713 | #define BTM_ACL_PKT_TYPES_MASK_NO_3_DH5 HCI_PKT_TYPES_MASK_NO_3_DH5 |
| 714 | |
| 715 | /*************** |
| 716 | ** ACL Types |
| 717 | ****************/ |
| 718 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 719 | /* Structure returned with Role Switch information (in tBTM_CMPL_CB callback function) |
| 720 | ** in response to BTM_SwitchRole call. |
| 721 | */ |
| 722 | typedef struct |
| 723 | { |
| 724 | UINT8 hci_status; /* HCI status returned with the event */ |
| 725 | UINT8 role; /* BTM_ROLE_MASTER or BTM_ROLE_SLAVE */ |
| 726 | BD_ADDR remote_bd_addr; /* Remote BD addr involved with the switch */ |
| 727 | } tBTM_ROLE_SWITCH_CMPL; |
| 728 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 729 | /* Structure returned with QoS information (in tBTM_CMPL_CB callback function) |
| 730 | ** in response to BTM_SetQoS call. |
| 731 | */ |
| 732 | typedef struct |
| 733 | { |
| 734 | FLOW_SPEC flow; |
| 735 | UINT16 handle; |
| 736 | UINT8 status; |
| 737 | } tBTM_QOS_SETUP_CMPL; |
| 738 | |
| 739 | |
| 740 | /* Structure returned with read RSSI event (in tBTM_CMPL_CB callback function) |
| 741 | ** in response to BTM_ReadRSSI call. |
| 742 | */ |
| 743 | typedef struct |
| 744 | { |
| 745 | tBTM_STATUS status; |
| 746 | UINT8 hci_status; |
| 747 | INT8 rssi; |
| 748 | BD_ADDR rem_bda; |
| 749 | } tBTM_RSSI_RESULTS; |
| 750 | |
| 751 | /* Structure returned with read current TX power event (in tBTM_CMPL_CB callback function) |
| 752 | ** in response to BTM_ReadTxPower call. |
| 753 | */ |
| 754 | typedef struct |
| 755 | { |
| 756 | tBTM_STATUS status; |
| 757 | UINT8 hci_status; |
| 758 | INT8 tx_power; |
| 759 | BD_ADDR rem_bda; |
| 760 | } tBTM_TX_POWER_RESULTS; |
| 761 | |
| 762 | /* Structure returned with read link quality event (in tBTM_CMPL_CB callback function) |
| 763 | ** in response to BTM_ReadLinkQuality call. |
| 764 | */ |
| 765 | typedef struct |
| 766 | { |
| 767 | tBTM_STATUS status; |
| 768 | UINT8 hci_status; |
| 769 | UINT8 link_quality; |
| 770 | BD_ADDR rem_bda; |
| 771 | } tBTM_LINK_QUALITY_RESULTS; |
| 772 | |
| 773 | /* Structure returned with read inq tx power quality event (in tBTM_CMPL_CB callback function) |
| 774 | ** in response to BTM_ReadInquiryRspTxPower call. |
| 775 | */ |
| 776 | typedef struct |
| 777 | { |
| 778 | tBTM_STATUS status; |
| 779 | UINT8 hci_status; |
| 780 | INT8 tx_power; |
| 781 | } tBTM_INQ_TXPWR_RESULTS; |
| 782 | |
| 783 | enum |
| 784 | { |
| 785 | BTM_BL_CONN_EVT, |
| 786 | BTM_BL_DISCN_EVT, |
| 787 | BTM_BL_UPDATE_EVT, |
| 788 | BTM_BL_ROLE_CHG_EVT, |
| 789 | BTM_BL_COLLISION_EVT |
| 790 | }; |
| 791 | typedef UINT8 tBTM_BL_EVENT; |
| 792 | typedef UINT16 tBTM_BL_EVENT_MASK; |
| 793 | |
| 794 | #define BTM_BL_CONN_MASK 0x0001 |
| 795 | #define BTM_BL_DISCN_MASK 0x0002 |
| 796 | #define BTM_BL_UPDATE_MASK 0x0004 |
| 797 | #define BTM_BL_ROLE_CHG_MASK 0x0008 |
| 798 | |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 799 | /* Device features mask definitions */ |
| 800 | #define BTM_FEATURE_BYTES_PER_PAGE HCI_FEATURE_BYTES_PER_PAGE |
| 801 | #define BTM_EXT_FEATURES_PAGE_MAX HCI_EXT_FEATURES_PAGE_MAX |
| 802 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 803 | /* the data type associated with BTM_BL_CONN_EVT */ |
| 804 | typedef struct |
| 805 | { |
| 806 | tBTM_BL_EVENT event; /* The event reported. */ |
| 807 | BD_ADDR_PTR p_bda; /* The address of the newly connected device */ |
| 808 | DEV_CLASS_PTR p_dc; /* The device class */ |
| 809 | BD_NAME_PTR p_bdn; /* The device name */ |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 810 | UINT8 *p_features; /* pointer to the remote device's features page[0] (supported features page) */ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 811 | #if BLE_INCLUDED == TRUE |
| 812 | UINT16 handle; /* connection handle */ |
| 813 | tBT_TRANSPORT transport; /* link is LE or not */ |
| 814 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 815 | } tBTM_BL_CONN_DATA; |
| 816 | |
| 817 | /* the data type associated with BTM_BL_DISCN_EVT */ |
| 818 | typedef struct |
| 819 | { |
| 820 | tBTM_BL_EVENT event; /* The event reported. */ |
| 821 | BD_ADDR_PTR p_bda; /* The address of the disconnected device */ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 822 | #if BLE_INCLUDED == TRUE |
| 823 | UINT16 handle; /* disconnected connection handle */ |
| 824 | tBT_TRANSPORT transport; /* link is LE link or not */ |
| 825 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 826 | } tBTM_BL_DISCN_DATA; |
| 827 | |
| 828 | /* Busy-Level shall have the inquiry_paging mask set when |
| 829 | * inquiry/paging is in progress, Else the number of ACL links */ |
| 830 | #define BTM_BL_INQUIRY_PAGING_MASK 0x10 |
| 831 | #define BTM_BL_INQUIRY_STARTED (BTM_BL_INQUIRY_PAGING_MASK | 0x1) |
| 832 | #define BTM_BL_INQUIRY_CANCELLED (BTM_BL_INQUIRY_PAGING_MASK | 0x2) |
| 833 | #define BTM_BL_INQUIRY_COMPLETE (BTM_BL_INQUIRY_PAGING_MASK | 0x3) |
| 834 | #define BTM_BL_PAGING_STARTED (BTM_BL_INQUIRY_PAGING_MASK | 0x4) |
| 835 | #define BTM_BL_PAGING_COMPLETE (BTM_BL_INQUIRY_PAGING_MASK | 0x5) |
| 836 | /* the data type associated with BTM_BL_UPDATE_EVT */ |
| 837 | typedef struct |
| 838 | { |
| 839 | tBTM_BL_EVENT event; /* The event reported. */ |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 840 | UINT8 busy_level;/* when paging or inquiring, level is 10. |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 841 | * Otherwise, the number of ACL links. */ |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 842 | UINT8 busy_level_flags; /* Notifies actual inquiry/page activities */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 843 | } tBTM_BL_UPDATE_DATA; |
| 844 | |
| 845 | /* the data type associated with BTM_BL_ROLE_CHG_EVT */ |
| 846 | typedef struct |
| 847 | { |
| 848 | tBTM_BL_EVENT event; /* The event reported. */ |
| 849 | BD_ADDR_PTR p_bda; /* The address of the peer connected device */ |
| 850 | UINT8 new_role; |
| 851 | UINT8 hci_status; /* HCI status returned with the event */ |
| 852 | } tBTM_BL_ROLE_CHG_DATA; |
| 853 | |
| 854 | typedef union |
| 855 | { |
| 856 | tBTM_BL_EVENT event; /* The event reported. */ |
| 857 | tBTM_BL_CONN_DATA conn; /* The data associated with BTM_BL_CONN_EVT */ |
| 858 | tBTM_BL_DISCN_DATA discn; /* The data associated with BTM_BL_DISCN_EVT */ |
| 859 | tBTM_BL_UPDATE_DATA update; /* The data associated with BTM_BL_UPDATE_EVT */ |
| 860 | tBTM_BL_ROLE_CHG_DATA role_chg;/*The data associated with BTM_BL_ROLE_CHG_EVT */ |
| 861 | } tBTM_BL_EVENT_DATA; |
| 862 | |
| 863 | /* Callback function for notifications when the BTM busy level |
| 864 | ** changes. |
| 865 | */ |
| 866 | typedef void (tBTM_BL_CHANGE_CB) (tBTM_BL_EVENT_DATA *p_data); |
| 867 | |
| 868 | /*************************** |
| 869 | ** ACL Callback Functions |
| 870 | ****************************/ |
| 871 | /* Callback function for notifications when the BTM ACL connection DB |
| 872 | ** changes. First param is BD address, second is if added or removed. |
| 873 | ** Registered through BTM_AclRegisterForChanges call. |
| 874 | */ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 875 | #if BLE_INCLUDED == TRUE |
| 876 | typedef void (tBTM_ACL_DB_CHANGE_CB) (BD_ADDR p_bda, DEV_CLASS p_dc, |
| 877 | BD_NAME p_bdn, UINT8 *features, |
| 878 | BOOLEAN is_new, UINT16 handle, |
| 879 | tBT_TRANSPORT transport); |
| 880 | #else |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 881 | typedef void (tBTM_ACL_DB_CHANGE_CB) (BD_ADDR p_bda, DEV_CLASS p_dc, |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 882 | BD_NAME p_bdn, UINT8 *features, |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 883 | BOOLEAN is_new); |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 884 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 885 | /***************************************************************************** |
| 886 | ** SCO CHANNEL MANAGEMENT |
| 887 | *****************************************************************************/ |
| 888 | /****************** |
| 889 | ** SCO Constants |
| 890 | *******************/ |
| 891 | |
| 892 | /* Define an invalid SCO index and an invalid HCI handle */ |
| 893 | #define BTM_INVALID_SCO_INDEX 0xFFFF |
| 894 | #define BTM_INVALID_HCI_HANDLE 0xFFFF |
| 895 | |
| 896 | /* Define an invalid SCO disconnect reason */ |
| 897 | #define BTM_INVALID_SCO_DISC_REASON 0xFFFF |
| 898 | |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 899 | /* Define first active SCO index */ |
| 900 | #define BTM_FIRST_ACTIVE_SCO_INDEX BTM_MAX_SCO_LINKS |
| 901 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 902 | /* Define SCO packet types used in APIs */ |
| 903 | #define BTM_SCO_PKT_TYPES_MASK_HV1 HCI_ESCO_PKT_TYPES_MASK_HV1 |
| 904 | #define BTM_SCO_PKT_TYPES_MASK_HV2 HCI_ESCO_PKT_TYPES_MASK_HV2 |
| 905 | #define BTM_SCO_PKT_TYPES_MASK_HV3 HCI_ESCO_PKT_TYPES_MASK_HV3 |
| 906 | #define BTM_SCO_PKT_TYPES_MASK_EV3 HCI_ESCO_PKT_TYPES_MASK_EV3 |
| 907 | #define BTM_SCO_PKT_TYPES_MASK_EV4 HCI_ESCO_PKT_TYPES_MASK_EV4 |
| 908 | #define BTM_SCO_PKT_TYPES_MASK_EV5 HCI_ESCO_PKT_TYPES_MASK_EV5 |
| 909 | #define BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 HCI_ESCO_PKT_TYPES_MASK_NO_2_EV3 |
| 910 | #define BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 HCI_ESCO_PKT_TYPES_MASK_NO_3_EV3 |
| 911 | #define BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 HCI_ESCO_PKT_TYPES_MASK_NO_2_EV5 |
| 912 | #define BTM_SCO_PKT_TYPES_MASK_NO_3_EV5 HCI_ESCO_PKT_TYPES_MASK_NO_3_EV5 |
| 913 | |
| 914 | #define BTM_SCO_LINK_ONLY_MASK (BTM_SCO_PKT_TYPES_MASK_HV1 | \ |
| 915 | BTM_SCO_PKT_TYPES_MASK_HV2 | \ |
| 916 | BTM_SCO_PKT_TYPES_MASK_HV3) |
| 917 | |
| 918 | #define BTM_ESCO_LINK_ONLY_MASK (BTM_SCO_PKT_TYPES_MASK_EV3 | \ |
| 919 | BTM_SCO_PKT_TYPES_MASK_EV4 | \ |
| 920 | BTM_SCO_PKT_TYPES_MASK_EV5) |
| 921 | |
| 922 | #define BTM_SCO_LINK_ALL_PKT_MASK (BTM_SCO_LINK_ONLY_MASK | \ |
| 923 | BTM_ESCO_LINK_ONLY_MASK) |
| 924 | |
| 925 | #define BTM_VALID_SCO_ALL_PKT_TYPE HCI_VALID_SCO_ALL_PKT_TYPE |
| 926 | |
| 927 | /* Passed in BTM_CreateSco if the packet type parameter should be ignored */ |
| 928 | #define BTM_IGNORE_SCO_PKT_TYPE 0 |
| 929 | |
| 930 | /*************** |
| 931 | ** SCO Types |
| 932 | ****************/ |
| 933 | #define BTM_LINK_TYPE_SCO HCI_LINK_TYPE_SCO |
| 934 | #define BTM_LINK_TYPE_ESCO HCI_LINK_TYPE_ESCO |
| 935 | typedef UINT8 tBTM_SCO_TYPE; |
| 936 | |
| 937 | |
| 938 | /******************* |
| 939 | ** SCO Routing Path |
| 940 | ********************/ |
| 941 | #define BTM_SCO_ROUTE_PCM HCI_BRCM_SCO_ROUTE_PCM |
| 942 | #define BTM_SCO_ROUTE_HCI HCI_BRCM_SCO_ROUTE_HCI |
| 943 | typedef UINT8 tBTM_SCO_ROUTE_TYPE; |
| 944 | |
| 945 | |
| 946 | /******************* |
| 947 | ** SCO Codec Types |
| 948 | ********************/ |
Mudumba Ananth | 6afb248 | 2015-03-25 05:20:02 -0700 | [diff] [blame] | 949 | // TODO(google) This should use common definitions |
| 950 | // in hci/include/hci_audio.h |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 951 | #define BTM_SCO_CODEC_NONE 0x0000 |
| 952 | #define BTM_SCO_CODEC_CVSD 0x0001 |
| 953 | #define BTM_SCO_CODEC_MSBC 0x0002 |
| 954 | typedef UINT16 tBTM_SCO_CODEC_TYPE; |
| 955 | |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 956 | |
| 957 | |
| 958 | /******************* |
| 959 | ** SCO Air Mode Types |
| 960 | ********************/ |
| 961 | #define BTM_SCO_AIR_MODE_U_LAW 0 |
| 962 | #define BTM_SCO_AIR_MODE_A_LAW 1 |
| 963 | #define BTM_SCO_AIR_MODE_CVSD 2 |
| 964 | #define BTM_SCO_AIR_MODE_TRANSPNT 3 |
| 965 | typedef UINT8 tBTM_SCO_AIR_MODE_TYPE; |
| 966 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 967 | /******************* |
| 968 | ** SCO Voice Settings |
| 969 | ********************/ |
| 970 | #define BTM_VOICE_SETTING_CVSD ((UINT16) (HCI_INP_CODING_LINEAR | \ |
| 971 | HCI_INP_DATA_FMT_2S_COMPLEMENT | \ |
| 972 | HCI_INP_SAMPLE_SIZE_16BIT | \ |
| 973 | HCI_AIR_CODING_FORMAT_CVSD)) |
| 974 | |
| 975 | #define BTM_VOICE_SETTING_TRANS ((UINT16) (HCI_INP_CODING_LINEAR | \ |
| 976 | HCI_INP_DATA_FMT_2S_COMPLEMENT | \ |
| 977 | HCI_INP_SAMPLE_SIZE_16BIT | \ |
| 978 | HCI_AIR_CODING_FORMAT_TRANSPNT)) |
| 979 | |
| 980 | /******************* |
| 981 | ** SCO Data Status |
| 982 | ********************/ |
| 983 | enum |
| 984 | { |
| 985 | BTM_SCO_DATA_CORRECT, |
| 986 | BTM_SCO_DATA_PAR_ERR, |
| 987 | BTM_SCO_DATA_NONE, |
| 988 | BTM_SCO_DATA_PAR_LOST |
| 989 | }; |
| 990 | typedef UINT8 tBTM_SCO_DATA_FLAG; |
| 991 | |
| 992 | /*************************** |
| 993 | ** SCO Callback Functions |
| 994 | ****************************/ |
| 995 | typedef void (tBTM_SCO_CB) (UINT16 sco_inx); |
| 996 | typedef void (tBTM_SCO_DATA_CB) (UINT16 sco_inx, BT_HDR *p_data, tBTM_SCO_DATA_FLAG status); |
| 997 | |
| 998 | /****************** |
| 999 | ** eSCO Constants |
| 1000 | *******************/ |
| 1001 | #define BTM_64KBITS_RATE 0x00001f40 /* 64 kbits/sec data rate */ |
| 1002 | |
| 1003 | /* Retransmission effort */ |
| 1004 | #define BTM_ESCO_RETRANS_OFF 0 |
| 1005 | #define BTM_ESCO_RETRANS_POWER 1 |
| 1006 | #define BTM_ESCO_RETRANS_QUALITY 2 |
| 1007 | #define BTM_ESCO_RETRANS_DONTCARE 0xff |
| 1008 | |
| 1009 | /* Max Latency Don't Care */ |
| 1010 | #define BTM_ESCO_MAX_LAT_DONTCARE 0xffff |
| 1011 | |
| 1012 | /*************** |
| 1013 | ** eSCO Types |
| 1014 | ****************/ |
| 1015 | /* tBTM_ESCO_CBACK event types */ |
| 1016 | #define BTM_ESCO_CHG_EVT 1 |
| 1017 | #define BTM_ESCO_CONN_REQ_EVT 2 |
| 1018 | typedef UINT8 tBTM_ESCO_EVT; |
| 1019 | |
| 1020 | /* Passed into BTM_SetEScoMode() */ |
| 1021 | typedef struct |
| 1022 | { |
| 1023 | UINT32 tx_bw; |
| 1024 | UINT32 rx_bw; |
| 1025 | UINT16 max_latency; |
| 1026 | UINT16 voice_contfmt; /* Voice Settings or Content Format */ |
| 1027 | UINT16 packet_types; |
| 1028 | UINT8 retrans_effort; |
| 1029 | } tBTM_ESCO_PARAMS; |
| 1030 | |
| 1031 | typedef struct |
| 1032 | { |
| 1033 | UINT16 max_latency; |
| 1034 | UINT16 packet_types; |
| 1035 | UINT8 retrans_effort; |
| 1036 | } tBTM_CHG_ESCO_PARAMS; |
| 1037 | |
| 1038 | /* Returned by BTM_ReadEScoLinkParms() */ |
| 1039 | typedef struct |
| 1040 | { |
| 1041 | UINT16 rx_pkt_len; |
| 1042 | UINT16 tx_pkt_len; |
| 1043 | BD_ADDR bd_addr; |
| 1044 | UINT8 link_type; /* BTM_LINK_TYPE_SCO or BTM_LINK_TYPE_ESCO */ |
| 1045 | UINT8 tx_interval; |
| 1046 | UINT8 retrans_window; |
| 1047 | UINT8 air_mode; |
| 1048 | } tBTM_ESCO_DATA; |
| 1049 | |
| 1050 | typedef struct |
| 1051 | { |
| 1052 | UINT16 sco_inx; |
| 1053 | UINT16 rx_pkt_len; |
| 1054 | UINT16 tx_pkt_len; |
| 1055 | BD_ADDR bd_addr; |
| 1056 | UINT8 hci_status; |
| 1057 | UINT8 tx_interval; |
| 1058 | UINT8 retrans_window; |
| 1059 | } tBTM_CHG_ESCO_EVT_DATA; |
| 1060 | |
| 1061 | typedef struct |
| 1062 | { |
| 1063 | UINT16 sco_inx; |
| 1064 | BD_ADDR bd_addr; |
| 1065 | DEV_CLASS dev_class; |
| 1066 | tBTM_SCO_TYPE link_type; |
| 1067 | } tBTM_ESCO_CONN_REQ_EVT_DATA; |
| 1068 | |
| 1069 | typedef union |
| 1070 | { |
| 1071 | tBTM_CHG_ESCO_EVT_DATA chg_evt; |
| 1072 | tBTM_ESCO_CONN_REQ_EVT_DATA conn_evt; |
| 1073 | } tBTM_ESCO_EVT_DATA; |
| 1074 | |
| 1075 | /*************************** |
| 1076 | ** eSCO Callback Functions |
| 1077 | ****************************/ |
| 1078 | typedef void (tBTM_ESCO_CBACK) (tBTM_ESCO_EVT event, tBTM_ESCO_EVT_DATA *p_data); |
| 1079 | |
| 1080 | |
| 1081 | /***************************************************************************** |
| 1082 | ** SECURITY MANAGEMENT |
| 1083 | *****************************************************************************/ |
| 1084 | /******************************* |
| 1085 | ** Security Manager Constants |
| 1086 | ********************************/ |
| 1087 | |
| 1088 | /* Security Mode (BTM_SetSecurityMode) */ |
| 1089 | #define BTM_SEC_MODE_UNDEFINED 0 |
| 1090 | #define BTM_SEC_MODE_NONE 1 |
| 1091 | #define BTM_SEC_MODE_SERVICE 2 |
| 1092 | #define BTM_SEC_MODE_LINK 3 |
| 1093 | #define BTM_SEC_MODE_SP 4 |
| 1094 | #define BTM_SEC_MODE_SP_DEBUG 5 |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1095 | #define BTM_SEC_MODE_SC 6 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1096 | |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 1097 | /* Maximum Number of BTM Security Modes */ |
| 1098 | #define BTM_SEC_MODES_MAX 7 |
| 1099 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1100 | /* Security Service Levels [bit mask] (BTM_SetSecurityLevel) |
| 1101 | ** Encryption should not be used without authentication |
| 1102 | */ |
| 1103 | #define BTM_SEC_NONE 0x0000 /* Nothing required */ |
| 1104 | #define BTM_SEC_IN_AUTHORIZE 0x0001 /* Inbound call requires authorization */ |
| 1105 | #define BTM_SEC_IN_AUTHENTICATE 0x0002 /* Inbound call requires authentication */ |
| 1106 | #define BTM_SEC_IN_ENCRYPT 0x0004 /* Inbound call requires encryption */ |
| 1107 | #define BTM_SEC_OUT_AUTHORIZE 0x0008 /* Outbound call requires authorization */ |
| 1108 | #define BTM_SEC_OUT_AUTHENTICATE 0x0010 /* Outbound call requires authentication */ |
| 1109 | #define BTM_SEC_OUT_ENCRYPT 0x0020 /* Outbound call requires encryption */ |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 1110 | #define BTM_SEC_MODE4_LEVEL4 0x0040 /* Secure Connections Only Mode */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1111 | #define BTM_SEC_FORCE_MASTER 0x0100 /* Need to switch connection to be master */ |
| 1112 | #define BTM_SEC_ATTEMPT_MASTER 0x0200 /* Try to switch connection to be master */ |
| 1113 | #define BTM_SEC_FORCE_SLAVE 0x0400 /* Need to switch connection to be master */ |
| 1114 | #define BTM_SEC_ATTEMPT_SLAVE 0x0800 /* Try to switch connection to be slave */ |
| 1115 | #define BTM_SEC_IN_MITM 0x1000 /* inbound Do man in the middle protection */ |
| 1116 | #define BTM_SEC_OUT_MITM 0x2000 /* outbound Do man in the middle protection */ |
Casper Bonde | 818d0f2 | 2015-05-21 11:08:45 +0200 | [diff] [blame] | 1117 | #define BTM_SEC_IN_MIN_16_DIGIT_PIN 0x4000 /* enforce a minimum of 16 digit for sec mode 2 */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1118 | |
| 1119 | /* Security Flags [bit mask] (BTM_GetSecurityFlags) |
| 1120 | */ |
| 1121 | #define BTM_SEC_FLAG_AUTHORIZED 0x01 |
| 1122 | #define BTM_SEC_FLAG_AUTHENTICATED 0x02 |
| 1123 | #define BTM_SEC_FLAG_ENCRYPTED 0x04 |
| 1124 | #define BTM_SEC_FLAG_LKEY_KNOWN 0x10 |
| 1125 | #define BTM_SEC_FLAG_LKEY_AUTHED 0x20 |
| 1126 | |
| 1127 | /* PIN types */ |
| 1128 | #define BTM_PIN_TYPE_VARIABLE HCI_PIN_TYPE_VARIABLE |
| 1129 | #define BTM_PIN_TYPE_FIXED HCI_PIN_TYPE_FIXED |
| 1130 | |
| 1131 | /* Link Key types used to generate the new link key. |
| 1132 | ** returned in link key notification callback function |
| 1133 | */ |
| 1134 | #define BTM_LKEY_TYPE_COMBINATION HCI_LKEY_TYPE_COMBINATION |
| 1135 | #define BTM_LKEY_TYPE_LOCAL_UNIT HCI_LKEY_TYPE_LOCAL_UNIT |
| 1136 | #define BTM_LKEY_TYPE_REMOTE_UNIT HCI_LKEY_TYPE_REMOTE_UNIT |
| 1137 | #define BTM_LKEY_TYPE_DEBUG_COMB HCI_LKEY_TYPE_DEBUG_COMB |
| 1138 | #define BTM_LKEY_TYPE_UNAUTH_COMB HCI_LKEY_TYPE_UNAUTH_COMB |
| 1139 | #define BTM_LKEY_TYPE_AUTH_COMB HCI_LKEY_TYPE_AUTH_COMB |
| 1140 | #define BTM_LKEY_TYPE_CHANGED_COMB HCI_LKEY_TYPE_CHANGED_COMB |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1141 | |
| 1142 | #define BTM_LKEY_TYPE_UNAUTH_COMB_P_256 HCI_LKEY_TYPE_UNAUTH_COMB_P_256 |
| 1143 | #define BTM_LKEY_TYPE_AUTH_COMB_P_256 HCI_LKEY_TYPE_AUTH_COMB_P_256 |
| 1144 | |
| 1145 | #define BTM_LTK_DERIVED_LKEY_OFFSET 0x20 /* "easy" requirements for LK derived from LTK */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1146 | #define BTM_LKEY_TYPE_IGNORE 0xff /* used when event is response from |
| 1147 | hci return link keys request */ |
| 1148 | |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1149 | typedef UINT8 tBTM_LINK_KEY_TYPE; |
| 1150 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1151 | /* Protocol level security (BTM_SetSecurityLevel) */ |
| 1152 | #define BTM_SEC_PROTO_L2CAP 0 |
| 1153 | #define BTM_SEC_PROTO_SDP 1 |
| 1154 | #define BTM_SEC_PROTO_TCS 2 |
| 1155 | #define BTM_SEC_PROTO_RFCOMM 3 |
| 1156 | #define BTM_SEC_PROTO_OBEX 4 |
| 1157 | #define BTM_SEC_PROTO_BNEP 5 |
| 1158 | #define BTM_SEC_PROTO_HID 6 /* HID */ |
| 1159 | #define BTM_SEC_PROTO_AVDT 7 |
| 1160 | #define BTM_SEC_PROTO_MCA 8 |
| 1161 | |
| 1162 | /* Determine the number of UINT32's necessary for security services */ |
| 1163 | #define BTM_SEC_ARRAY_BITS 32 /* Number of bits in each array element */ |
| 1164 | #define BTM_SEC_SERVICE_ARRAY_SIZE (((UINT32)BTM_SEC_MAX_SERVICES / BTM_SEC_ARRAY_BITS) + \ |
| 1165 | (((UINT32)BTM_SEC_MAX_SERVICES % BTM_SEC_ARRAY_BITS) ? 1 : 0)) |
| 1166 | |
| 1167 | /* Security service definitions (BTM_SetSecurityLevel) |
| 1168 | ** Used for Authorization APIs |
| 1169 | */ |
| 1170 | #define BTM_SEC_SERVICE_SDP_SERVER 0 |
| 1171 | #define BTM_SEC_SERVICE_SERIAL_PORT 1 |
| 1172 | #define BTM_SEC_SERVICE_LAN_ACCESS 2 |
| 1173 | #define BTM_SEC_SERVICE_DUN 3 |
| 1174 | #define BTM_SEC_SERVICE_IRMC_SYNC 4 |
| 1175 | #define BTM_SEC_SERVICE_IRMC_SYNC_CMD 5 |
| 1176 | #define BTM_SEC_SERVICE_OBEX 6 |
| 1177 | #define BTM_SEC_SERVICE_OBEX_FTP 7 |
| 1178 | #define BTM_SEC_SERVICE_HEADSET 8 |
| 1179 | #define BTM_SEC_SERVICE_CORDLESS 9 |
| 1180 | #define BTM_SEC_SERVICE_INTERCOM 10 |
| 1181 | #define BTM_SEC_SERVICE_FAX 11 |
| 1182 | #define BTM_SEC_SERVICE_HEADSET_AG 12 |
| 1183 | #define BTM_SEC_SERVICE_PNP_INFO 13 |
| 1184 | #define BTM_SEC_SERVICE_GEN_NET 14 |
| 1185 | #define BTM_SEC_SERVICE_GEN_FILE 15 |
| 1186 | #define BTM_SEC_SERVICE_GEN_AUDIO 16 |
| 1187 | #define BTM_SEC_SERVICE_GEN_TEL 17 |
| 1188 | #define BTM_SEC_SERVICE_CTP_DATA 18 |
| 1189 | #define BTM_SEC_SERVICE_HCRP_CTRL 19 |
| 1190 | #define BTM_SEC_SERVICE_HCRP_DATA 20 |
| 1191 | #define BTM_SEC_SERVICE_HCRP_NOTIF 21 |
| 1192 | #define BTM_SEC_SERVICE_BPP_JOB 22 |
| 1193 | #define BTM_SEC_SERVICE_BPP_STATUS 23 |
| 1194 | #define BTM_SEC_SERVICE_BPP_REF 24 |
| 1195 | #define BTM_SEC_SERVICE_BNEP_PANU 25 |
| 1196 | #define BTM_SEC_SERVICE_BNEP_GN 26 |
| 1197 | #define BTM_SEC_SERVICE_BNEP_NAP 27 |
| 1198 | #define BTM_SEC_SERVICE_HF_HANDSFREE 28 |
| 1199 | #define BTM_SEC_SERVICE_AG_HANDSFREE 29 |
| 1200 | #define BTM_SEC_SERVICE_TE_PHONE_ACCESS 30 |
| 1201 | #define BTM_SEC_SERVICE_ME_PHONE_ACCESS 31 |
| 1202 | |
Andre Eisenbach | 2e7fa68 | 2013-08-08 15:42:48 -0700 | [diff] [blame] | 1203 | #define BTM_SEC_SERVICE_HIDH_SEC_CTRL 32 |
| 1204 | #define BTM_SEC_SERVICE_HIDH_NOSEC_CTRL 33 |
| 1205 | #define BTM_SEC_SERVICE_HIDH_INTR 34 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1206 | #define BTM_SEC_SERVICE_BIP 35 |
| 1207 | #define BTM_SEC_SERVICE_BIP_REF 36 |
| 1208 | #define BTM_SEC_SERVICE_AVDTP 37 |
| 1209 | #define BTM_SEC_SERVICE_AVDTP_NOSEC 38 |
| 1210 | #define BTM_SEC_SERVICE_AVCTP 39 |
| 1211 | #define BTM_SEC_SERVICE_SAP 40 |
| 1212 | #define BTM_SEC_SERVICE_PBAP 41 |
| 1213 | #define BTM_SEC_SERVICE_RFC_MUX 42 |
| 1214 | #define BTM_SEC_SERVICE_AVCTP_BROWSE 43 |
| 1215 | #define BTM_SEC_SERVICE_MAP 44 |
| 1216 | #define BTM_SEC_SERVICE_MAP_NOTIF 45 |
| 1217 | #define BTM_SEC_SERVICE_MCAP_CTRL 46 |
| 1218 | #define BTM_SEC_SERVICE_MCAP_DATA 47 |
| 1219 | #define BTM_SEC_SERVICE_HDP_SNK 48 |
| 1220 | #define BTM_SEC_SERVICE_HDP_SRC 49 |
| 1221 | #define BTM_SEC_SERVICE_ATT 50 |
| 1222 | |
| 1223 | /* Update these as services are added */ |
| 1224 | #define BTM_SEC_SERVICE_FIRST_EMPTY 51 |
| 1225 | |
| 1226 | #ifndef BTM_SEC_MAX_SERVICES |
| 1227 | #define BTM_SEC_MAX_SERVICES 65 |
| 1228 | #endif |
| 1229 | |
| 1230 | /************************************************************************************************ |
| 1231 | ** Security Services MACROS handle array of UINT32 bits for more than 32 trusted services |
| 1232 | *************************************************************************************************/ |
| 1233 | /* MACRO to set the security service bit mask in a bit stream */ |
| 1234 | #define BTM_SEC_SET_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)] |= \ |
| 1235 | ((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS))) |
| 1236 | |
| 1237 | |
| 1238 | /* MACRO to clear the security service bit mask in a bit stream */ |
| 1239 | #define BTM_SEC_CLR_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)] &= \ |
| 1240 | ~((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS))) |
| 1241 | |
| 1242 | /* MACRO to check the security service bit mask in a bit stream (Returns TRUE or FALSE) */ |
| 1243 | #define BTM_SEC_IS_SERVICE_TRUSTED(p, service) (((((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)]) & \ |
| 1244 | (UINT32)(((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS)))) ? TRUE : FALSE) |
| 1245 | |
| 1246 | /* MACRO to copy two trusted device bitmask */ |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1247 | #define BTM_SEC_COPY_TRUSTED_DEVICE(p_src, p_dst) {UINT32 trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1248 | ((UINT32 *)(p_dst))[trst] = ((UINT32 *)(p_src))[trst];} |
| 1249 | |
| 1250 | /* MACRO to clear two trusted device bitmask */ |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1251 | #define BTM_SEC_CLR_TRUSTED_DEVICE(p_dst) {UINT32 trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1252 | ((UINT32 *)(p_dst))[trst] = 0;} |
| 1253 | |
| 1254 | /* Following bits can be provided by host in the trusted_mask array */ |
| 1255 | /* 0..31 bits of mask[0] (Least Significant Word) */ |
| 1256 | #define BTM_SEC_TRUST_SDP_SERVER (1 << BTM_SEC_SERVICE_SDP_SERVER) |
| 1257 | #define BTM_SEC_TRUST_SERIAL_PORT (1 << BTM_SEC_SERVICE_SERIAL_PORT) |
| 1258 | #define BTM_SEC_TRUST_LAN_ACCESS (1 << BTM_SEC_SERVICE_LAN_ACCESS) |
| 1259 | #define BTM_SEC_TRUST_DUN (1 << BTM_SEC_SERVICE_DUN) |
| 1260 | #define BTM_SEC_TRUST_IRMC_SYNC (1 << BTM_SEC_SERVICE_IRMC_SYNC) |
| 1261 | #define BTM_SEC_TRUST_IRMC_SYNC_CMD (1 << BTM_SEC_SERVICE_IRMC_SYNC_CMD) |
| 1262 | #define BTM_SEC_TRUST_OBEX (1 << BTM_SEC_SERVICE_OBEX) |
| 1263 | #define BTM_SEC_TRUST_OBEX_FTP (1 << BTM_SEC_SERVICE_OBEX_FTP) |
| 1264 | #define BTM_SEC_TRUST_HEADSET (1 << BTM_SEC_SERVICE_HEADSET) |
| 1265 | #define BTM_SEC_TRUST_CORDLESS (1 << BTM_SEC_SERVICE_CORDLESS) |
| 1266 | #define BTM_SEC_TRUST_INTERCOM (1 << BTM_SEC_SERVICE_INTERCOM) |
| 1267 | #define BTM_SEC_TRUST_FAX (1 << BTM_SEC_SERVICE_FAX) |
| 1268 | #define BTM_SEC_TRUST_HEADSET_AG (1 << BTM_SEC_SERVICE_HEADSET_AG) |
| 1269 | #define BTM_SEC_TRUST_PNP_INFO (1 << BTM_SEC_SERVICE_PNP_INFO) |
| 1270 | #define BTM_SEC_TRUST_GEN_NET (1 << BTM_SEC_SERVICE_GEN_NET) |
| 1271 | #define BTM_SEC_TRUST_GEN_FILE (1 << BTM_SEC_SERVICE_GEN_FILE) |
| 1272 | #define BTM_SEC_TRUST_GEN_AUDIO (1 << BTM_SEC_SERVICE_GEN_AUDIO) |
| 1273 | #define BTM_SEC_TRUST_GEN_TEL (1 << BTM_SEC_SERVICE_GEN_TEL) |
| 1274 | #define BTM_SEC_TRUST_CTP_DATA (1 << BTM_SEC_SERVICE_CTP_DATA) |
| 1275 | #define BTM_SEC_TRUST_HCRP_CTRL (1 << BTM_SEC_SERVICE_HCRP_CTRL) |
| 1276 | #define BTM_SEC_TRUST_HCRP_DATA (1 << BTM_SEC_SERVICE_HCRP_DATA) |
| 1277 | #define BTM_SEC_TRUST_HCRP_NOTIF (1 << BTM_SEC_SERVICE_HCRP_NOTIF) |
| 1278 | #define BTM_SEC_TRUST_BPP_JOB (1 << BTM_SEC_SERVICE_JOB) |
| 1279 | #define BTM_SEC_TRUST_BPP_STATUS (1 << BTM_SEC_SERVICE_STATUS) |
| 1280 | #define BTM_SEC_TRUST_BPP_REF (1 << BTM_SEC_SERVICE_REF) |
| 1281 | #define BTM_SEC_TRUST_BNEP_PANU (1 << BTM_SEC_SERVICE_BNEP_PANU) |
| 1282 | #define BTM_SEC_TRUST_BNEP_GN (1 << BTM_SEC_SERVICE_BNEP_GN) |
| 1283 | #define BTM_SEC_TRUST_BNEP_NAP (1 << BTM_SEC_SERVICE_BNEP_NAP) |
| 1284 | #define BTM_SEC_TRUST_HFP_HF (1 << BTM_SEC_SERVICE_HF_HANDSFREE) |
| 1285 | #define BTM_SEC_TRUST_HFP_AG (1 << BTM_SEC_SERVICE_AG_HANDSFREE) |
| 1286 | #define BTM_SEC_TRUST_TE_PHONE_ACCESS (1 << BTM_SEC_SERVICE_TE_PHONE_ACCESS) |
| 1287 | #define BTM_SEC_TRUST_ME_PHONE_ACCESS (1 << BTM_SEC_SERVICE_ME_PHONE_ACCESS) |
| 1288 | |
| 1289 | /* 0..31 bits of mask[1] (Most Significant Word) */ |
Andre Eisenbach | 2e7fa68 | 2013-08-08 15:42:48 -0700 | [diff] [blame] | 1290 | #define BTM_SEC_TRUST_HIDH_CTRL (1 << (BTM_SEC_SERVICE_HIDH_SEC_CTRL - 32)) |
| 1291 | #define BTM_SEC_TRUST_HIDH_NOSEC_CTRL (1 << (BTM_SEC_SERVICE_HIDH_NOSEC_CTRL - 32)) |
| 1292 | #define BTM_SEC_TRUST_HIDH_INTR (1 << (BTM_SEC_SERVICE_HIDH_INTR - 32)) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1293 | #define BTM_SEC_TRUST_BIP (1 << (BTM_SEC_SERVICE_BIP - 32)) |
| 1294 | #define BTM_SEC_TRUST_BIP_REF (1 << (BTM_SEC_SERVICE_BIP_REF - 32)) |
| 1295 | #define BTM_SEC_TRUST_AVDTP (1 << (BTM_SEC_SERVICE_AVDTP - 32)) |
| 1296 | #define BTM_SEC_TRUST_AVDTP_NOSEC (1 << (BTM_SEC_SERVICE_AVDTP_NOSEC - 32)) |
| 1297 | #define BTM_SEC_TRUST_AVCTP (1 << (BTM_SEC_SERVICE_AVCTP - 32)) |
| 1298 | #define BTM_SEC_TRUST_SAP (1 << (BTM_SEC_SERVICE_SAP - 32)) |
| 1299 | #define BTM_SEC_TRUST_PBAP (1 << (BTM_SEC_SERVICE_PBAP - 32)) |
| 1300 | #define BTM_SEC_TRUST_RFC_MUX (1 << (BTM_SEC_SERVICE_RFC_MUX - 32)) |
| 1301 | #define BTM_SEC_TRUST_AVCTP_BROWSE (1 << (BTM_SEC_SERVICE_AVCTP_BROWSE - 32)) |
| 1302 | #define BTM_SEC_TRUST_MAP (1 << (BTM_SEC_SERVICE_MAP - 32)) |
| 1303 | #define BTM_SEC_TRUST_MAP_NOTIF (1 << (BTM_SEC_SERVICE_MAP_NOTIF - 32)) |
| 1304 | #define BTM_SEC_TRUST_MCAP_CTRL (1 << (BTM_SEC_SERVICE_MCAP_CTRL - 32)) |
| 1305 | #define BTM_SEC_TRUST_MCAP_DATA (1 << (BTM_SEC_SERVICE_MCAP_DATA - 32)) |
| 1306 | #define BTM_SEC_TRUST_HDP_SNK (1 << (BTM_SEC_SERVICE_HDP_SNK - 32)) |
| 1307 | #define BTM_SEC_TRUST_HDP_SRC (1 << (BTM_SEC_SERVICE_HDP_SRC - 32)) |
| 1308 | |
| 1309 | #define BTM_SEC_TRUST_ALL 0xFFFFFFFF /* for each array element */ |
| 1310 | |
| 1311 | /**************************************** |
| 1312 | ** Security Manager Callback Functions |
| 1313 | *****************************************/ |
| 1314 | /* Authorize device for service. Parameters are |
| 1315 | ** BD Address of remote |
| 1316 | ** Device Class of remote |
| 1317 | ** BD Name of remote |
| 1318 | ** Service name |
| 1319 | ** Service Id (NULL - unknown service or unused |
| 1320 | ** [BTM_SEC_SERVICE_NAME_LEN set to 0]) |
| 1321 | ** Is originator of the connection |
| 1322 | ** Result of the operation |
| 1323 | */ |
| 1324 | typedef UINT8 (tBTM_AUTHORIZE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class, |
| 1325 | tBTM_BD_NAME bd_name, UINT8 *service_name, |
| 1326 | UINT8 service_id, BOOLEAN is_originator); |
| 1327 | |
| 1328 | /* Get PIN for the connection. Parameters are |
| 1329 | ** BD Address of remote |
| 1330 | ** Device Class of remote |
| 1331 | ** BD Name of remote |
Casper Bonde | 818d0f2 | 2015-05-21 11:08:45 +0200 | [diff] [blame] | 1332 | ** Flag indicating the minimum pin code length to be 16 digits |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1333 | */ |
| 1334 | typedef UINT8 (tBTM_PIN_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class, |
Casper Bonde | 818d0f2 | 2015-05-21 11:08:45 +0200 | [diff] [blame] | 1335 | tBTM_BD_NAME bd_name, BOOLEAN min_16_digit); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1336 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1337 | /* New Link Key for the connection. Parameters are |
| 1338 | ** BD Address of remote |
| 1339 | ** Link Key |
| 1340 | ** Key Type: Combination, Local Unit, or Remote Unit |
| 1341 | */ |
| 1342 | typedef UINT8 (tBTM_LINK_KEY_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class, |
| 1343 | tBTM_BD_NAME bd_name, UINT8 *key, |
| 1344 | UINT8 key_type); |
| 1345 | |
| 1346 | |
| 1347 | /* Remote Name Resolved. Parameters are |
| 1348 | ** BD Address of remote |
| 1349 | ** BD Name of remote |
| 1350 | */ |
| 1351 | typedef void (tBTM_RMT_NAME_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dc, |
| 1352 | tBTM_BD_NAME bd_name); |
| 1353 | |
| 1354 | |
| 1355 | /* Authentication complete for the connection. Parameters are |
| 1356 | ** BD Address of remote |
| 1357 | ** Device Class of remote |
| 1358 | ** BD Name of remote |
| 1359 | ** |
| 1360 | */ |
| 1361 | typedef UINT8 (tBTM_AUTH_COMPLETE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class, |
| 1362 | tBTM_BD_NAME bd_name, int result); |
| 1363 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1364 | enum |
| 1365 | { |
| 1366 | BTM_SP_IO_REQ_EVT, /* received IO_CAPABILITY_REQUEST event */ |
| 1367 | BTM_SP_IO_RSP_EVT, /* received IO_CAPABILITY_RESPONSE event */ |
| 1368 | BTM_SP_CFM_REQ_EVT, /* received USER_CONFIRMATION_REQUEST event */ |
| 1369 | BTM_SP_KEY_NOTIF_EVT, /* received USER_PASSKEY_NOTIFY event */ |
| 1370 | BTM_SP_KEY_REQ_EVT, /* received USER_PASSKEY_REQUEST event */ |
| 1371 | BTM_SP_KEYPRESS_EVT, /* received KEYPRESS_NOTIFY event */ |
| 1372 | BTM_SP_LOC_OOB_EVT, /* received result for READ_LOCAL_OOB_DATA command */ |
| 1373 | BTM_SP_RMT_OOB_EVT, /* received REMOTE_OOB_DATA_REQUEST event */ |
| 1374 | BTM_SP_COMPLT_EVT, /* received SIMPLE_PAIRING_COMPLETE event */ |
| 1375 | BTM_SP_UPGRADE_EVT /* check if the application wants to upgrade the link key */ |
| 1376 | }; |
| 1377 | typedef UINT8 tBTM_SP_EVT; |
| 1378 | |
| 1379 | #define BTM_IO_CAP_OUT 0 /* DisplayOnly */ |
| 1380 | #define BTM_IO_CAP_IO 1 /* DisplayYesNo */ |
| 1381 | #define BTM_IO_CAP_IN 2 /* KeyboardOnly */ |
| 1382 | #define BTM_IO_CAP_NONE 3 /* NoInputNoOutput */ |
| 1383 | #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE |
| 1384 | #define BTM_IO_CAP_KBDISP 4 /* Keyboard display */ |
| 1385 | #define BTM_IO_CAP_MAX 5 |
| 1386 | #else |
| 1387 | #define BTM_IO_CAP_MAX 4 |
| 1388 | #endif |
| 1389 | |
| 1390 | typedef UINT8 tBTM_IO_CAP; |
| 1391 | |
| 1392 | #define BTM_MAX_PASSKEY_VAL (999999) |
| 1393 | #define BTM_MIN_PASSKEY_VAL (0) |
| 1394 | |
| 1395 | #define BTM_AUTH_SP_NO 0 /* MITM Protection Not Required - Single Profile/non-bonding |
| 1396 | Numeric comparison with automatic accept allowed */ |
| 1397 | #define BTM_AUTH_SP_YES 1 /* MITM Protection Required - Single Profile/non-bonding |
| 1398 | Use IO Capabilities to determine authentication procedure */ |
| 1399 | #define BTM_AUTH_AP_NO 2 /* MITM Protection Not Required - All Profiles/dedicated bonding |
| 1400 | Numeric comparison with automatic accept allowed */ |
| 1401 | #define BTM_AUTH_AP_YES 3 /* MITM Protection Required - All Profiles/dedicated bonding |
| 1402 | Use IO Capabilities to determine authentication procedure */ |
| 1403 | #define BTM_AUTH_SPGB_NO 4 /* MITM Protection Not Required - Single Profiles/general bonding |
| 1404 | Numeric comparison with automatic accept allowed */ |
| 1405 | #define BTM_AUTH_SPGB_YES 5 /* MITM Protection Required - Single Profiles/general bonding |
| 1406 | Use IO Capabilities to determine authentication procedure */ |
| 1407 | #define BTM_AUTH_DD_BOND 2 /* this bit is ORed to the BTM_AUTH_SP_* when IO exchange for dedicated bonding */ |
| 1408 | #define BTM_AUTH_GB_BIT 4 /* the genernal bonding bit */ |
| 1409 | #define BTM_AUTH_BONDS 6 /* the general/dedicated bonding bits */ |
| 1410 | #define BTM_AUTH_YN_BIT 1 /* this is the Yes or No bit */ |
| 1411 | |
Chaojing Sun | e280553 | 2015-04-22 13:40:21 -0700 | [diff] [blame] | 1412 | #define BTM_BLE_INITIATOR_KEY_SIZE 15 |
| 1413 | #define BTM_BLE_RESPONDER_KEY_SIZE 15 |
| 1414 | #define BTM_BLE_MAX_KEY_SIZE 16 |
| 1415 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1416 | typedef UINT8 tBTM_AUTH_REQ; |
| 1417 | |
| 1418 | enum |
| 1419 | { |
| 1420 | BTM_OOB_NONE, |
Jakub Pawlowski | 175da70 | 2015-11-12 15:00:58 -0800 | [diff] [blame^] | 1421 | BTM_OOB_PRESENT, |
| 1422 | BTM_OOB_UNKNOWN |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1423 | }; |
| 1424 | typedef UINT8 tBTM_OOB_DATA; |
| 1425 | |
| 1426 | /* data type for BTM_SP_IO_REQ_EVT */ |
| 1427 | typedef struct |
| 1428 | { |
| 1429 | BD_ADDR bd_addr; /* peer address */ |
| 1430 | tBTM_IO_CAP io_cap; /* local IO capabilities */ |
| 1431 | tBTM_OOB_DATA oob_data; /* OOB data present (locally) for the peer device */ |
| 1432 | tBTM_AUTH_REQ auth_req; /* Authentication required (for local device) */ |
| 1433 | BOOLEAN is_orig; /* TRUE, if local device initiated the SP process */ |
| 1434 | } tBTM_SP_IO_REQ; |
| 1435 | |
| 1436 | /* data type for BTM_SP_IO_RSP_EVT */ |
| 1437 | typedef struct |
| 1438 | { |
| 1439 | BD_ADDR bd_addr; /* peer address */ |
| 1440 | tBTM_IO_CAP io_cap; /* peer IO capabilities */ |
| 1441 | tBTM_OOB_DATA oob_data; /* OOB data present at peer device for the local device */ |
| 1442 | tBTM_AUTH_REQ auth_req; /* Authentication required for peer device */ |
| 1443 | } tBTM_SP_IO_RSP; |
| 1444 | |
| 1445 | /* data type for BTM_SP_CFM_REQ_EVT */ |
| 1446 | typedef struct |
| 1447 | { |
| 1448 | BD_ADDR bd_addr; /* peer address */ |
| 1449 | DEV_CLASS dev_class; /* peer CoD */ |
| 1450 | tBTM_BD_NAME bd_name; /* peer device name */ |
| 1451 | UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */ |
| 1452 | BOOLEAN just_works; /* TRUE, if "Just Works" association model */ |
| 1453 | tBTM_AUTH_REQ loc_auth_req; /* Authentication required for local device */ |
| 1454 | tBTM_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */ |
| 1455 | tBTM_IO_CAP loc_io_caps; /* IO Capabilities of the local device */ |
| 1456 | tBTM_IO_CAP rmt_io_caps; /* IO Capabilities of the remot device */ |
| 1457 | } tBTM_SP_CFM_REQ; |
| 1458 | |
| 1459 | /* data type for BTM_SP_KEY_REQ_EVT */ |
| 1460 | typedef struct |
| 1461 | { |
| 1462 | BD_ADDR bd_addr; /* peer address */ |
| 1463 | DEV_CLASS dev_class; /* peer CoD */ |
| 1464 | tBTM_BD_NAME bd_name; /* peer device name */ |
| 1465 | } tBTM_SP_KEY_REQ; |
| 1466 | |
| 1467 | /* data type for BTM_SP_KEY_NOTIF_EVT */ |
| 1468 | typedef struct |
| 1469 | { |
| 1470 | BD_ADDR bd_addr; /* peer address */ |
| 1471 | DEV_CLASS dev_class; /* peer CoD */ |
| 1472 | tBTM_BD_NAME bd_name; /* peer device name */ |
| 1473 | UINT32 passkey; /* passkey */ |
| 1474 | } tBTM_SP_KEY_NOTIF; |
| 1475 | |
| 1476 | enum |
| 1477 | { |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1478 | BTM_SP_KEY_STARTED, /* 0 - passkey entry started */ |
| 1479 | BTM_SP_KEY_ENTERED, /* 1 - passkey digit entered */ |
| 1480 | BTM_SP_KEY_ERASED, /* 2 - passkey digit erased */ |
| 1481 | BTM_SP_KEY_CLEARED, /* 3 - passkey cleared */ |
| 1482 | BTM_SP_KEY_COMPLT, /* 4 - passkey entry completed */ |
| 1483 | BTM_SP_KEY_OUT_OF_RANGE /* 5 - out of range */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1484 | }; |
| 1485 | typedef UINT8 tBTM_SP_KEY_TYPE; |
| 1486 | |
| 1487 | /* data type for BTM_SP_KEYPRESS_EVT */ |
| 1488 | typedef struct |
| 1489 | { |
| 1490 | BD_ADDR bd_addr; /* peer address */ |
| 1491 | tBTM_SP_KEY_TYPE notif_type; |
| 1492 | } tBTM_SP_KEYPRESS; |
| 1493 | |
| 1494 | /* data type for BTM_SP_LOC_OOB_EVT */ |
| 1495 | typedef struct |
| 1496 | { |
| 1497 | tBTM_STATUS status; /* */ |
| 1498 | BT_OCTET16 c; /* Simple Pairing Hash C */ |
| 1499 | BT_OCTET16 r; /* Simple Pairing Randomnizer R */ |
| 1500 | } tBTM_SP_LOC_OOB; |
| 1501 | |
| 1502 | /* data type for BTM_SP_RMT_OOB_EVT */ |
| 1503 | typedef struct |
| 1504 | { |
| 1505 | BD_ADDR bd_addr; /* peer address */ |
| 1506 | DEV_CLASS dev_class; /* peer CoD */ |
| 1507 | tBTM_BD_NAME bd_name; /* peer device name */ |
| 1508 | } tBTM_SP_RMT_OOB; |
| 1509 | |
| 1510 | |
| 1511 | /* data type for BTM_SP_COMPLT_EVT */ |
| 1512 | typedef struct |
| 1513 | { |
| 1514 | BD_ADDR bd_addr; /* peer address */ |
| 1515 | DEV_CLASS dev_class; /* peer CoD */ |
| 1516 | tBTM_BD_NAME bd_name; /* peer device name */ |
| 1517 | tBTM_STATUS status; /* status of the simple pairing process */ |
| 1518 | } tBTM_SP_COMPLT; |
| 1519 | |
| 1520 | /* data type for BTM_SP_UPGRADE_EVT */ |
| 1521 | typedef struct |
| 1522 | { |
| 1523 | BD_ADDR bd_addr; /* peer address */ |
| 1524 | BOOLEAN upgrade; /* TRUE, to upgrade the link key */ |
| 1525 | } tBTM_SP_UPGRADE; |
| 1526 | |
| 1527 | typedef union |
| 1528 | { |
| 1529 | tBTM_SP_IO_REQ io_req; /* BTM_SP_IO_REQ_EVT */ |
| 1530 | tBTM_SP_IO_RSP io_rsp; /* BTM_SP_IO_RSP_EVT */ |
| 1531 | tBTM_SP_CFM_REQ cfm_req; /* BTM_SP_CFM_REQ_EVT */ |
| 1532 | tBTM_SP_KEY_NOTIF key_notif; /* BTM_SP_KEY_NOTIF_EVT */ |
| 1533 | tBTM_SP_KEY_REQ key_req; /* BTM_SP_KEY_REQ_EVT */ |
| 1534 | tBTM_SP_KEYPRESS key_press; /* BTM_SP_KEYPRESS_EVT */ |
| 1535 | tBTM_SP_LOC_OOB loc_oob; /* BTM_SP_LOC_OOB_EVT */ |
| 1536 | tBTM_SP_RMT_OOB rmt_oob; /* BTM_SP_RMT_OOB_EVT */ |
| 1537 | tBTM_SP_COMPLT complt; /* BTM_SP_COMPLT_EVT */ |
| 1538 | tBTM_SP_UPGRADE upgrade; /* BTM_SP_UPGRADE_EVT */ |
| 1539 | } tBTM_SP_EVT_DATA; |
| 1540 | |
| 1541 | /* Simple Pairing Events. Called by the stack when Simple Pairing related |
| 1542 | ** events occur. |
| 1543 | */ |
| 1544 | typedef UINT8 (tBTM_SP_CALLBACK) (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data); |
| 1545 | |
| 1546 | |
| 1547 | typedef void (tBTM_MKEY_CALLBACK) (BD_ADDR bd_addr, UINT8 status, UINT8 key_flag) ; |
| 1548 | |
| 1549 | /* Encryption enabled/disabled complete: Optionally passed with BTM_SetEncryption. |
| 1550 | ** Parameters are |
| 1551 | ** BD Address of remote |
| 1552 | ** optional data passed in by BTM_SetEncryption |
| 1553 | ** tBTM_STATUS - result of the operation |
| 1554 | */ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1555 | typedef void (tBTM_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT trasnport, |
| 1556 | void *p_ref_data, tBTM_STATUS result); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1557 | |
| 1558 | /* Bond Cancel complete. Parameters are |
| 1559 | ** Result of the cancel operation |
| 1560 | ** |
| 1561 | */ |
| 1562 | typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result); |
| 1563 | |
| 1564 | /* LE related event and data structure |
| 1565 | */ |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1566 | #define BTM_LE_IO_REQ_EVT SMP_IO_CAP_REQ_EVT /* received IO_CAPABILITY_REQUEST event */ |
| 1567 | #define BTM_LE_SEC_REQUEST_EVT SMP_SEC_REQUEST_EVT /* security request event */ |
| 1568 | #define BTM_LE_KEY_NOTIF_EVT SMP_PASSKEY_NOTIF_EVT /* received USER_PASSKEY_NOTIFY event */ |
| 1569 | #define BTM_LE_KEY_REQ_EVT SMP_PASSKEY_REQ_EVT /* received USER_PASSKEY_REQUEST event */ |
| 1570 | #define BTM_LE_OOB_REQ_EVT SMP_OOB_REQ_EVT /* OOB data request event */ |
| 1571 | #define BTM_LE_NC_REQ_EVT SMP_NC_REQ_EVT /* Numeric Comparison request event */ |
| 1572 | #define BTM_LE_PR_KEYPR_NOT_EVT SMP_PEER_KEYPR_NOT_EVT /* Peer keypress notification recd event */ |
| 1573 | /* SC OOB request event (both local and peer OOB data) can be expected in response */ |
| 1574 | #define BTM_LE_SC_OOB_REQ_EVT SMP_SC_OOB_REQ_EVT |
| 1575 | /* SC OOB local data set is created (as result of SMP_CrLocScOobData(...)) */ |
| 1576 | #define BTM_LE_SC_LOC_OOB_EVT SMP_SC_LOC_OOB_DATA_UP_EVT |
| 1577 | #define BTM_LE_BR_KEYS_REQ_EVT SMP_BR_KEYS_REQ_EVT /* SMP over BR keys request event */ |
| 1578 | #define BTM_LE_COMPLT_EVT SMP_COMPLT_EVT /* SMP complete event */ |
| 1579 | #define BTM_LE_LAST_FROM_SMP BTM_LE_BR_KEYS_REQ_EVT |
| 1580 | #define BTM_LE_KEY_EVT BTM_LE_LAST_FROM_SMP + 1 /* KEY update event */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1581 | typedef UINT8 tBTM_LE_EVT; |
| 1582 | |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1583 | #define BTM_LE_KEY_NONE 0 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1584 | #define BTM_LE_KEY_PENC SMP_SEC_KEY_TYPE_ENC /* encryption information of peer device */ |
| 1585 | #define BTM_LE_KEY_PID SMP_SEC_KEY_TYPE_ID /* identity key of the peer device */ |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1586 | #define BTM_LE_KEY_PCSRK SMP_SEC_KEY_TYPE_CSRK /* peer SRK */ |
| 1587 | #define BTM_LE_KEY_PLK SMP_SEC_KEY_TYPE_LK |
| 1588 | #define BTM_LE_KEY_LLK (SMP_SEC_KEY_TYPE_LK << 4) |
| 1589 | #define BTM_LE_KEY_LENC (SMP_SEC_KEY_TYPE_ENC << 4) /* master role security information:div */ |
| 1590 | #define BTM_LE_KEY_LID (SMP_SEC_KEY_TYPE_ID << 4) /* master device ID key */ |
| 1591 | #define BTM_LE_KEY_LCSRK (SMP_SEC_KEY_TYPE_CSRK << 4) /* local CSRK has been deliver to peer */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1592 | typedef UINT8 tBTM_LE_KEY_TYPE; |
| 1593 | |
| 1594 | #define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND /* 0 */ |
| 1595 | #define BTM_LE_AUTH_REQ_BOND SMP_AUTH_GEN_BOND /* 1 << 0 */ |
| 1596 | #define BTM_LE_AUTH_REQ_MITM SMP_AUTH_YN_BIT /* 1 << 2 */ |
| 1597 | typedef UINT8 tBTM_LE_AUTH_REQ; |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1598 | #define BTM_LE_SC_SUPPORT_BIT SMP_SC_SUPPORT_BIT /* (1 << 3) */ |
| 1599 | #define BTM_LE_KP_SUPPORT_BIT SMP_KP_SUPPORT_BIT /* (1 << 4) */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1600 | |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1601 | #define BTM_LE_AUTH_REQ_SC_ONLY SMP_AUTH_SC_ENC_ONLY /* 1 << 3 */ |
| 1602 | #define BTM_LE_AUTH_REQ_SC_BOND SMP_AUTH_SC_GB /* 1001 */ |
| 1603 | #define BTM_LE_AUTH_REQ_SC_MITM SMP_AUTH_SC_MITM_NB /* 1100 */ |
| 1604 | #define BTM_LE_AUTH_REQ_SC_MITM_BOND SMP_AUTH_SC_MITM_GB /* 1101 */ |
| 1605 | #define BTM_LE_AUTH_REQ_MASK SMP_AUTH_MASK /* 0x1D */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1606 | |
| 1607 | /* LE security level */ |
| 1608 | #define BTM_LE_SEC_NONE SMP_SEC_NONE |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1609 | #define BTM_LE_SEC_UNAUTHENTICATE SMP_SEC_UNAUTHENTICATE /* 1 */ |
| 1610 | #define BTM_LE_SEC_AUTHENTICATED SMP_SEC_AUTHENTICATED /* 4 */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1611 | typedef UINT8 tBTM_LE_SEC; |
| 1612 | |
| 1613 | |
| 1614 | typedef struct |
| 1615 | { |
| 1616 | tBTM_IO_CAP io_cap; /* local IO capabilities */ |
| 1617 | UINT8 oob_data; /* OOB data present (locally) for the peer device */ |
| 1618 | tBTM_LE_AUTH_REQ auth_req; /* Authentication request (for local device) contain bonding and MITM info */ |
| 1619 | UINT8 max_key_size; /* max encryption key size */ |
| 1620 | tBTM_LE_KEY_TYPE init_keys; /* keys to be distributed, bit mask */ |
| 1621 | tBTM_LE_KEY_TYPE resp_keys; /* keys to be distributed, bit mask */ |
| 1622 | } tBTM_LE_IO_REQ; |
| 1623 | |
| 1624 | #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE |
| 1625 | /* data type for tBTM_LE_COMPLT */ |
| 1626 | typedef struct |
| 1627 | { |
Chaojing Sun | e280553 | 2015-04-22 13:40:21 -0700 | [diff] [blame] | 1628 | UINT8 reason; |
| 1629 | UINT8 sec_level; |
| 1630 | BOOLEAN is_pair_cancel; |
| 1631 | BOOLEAN smp_over_br; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1632 | }tBTM_LE_COMPLT; |
| 1633 | #endif |
| 1634 | |
| 1635 | /* BLE encryption keys */ |
| 1636 | typedef struct |
| 1637 | { |
| 1638 | BT_OCTET16 ltk; |
| 1639 | BT_OCTET8 rand; |
| 1640 | UINT16 ediv; |
| 1641 | UINT8 sec_level; |
| 1642 | UINT8 key_size; |
| 1643 | }tBTM_LE_PENC_KEYS; |
| 1644 | |
| 1645 | /* BLE CSRK keys */ |
| 1646 | typedef struct |
| 1647 | { |
| 1648 | UINT32 counter; |
| 1649 | BT_OCTET16 csrk; |
| 1650 | UINT8 sec_level; |
| 1651 | }tBTM_LE_PCSRK_KEYS; |
| 1652 | |
| 1653 | /* BLE Encryption reproduction keys */ |
| 1654 | typedef struct |
| 1655 | { |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1656 | BT_OCTET16 ltk; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1657 | UINT16 div; |
| 1658 | UINT8 key_size; |
| 1659 | UINT8 sec_level; |
| 1660 | }tBTM_LE_LENC_KEYS; |
| 1661 | |
| 1662 | /* BLE SRK keys */ |
| 1663 | typedef struct |
| 1664 | { |
| 1665 | UINT32 counter; |
| 1666 | UINT16 div; |
| 1667 | UINT8 sec_level; |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1668 | BT_OCTET16 csrk; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1669 | }tBTM_LE_LCSRK_KEYS; |
| 1670 | |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1671 | typedef struct |
| 1672 | { |
| 1673 | BT_OCTET16 irk; |
| 1674 | tBLE_ADDR_TYPE addr_type; |
| 1675 | BD_ADDR static_addr; |
| 1676 | }tBTM_LE_PID_KEYS; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1677 | |
| 1678 | typedef union |
| 1679 | { |
| 1680 | tBTM_LE_PENC_KEYS penc_key; /* received peer encryption key */ |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1681 | tBTM_LE_PCSRK_KEYS pcsrk_key; /* received peer device SRK */ |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1682 | tBTM_LE_PID_KEYS pid_key; /* peer device ID key */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1683 | tBTM_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/ |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1684 | tBTM_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1685 | }tBTM_LE_KEY_VALUE; |
| 1686 | |
| 1687 | typedef struct |
| 1688 | { |
| 1689 | tBTM_LE_KEY_TYPE key_type; |
| 1690 | tBTM_LE_KEY_VALUE *p_key_value; |
| 1691 | }tBTM_LE_KEY; |
| 1692 | |
| 1693 | typedef union |
| 1694 | { |
| 1695 | tBTM_LE_IO_REQ io_req; /* BTM_LE_IO_REQ_EVT */ |
| 1696 | UINT32 key_notif; /* BTM_LE_KEY_NOTIF_EVT */ |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1697 | /* BTM_LE_NC_REQ_EVT */ |
| 1698 | /* no callback data for BTM_LE_KEY_REQ_EVT */ |
| 1699 | /* and BTM_LE_OOB_REQ_EVT */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1700 | #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE |
| 1701 | tBTM_LE_COMPLT complt; /* BTM_LE_COMPLT_EVT */ |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1702 | tSMP_OOB_DATA_TYPE req_oob_type; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1703 | #endif |
| 1704 | tBTM_LE_KEY key; |
| 1705 | } tBTM_LE_EVT_DATA; |
| 1706 | |
| 1707 | /* Simple Pairing Events. Called by the stack when Simple Pairing related |
| 1708 | ** events occur. |
| 1709 | */ |
| 1710 | typedef UINT8 (tBTM_LE_CALLBACK) (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_DATA *p_data); |
| 1711 | |
| 1712 | #define BTM_BLE_KEY_TYPE_ID 1 |
| 1713 | #define BTM_BLE_KEY_TYPE_ER 2 |
| 1714 | #define BTM_BLE_KEY_TYPE_COUNTER 3 //tobe obsolete |
| 1715 | |
| 1716 | typedef struct |
| 1717 | { |
| 1718 | BT_OCTET16 ir; |
| 1719 | BT_OCTET16 irk; |
| 1720 | BT_OCTET16 dhk; |
| 1721 | |
| 1722 | }tBTM_BLE_LOCAL_ID_KEYS; |
| 1723 | |
| 1724 | typedef union |
| 1725 | { |
| 1726 | tBTM_BLE_LOCAL_ID_KEYS id_keys; |
| 1727 | BT_OCTET16 er; |
| 1728 | }tBTM_BLE_LOCAL_KEYS; |
| 1729 | |
| 1730 | |
| 1731 | /* New LE identity key for local device. |
| 1732 | */ |
| 1733 | typedef void (tBTM_LE_KEY_CALLBACK) (UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key); |
| 1734 | |
| 1735 | |
| 1736 | /*************************** |
| 1737 | ** Security Manager Types |
| 1738 | ****************************/ |
| 1739 | /* Structure that applications use to register with BTM_SecRegister */ |
| 1740 | typedef struct |
| 1741 | { |
| 1742 | tBTM_AUTHORIZE_CALLBACK *p_authorize_callback; |
| 1743 | tBTM_PIN_CALLBACK *p_pin_callback; |
| 1744 | tBTM_LINK_KEY_CALLBACK *p_link_key_callback; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1745 | tBTM_AUTH_COMPLETE_CALLBACK *p_auth_complete_callback; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1746 | tBTM_BOND_CANCEL_CMPL_CALLBACK *p_bond_cancel_cmpl_callback; |
| 1747 | tBTM_SP_CALLBACK *p_sp_callback; |
| 1748 | #if BLE_INCLUDED == TRUE |
| 1749 | #if SMP_INCLUDED == TRUE |
| 1750 | tBTM_LE_CALLBACK *p_le_callback; |
| 1751 | #endif |
| 1752 | tBTM_LE_KEY_CALLBACK *p_le_key_callback; |
| 1753 | #endif |
| 1754 | } tBTM_APPL_INFO; |
| 1755 | |
| 1756 | /* Callback function for when a link supervision timeout event occurs. |
| 1757 | ** This asynchronous event is enabled/disabled by calling BTM_RegForLstoEvt(). |
| 1758 | */ |
| 1759 | typedef void (tBTM_LSTO_CBACK) (BD_ADDR remote_bda, UINT16 timeout); |
| 1760 | |
| 1761 | /***************************************************************************** |
| 1762 | ** POWER MANAGEMENT |
| 1763 | *****************************************************************************/ |
| 1764 | /**************************** |
| 1765 | ** Power Manager Constants |
| 1766 | *****************************/ |
| 1767 | /* BTM Power manager status codes */ |
| 1768 | enum |
| 1769 | { |
| 1770 | BTM_PM_STS_ACTIVE = HCI_MODE_ACTIVE, |
| 1771 | BTM_PM_STS_HOLD = HCI_MODE_HOLD, |
| 1772 | BTM_PM_STS_SNIFF = HCI_MODE_SNIFF, |
| 1773 | BTM_PM_STS_PARK = HCI_MODE_PARK, |
| 1774 | BTM_PM_STS_SSR, /* report the SSR parameters in HCI_SNIFF_SUB_RATE_EVT */ |
| 1775 | BTM_PM_STS_PENDING, /* when waiting for status from controller */ |
| 1776 | BTM_PM_STS_ERROR /* when HCI command status returns error */ |
| 1777 | }; |
| 1778 | typedef UINT8 tBTM_PM_STATUS; |
| 1779 | |
| 1780 | /* BTM Power manager modes */ |
| 1781 | enum |
| 1782 | { |
| 1783 | BTM_PM_MD_ACTIVE = BTM_PM_STS_ACTIVE, |
| 1784 | BTM_PM_MD_HOLD = BTM_PM_STS_HOLD, |
| 1785 | BTM_PM_MD_SNIFF = BTM_PM_STS_SNIFF, |
| 1786 | BTM_PM_MD_PARK = BTM_PM_STS_PARK, |
| 1787 | BTM_PM_MD_FORCE = 0x10 /* OR this to force ACL link to a certain mode */ |
| 1788 | }; |
| 1789 | typedef UINT8 tBTM_PM_MODE; |
| 1790 | |
| 1791 | #define BTM_PM_SET_ONLY_ID 0x80 |
| 1792 | |
| 1793 | /* Operation codes */ |
| 1794 | #define BTM_PM_REG_SET 1 /* The module wants to set the desired power mode */ |
| 1795 | #define BTM_PM_REG_NOTIF 2 /* The module wants to receive mode change event */ |
| 1796 | #define BTM_PM_DEREG 4 /* The module does not want to involve with PM anymore */ |
| 1797 | |
| 1798 | /************************ |
| 1799 | ** Power Manager Types |
| 1800 | *************************/ |
| 1801 | typedef struct |
| 1802 | { |
| 1803 | UINT16 max; |
| 1804 | UINT16 min; |
| 1805 | UINT16 attempt; |
| 1806 | UINT16 timeout; |
| 1807 | tBTM_PM_MODE mode; |
| 1808 | } tBTM_PM_PWR_MD; |
| 1809 | |
| 1810 | /************************************* |
| 1811 | ** Power Manager Callback Functions |
| 1812 | **************************************/ |
| 1813 | typedef void (tBTM_PM_STATUS_CBACK) (BD_ADDR p_bda, tBTM_PM_STATUS status, |
| 1814 | UINT16 value, UINT8 hci_status); |
| 1815 | |
| 1816 | |
| 1817 | /************************ |
| 1818 | ** Stored Linkkey Types |
| 1819 | *************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1820 | #define BTM_CB_EVT_DELETE_STORED_LINK_KEYS 4 |
| 1821 | |
| 1822 | typedef struct |
| 1823 | { |
| 1824 | UINT8 event; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1825 | UINT8 status; |
| 1826 | UINT16 num_keys; |
| 1827 | |
| 1828 | } tBTM_DELETE_STORED_LINK_KEY_COMPLETE; |
| 1829 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1830 | /* MIP evnets, callbacks */ |
| 1831 | enum |
| 1832 | { |
| 1833 | BTM_MIP_MODE_CHG_EVT, |
| 1834 | BTM_MIP_DISCONNECT_EVT, |
| 1835 | BTM_MIP_PKTS_COMPL_EVT, |
| 1836 | BTM_MIP_RXDATA_EVT |
| 1837 | }; |
| 1838 | typedef UINT8 tBTM_MIP_EVT; |
| 1839 | |
| 1840 | typedef struct |
| 1841 | { |
| 1842 | tBTM_MIP_EVT event; |
| 1843 | BD_ADDR bd_addr; |
| 1844 | UINT16 mip_id; |
| 1845 | } tBTM_MIP_MODE_CHANGE; |
| 1846 | |
| 1847 | typedef struct |
| 1848 | { |
| 1849 | tBTM_MIP_EVT event; |
| 1850 | UINT16 mip_id; |
| 1851 | UINT8 disc_reason; |
| 1852 | } tBTM_MIP_CONN_TIMEOUT; |
| 1853 | |
| 1854 | #define BTM_MIP_MAX_RX_LEN 17 |
| 1855 | |
| 1856 | typedef struct |
| 1857 | { |
| 1858 | tBTM_MIP_EVT event; |
| 1859 | UINT16 mip_id; |
| 1860 | UINT8 rx_len; |
| 1861 | UINT8 rx_data[BTM_MIP_MAX_RX_LEN]; |
| 1862 | } tBTM_MIP_RXDATA; |
| 1863 | |
| 1864 | typedef struct |
| 1865 | { |
| 1866 | tBTM_MIP_EVT event; |
| 1867 | BD_ADDR bd_addr; |
| 1868 | UINT8 data[11]; /* data[0] shows Vender-specific device type */ |
| 1869 | } tBTM_MIP_EIR_HANDSHAKE; |
| 1870 | |
| 1871 | typedef struct |
| 1872 | { |
| 1873 | tBTM_MIP_EVT event; |
| 1874 | UINT16 num_sent; /* Number of packets completed at the controller */ |
| 1875 | } tBTM_MIP_PKTS_COMPL; |
| 1876 | |
| 1877 | typedef union |
| 1878 | { |
| 1879 | tBTM_MIP_EVT event; |
| 1880 | tBTM_MIP_MODE_CHANGE mod_chg; |
| 1881 | tBTM_MIP_CONN_TIMEOUT conn_tmo; |
| 1882 | tBTM_MIP_EIR_HANDSHAKE eir; |
| 1883 | tBTM_MIP_PKTS_COMPL completed; |
| 1884 | tBTM_MIP_RXDATA rxdata; |
| 1885 | } tBTM_MIP_EVENT_DATA; |
| 1886 | |
| 1887 | /* MIP event callback function */ |
| 1888 | typedef void (tBTM_MIP_EVENTS_CB) (tBTM_MIP_EVT event, tBTM_MIP_EVENT_DATA data); |
| 1889 | |
| 1890 | /* MIP Device query callback function */ |
| 1891 | typedef BOOLEAN (tBTM_MIP_QUERY_CB) (BD_ADDR dev_addr, UINT8 *p_mode, LINK_KEY link_key); |
| 1892 | |
Satya Calloji | e5ba884 | 2014-07-03 17:18:02 -0700 | [diff] [blame] | 1893 | #define BTM_CONTRL_ACTIVE 1 /* ACL link on, SCO link ongoing, sniff mode */ |
| 1894 | #define BTM_CONTRL_SCAN 2 /* Scan state - paging/inquiry/trying to connect*/ |
| 1895 | #define BTM_CONTRL_IDLE 3 /* Idle state - page scan, LE advt, inquiry scan */ |
| 1896 | |
| 1897 | typedef UINT8 tBTM_CONTRL_STATE; |
| 1898 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1899 | /***************************************************************************** |
| 1900 | ** EXTERNAL FUNCTION DECLARATIONS |
| 1901 | *****************************************************************************/ |
| 1902 | #ifdef __cplusplus |
| 1903 | extern "C" { |
| 1904 | #endif |
| 1905 | |
| 1906 | /***************************************************************************** |
| 1907 | ** DEVICE CONTROL and COMMON FUNCTIONS |
| 1908 | *****************************************************************************/ |
| 1909 | |
| 1910 | /******************************************************************************* |
| 1911 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1912 | ** Function BTM_DeviceReset |
| 1913 | ** |
| 1914 | ** Description This function is called to reset the controller.The Callback function |
| 1915 | ** if provided is called when startup of the device has |
| 1916 | ** completed. |
| 1917 | ** |
| 1918 | ** Returns void |
| 1919 | ** |
| 1920 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1921 | extern void BTM_DeviceReset (tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1922 | |
| 1923 | |
| 1924 | /******************************************************************************* |
| 1925 | ** |
| 1926 | ** Function BTM_IsDeviceUp |
| 1927 | ** |
| 1928 | ** Description This function is called to check if the device is up. |
| 1929 | ** |
| 1930 | ** Returns TRUE if device is up, else FALSE |
| 1931 | ** |
| 1932 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1933 | extern BOOLEAN BTM_IsDeviceUp (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1934 | |
| 1935 | |
| 1936 | /******************************************************************************* |
| 1937 | ** |
| 1938 | ** Function BTM_SetLocalDeviceName |
| 1939 | ** |
| 1940 | ** Description This function is called to set the local device name. |
| 1941 | ** |
| 1942 | ** Returns BTM_CMD_STARTED if successful, otherwise an error |
| 1943 | ** |
| 1944 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1945 | extern tBTM_STATUS BTM_SetLocalDeviceName (char *p_name); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1946 | |
| 1947 | /******************************************************************************* |
| 1948 | ** |
| 1949 | ** Function BTM_SetDeviceClass |
| 1950 | ** |
| 1951 | ** Description This function is called to set the local device class |
| 1952 | ** |
| 1953 | ** Returns BTM_SUCCESS if successful, otherwise an error |
| 1954 | ** |
| 1955 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1956 | extern tBTM_STATUS BTM_SetDeviceClass (DEV_CLASS dev_class); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1957 | |
| 1958 | |
| 1959 | /******************************************************************************* |
| 1960 | ** |
| 1961 | ** Function BTM_ReadLocalDeviceName |
| 1962 | ** |
| 1963 | ** Description This function is called to read the local device name. |
| 1964 | ** |
| 1965 | ** Returns status of the operation |
| 1966 | ** If success, BTM_SUCCESS is returned and p_name points stored |
| 1967 | ** local device name |
| 1968 | ** If BTM doesn't store local device name, BTM_NO_RESOURCES is |
| 1969 | ** is returned and p_name is set to NULL |
| 1970 | ** |
| 1971 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1972 | extern tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1973 | |
| 1974 | /******************************************************************************* |
| 1975 | ** |
| 1976 | ** Function BTM_ReadLocalDeviceNameFromController |
| 1977 | ** |
| 1978 | ** Description Get local device name from controller. Do not use cached |
| 1979 | ** name (used to get chip-id prior to btm reset complete). |
| 1980 | ** |
| 1981 | ** Returns BTM_CMD_STARTED if successful, otherwise an error |
| 1982 | ** |
| 1983 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1984 | extern tBTM_STATUS BTM_ReadLocalDeviceNameFromController (tBTM_CMPL_CB *p_rln_cmpl_cback); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1985 | |
| 1986 | /******************************************************************************* |
| 1987 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1988 | ** Function BTM_ReadDeviceClass |
| 1989 | ** |
| 1990 | ** Description This function is called to read the local device class |
| 1991 | ** |
| 1992 | ** Returns pointer to the device class |
| 1993 | ** |
| 1994 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1995 | extern UINT8 *BTM_ReadDeviceClass (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1996 | |
| 1997 | |
| 1998 | /******************************************************************************* |
| 1999 | ** |
| 2000 | ** Function BTM_ReadLocalFeatures |
| 2001 | ** |
| 2002 | ** Description This function is called to read the local features |
| 2003 | ** |
| 2004 | ** Returns pointer to the local features string |
| 2005 | ** |
| 2006 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2007 | extern UINT8 *BTM_ReadLocalFeatures (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2008 | |
| 2009 | /******************************************************************************* |
| 2010 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2011 | ** Function BTM_RegisterForDeviceStatusNotif |
| 2012 | ** |
| 2013 | ** Description This function is called to register for device status |
| 2014 | ** change notifications. |
| 2015 | ** |
| 2016 | ** Returns pointer to previous caller's callback function or NULL if first |
| 2017 | ** registration. |
| 2018 | ** |
| 2019 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2020 | extern tBTM_DEV_STATUS_CB *BTM_RegisterForDeviceStatusNotif (tBTM_DEV_STATUS_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2021 | |
| 2022 | |
| 2023 | /******************************************************************************* |
| 2024 | ** |
| 2025 | ** Function BTM_RegisterForVSEvents |
| 2026 | ** |
| 2027 | ** Description This function is called to register/deregister for vendor |
| 2028 | ** specific HCI events. |
| 2029 | ** |
| 2030 | ** If is_register=TRUE, then the function will be registered; |
| 2031 | ** if is_register=FALSE, then the function will be deregistered. |
| 2032 | ** |
| 2033 | ** Returns BTM_SUCCESS if successful, |
| 2034 | ** BTM_BUSY if maximum number of callbacks have already been |
| 2035 | ** registered. |
| 2036 | ** |
| 2037 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2038 | extern tBTM_STATUS BTM_RegisterForVSEvents (tBTM_VS_EVT_CB *p_cb, BOOLEAN is_register); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2039 | |
| 2040 | |
| 2041 | /******************************************************************************* |
| 2042 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2043 | ** Function BTM_VendorSpecificCommand |
| 2044 | ** |
| 2045 | ** Description Send a vendor specific HCI command to the controller. |
| 2046 | ** |
| 2047 | ** Returns |
| 2048 | ** BTM_SUCCESS Command sent. Does not expect command complete |
| 2049 | ** event. (command cmpl callback param is NULL) |
| 2050 | ** BTM_CMD_STARTED Command sent. Waiting for command cmpl event. |
| 2051 | ** BTM_BUSY Command not sent. Waiting for cmd cmpl event for |
| 2052 | ** prior command. |
| 2053 | ** |
| 2054 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2055 | extern tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode, |
| 2056 | UINT8 param_len, |
| 2057 | UINT8 *p_param_buf, |
| 2058 | tBTM_VSC_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2059 | |
| 2060 | |
| 2061 | /******************************************************************************* |
| 2062 | ** |
| 2063 | ** Function BTM_AllocateSCN |
| 2064 | ** |
| 2065 | ** Description Look through the Server Channel Numbers for a free one to be |
| 2066 | ** used with an RFCOMM connection. |
| 2067 | ** |
| 2068 | ** Returns Allocated SCN number or 0 if none. |
| 2069 | ** |
| 2070 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2071 | extern UINT8 BTM_AllocateSCN(void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2072 | |
| 2073 | // btla-specific ++ |
| 2074 | /******************************************************************************* |
| 2075 | ** |
| 2076 | ** Function BTM_TryAllocateSCN |
| 2077 | ** |
| 2078 | ** Description Try to allocate a fixed server channel |
| 2079 | ** |
| 2080 | ** Returns Returns TRUE if server channel was available |
| 2081 | ** |
| 2082 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2083 | extern BOOLEAN BTM_TryAllocateSCN(UINT8 scn); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2084 | // btla-specific -- |
| 2085 | |
| 2086 | |
| 2087 | /******************************************************************************* |
| 2088 | ** |
| 2089 | ** Function BTM_FreeSCN |
| 2090 | ** |
| 2091 | ** Description Free the specified SCN. |
| 2092 | ** |
| 2093 | ** Returns TRUE if successful, FALSE if SCN is not in use or invalid |
| 2094 | ** |
| 2095 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2096 | extern BOOLEAN BTM_FreeSCN(UINT8 scn); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2097 | |
| 2098 | |
| 2099 | /******************************************************************************* |
| 2100 | ** |
| 2101 | ** Function BTM_SetTraceLevel |
| 2102 | ** |
| 2103 | ** Description This function sets the trace level for BTM. If called with |
| 2104 | ** a value of 0xFF, it simply returns the current trace level. |
| 2105 | ** |
| 2106 | ** Returns The new or current trace level |
| 2107 | ** |
| 2108 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2109 | extern UINT8 BTM_SetTraceLevel (UINT8 new_level); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2110 | |
| 2111 | |
| 2112 | /******************************************************************************* |
| 2113 | ** |
| 2114 | ** Function BTM_WritePageTimeout |
| 2115 | ** |
| 2116 | ** Description Send HCI Wite Page Timeout. |
| 2117 | ** |
| 2118 | ** Returns |
| 2119 | ** BTM_SUCCESS Command sent. |
| 2120 | ** BTM_NO_RESOURCES If out of resources to send the command. |
| 2121 | ** |
| 2122 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2123 | extern tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2124 | |
| 2125 | /******************************************************************************* |
| 2126 | ** |
| 2127 | ** Function BTM_WriteVoiceSettings |
| 2128 | ** |
| 2129 | ** Description Send HCI Write Voice Settings command. |
| 2130 | ** See hcidefs.h for settings bitmask values. |
| 2131 | ** |
| 2132 | ** Returns |
| 2133 | ** BTM_SUCCESS Command sent. |
| 2134 | ** BTM_NO_RESOURCES If out of resources to send the command. |
| 2135 | ** |
| 2136 | ** |
| 2137 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2138 | extern tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2139 | |
| 2140 | /******************************************************************************* |
| 2141 | ** |
| 2142 | ** Function BTM_EnableTestMode |
| 2143 | ** |
| 2144 | ** Description Send HCI the enable device under test command. |
| 2145 | ** |
| 2146 | ** Note: Controller can only be taken out of this mode by |
| 2147 | ** resetting the controller. |
| 2148 | ** |
| 2149 | ** Returns |
| 2150 | ** BTM_SUCCESS Command sent. |
| 2151 | ** BTM_NO_RESOURCES If out of resources to send the command. |
| 2152 | ** |
| 2153 | ** |
| 2154 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2155 | extern tBTM_STATUS BTM_EnableTestMode(void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2156 | |
| 2157 | |
| 2158 | /***************************************************************************** |
| 2159 | ** DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device |
| 2160 | *****************************************************************************/ |
| 2161 | |
| 2162 | /******************************************************************************* |
| 2163 | ** |
| 2164 | ** Function BTM_SetDiscoverability |
| 2165 | ** |
| 2166 | ** Description This function is called to set the device into or out of |
| 2167 | ** discoverable mode. Discoverable mode means inquiry |
| 2168 | ** scans are enabled. If a value of '0' is entered for window or |
| 2169 | ** interval, the default values are used. |
| 2170 | ** |
| 2171 | ** Returns BTM_SUCCESS if successful |
| 2172 | ** BTM_BUSY if a setting of the filter is already in progress |
| 2173 | ** BTM_NO_RESOURCES if couldn't get a memory pool buffer |
| 2174 | ** BTM_ILLEGAL_VALUE if a bad parameter was detected |
| 2175 | ** BTM_WRONG_MODE if the device is not up. |
| 2176 | ** |
| 2177 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2178 | extern tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, |
| 2179 | UINT16 interval); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2180 | |
| 2181 | |
| 2182 | /******************************************************************************* |
| 2183 | ** |
| 2184 | ** Function BTM_ReadDiscoverability |
| 2185 | ** |
| 2186 | ** Description This function is called to read the current discoverability |
| 2187 | ** mode of the device. |
| 2188 | ** |
| 2189 | ** Output Params: p_window - current inquiry scan duration |
| 2190 | ** p_interval - current inquiry scan interval |
| 2191 | ** |
| 2192 | ** Returns BTM_NON_DISCOVERABLE, BTM_LIMITED_DISCOVERABLE, or |
| 2193 | ** BTM_GENERAL_DISCOVERABLE |
| 2194 | ** |
| 2195 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2196 | extern UINT16 BTM_ReadDiscoverability (UINT16 *p_window, |
| 2197 | UINT16 *p_interval); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2198 | |
| 2199 | |
| 2200 | /******************************************************************************* |
| 2201 | ** |
| 2202 | ** Function BTM_SetPeriodicInquiryMode |
| 2203 | ** |
| 2204 | ** Description This function is called to set the device periodic inquiry mode. |
| 2205 | ** If the duration is zero, the periodic inquiry mode is cancelled. |
| 2206 | ** |
| 2207 | ** Parameters: p_inqparms - pointer to the inquiry information |
| 2208 | ** mode - GENERAL or LIMITED inquiry |
| 2209 | ** duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED) |
| 2210 | ** max_resps - maximum amount of devices to search for before ending the inquiry |
| 2211 | ** filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or |
| 2212 | ** BTM_FILTER_COND_BD_ADDR |
| 2213 | ** filter_cond - value for the filter (based on filter_cond_type) |
| 2214 | ** |
| 2215 | ** max_delay - maximum amount of time between successive inquiries |
| 2216 | ** min_delay - minimum amount of time between successive inquiries |
| 2217 | ** p_results_cb - callback returning pointer to results (tBTM_INQ_RESULTS) |
| 2218 | ** |
| 2219 | ** Returns BTM_CMD_STARTED if successfully started |
| 2220 | ** BTM_ILLEGAL_VALUE if a bad parameter is detected |
| 2221 | ** BTM_NO_RESOURCES if could not allocate a message buffer |
| 2222 | ** BTM_SUCCESS - if cancelling the periodic inquiry |
| 2223 | ** BTM_BUSY - if an inquiry is already active |
| 2224 | ** BTM_WRONG_MODE if the device is not up. |
| 2225 | ** |
| 2226 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2227 | extern tBTM_STATUS BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms, |
| 2228 | UINT16 max_delay, UINT16 min_delay, |
| 2229 | tBTM_INQ_RESULTS_CB *p_results_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2230 | |
| 2231 | |
| 2232 | /******************************************************************************* |
| 2233 | ** |
| 2234 | ** Function BTM_StartInquiry |
| 2235 | ** |
| 2236 | ** Description This function is called to start an inquiry. |
| 2237 | ** |
| 2238 | ** Parameters: p_inqparms - pointer to the inquiry information |
| 2239 | ** mode - GENERAL or LIMITED inquiry |
| 2240 | ** duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED) |
| 2241 | ** max_resps - maximum amount of devices to search for before ending the inquiry |
| 2242 | ** filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or |
| 2243 | ** BTM_FILTER_COND_BD_ADDR |
| 2244 | ** filter_cond - value for the filter (based on filter_cond_type) |
| 2245 | ** |
| 2246 | ** p_results_cb - Pointer to the callback routine which gets called |
| 2247 | ** upon receipt of an inquiry result. If this field is |
| 2248 | ** NULL, the application is not notified. |
| 2249 | ** |
| 2250 | ** p_cmpl_cb - Pointer to the callback routine which gets called |
| 2251 | ** upon completion. If this field is NULL, the |
| 2252 | ** application is not notified when completed. |
| 2253 | ** Returns tBTM_STATUS |
| 2254 | ** BTM_CMD_STARTED if successfully initiated |
| 2255 | ** BTM_BUSY if already in progress |
| 2256 | ** BTM_ILLEGAL_VALUE if parameter(s) are out of range |
| 2257 | ** BTM_NO_RESOURCES if could not allocate resources to start the command |
| 2258 | ** BTM_WRONG_MODE if the device is not up. |
| 2259 | ** |
| 2260 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2261 | extern tBTM_STATUS BTM_StartInquiry (tBTM_INQ_PARMS *p_inqparms, |
| 2262 | tBTM_INQ_RESULTS_CB *p_results_cb, |
| 2263 | tBTM_CMPL_CB *p_cmpl_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2264 | |
| 2265 | |
| 2266 | /******************************************************************************* |
| 2267 | ** |
| 2268 | ** Function BTM_IsInquiryActive |
| 2269 | ** |
| 2270 | ** Description This function returns a bit mask of the current inquiry state |
| 2271 | ** |
| 2272 | ** Returns BTM_INQUIRY_INACTIVE if inactive (0) |
| 2273 | ** BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active |
| 2274 | ** BTM_GENERAL_INQUIRY_ACTIVE if a general inquiry is active |
| 2275 | ** BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active |
| 2276 | ** |
| 2277 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2278 | extern UINT16 BTM_IsInquiryActive (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2279 | |
| 2280 | |
| 2281 | /******************************************************************************* |
| 2282 | ** |
| 2283 | ** Function BTM_CancelInquiry |
| 2284 | ** |
| 2285 | ** Description This function cancels an inquiry if active |
| 2286 | ** |
| 2287 | ** Returns BTM_SUCCESS if successful |
| 2288 | ** BTM_NO_RESOURCES if could not allocate a message buffer |
| 2289 | ** BTM_WRONG_MODE if the device is not up. |
| 2290 | ** |
| 2291 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2292 | extern tBTM_STATUS BTM_CancelInquiry(void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2293 | |
| 2294 | |
| 2295 | /******************************************************************************* |
| 2296 | ** |
| 2297 | ** Function BTM_CancelPeriodicInquiry |
| 2298 | ** |
| 2299 | ** Description This function cancels a periodic inquiry |
| 2300 | ** |
| 2301 | ** Returns |
| 2302 | ** BTM_NO_RESOURCES if could not allocate a message buffer |
| 2303 | ** BTM_SUCCESS - if cancelling the periodic inquiry |
| 2304 | ** BTM_WRONG_MODE if the device is not up. |
| 2305 | ** |
| 2306 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2307 | extern tBTM_STATUS BTM_CancelPeriodicInquiry(void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2308 | |
| 2309 | |
| 2310 | /******************************************************************************* |
| 2311 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2312 | ** Function BTM_SetConnectability |
| 2313 | ** |
| 2314 | ** Description This function is called to set the device into or out of |
| 2315 | ** connectable mode. Discoverable mode means page scans enabled. |
| 2316 | ** |
| 2317 | ** Returns BTM_SUCCESS if successful |
| 2318 | ** BTM_ILLEGAL_VALUE if a bad parameter is detected |
| 2319 | ** BTM_NO_RESOURCES if could not allocate a message buffer |
| 2320 | ** BTM_WRONG_MODE if the device is not up. |
| 2321 | ** |
| 2322 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2323 | extern tBTM_STATUS BTM_SetConnectability (UINT16 page_mode, UINT16 window, |
| 2324 | UINT16 interval); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2325 | |
| 2326 | |
| 2327 | /******************************************************************************* |
| 2328 | ** |
| 2329 | ** Function BTM_ReadConnectability |
| 2330 | ** |
| 2331 | ** Description This function is called to read the current discoverability |
| 2332 | ** mode of the device. |
| 2333 | ** Output Params p_window - current page scan duration |
| 2334 | ** p_interval - current time between page scans |
| 2335 | ** |
| 2336 | ** Returns BTM_NON_CONNECTABLE or BTM_CONNECTABLE |
| 2337 | ** |
| 2338 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2339 | extern UINT16 BTM_ReadConnectability (UINT16 *p_window, UINT16 *p_interval); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2340 | |
| 2341 | |
| 2342 | /******************************************************************************* |
| 2343 | ** |
| 2344 | ** Function BTM_SetInquiryMode |
| 2345 | ** |
| 2346 | ** Description This function is called to set standard, with RSSI |
| 2347 | ** mode or extended of the inquiry for local device. |
| 2348 | ** |
| 2349 | ** Input Params: BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or |
| 2350 | ** BTM_INQ_RESULT_EXTENDED |
| 2351 | ** |
| 2352 | ** Returns BTM_SUCCESS if successful |
| 2353 | ** BTM_NO_RESOURCES if couldn't get a memory pool buffer |
| 2354 | ** BTM_ILLEGAL_VALUE if a bad parameter was detected |
| 2355 | ** BTM_WRONG_MODE if the device is not up. |
| 2356 | ** |
| 2357 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2358 | extern tBTM_STATUS BTM_SetInquiryMode (UINT8 mode); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2359 | |
| 2360 | /******************************************************************************* |
| 2361 | ** |
| 2362 | ** Function BTM_SetInquiryScanType |
| 2363 | ** |
| 2364 | ** Description This function is called to set the iquiry scan-type to |
| 2365 | ** standard or interlaced. |
| 2366 | ** |
| 2367 | ** Input Params: BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED |
| 2368 | ** |
| 2369 | ** Returns BTM_SUCCESS if successful |
| 2370 | ** BTM_MODE_UNSUPPORTED if not a 1.2 device |
| 2371 | ** BTM_WRONG_MODE if the device is not up. |
| 2372 | ** |
| 2373 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2374 | extern tBTM_STATUS BTM_SetInquiryScanType (UINT16 scan_type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2375 | |
| 2376 | /******************************************************************************* |
| 2377 | ** |
| 2378 | ** Function BTM_SetPageScanType |
| 2379 | ** |
| 2380 | ** Description This function is called to set the page scan-type to |
| 2381 | ** standard or interlaced. |
| 2382 | ** |
| 2383 | ** Input Params: BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED |
| 2384 | ** |
| 2385 | ** Returns BTM_SUCCESS if successful |
| 2386 | ** BTM_MODE_UNSUPPORTED if not a 1.2 device |
| 2387 | ** BTM_WRONG_MODE if the device is not up. |
| 2388 | ** |
| 2389 | *******************************************************************************/ |
| 2390 | |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2391 | extern tBTM_STATUS BTM_SetPageScanType (UINT16 scan_type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2392 | |
| 2393 | /******************************************************************************* |
| 2394 | ** |
| 2395 | ** Function BTM_ReadRemoteDeviceName |
| 2396 | ** |
| 2397 | ** Description This function initiates a remote device HCI command to the |
| 2398 | ** controller and calls the callback when the process has completed. |
| 2399 | ** |
| 2400 | ** Input Params: remote_bda - device address of name to retrieve |
| 2401 | ** p_cb - callback function called when BTM_CMD_STARTED |
| 2402 | ** is returned. |
| 2403 | ** A pointer to tBTM_REMOTE_DEV_NAME is passed to the |
| 2404 | ** callback. |
| 2405 | ** |
| 2406 | ** Returns |
| 2407 | ** BTM_CMD_STARTED is returned if the request was successfully sent |
| 2408 | ** to HCI. |
| 2409 | ** BTM_BUSY if already in progress |
| 2410 | ** BTM_UNKNOWN_ADDR if device address is bad |
| 2411 | ** BTM_NO_RESOURCES if could not allocate resources to start the command |
| 2412 | ** BTM_WRONG_MODE if the device is not up. |
| 2413 | ** |
| 2414 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2415 | extern tBTM_STATUS BTM_ReadRemoteDeviceName (BD_ADDR remote_bda, |
| 2416 | tBTM_CMPL_CB *p_cb, |
| 2417 | tBT_TRANSPORT transport); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2418 | |
| 2419 | |
| 2420 | /******************************************************************************* |
| 2421 | ** |
| 2422 | ** Function BTM_CancelRemoteDeviceName |
| 2423 | ** |
| 2424 | ** Description This function initiates the cancel request for the specified |
| 2425 | ** remote device. |
| 2426 | ** |
| 2427 | ** Input Params: None |
| 2428 | ** |
| 2429 | ** Returns |
| 2430 | ** BTM_CMD_STARTED is returned if the request was successfully sent |
| 2431 | ** to HCI. |
| 2432 | ** BTM_NO_RESOURCES if could not allocate resources to start the command |
| 2433 | ** BTM_WRONG_MODE if there is not an active remote name request. |
| 2434 | ** |
| 2435 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2436 | extern tBTM_STATUS BTM_CancelRemoteDeviceName (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2437 | |
| 2438 | /******************************************************************************* |
| 2439 | ** |
| 2440 | ** Function BTM_ReadRemoteVersion |
| 2441 | ** |
| 2442 | ** Description This function is called to read a remote device's version |
| 2443 | ** |
| 2444 | ** Returns BTM_SUCCESS if successful, otherwise an error |
| 2445 | ** |
| 2446 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2447 | extern tBTM_STATUS BTM_ReadRemoteVersion (BD_ADDR addr, |
| 2448 | UINT8 *lmp_version, |
| 2449 | UINT16 *manufacturer, |
| 2450 | UINT16 *lmp_sub_version); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2451 | |
| 2452 | /******************************************************************************* |
| 2453 | ** |
| 2454 | ** Function BTM_ReadRemoteFeatures |
| 2455 | ** |
Ganesh Ganapathi Batta | 9d140a9 | 2013-04-11 16:13:14 -0700 | [diff] [blame] | 2456 | ** Description This function is called to read a remote device's |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 2457 | ** supported features mask (features mask located at page 0) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2458 | ** |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 2459 | ** Note: The size of device features mask page is |
| 2460 | ** BTM_FEATURE_BYTES_PER_PAGE bytes. |
| 2461 | ** |
| 2462 | ** Returns pointer to the remote supported features mask |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2463 | ** |
| 2464 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2465 | extern UINT8 *BTM_ReadRemoteFeatures (BD_ADDR addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2466 | |
| 2467 | /******************************************************************************* |
| 2468 | ** |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 2469 | ** Function BTM_ReadRemoteExtendedFeatures |
| 2470 | ** |
| 2471 | ** Description This function is called to read a specific extended features |
| 2472 | ** page of the remote device |
| 2473 | ** |
| 2474 | ** Note1: The size of device features mask page is |
| 2475 | ** BTM_FEATURE_BYTES_PER_PAGE bytes. |
| 2476 | ** Note2: The valid device features mask page number depends on |
| 2477 | ** the remote device capabilities. It is expected to be in the |
| 2478 | ** range [0 - BTM_EXT_FEATURES_PAGE_MAX]. |
| 2479 | |
| 2480 | ** Returns pointer to the remote extended features mask |
| 2481 | ** or NULL if page_number is not valid |
| 2482 | ** |
| 2483 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2484 | extern UINT8 *BTM_ReadRemoteExtendedFeatures (BD_ADDR addr, UINT8 page_number); |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 2485 | |
| 2486 | /******************************************************************************* |
| 2487 | ** |
| 2488 | ** Function BTM_ReadNumberRemoteFeaturesPages |
| 2489 | ** |
| 2490 | ** Description This function is called to retrieve the number of feature pages |
| 2491 | ** read from the remote device |
| 2492 | ** |
| 2493 | ** Returns number of features pages read from the remote device |
| 2494 | ** |
| 2495 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2496 | extern UINT8 BTM_ReadNumberRemoteFeaturesPages (BD_ADDR addr); |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 2497 | |
| 2498 | /******************************************************************************* |
| 2499 | ** |
| 2500 | ** Function BTM_ReadAllRemoteFeatures |
| 2501 | ** |
| 2502 | ** Description This function is called to read all features of the remote device |
| 2503 | ** |
| 2504 | ** Returns pointer to the byte[0] of the page[0] of the remote device |
| 2505 | ** feature mask. |
| 2506 | ** |
| 2507 | ** Note: the function returns the pointer to the array of the size |
| 2508 | ** BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1). |
| 2509 | ** |
| 2510 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2511 | extern UINT8 *BTM_ReadAllRemoteFeatures (BD_ADDR addr); |
Andre Eisenbach | 3aa6054 | 2013-03-22 18:00:51 -0700 | [diff] [blame] | 2512 | |
| 2513 | /******************************************************************************* |
| 2514 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2515 | ** Function BTM_InqDbRead |
| 2516 | ** |
| 2517 | ** Description This function looks through the inquiry database for a match |
| 2518 | ** based on Bluetooth Device Address. This is the application's |
| 2519 | ** interface to get the inquiry details of a specific BD address. |
| 2520 | ** |
| 2521 | ** Returns pointer to entry, or NULL if not found |
| 2522 | ** |
| 2523 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2524 | extern tBTM_INQ_INFO *BTM_InqDbRead (BD_ADDR p_bda); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2525 | |
| 2526 | |
| 2527 | /******************************************************************************* |
| 2528 | ** |
| 2529 | ** Function BTM_InqDbFirst |
| 2530 | ** |
| 2531 | ** Description This function looks through the inquiry database for the first |
| 2532 | ** used entry, and returns that. This is used in conjunction with |
| 2533 | ** BTM_InqDbNext by applications as a way to walk through the |
| 2534 | ** inquiry database. |
| 2535 | ** |
| 2536 | ** Returns pointer to first in-use entry, or NULL if DB is empty |
| 2537 | ** |
| 2538 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2539 | extern tBTM_INQ_INFO *BTM_InqDbFirst (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2540 | |
| 2541 | |
| 2542 | /******************************************************************************* |
| 2543 | ** |
| 2544 | ** Function BTM_InqDbNext |
| 2545 | ** |
| 2546 | ** Description This function looks through the inquiry database for the next |
| 2547 | ** used entry, and returns that. If the input parameter is NULL, |
| 2548 | ** the first entry is returned. |
| 2549 | ** |
| 2550 | ** Returns pointer to next in-use entry, or NULL if no more found. |
| 2551 | ** |
| 2552 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2553 | extern tBTM_INQ_INFO *BTM_InqDbNext (tBTM_INQ_INFO *p_cur); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2554 | |
| 2555 | |
| 2556 | /******************************************************************************* |
| 2557 | ** |
| 2558 | ** Function BTM_ClearInqDb |
| 2559 | ** |
| 2560 | ** Description This function is called to clear out a device or all devices |
| 2561 | ** from the inquiry database. |
| 2562 | ** |
| 2563 | ** Parameter p_bda - (input) BD_ADDR -> Address of device to clear |
| 2564 | ** (NULL clears all entries) |
| 2565 | ** |
| 2566 | ** Returns BTM_BUSY if an inquiry, get remote name, or event filter |
| 2567 | ** is active, otherwise BTM_SUCCESS |
| 2568 | ** |
| 2569 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2570 | extern tBTM_STATUS BTM_ClearInqDb (BD_ADDR p_bda); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2571 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2572 | /******************************************************************************* |
| 2573 | ** |
| 2574 | ** Function BTM_ReadInquiryRspTxPower |
| 2575 | ** |
| 2576 | ** Description This command will read the inquiry Transmit Power level used |
| 2577 | ** to transmit the FHS and EIR data packets. |
| 2578 | ** This can be used directly in the Tx Power Level EIR data type. |
| 2579 | ** |
| 2580 | ** Returns BTM_SUCCESS if successful |
| 2581 | ** |
| 2582 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2583 | extern tBTM_STATUS BTM_ReadInquiryRspTxPower (tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2584 | |
| 2585 | /******************************************************************************* |
| 2586 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2587 | ** Function BTM_StartDiscovery |
| 2588 | ** |
| 2589 | ** Description This function is called by an application (or profile) |
| 2590 | ** when it wants to trigger an service discovery using the |
| 2591 | ** BTM's discovery database. |
| 2592 | ** |
| 2593 | ** Returns tBTM_STATUS |
| 2594 | ** BTM_CMD_STARTED if the discovery was initiated |
| 2595 | ** BTM_BUSY if one is already in progress |
| 2596 | ** BTM_UNKNOWN_ADDR if no addresses are in the INQ DB |
| 2597 | ** BTM_ERR_PROCESSING if err initiating the command |
| 2598 | ** |
| 2599 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2600 | extern tBTM_STATUS BTM_StartDiscovery (tBTM_CMPL_CB *p_cmpl_cb, |
| 2601 | BD_ADDR_PTR p_rem_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2602 | |
| 2603 | |
| 2604 | /******************************************************************************* |
| 2605 | ** |
| 2606 | ** Function BTM_FindAttribute |
| 2607 | ** |
| 2608 | ** Description This function is called by an application (or profile) |
| 2609 | ** when it wants to see if an attribute exists in the BTM |
| 2610 | ** discovery database. |
| 2611 | ** |
| 2612 | ** Returns Pointer to matching record, or NULL |
| 2613 | ** |
| 2614 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2615 | extern tSDP_DISC_REC *BTM_FindAttribute (UINT16 attr_id, |
| 2616 | tSDP_DISC_REC *p_start_rec); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2617 | |
| 2618 | |
| 2619 | /******************************************************************************* |
| 2620 | ** |
| 2621 | ** Function BTM_FindService |
| 2622 | ** |
| 2623 | ** Description This function is called by an application (or profile) |
| 2624 | ** when it wants to see if a service exists in the BTM |
| 2625 | ** discovery database. |
| 2626 | ** |
| 2627 | ** Returns Pointer to matching record, or NULL |
| 2628 | ** |
| 2629 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2630 | extern tSDP_DISC_REC *BTM_FindService (UINT16 service_uuid, |
| 2631 | tSDP_DISC_REC *p_start_rec); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2632 | |
| 2633 | |
| 2634 | /******************************************************************************* |
| 2635 | ** |
| 2636 | ** Function BTM_SetDiscoveryParams |
| 2637 | ** |
| 2638 | ** Description This function is called to set the BTM default discovery parameters. |
| 2639 | ** These UUID and attribute filters are used during the call to |
| 2640 | ** BTM_StartDiscovery. |
| 2641 | ** |
| 2642 | ** Returns void |
| 2643 | ** |
| 2644 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2645 | extern void BTM_SetDiscoveryParams (UINT16 num_uuid, tSDP_UUID *p_uuid_list, |
| 2646 | UINT16 num_attr, UINT16 *p_attr_list); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2647 | |
| 2648 | |
| 2649 | /***************************************************************************** |
| 2650 | ** ACL CHANNEL MANAGEMENT FUNCTIONS |
| 2651 | *****************************************************************************/ |
| 2652 | /******************************************************************************* |
| 2653 | ** |
| 2654 | ** Function BTM_SetLinkPolicy |
| 2655 | ** |
| 2656 | ** Description Create and send HCI "Write Policy Set" command |
| 2657 | ** |
| 2658 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 2659 | ** |
| 2660 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2661 | extern tBTM_STATUS BTM_SetLinkPolicy (BD_ADDR remote_bda, |
| 2662 | UINT16 *settings); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2663 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2664 | /******************************************************************************* |
| 2665 | ** |
| 2666 | ** Function BTM_SetDefaultLinkPolicy |
| 2667 | ** |
| 2668 | ** Description Set the default value for HCI "Write Policy Set" command |
| 2669 | ** to use when an ACL link is created. |
| 2670 | ** |
| 2671 | ** Returns void |
| 2672 | ** |
| 2673 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2674 | extern void BTM_SetDefaultLinkPolicy (UINT16 settings); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2675 | |
| 2676 | |
| 2677 | /******************************************************************************* |
| 2678 | ** |
| 2679 | ** Function BTM_SetDefaultLinkSuperTout |
| 2680 | ** |
| 2681 | ** Description Set the default value for HCI "Write Link Supervision Timeout" |
| 2682 | ** command to use when an ACL link is created. |
| 2683 | ** |
| 2684 | ** Returns void |
| 2685 | ** |
| 2686 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2687 | extern void BTM_SetDefaultLinkSuperTout (UINT16 timeout); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2688 | |
| 2689 | |
| 2690 | /******************************************************************************* |
| 2691 | ** |
| 2692 | ** Function BTM_SetLinkSuperTout |
| 2693 | ** |
| 2694 | ** Description Create and send HCI "Write Link Supervision Timeout" command |
| 2695 | ** |
| 2696 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 2697 | ** |
| 2698 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2699 | extern tBTM_STATUS BTM_SetLinkSuperTout (BD_ADDR remote_bda, |
| 2700 | UINT16 timeout); |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 2701 | /******************************************************************************* |
| 2702 | ** |
| 2703 | ** Function BTM_GetLinkSuperTout |
| 2704 | ** |
| 2705 | ** Description Read the link supervision timeout value of the connection |
| 2706 | ** |
| 2707 | ** Returns status of the operation |
| 2708 | ** |
| 2709 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2710 | extern tBTM_STATUS BTM_GetLinkSuperTout (BD_ADDR remote_bda, |
| 2711 | UINT16 *p_timeout); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2712 | |
| 2713 | /******************************************************************************* |
| 2714 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2715 | ** Function BTM_IsAclConnectionUp |
| 2716 | ** |
| 2717 | ** Description This function is called to check if an ACL connection exists |
| 2718 | ** to a specific remote BD Address. |
| 2719 | ** |
| 2720 | ** Returns TRUE if connection is up, else FALSE. |
| 2721 | ** |
| 2722 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2723 | extern BOOLEAN BTM_IsAclConnectionUp (BD_ADDR remote_bda, tBT_TRANSPORT transport); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2724 | |
| 2725 | |
| 2726 | /******************************************************************************* |
| 2727 | ** |
| 2728 | ** Function BTM_GetRole |
| 2729 | ** |
| 2730 | ** Description This function is called to get the role of the local device |
| 2731 | ** for the ACL connection with the specified remote device |
| 2732 | ** |
| 2733 | ** Returns BTM_SUCCESS if connection exists. |
| 2734 | ** BTM_UNKNOWN_ADDR if no active link with bd addr specified |
| 2735 | ** |
| 2736 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2737 | extern tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, UINT8 *p_role); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2738 | |
| 2739 | |
| 2740 | |
| 2741 | /******************************************************************************* |
| 2742 | ** |
| 2743 | ** Function BTM_SwitchRole |
| 2744 | ** |
| 2745 | ** Description This function is called to switch role between master and |
| 2746 | ** slave. If role is already set it will do nothing. If the |
| 2747 | ** command was initiated, the callback function is called upon |
| 2748 | ** completion. |
| 2749 | ** |
| 2750 | ** Returns BTM_SUCCESS if already in specified role. |
| 2751 | ** BTM_CMD_STARTED if command issued to controller. |
| 2752 | ** BTM_NO_RESOURCES if couldn't allocate memory to issue command |
| 2753 | ** BTM_UNKNOWN_ADDR if no active link with bd addr specified |
| 2754 | ** BTM_MODE_UNSUPPORTED if local device does not support role switching |
| 2755 | ** |
| 2756 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2757 | extern tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr, |
| 2758 | UINT8 new_role, |
| 2759 | tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2760 | |
| 2761 | /******************************************************************************* |
| 2762 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2763 | ** Function BTM_ReadRSSI |
| 2764 | ** |
| 2765 | ** Description This function is called to read the link policy settings. |
| 2766 | ** The address of link policy results are returned in the callback. |
| 2767 | ** (tBTM_RSSI_RESULTS) |
| 2768 | ** |
| 2769 | ** Returns BTM_CMD_STARTED if command issued to controller. |
| 2770 | ** BTM_NO_RESOURCES if couldn't allocate memory to issue command |
| 2771 | ** BTM_UNKNOWN_ADDR if no active link with bd addr specified |
| 2772 | ** BTM_BUSY if command is already in progress |
| 2773 | ** |
| 2774 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2775 | extern tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2776 | |
| 2777 | |
| 2778 | /******************************************************************************* |
| 2779 | ** |
| 2780 | ** Function BTM_ReadTxPower |
| 2781 | ** |
| 2782 | ** Description This function is called to read the current connection |
| 2783 | ** TX power of the connection. The TX power level results |
| 2784 | ** are returned in the callback. |
| 2785 | ** (tBTM_RSSI_RESULTS) |
| 2786 | ** |
| 2787 | ** Returns BTM_CMD_STARTED if command issued to controller. |
| 2788 | ** BTM_NO_RESOURCES if couldn't allocate memory to issue command |
| 2789 | ** BTM_UNKNOWN_ADDR if no active link with bd addr specified |
| 2790 | ** BTM_BUSY if command is already in progress |
| 2791 | ** |
| 2792 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2793 | extern tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, |
| 2794 | tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2795 | |
| 2796 | /******************************************************************************* |
| 2797 | ** |
| 2798 | ** Function BTM_ReadLinkQuality |
| 2799 | ** |
| 2800 | ** Description This function is called to read the link quality. |
| 2801 | ** The value of the link quality is returned in the callback. |
| 2802 | ** (tBTM_LINK_QUALITY_RESULTS) |
| 2803 | ** |
| 2804 | ** Returns BTM_CMD_STARTED if command issued to controller. |
| 2805 | ** BTM_NO_RESOURCES if couldn't allocate memory to issue command |
| 2806 | ** BTM_UNKNOWN_ADDR if no active link with bd addr specified |
| 2807 | ** BTM_BUSY if command is already in progress |
| 2808 | ** |
| 2809 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2810 | extern tBTM_STATUS BTM_ReadLinkQuality (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2811 | |
| 2812 | /******************************************************************************* |
| 2813 | ** |
| 2814 | ** Function BTM_RegBusyLevelNotif |
| 2815 | ** |
| 2816 | ** Description This function is called to register a callback to receive |
| 2817 | ** busy level change events. |
| 2818 | ** |
| 2819 | ** Returns BTM_SUCCESS if successfully registered, otherwise error |
| 2820 | ** |
| 2821 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2822 | extern tBTM_STATUS BTM_RegBusyLevelNotif (tBTM_BL_CHANGE_CB *p_cb, UINT8 *p_level, |
| 2823 | tBTM_BL_EVENT_MASK evt_mask); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2824 | |
| 2825 | /******************************************************************************* |
| 2826 | ** |
| 2827 | ** Function BTM_AclRegisterForChanges |
| 2828 | ** |
| 2829 | ** Description This function is called to register a callback to receive |
| 2830 | ** ACL database change events, i.e. new connection or removed. |
| 2831 | ** |
| 2832 | ** Returns BTM_SUCCESS if successfully initiated, otherwise error |
| 2833 | ** |
| 2834 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2835 | extern tBTM_STATUS BTM_AclRegisterForChanges (tBTM_ACL_DB_CHANGE_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2836 | |
| 2837 | /******************************************************************************* |
| 2838 | ** |
| 2839 | ** Function BTM_GetNumAclLinks |
| 2840 | ** |
| 2841 | ** Description This function is called to count the number of |
| 2842 | ** ACL links that are active. |
| 2843 | ** |
| 2844 | ** Returns UINT16 Number of active ACL links |
| 2845 | ** |
| 2846 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2847 | extern UINT16 BTM_GetNumAclLinks (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2848 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2849 | /******************************************************************************* |
| 2850 | ** |
| 2851 | ** Function BTM_SetQoS |
| 2852 | ** |
| 2853 | ** Description This function is called to setup QoS |
| 2854 | ** |
| 2855 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 2856 | ** |
| 2857 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2858 | extern tBTM_STATUS BTM_SetQoS(BD_ADDR bd, FLOW_SPEC *p_flow, |
| 2859 | tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2860 | |
| 2861 | |
| 2862 | /***************************************************************************** |
| 2863 | ** (e)SCO CHANNEL MANAGEMENT FUNCTIONS |
| 2864 | *****************************************************************************/ |
| 2865 | /******************************************************************************* |
| 2866 | ** |
| 2867 | ** Function BTM_CreateSco |
| 2868 | ** |
| 2869 | ** Description This function is called to create an SCO connection. If the |
| 2870 | ** "is_orig" flag is TRUE, the connection will be originated, |
| 2871 | ** otherwise BTM will wait for the other side to connect. |
| 2872 | ** |
| 2873 | ** Returns BTM_UNKNOWN_ADDR if the ACL connection is not up |
| 2874 | ** BTM_BUSY if another SCO being set up to |
| 2875 | ** the same BD address |
| 2876 | ** BTM_NO_RESOURCES if the max SCO limit has been reached |
| 2877 | ** BTM_CMD_STARTED if the connection establishment is started. |
| 2878 | ** In this case, "*p_sco_inx" is filled in |
| 2879 | ** with the sco index used for the connection. |
| 2880 | ** |
| 2881 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2882 | extern tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig, |
| 2883 | UINT16 pkt_types, UINT16 *p_sco_inx, |
| 2884 | tBTM_SCO_CB *p_conn_cb, |
| 2885 | tBTM_SCO_CB *p_disc_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2886 | |
| 2887 | |
| 2888 | /******************************************************************************* |
| 2889 | ** |
| 2890 | ** Function BTM_RemoveSco |
| 2891 | ** |
| 2892 | ** Description This function is called to remove a specific SCO connection. |
| 2893 | ** |
| 2894 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 2895 | ** |
| 2896 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2897 | extern tBTM_STATUS BTM_RemoveSco (UINT16 sco_inx); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2898 | |
| 2899 | |
| 2900 | /******************************************************************************* |
| 2901 | ** |
| 2902 | ** Function BTM_SetScoPacketTypes |
| 2903 | ** |
| 2904 | ** Description This function is called to set the packet types used for |
| 2905 | ** a specific SCO connection, |
| 2906 | ** |
| 2907 | ** Parameters pkt_types - One or more of the following |
| 2908 | ** BTM_SCO_PKT_TYPES_MASK_HV1 |
| 2909 | ** BTM_SCO_PKT_TYPES_MASK_HV2 |
| 2910 | ** BTM_SCO_PKT_TYPES_MASK_HV3 |
| 2911 | ** BTM_SCO_PKT_TYPES_MASK_EV3 |
| 2912 | ** BTM_SCO_PKT_TYPES_MASK_EV4 |
| 2913 | ** BTM_SCO_PKT_TYPES_MASK_EV5 |
| 2914 | ** |
| 2915 | ** BTM_SCO_LINK_ALL_MASK - enables all supported types |
| 2916 | ** |
| 2917 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 2918 | ** |
| 2919 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2920 | extern tBTM_STATUS BTM_SetScoPacketTypes (UINT16 sco_inx, UINT16 pkt_types); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2921 | |
| 2922 | |
| 2923 | /******************************************************************************* |
| 2924 | ** |
| 2925 | ** Function BTM_ReadScoPacketTypes |
| 2926 | ** |
| 2927 | ** Description This function is read the packet types used for a specific |
| 2928 | ** SCO connection. |
| 2929 | ** |
| 2930 | ** Returns One or more of the following (bitmask) |
| 2931 | ** BTM_SCO_PKT_TYPES_MASK_HV1 |
| 2932 | ** BTM_SCO_PKT_TYPES_MASK_HV2 |
| 2933 | ** BTM_SCO_PKT_TYPES_MASK_HV3 |
| 2934 | ** BTM_SCO_PKT_TYPES_MASK_EV3 |
| 2935 | ** BTM_SCO_PKT_TYPES_MASK_EV4 |
| 2936 | ** BTM_SCO_PKT_TYPES_MASK_EV5 |
| 2937 | ** |
| 2938 | ** Returns packet types supported for the connection |
| 2939 | ** |
| 2940 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2941 | extern UINT16 BTM_ReadScoPacketTypes (UINT16 sco_inx); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2942 | |
| 2943 | |
| 2944 | /******************************************************************************* |
| 2945 | ** |
| 2946 | ** Function BTM_ReadDeviceScoPacketTypes |
| 2947 | ** |
| 2948 | ** Description This function is read the SCO packet types that |
| 2949 | ** the device supports. |
| 2950 | ** |
| 2951 | ** Returns packet types supported by the device. |
| 2952 | ** |
| 2953 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2954 | extern UINT16 BTM_ReadDeviceScoPacketTypes (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2955 | |
| 2956 | |
| 2957 | /******************************************************************************* |
| 2958 | ** |
| 2959 | ** Function BTM_ReadScoHandle |
| 2960 | ** |
| 2961 | ** Description This function is used to read the HCI handle used for a specific |
| 2962 | ** SCO connection, |
| 2963 | ** |
| 2964 | ** Returns handle for the connection, or 0xFFFF if invalid SCO index. |
| 2965 | ** |
| 2966 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2967 | extern UINT16 BTM_ReadScoHandle (UINT16 sco_inx); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2968 | |
| 2969 | |
| 2970 | /******************************************************************************* |
| 2971 | ** |
| 2972 | ** Function BTM_ReadScoBdAddr |
| 2973 | ** |
| 2974 | ** Description This function is read the remote BD Address for a specific |
| 2975 | ** SCO connection, |
| 2976 | ** |
| 2977 | ** Returns pointer to BD address or NULL if not known |
| 2978 | ** |
| 2979 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2980 | extern UINT8 *BTM_ReadScoBdAddr (UINT16 sco_inx); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2981 | |
| 2982 | |
| 2983 | /******************************************************************************* |
| 2984 | ** |
| 2985 | ** Function BTM_ReadScoDiscReason |
| 2986 | ** |
| 2987 | ** Description This function is returns the reason why an (e)SCO connection |
| 2988 | ** has been removed. It contains the value until read, or until |
| 2989 | ** another (e)SCO connection has disconnected. |
| 2990 | ** |
| 2991 | ** Returns HCI reason or BTM_INVALID_SCO_DISC_REASON if not set. |
| 2992 | ** |
| 2993 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 2994 | extern UINT16 BTM_ReadScoDiscReason (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 2995 | |
| 2996 | |
| 2997 | /******************************************************************************* |
| 2998 | ** |
| 2999 | ** Function BTM_SetEScoMode |
| 3000 | ** |
| 3001 | ** Description This function sets up the negotiated parameters for SCO or |
| 3002 | ** eSCO, and sets as the default mode used for calls to |
| 3003 | ** BTM_CreateSco. It can be called only when there are no |
| 3004 | ** active (e)SCO links. |
| 3005 | ** |
| 3006 | ** Returns BTM_SUCCESS if the successful. |
| 3007 | ** BTM_BUSY if there are one or more active (e)SCO links. |
| 3008 | ** |
| 3009 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3010 | extern tBTM_STATUS BTM_SetEScoMode (tBTM_SCO_TYPE sco_mode, |
| 3011 | tBTM_ESCO_PARAMS *p_parms); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3012 | |
| 3013 | /******************************************************************************* |
| 3014 | ** |
| 3015 | ** Function BTM_SetWBSCodec |
| 3016 | ** |
| 3017 | ** Description This function sends command to the controller to setup |
| 3018 | ** WBS codec for the upcoming eSCO connection. |
| 3019 | ** |
| 3020 | ** Returns BTM_SUCCESS. |
| 3021 | ** |
| 3022 | ** |
| 3023 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3024 | extern tBTM_STATUS BTM_SetWBSCodec (tBTM_SCO_CODEC_TYPE codec_type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3025 | |
| 3026 | /******************************************************************************* |
| 3027 | ** |
| 3028 | ** Function BTM_RegForEScoEvts |
| 3029 | ** |
| 3030 | ** Description This function registers a SCO event callback with the |
| 3031 | ** specified instance. It should be used to received |
| 3032 | ** connection indication events and change of link parameter |
| 3033 | ** events. |
| 3034 | ** |
| 3035 | ** Returns BTM_SUCCESS if the successful. |
| 3036 | ** BTM_ILLEGAL_VALUE if there is an illegal sco_inx |
| 3037 | ** |
| 3038 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3039 | extern tBTM_STATUS BTM_RegForEScoEvts (UINT16 sco_inx, |
| 3040 | tBTM_ESCO_CBACK *p_esco_cback); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3041 | |
| 3042 | /******************************************************************************* |
| 3043 | ** |
| 3044 | ** Function BTM_ReadEScoLinkParms |
| 3045 | ** |
| 3046 | ** Description This function returns the current eSCO link parameters for |
| 3047 | ** the specified handle. This can be called anytime a connection |
| 3048 | ** is active, but is typically called after receiving the SCO |
| 3049 | ** opened callback. |
| 3050 | ** |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 3051 | ** Note: If called over a 1.1 controller, only the packet types |
| 3052 | ** field has meaning. |
| 3053 | ** Note: If the upper layer doesn't know the current sco index, |
| 3054 | ** BTM_FIRST_ACTIVE_SCO_INDEX can be used as the first parameter to |
| 3055 | ** find the first active SCO index |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3056 | ** |
| 3057 | ** Returns BTM_SUCCESS if returned data is valid connection. |
| 3058 | ** BTM_ILLEGAL_VALUE if no connection for specified sco_inx. |
| 3059 | ** BTM_MODE_UNSUPPORTED if local controller does not support |
| 3060 | ** 1.2 specification. |
| 3061 | ** |
| 3062 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3063 | extern tBTM_STATUS BTM_ReadEScoLinkParms (UINT16 sco_inx, |
| 3064 | tBTM_ESCO_DATA *p_parms); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3065 | |
| 3066 | /******************************************************************************* |
| 3067 | ** |
| 3068 | ** Function BTM_ChangeEScoLinkParms |
| 3069 | ** |
| 3070 | ** Description This function requests renegotiation of the parameters on |
| 3071 | ** the current eSCO Link. If any of the changes are accepted |
| 3072 | ** by the controllers, the BTM_ESCO_CHG_EVT event is sent in |
| 3073 | ** the tBTM_ESCO_CBACK function with the current settings of |
| 3074 | ** the link. The callback is registered through the call to |
| 3075 | ** BTM_SetEScoMode. |
| 3076 | ** |
| 3077 | ** |
| 3078 | ** Returns BTM_CMD_STARTED if command is successfully initiated. |
| 3079 | ** BTM_ILLEGAL_VALUE if no connection for specified sco_inx. |
| 3080 | ** BTM_NO_RESOURCES - not enough resources to initiate command. |
| 3081 | ** BTM_MODE_UNSUPPORTED if local controller does not support |
| 3082 | ** 1.2 specification. |
| 3083 | ** |
| 3084 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3085 | extern tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx, |
| 3086 | tBTM_CHG_ESCO_PARAMS *p_parms); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3087 | |
| 3088 | /******************************************************************************* |
| 3089 | ** |
| 3090 | ** Function BTM_EScoConnRsp |
| 3091 | ** |
| 3092 | ** Description This function is called upon receipt of an (e)SCO connection |
| 3093 | ** request event (BTM_ESCO_CONN_REQ_EVT) to accept or reject |
| 3094 | ** the request. Parameters used to negotiate eSCO links. |
| 3095 | ** If p_parms is NULL, then values set through BTM_SetEScoMode |
| 3096 | ** are used. |
| 3097 | ** If the link type of the incoming request is SCO, then only |
| 3098 | ** the tx_bw, max_latency, content format, and packet_types are |
| 3099 | ** valid. The hci_status parameter should be |
| 3100 | ** ([0x0] to accept, [0x0d..0x0f] to reject) |
| 3101 | ** |
| 3102 | ** |
| 3103 | ** Returns void |
| 3104 | ** |
| 3105 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3106 | extern void BTM_EScoConnRsp (UINT16 sco_inx, UINT8 hci_status, |
| 3107 | tBTM_ESCO_PARAMS *p_parms); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3108 | |
| 3109 | /******************************************************************************* |
| 3110 | ** |
| 3111 | ** Function BTM_GetNumScoLinks |
| 3112 | ** |
| 3113 | ** Description This function returns the number of active SCO links. |
| 3114 | ** |
| 3115 | ** Returns UINT8 |
| 3116 | ** |
| 3117 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3118 | extern UINT8 BTM_GetNumScoLinks (void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3119 | |
| 3120 | /***************************************************************************** |
| 3121 | ** SECURITY MANAGEMENT FUNCTIONS |
| 3122 | *****************************************************************************/ |
| 3123 | /******************************************************************************* |
| 3124 | ** |
| 3125 | ** Function BTM_SecRegister |
| 3126 | ** |
| 3127 | ** Description Application manager calls this function to register for |
| 3128 | ** security services. There can be one and only one application |
| 3129 | ** saving link keys. BTM allows only first registration. |
| 3130 | ** |
| 3131 | ** Returns TRUE if registered OK, else FALSE |
| 3132 | ** |
| 3133 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3134 | extern BOOLEAN BTM_SecRegister (tBTM_APPL_INFO *p_cb_info); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3135 | |
Satya Calloji | 877123f | 2015-04-23 23:39:49 -0700 | [diff] [blame] | 3136 | /******************************************************************************* |
| 3137 | ** |
| 3138 | ** Function BTM_SecRegisterLinkKeyNotificationCallback |
| 3139 | ** |
| 3140 | ** Description Profiles can register to be notified when a new Link Key |
| 3141 | ** is generated per connection. |
| 3142 | ** |
| 3143 | ** Returns TRUE if registered OK, else FALSE |
| 3144 | ** |
| 3145 | *******************************************************************************/ |
| 3146 | extern BOOLEAN BTM_SecRegisterLinkKeyNotificationCallback( |
| 3147 | tBTM_LINK_KEY_CALLBACK *p_callback); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3148 | |
| 3149 | /******************************************************************************* |
| 3150 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3151 | ** Function BTM_SecAddRmtNameNotifyCallback |
| 3152 | ** |
| 3153 | ** Description Profiles can register to be notified when name of the |
| 3154 | ** remote device is resolved (up to BTM_SEC_MAX_RMT_NAME_CALLBACKS). |
| 3155 | ** |
| 3156 | ** Returns TRUE if registered OK, else FALSE |
| 3157 | ** |
| 3158 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3159 | extern BOOLEAN BTM_SecAddRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3160 | |
| 3161 | |
| 3162 | /******************************************************************************* |
| 3163 | ** |
| 3164 | ** Function BTM_SecDeleteRmtNameNotifyCallback |
| 3165 | ** |
| 3166 | ** Description A profile can deregister notification when a new Link Key |
| 3167 | ** is generated per connection. |
| 3168 | ** |
| 3169 | ** Returns TRUE if OK, else FALSE |
| 3170 | ** |
| 3171 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3172 | extern BOOLEAN BTM_SecDeleteRmtNameNotifyCallback (tBTM_RMT_NAME_CALLBACK *p_callback); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3173 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3174 | /******************************************************************************* |
| 3175 | ** |
| 3176 | ** Function BTM_GetSecurityFlags |
| 3177 | ** |
| 3178 | ** Description Get security flags for the device |
| 3179 | ** |
| 3180 | ** Returns BOOLEAN TRUE or FALSE is device found |
| 3181 | ** |
| 3182 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3183 | extern BOOLEAN BTM_GetSecurityFlags (BD_ADDR bd_addr, UINT8 * p_sec_flags); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3184 | |
| 3185 | /******************************************************************************* |
| 3186 | ** |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 3187 | ** Function BTM_GetSecurityFlagsByTransport |
| 3188 | ** |
| 3189 | ** Description Get security flags for the device on a particular transport |
| 3190 | ** |
| 3191 | ** Parameters bd_addr: BD address of remote device |
| 3192 | ** p_sec_flags : Out parameter to be filled with security flags for the connection |
| 3193 | ** transport : Physical transport of the connection (BR/EDR or LE) |
| 3194 | ** |
| 3195 | ** Returns BOOLEAN TRUE or FALSE is device found |
| 3196 | ** |
| 3197 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3198 | extern BOOLEAN BTM_GetSecurityFlagsByTransport (BD_ADDR bd_addr, |
| 3199 | UINT8 * p_sec_flags, tBT_TRANSPORT transport); |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 3200 | |
| 3201 | /******************************************************************************* |
| 3202 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3203 | ** Function BTM_ReadTrustedMask |
| 3204 | ** |
| 3205 | ** Description Get trusted mask for the device |
| 3206 | ** |
| 3207 | ** Returns NULL, if the device record is not found. |
| 3208 | ** otherwise, the trusted mask |
| 3209 | ** |
| 3210 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3211 | extern UINT32 * BTM_ReadTrustedMask (BD_ADDR bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3212 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3213 | /******************************************************************************* |
| 3214 | ** |
| 3215 | ** Function BTM_SetPinType |
| 3216 | ** |
| 3217 | ** Description Set PIN type for the device. |
| 3218 | ** |
| 3219 | ** Returns void |
| 3220 | ** |
| 3221 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3222 | extern void BTM_SetPinType (UINT8 pin_type, PIN_CODE pin_code, UINT8 pin_code_len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3223 | |
| 3224 | |
| 3225 | /******************************************************************************* |
| 3226 | ** |
| 3227 | ** Function BTM_SetPairableMode |
| 3228 | ** |
| 3229 | ** Description Enable or disable pairing |
| 3230 | ** |
| 3231 | ** Parameters allow_pairing - (TRUE or FALSE) whether or not the device |
| 3232 | ** allows pairing. |
| 3233 | ** connect_only_paired - (TRUE or FALSE) whether or not to |
| 3234 | ** only allow paired devices to connect. |
| 3235 | ** |
| 3236 | ** Returns void |
| 3237 | ** |
| 3238 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3239 | extern void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3240 | |
| 3241 | /******************************************************************************* |
| 3242 | ** |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 3243 | ** Function BTM_SetSecureConnectionsOnly |
| 3244 | ** |
| 3245 | ** Description Enable or disable default treatment for Mode 4 Level 0 services |
| 3246 | ** |
| 3247 | ** Parameter secure_connections_only_mode - (TRUE or FALSE) |
| 3248 | ** TRUE means that the device should treat Mode 4 Level 0 services as |
| 3249 | ** services of other levels. |
| 3250 | ** FALSE means that the device should provide default treatment for |
| 3251 | ** Mode 4 Level 0 services. |
| 3252 | ** |
| 3253 | ** Returns void |
| 3254 | ** |
| 3255 | *******************************************************************************/ |
| 3256 | extern void BTM_SetSecureConnectionsOnly (BOOLEAN secure_connections_only_mode); |
| 3257 | |
| 3258 | /******************************************************************************* |
| 3259 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3260 | ** Function BTM_SetSecurityLevel |
| 3261 | ** |
| 3262 | ** Description Register service security level with Security Manager. Each |
| 3263 | ** service must register its requirements regardless of the |
| 3264 | ** security level that is used. This API is called once for originators |
| 3265 | ** nad again for acceptors of connections. |
| 3266 | ** |
| 3267 | ** Returns TRUE if registered OK, else FALSE |
| 3268 | ** |
| 3269 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3270 | extern BOOLEAN BTM_SetSecurityLevel (BOOLEAN is_originator, char *p_name, |
| 3271 | UINT8 service_id, UINT16 sec_level, |
| 3272 | UINT16 psm, UINT32 mx_proto_id, |
| 3273 | UINT32 mx_chan_id); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3274 | |
| 3275 | /******************************************************************************* |
| 3276 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3277 | ** Function BTM_SetOutService |
| 3278 | ** |
| 3279 | ** Description This function is called to set the service for |
| 3280 | ** outgoing connection. |
| 3281 | ** |
| 3282 | ** Returns void |
| 3283 | ** |
| 3284 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3285 | extern void BTM_SetOutService(BD_ADDR bd_addr, UINT8 service_id, UINT32 mx_chan_id); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3286 | |
| 3287 | /******************************************************************************* |
| 3288 | ** |
| 3289 | ** Function BTM_SecClrService |
| 3290 | ** |
| 3291 | ** Description Removes specified service record(s) from the security database. |
| 3292 | ** All service records with the specified name are removed. |
| 3293 | ** Typically used only by devices with limited RAM so that it can |
| 3294 | ** reuse an old security service record. |
| 3295 | ** records (except SDP). |
| 3296 | ** |
| 3297 | ** Returns Number of records that were freed. |
| 3298 | ** |
| 3299 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3300 | extern UINT8 BTM_SecClrService (UINT8 service_id); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3301 | |
| 3302 | /******************************************************************************* |
| 3303 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3304 | ** Function BTM_SecAddDevice |
| 3305 | ** |
| 3306 | ** Description Add/modify device. This function will be normally called |
| 3307 | ** during host startup to restore all required information |
| 3308 | ** stored in the NVRAM. |
| 3309 | ** dev_class, bd_name, link_key, and features are NULL if unknown |
| 3310 | ** |
| 3311 | ** Returns TRUE if added OK, else FALSE |
| 3312 | ** |
| 3313 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3314 | extern BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, |
| 3315 | BD_NAME bd_name, UINT8 *features, |
| 3316 | UINT32 trusted_mask[], LINK_KEY link_key, |
Casper Bonde | 818d0f2 | 2015-05-21 11:08:45 +0200 | [diff] [blame] | 3317 | UINT8 key_type, tBTM_IO_CAP io_cap, UINT8 pin_length); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3318 | |
| 3319 | |
| 3320 | /******************************************************************************* |
| 3321 | ** |
| 3322 | ** Function BTM_SecDeleteDevice |
| 3323 | ** |
| 3324 | ** Description Free resources associated with the device. |
| 3325 | ** |
| 3326 | ** Returns TRUE if rmoved OK, FALSE if not found |
| 3327 | ** |
| 3328 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3329 | extern BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3330 | |
| 3331 | |
| 3332 | /******************************************************************************* |
| 3333 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3334 | ** Function BTM_SecGetDeviceLinkKey |
| 3335 | ** |
| 3336 | ** Description This function is called to obtain link key for the device |
| 3337 | ** it returns BTM_SUCCESS if link key is available, or |
| 3338 | ** BTM_UNKNOWN_ADDR if Security Manager does not know about |
| 3339 | ** the device or device record does not contain link key info |
| 3340 | ** |
| 3341 | ** Returns BTM_SUCCESS if successful, otherwise error code |
| 3342 | ** |
| 3343 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3344 | extern tBTM_STATUS BTM_SecGetDeviceLinkKey (BD_ADDR bd_addr, |
| 3345 | LINK_KEY link_key); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3346 | |
| 3347 | |
| 3348 | /******************************************************************************* |
| 3349 | ** |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 3350 | ** Function BTM_SecGetDeviceLinkKeyType |
| 3351 | ** |
| 3352 | ** Description This function is called to obtain link key type for the |
| 3353 | ** device. |
| 3354 | ** it returns BTM_SUCCESS if link key is available, or |
| 3355 | ** BTM_UNKNOWN_ADDR if Security Manager does not know about |
| 3356 | ** the device or device record does not contain link key info |
| 3357 | ** |
| 3358 | ** Returns BTM_LKEY_TYPE_IGNORE if link key is unknown, link type |
| 3359 | ** otherwise. |
| 3360 | ** |
| 3361 | *******************************************************************************/ |
| 3362 | extern tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType (BD_ADDR bd_addr); |
| 3363 | |
| 3364 | |
| 3365 | /******************************************************************************* |
| 3366 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3367 | ** Function BTM_PINCodeReply |
| 3368 | ** |
| 3369 | ** Description This function is called after Security Manager submitted |
| 3370 | ** PIN code request to the UI. |
| 3371 | ** |
| 3372 | ** Parameters: bd_addr - Address of the device for which PIN was requested |
| 3373 | ** res - result of the operation BTM_SUCCESS if success |
| 3374 | ** pin_len - length in bytes of the PIN Code |
| 3375 | ** p_pin - pointer to array with the PIN Code |
| 3376 | ** trusted_mask - bitwise OR of trusted services (array of UINT32) |
| 3377 | ** |
| 3378 | ** Returns void |
| 3379 | ** |
| 3380 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3381 | extern void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, |
| 3382 | UINT8 *p_pin, UINT32 trusted_mask[]); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3383 | |
| 3384 | |
| 3385 | /******************************************************************************* |
| 3386 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3387 | ** Function BTM_SecBond |
| 3388 | ** |
| 3389 | ** Description This function is called to perform bonding with peer device. |
| 3390 | ** |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 3391 | ** Parameters: bd_addr - Address of the device to bond |
| 3392 | ** pin_len - length in bytes of the PIN Code |
| 3393 | ** p_pin - pointer to array with the PIN Code |
| 3394 | ** trusted_mask - bitwise OR of trusted services (array of UINT32) |
| 3395 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3396 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 3397 | ** |
| 3398 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3399 | extern tBTM_STATUS BTM_SecBond (BD_ADDR bd_addr, |
| 3400 | UINT8 pin_len, UINT8 *p_pin, |
| 3401 | UINT32 trusted_mask[]); |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 3402 | |
| 3403 | /******************************************************************************* |
| 3404 | ** |
| 3405 | ** Function BTM_SecBondByTransport |
| 3406 | ** |
| 3407 | ** Description This function is called to perform bonding by designated transport |
| 3408 | ** |
| 3409 | ** Parameters: bd_addr - Address of the device to bond |
| 3410 | ** pin_len - length in bytes of the PIN Code |
| 3411 | ** p_pin - pointer to array with the PIN Code |
| 3412 | ** trusted_mask - bitwise OR of trusted services (array of UINT32) |
| 3413 | ** transport : Physical transport to use for bonding (BR/EDR or LE) |
| 3414 | ** |
| 3415 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 3416 | ** |
| 3417 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3418 | extern tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, |
| 3419 | tBT_TRANSPORT transport, |
| 3420 | UINT8 pin_len, UINT8 *p_pin, |
| 3421 | UINT32 trusted_mask[]); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3422 | |
| 3423 | /******************************************************************************* |
| 3424 | ** |
| 3425 | ** Function BTM_SecBondCancel |
| 3426 | ** |
| 3427 | ** Description This function is called to cancel ongoing bonding process |
| 3428 | ** with peer device. |
| 3429 | ** |
| 3430 | ** Returns BTM_CMD_STARTED if successfully initiated, otherwise error |
| 3431 | ** |
| 3432 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3433 | extern tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3434 | |
| 3435 | /******************************************************************************* |
| 3436 | ** |
| 3437 | ** Function BTM_SetEncryption |
| 3438 | ** |
| 3439 | ** Description This function is called to ensure that connection is |
| 3440 | ** encrypted. Should be called only on an open connection. |
| 3441 | ** Typically only needed for connections that first want to |
| 3442 | ** bring up unencrypted links, then later encrypt them. |
| 3443 | ** |
| 3444 | ** Parameters: bd_addr - Address of the peer device |
| 3445 | ** p_callback - Pointer to callback function called if |
| 3446 | ** this function returns PENDING after required |
| 3447 | ** procedures are completed. Can be set to NULL |
| 3448 | ** if status is not desired. |
| 3449 | ** p_ref_data - pointer to any data the caller wishes to receive |
| 3450 | ** in the callback function upon completion. |
| 3451 | * can be set to NULL if not used. |
| 3452 | ** |
| 3453 | ** Returns BTM_SUCCESS - already encrypted |
| 3454 | ** BTM_PENDING - command will be returned in the callback |
| 3455 | ** BTM_WRONG_MODE- connection not up. |
| 3456 | ** BTM_BUSY - security procedures are currently active |
| 3457 | ** BTM_MODE_UNSUPPORTED - if security manager not linked in. |
| 3458 | ** |
| 3459 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3460 | extern tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, |
| 3461 | tBTM_SEC_CBACK *p_callback, void *p_ref_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3462 | |
| 3463 | /******************************************************************************* |
| 3464 | ** |
| 3465 | ** Function BTM_ConfirmReqReply |
| 3466 | ** |
| 3467 | ** Description This function is called to confirm the numeric value for |
| 3468 | ** Simple Pairing in response to BTM_SP_CFM_REQ_EVT |
| 3469 | ** |
| 3470 | ** Parameters: res - result of the operation BTM_SUCCESS if success |
| 3471 | ** bd_addr - Address of the peer device |
| 3472 | ** |
| 3473 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3474 | extern void BTM_ConfirmReqReply(tBTM_STATUS res, BD_ADDR bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3475 | |
| 3476 | /******************************************************************************* |
| 3477 | ** |
| 3478 | ** Function BTM_PasskeyReqReply |
| 3479 | ** |
| 3480 | ** Description This function is called to provide the passkey for |
| 3481 | ** Simple Pairing in response to BTM_SP_KEY_REQ_EVT |
| 3482 | ** |
| 3483 | ** Parameters: res - result of the operation BTM_SUCCESS if success |
| 3484 | ** bd_addr - Address of the peer device |
| 3485 | ** passkey - numeric value in the range of 0 - 999999(0xF423F). |
| 3486 | ** |
| 3487 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3488 | extern void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, UINT32 passkey); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3489 | |
| 3490 | /******************************************************************************* |
| 3491 | ** |
| 3492 | ** Function BTM_SendKeypressNotif |
| 3493 | ** |
| 3494 | ** Description This function is used during the passkey entry model |
| 3495 | ** by a device with KeyboardOnly IO capabilities |
| 3496 | ** (very likely to be a HID Device). |
| 3497 | ** It is called by a HID Device to inform the remote device when |
| 3498 | ** a key has been entered or erased. |
| 3499 | ** |
| 3500 | ** Parameters: bd_addr - Address of the peer device |
| 3501 | ** type - notification type |
| 3502 | ** |
| 3503 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3504 | extern void BTM_SendKeypressNotif(BD_ADDR bd_addr, tBTM_SP_KEY_TYPE type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3505 | |
| 3506 | /******************************************************************************* |
| 3507 | ** |
| 3508 | ** Function BTM_IoCapRsp |
| 3509 | ** |
| 3510 | ** Description This function is called in response to BTM_SP_IO_REQ_EVT |
| 3511 | ** When the event data io_req.oob_data is set to BTM_OOB_UNKNOWN |
| 3512 | ** by the tBTM_SP_CALLBACK implementation, this function is |
| 3513 | ** called to provide the actual response |
| 3514 | ** |
| 3515 | ** Parameters: bd_addr - Address of the peer device |
| 3516 | ** io_cap - The IO capability of local device. |
| 3517 | ** oob - BTM_OOB_NONE or BTM_OOB_PRESENT. |
| 3518 | ** auth_req- MITM protection required or not. |
| 3519 | ** |
| 3520 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3521 | extern void BTM_IoCapRsp(BD_ADDR bd_addr, tBTM_IO_CAP io_cap, |
| 3522 | tBTM_OOB_DATA oob, tBTM_AUTH_REQ auth_req); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3523 | |
| 3524 | /******************************************************************************* |
| 3525 | ** |
| 3526 | ** Function BTM_ReadLocalOobData |
| 3527 | ** |
| 3528 | ** Description This function is called to read the local OOB data from |
| 3529 | ** LM |
| 3530 | ** |
| 3531 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3532 | extern tBTM_STATUS BTM_ReadLocalOobData(void); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3533 | |
| 3534 | /******************************************************************************* |
| 3535 | ** |
| 3536 | ** Function BTM_RemoteOobDataReply |
| 3537 | ** |
| 3538 | ** Description This function is called to provide the remote OOB data for |
| 3539 | ** Simple Pairing in response to BTM_SP_RMT_OOB_EVT |
| 3540 | ** |
| 3541 | ** Parameters: bd_addr - Address of the peer device |
| 3542 | ** c - simple pairing Hash C. |
| 3543 | ** r - simple pairing Randomizer C. |
| 3544 | ** |
| 3545 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3546 | extern void BTM_RemoteOobDataReply(tBTM_STATUS res, BD_ADDR bd_addr, |
| 3547 | BT_OCTET16 c, BT_OCTET16 r); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3548 | |
| 3549 | /******************************************************************************* |
| 3550 | ** |
| 3551 | ** Function BTM_BuildOobData |
| 3552 | ** |
| 3553 | ** Description This function is called to build the OOB data payload to |
| 3554 | ** be sent over OOB (non-Bluetooth) link |
| 3555 | ** |
| 3556 | ** Parameters: p_data - the location for OOB data |
| 3557 | ** max_len - p_data size. |
| 3558 | ** c - simple pairing Hash C. |
| 3559 | ** r - simple pairing Randomizer C. |
| 3560 | ** name_len- 0, local device name would not be included. |
| 3561 | ** otherwise, the local device name is included for |
| 3562 | ** up to this specified length |
| 3563 | ** |
| 3564 | ** Returns Number of bytes in p_data. |
| 3565 | ** |
| 3566 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3567 | extern UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c, |
| 3568 | BT_OCTET16 r, UINT8 name_len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3569 | |
| 3570 | /******************************************************************************* |
| 3571 | ** |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 3572 | ** Function BTM_BothEndsSupportSecureConnections |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 3573 | ** |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 3574 | ** Description This function is called to check if both the local device and the peer device |
| 3575 | ** specified by bd_addr support BR/EDR Secure Connections. |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 3576 | ** |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 3577 | ** Parameters: bd_addr - address of the peer |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 3578 | ** |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 3579 | ** Returns TRUE if BR/EDR Secure Connections are supported by both local |
| 3580 | ** and the remote device. |
| 3581 | ** else FALSE. |
| 3582 | ** |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 3583 | *******************************************************************************/ |
Mudumba Ananth | 899b771 | 2015-01-30 02:33:02 -0800 | [diff] [blame] | 3584 | extern BOOLEAN BTM_BothEndsSupportSecureConnections(BD_ADDR bd_addr); |
| 3585 | |
| 3586 | /******************************************************************************* |
| 3587 | ** |
| 3588 | ** Function BTM_PeerSupportsSecureConnections |
| 3589 | ** |
| 3590 | ** Description This function is called to check if the peer supports |
| 3591 | ** BR/EDR Secure Connections. |
| 3592 | ** |
| 3593 | ** Parameters: bd_addr - address of the peer |
| 3594 | ** |
| 3595 | ** Returns TRUE if BR/EDR Secure Connections are supported by the peer, |
| 3596 | ** else FALSE. |
| 3597 | ** |
| 3598 | *******************************************************************************/ |
| 3599 | extern BOOLEAN BTM_PeerSupportsSecureConnections(BD_ADDR bd_addr); |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 3600 | |
| 3601 | /******************************************************************************* |
| 3602 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3603 | ** Function BTM_ReadOobData |
| 3604 | ** |
| 3605 | ** Description This function is called to parse the OOB data payload |
| 3606 | ** received over OOB (non-Bluetooth) link |
| 3607 | ** |
| 3608 | ** Parameters: p_data - the location for OOB data |
| 3609 | ** eir_tag - The associated EIR tag to read the data. |
| 3610 | ** *p_len(output) - the length of the data with the given tag. |
| 3611 | ** |
| 3612 | ** Returns the beginning of the data with the given tag. |
| 3613 | ** NULL, if the tag is not found. |
| 3614 | ** |
| 3615 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3616 | extern UINT8 * BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3617 | |
| 3618 | /******************************************************************************* |
| 3619 | ** |
| 3620 | ** Function BTM_SecReadDevName |
| 3621 | ** |
| 3622 | ** Description Looks for the device name in the security database for the |
| 3623 | ** specified BD address. |
| 3624 | ** |
| 3625 | ** Returns Pointer to the name or NULL |
| 3626 | ** |
| 3627 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3628 | extern char *BTM_SecReadDevName (BD_ADDR bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3629 | |
| 3630 | |
| 3631 | /***************************************************************************** |
| 3632 | ** POWER MANAGEMENT FUNCTIONS |
| 3633 | *****************************************************************************/ |
| 3634 | /******************************************************************************* |
| 3635 | ** |
| 3636 | ** Function BTM_PmRegister |
| 3637 | ** |
| 3638 | ** Description register or deregister with power manager |
| 3639 | ** |
| 3640 | ** Returns BTM_SUCCESS if successful, |
| 3641 | ** BTM_NO_RESOURCES if no room to hold registration |
| 3642 | ** BTM_ILLEGAL_VALUE |
| 3643 | ** |
| 3644 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3645 | extern tBTM_STATUS BTM_PmRegister (UINT8 mask, UINT8 *p_pm_id, |
| 3646 | tBTM_PM_STATUS_CBACK *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3647 | |
| 3648 | |
| 3649 | /******************************************************************************* |
| 3650 | ** |
| 3651 | ** Function BTM_SetPowerMode |
| 3652 | ** |
| 3653 | ** Description store the mode in control block or |
| 3654 | ** alter ACL connection behavior. |
| 3655 | ** |
| 3656 | ** Returns BTM_SUCCESS if successful, |
| 3657 | ** BTM_UNKNOWN_ADDR if bd addr is not active or bad |
| 3658 | ** |
| 3659 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3660 | extern tBTM_STATUS BTM_SetPowerMode (UINT8 pm_id, BD_ADDR remote_bda, |
| 3661 | tBTM_PM_PWR_MD *p_mode); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3662 | |
| 3663 | |
| 3664 | /******************************************************************************* |
| 3665 | ** |
| 3666 | ** Function BTM_ReadPowerMode |
| 3667 | ** |
| 3668 | ** Description This returns the current mode for a specific |
| 3669 | ** ACL connection. |
| 3670 | ** |
| 3671 | ** Input Param remote_bda - device address of desired ACL connection |
| 3672 | ** |
| 3673 | ** Output Param p_mode - address where the current mode is copied into. |
| 3674 | ** BTM_ACL_MODE_NORMAL |
| 3675 | ** BTM_ACL_MODE_HOLD |
| 3676 | ** BTM_ACL_MODE_SNIFF |
| 3677 | ** BTM_ACL_MODE_PARK |
| 3678 | ** (valid only if return code is BTM_SUCCESS) |
| 3679 | ** |
| 3680 | ** Returns BTM_SUCCESS if successful, |
| 3681 | ** BTM_UNKNOWN_ADDR if bd addr is not active or bad |
| 3682 | ** |
| 3683 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3684 | extern tBTM_STATUS BTM_ReadPowerMode (BD_ADDR remote_bda, |
| 3685 | tBTM_PM_MODE *p_mode); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3686 | |
| 3687 | /******************************************************************************* |
| 3688 | ** |
| 3689 | ** Function BTM_SetSsrParams |
| 3690 | ** |
| 3691 | ** Description This sends the given SSR parameters for the given ACL |
| 3692 | ** connection if it is in ACTIVE mode. |
| 3693 | ** |
| 3694 | ** Input Param remote_bda - device address of desired ACL connection |
| 3695 | ** max_lat - maximum latency (in 0.625ms)(0-0xFFFE) |
| 3696 | ** min_rmt_to - minimum remote timeout |
| 3697 | ** min_loc_to - minimum local timeout |
| 3698 | ** |
| 3699 | ** |
| 3700 | ** Returns BTM_SUCCESS if the HCI command is issued successful, |
| 3701 | ** BTM_UNKNOWN_ADDR if bd addr is not active or bad |
| 3702 | ** BTM_CMD_STORED if the command is stored |
| 3703 | ** |
| 3704 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3705 | extern tBTM_STATUS BTM_SetSsrParams (BD_ADDR remote_bda, UINT16 max_lat, |
| 3706 | UINT16 min_rmt_to, UINT16 min_loc_to); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3707 | |
| 3708 | /******************************************************************************* |
| 3709 | ** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3710 | ** Function BTM_GetHCIConnHandle |
| 3711 | ** |
| 3712 | ** Description This function is called to get the handle for an ACL connection |
| 3713 | ** to a specific remote BD Address. |
| 3714 | ** |
| 3715 | ** Returns the handle of the connection, or 0xFFFF if none. |
| 3716 | ** |
| 3717 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3718 | extern UINT16 BTM_GetHCIConnHandle (BD_ADDR remote_bda, tBT_TRANSPORT transport); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3719 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3720 | /******************************************************************************* |
| 3721 | ** |
| 3722 | ** Function BTM_DeleteStoredLinkKey |
| 3723 | ** |
| 3724 | ** Description This function is called to delete link key for the specified |
| 3725 | ** device addresses from the NVRAM storage attached to the Bluetooth |
| 3726 | ** controller. |
| 3727 | ** |
| 3728 | ** Parameters: bd_addr - Addresses of the devices |
| 3729 | ** p_cb - Call back function to be called to return |
| 3730 | ** the results |
| 3731 | ** |
| 3732 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3733 | extern tBTM_STATUS BTM_DeleteStoredLinkKey(BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3734 | |
| 3735 | /******************************************************************************* |
| 3736 | ** |
| 3737 | ** Function BTM_WriteEIR |
| 3738 | ** |
| 3739 | ** Description This function is called to write EIR data to controller. |
| 3740 | ** |
| 3741 | ** Parameters p_buff - allocated HCI command buffer including extended |
| 3742 | ** inquriry response |
| 3743 | ** |
| 3744 | ** Returns BTM_SUCCESS - if successful |
| 3745 | ** BTM_MODE_UNSUPPORTED - if local device cannot support it |
| 3746 | ** |
| 3747 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3748 | extern tBTM_STATUS BTM_WriteEIR( BT_HDR * p_buff ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3749 | |
| 3750 | /******************************************************************************* |
| 3751 | ** |
| 3752 | ** Function BTM_CheckEirData |
| 3753 | ** |
| 3754 | ** Description This function is called to get EIR data from significant part. |
| 3755 | ** |
| 3756 | ** Parameters p_eir - pointer of EIR significant part |
| 3757 | ** type - finding EIR data type |
| 3758 | ** p_length - return the length of EIR data |
| 3759 | ** |
| 3760 | ** Returns pointer of EIR data |
| 3761 | ** |
| 3762 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3763 | extern UINT8 *BTM_CheckEirData( UINT8 *p_eir, UINT8 type, UINT8 *p_length ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3764 | |
| 3765 | /******************************************************************************* |
| 3766 | ** |
| 3767 | ** Function BTM_HasEirService |
| 3768 | ** |
| 3769 | ** Description This function is called to know if UUID in bit map of UUID. |
| 3770 | ** |
| 3771 | ** Parameters p_eir_uuid - bit map of UUID list |
| 3772 | ** uuid16 - UUID 16-bit |
| 3773 | ** |
| 3774 | ** Returns TRUE - if found |
| 3775 | ** FALSE - if not found |
| 3776 | ** |
| 3777 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3778 | extern BOOLEAN BTM_HasEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3779 | |
| 3780 | /******************************************************************************* |
| 3781 | ** |
| 3782 | ** Function BTM_HasInquiryEirService |
| 3783 | ** |
| 3784 | ** Description This function is called to know if UUID in bit map of UUID list. |
| 3785 | ** |
| 3786 | ** Parameters p_results - inquiry results |
| 3787 | ** uuid16 - UUID 16-bit |
| 3788 | ** |
| 3789 | ** Returns BTM_EIR_FOUND - if found |
| 3790 | ** BTM_EIR_NOT_FOUND - if not found and it is complete list |
| 3791 | ** BTM_EIR_UNKNOWN - if not found and it is not complete list |
| 3792 | ** |
| 3793 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3794 | extern tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results, |
| 3795 | UINT16 uuid16 ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3796 | |
| 3797 | /******************************************************************************* |
| 3798 | ** |
| 3799 | ** Function BTM_AddEirService |
| 3800 | ** |
| 3801 | ** Description This function is called to add a service in bit map of UUID list. |
| 3802 | ** |
| 3803 | ** Parameters p_eir_uuid - bit mask of UUID list for EIR |
| 3804 | ** uuid16 - UUID 16-bit |
| 3805 | ** |
| 3806 | ** Returns None |
| 3807 | ** |
| 3808 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3809 | extern void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3810 | |
| 3811 | /******************************************************************************* |
| 3812 | ** |
| 3813 | ** Function BTM_RemoveEirService |
| 3814 | ** |
| 3815 | ** Description This function is called to remove a service in bit map of UUID list. |
| 3816 | ** |
| 3817 | ** Parameters p_eir_uuid - bit mask of UUID list for EIR |
| 3818 | ** uuid16 - UUID 16-bit |
| 3819 | ** |
| 3820 | ** Returns None |
| 3821 | ** |
| 3822 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3823 | extern void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3824 | |
| 3825 | /******************************************************************************* |
| 3826 | ** |
| 3827 | ** Function BTM_GetEirSupportedServices |
| 3828 | ** |
| 3829 | ** Description This function is called to get UUID list from bit map of UUID list. |
| 3830 | ** |
| 3831 | ** Parameters p_eir_uuid - bit mask of UUID list for EIR |
| 3832 | ** p - reference of current pointer of EIR |
| 3833 | ** max_num_uuid16 - max number of UUID can be written in EIR |
| 3834 | ** num_uuid16 - number of UUID have been written in EIR |
| 3835 | ** |
| 3836 | ** Returns BTM_EIR_MORE_16BITS_UUID_TYPE, if it has more than max |
| 3837 | ** BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise |
| 3838 | ** |
| 3839 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3840 | extern UINT8 BTM_GetEirSupportedServices( UINT32 *p_eir_uuid, UINT8 **p, |
| 3841 | UINT8 max_num_uuid16, UINT8 *p_num_uuid16); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3842 | |
| 3843 | /******************************************************************************* |
| 3844 | ** |
| 3845 | ** Function BTM_GetEirUuidList |
| 3846 | ** |
| 3847 | ** Description This function parses EIR and returns UUID list. |
| 3848 | ** |
| 3849 | ** Parameters p_eir - EIR |
| 3850 | ** uuid_size - LEN_UUID_16, LEN_UUID_32, LEN_UUID_128 |
| 3851 | ** p_num_uuid - return number of UUID in found list |
| 3852 | ** p_uuid_list - return UUID 16-bit list |
| 3853 | ** max_num_uuid - maximum number of UUID to be returned |
| 3854 | ** |
| 3855 | ** Returns 0 - if not found |
| 3856 | ** BTM_EIR_COMPLETE_16BITS_UUID_TYPE |
| 3857 | ** BTM_EIR_MORE_16BITS_UUID_TYPE |
| 3858 | ** BTM_EIR_COMPLETE_32BITS_UUID_TYPE |
| 3859 | ** BTM_EIR_MORE_32BITS_UUID_TYPE |
| 3860 | ** BTM_EIR_COMPLETE_128BITS_UUID_TYPE |
| 3861 | ** BTM_EIR_MORE_128BITS_UUID_TYPE |
| 3862 | ** |
| 3863 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3864 | extern UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid, |
| 3865 | UINT8 *p_uuid_list, UINT8 max_num_uuid); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3866 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3867 | /***************************************************************************** |
| 3868 | ** SCO OVER HCI |
| 3869 | *****************************************************************************/ |
| 3870 | /******************************************************************************* |
| 3871 | ** |
| 3872 | ** Function BTM_ConfigScoPath |
| 3873 | ** |
| 3874 | ** Description This function enable/disable SCO over HCI and registers SCO |
| 3875 | ** data callback if SCO over HCI is enabled. |
| 3876 | ** |
| 3877 | ** Parameter path: SCO or HCI |
| 3878 | ** p_sco_data_cb: callback function or SCO data if path is set |
| 3879 | ** to transport. |
| 3880 | ** p_pcm_param: pointer to the PCM interface parameter. If a NULL |
| 3881 | ** pointer is used, PCM parameter maintained in |
| 3882 | ** the control block will be used; otherwise update |
| 3883 | ** control block value. |
| 3884 | ** err_data_rpt: Lisbon feature to enable the erronous data report |
| 3885 | ** or not. |
| 3886 | ** |
| 3887 | ** Returns BTM_SUCCESS if the successful. |
| 3888 | ** BTM_NO_RESOURCES: no rsource to start the command. |
| 3889 | ** BTM_ILLEGAL_VALUE: invalid callback function pointer. |
| 3890 | ** BTM_CMD_STARTED :Command sent. Waiting for command cmpl event. |
| 3891 | ** |
| 3892 | ** |
| 3893 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3894 | extern tBTM_STATUS BTM_ConfigScoPath (tBTM_SCO_ROUTE_TYPE path, |
| 3895 | tBTM_SCO_DATA_CB *p_sco_data_cb, |
| 3896 | tBTM_SCO_PCM_PARAM *p_pcm_param, |
| 3897 | BOOLEAN err_data_rpt); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3898 | |
| 3899 | /******************************************************************************* |
| 3900 | ** |
| 3901 | ** Function BTM_WriteScoData |
| 3902 | ** |
| 3903 | ** Description This function write SCO data to a specified instance. The data |
| 3904 | ** to be written p_buf needs to carry an offset of |
| 3905 | ** HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not |
| 3906 | ** exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is set |
| 3907 | ** to 60 and is configurable. Data longer than the maximum bytes |
| 3908 | ** will be truncated. |
| 3909 | ** |
| 3910 | ** Returns BTM_SUCCESS: data write is successful |
| 3911 | ** BTM_ILLEGAL_VALUE: SCO data contains illegal offset value. |
| 3912 | ** BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO packet |
| 3913 | ** size. |
| 3914 | ** BTM_NO_RESOURCES: no resources. |
| 3915 | ** BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is not |
| 3916 | ** routed via HCI. |
| 3917 | ** |
| 3918 | ** |
| 3919 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3920 | extern tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3921 | |
| 3922 | /******************************************************************************* |
| 3923 | ** |
| 3924 | ** Function BTM_SetARCMode |
| 3925 | ** |
| 3926 | ** Description Send Audio Routing Control command. |
| 3927 | ** |
| 3928 | ** Returns void |
| 3929 | ** |
| 3930 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3931 | extern void BTM_SetARCMode (UINT8 iface, UINT8 arc_mode, tBTM_VSC_CMPL_CB *p_arc_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3932 | |
| 3933 | |
| 3934 | /******************************************************************************* |
| 3935 | ** |
| 3936 | ** Function BTM_PCM2Setup_Write |
| 3937 | ** |
| 3938 | ** Description Send PCM2_Setup write command. |
| 3939 | ** |
| 3940 | ** Returns void |
| 3941 | ** |
| 3942 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3943 | extern void BTM_PCM2Setup_Write (BOOLEAN clk_master, tBTM_VSC_CMPL_CB *p_arc_cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3944 | |
Satya Calloji | e5ba884 | 2014-07-03 17:18:02 -0700 | [diff] [blame] | 3945 | |
| 3946 | /******************************************************************************* |
| 3947 | ** |
| 3948 | ** Function BTM_PM_ReadControllerState |
| 3949 | ** |
| 3950 | ** Description This function is called to obtain the controller state |
| 3951 | ** |
| 3952 | ** Returns Controller state (BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and BTM_CONTRL_IDLE) |
| 3953 | ** |
| 3954 | *******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 3955 | extern tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void); |
Satya Calloji | e5ba884 | 2014-07-03 17:18:02 -0700 | [diff] [blame] | 3956 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 3957 | #ifdef __cplusplus |
| 3958 | } |
| 3959 | #endif |
| 3960 | |
| 3961 | #endif /* BTM_API_H */ |