1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_INCLUDE_BLUETOOTH_H 18 #define ANDROID_INCLUDE_BLUETOOTH_H 19 20 #include <stdbool.h> 21 #include <stdint.h> 22 #include <sys/cdefs.h> 23 #include <sys/types.h> 24 25 #include "avrcp/avrcp.h" 26 #include "bluetooth/uuid.h" 27 #include "raw_address.h" 28 29 /** 30 * The Bluetooth Hardware Module ID 31 */ 32 33 #define BT_HARDWARE_MODULE_ID "bluetooth" 34 #define BT_STACK_MODULE_ID "bluetooth" 35 36 /** Bluetooth profile interface IDs */ 37 #define BT_PROFILE_HANDSFREE_ID "handsfree" 38 #define BT_PROFILE_HANDSFREE_CLIENT_ID "handsfree_client" 39 #define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp" 40 #define BT_PROFILE_ADVANCED_AUDIO_SINK_ID "a2dp_sink" 41 #define BT_PROFILE_SOCKETS_ID "socket" 42 #define BT_PROFILE_HIDHOST_ID "hidhost" 43 #define BT_PROFILE_HIDDEV_ID "hiddev" 44 #define BT_PROFILE_PAN_ID "pan" 45 #define BT_PROFILE_MAP_CLIENT_ID "map_client" 46 #define BT_PROFILE_SDP_CLIENT_ID "sdp" 47 #define BT_PROFILE_GATT_ID "gatt" 48 #define BT_PROFILE_AV_RC_ID "avrcp" 49 #define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl" 50 #define BT_PROFILE_HEARING_AID_ID "hearing_aid" 51 52 /** Bluetooth Device Name */ 53 typedef struct { uint8_t name[249]; } __attribute__((packed)) bt_bdname_t; 54 55 /** Bluetooth Adapter Visibility Modes*/ 56 typedef enum { 57 BT_SCAN_MODE_NONE, 58 BT_SCAN_MODE_CONNECTABLE, 59 BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE 60 } bt_scan_mode_t; 61 62 /** Bluetooth Adapter State */ 63 typedef enum { BT_STATE_OFF, BT_STATE_ON } bt_state_t; 64 65 /** Bluetooth Adapter Input Output Capabilities which determine Pairing/Security 66 */ 67 typedef enum { 68 BT_IO_CAP_OUT, /* DisplayOnly */ 69 BT_IO_CAP_IO, /* DisplayYesNo */ 70 BT_IO_CAP_IN, /* KeyboardOnly */ 71 BT_IO_CAP_NONE, /* NoInputNoOutput */ 72 BT_IO_CAP_KBDISP, /* Keyboard display */ 73 BT_IO_CAP_MAX, 74 BT_IO_CAP_UNKNOWN = 0xFF /* Unknown value */ 75 } bt_io_cap_t; 76 77 /** Bluetooth Error Status */ 78 /** We need to build on this */ 79 80 typedef enum { 81 BT_STATUS_SUCCESS, 82 BT_STATUS_FAIL, 83 BT_STATUS_NOT_READY, 84 BT_STATUS_NOMEM, 85 BT_STATUS_BUSY, 86 BT_STATUS_DONE, /* request already completed */ 87 BT_STATUS_UNSUPPORTED, 88 BT_STATUS_PARM_INVALID, 89 BT_STATUS_UNHANDLED, 90 BT_STATUS_AUTH_FAILURE, 91 BT_STATUS_RMT_DEV_DOWN, 92 BT_STATUS_AUTH_REJECTED, 93 BT_STATUS_JNI_ENVIRONMENT_ERROR, 94 BT_STATUS_JNI_THREAD_ATTACH_ERROR, 95 BT_STATUS_WAKELOCK_ERROR 96 } bt_status_t; 97 98 /** Bluetooth PinKey Code */ 99 typedef struct { uint8_t pin[16]; } __attribute__((packed)) bt_pin_code_t; 100 101 typedef struct { 102 uint8_t status; 103 uint8_t ctrl_state; /* stack reported state */ 104 uint64_t tx_time; /* in ms */ 105 uint64_t rx_time; /* in ms */ 106 uint64_t idle_time; /* in ms */ 107 uint64_t energy_used; /* a product of mA, V and ms */ 108 } __attribute__((packed)) bt_activity_energy_info; 109 110 typedef struct { 111 int32_t app_uid; 112 uint64_t tx_bytes; 113 uint64_t rx_bytes; 114 } __attribute__((packed)) bt_uid_traffic_t; 115 116 /** Bluetooth Adapter Discovery state */ 117 typedef enum { 118 BT_DISCOVERY_STOPPED, 119 BT_DISCOVERY_STARTED 120 } bt_discovery_state_t; 121 122 /** Bluetooth ACL connection state */ 123 typedef enum { 124 BT_ACL_STATE_CONNECTED, 125 BT_ACL_STATE_DISCONNECTED 126 } bt_acl_state_t; 127 128 /** Bluetooth SDP service record */ 129 typedef struct { 130 bluetooth::Uuid uuid; 131 uint16_t channel; 132 char name[256]; // what's the maximum length 133 } bt_service_record_t; 134 135 /** Bluetooth Remote Version info */ 136 typedef struct { 137 int version; 138 int sub_ver; 139 int manufacturer; 140 } bt_remote_version_t; 141 142 typedef struct { 143 uint16_t version_supported; 144 uint8_t local_privacy_enabled; 145 uint8_t max_adv_instance; 146 uint8_t rpa_offload_supported; 147 uint8_t max_irk_list_size; 148 uint8_t max_adv_filter_supported; 149 uint8_t activity_energy_info_supported; 150 uint16_t scan_result_storage_size; 151 uint16_t total_trackable_advertisers; 152 bool extended_scan_support; 153 bool debug_logging_supported; 154 bool le_2m_phy_supported; 155 bool le_coded_phy_supported; 156 bool le_extended_advertising_supported; 157 bool le_periodic_advertising_supported; 158 uint16_t le_maximum_advertising_data_length; 159 } bt_local_le_features_t; 160 161 /* Bluetooth Adapter and Remote Device property types */ 162 typedef enum { 163 /* Properties common to both adapter and remote device */ 164 /** 165 * Description - Bluetooth Device Name 166 * Access mode - Adapter name can be GET/SET. Remote device can be GET 167 * Data type - bt_bdname_t 168 */ 169 BT_PROPERTY_BDNAME = 0x1, 170 /** 171 * Description - Bluetooth Device Address 172 * Access mode - Only GET. 173 * Data type - RawAddress 174 */ 175 BT_PROPERTY_BDADDR, 176 /** 177 * Description - Bluetooth Service 128-bit UUIDs 178 * Access mode - Only GET. 179 * Data type - Array of bluetooth::Uuid (Array size inferred from property 180 * length). 181 */ 182 BT_PROPERTY_UUIDS, 183 /** 184 * Description - Bluetooth Class of Device as found in Assigned Numbers 185 * Access mode - Only GET. 186 * Data type - uint32_t. 187 */ 188 BT_PROPERTY_CLASS_OF_DEVICE, 189 /** 190 * Description - Device Type - BREDR, BLE or DUAL Mode 191 * Access mode - Only GET. 192 * Data type - bt_device_type_t 193 */ 194 BT_PROPERTY_TYPE_OF_DEVICE, 195 /** 196 * Description - Bluetooth Service Record 197 * Access mode - Only GET. 198 * Data type - bt_service_record_t 199 */ 200 BT_PROPERTY_SERVICE_RECORD, 201 202 /* Properties unique to adapter */ 203 /** 204 * Description - Bluetooth Adapter scan mode 205 * Access mode - GET and SET 206 * Data type - bt_scan_mode_t. 207 */ 208 BT_PROPERTY_ADAPTER_SCAN_MODE, 209 /** 210 * Description - List of bonded devices 211 * Access mode - Only GET. 212 * Data type - Array of RawAddress of the bonded remote devices 213 * (Array size inferred from property length). 214 */ 215 BT_PROPERTY_ADAPTER_BONDED_DEVICES, 216 /** 217 * Description - Bluetooth Adapter Discovery timeout (in seconds) 218 * Access mode - GET and SET 219 * Data type - uint32_t 220 */ 221 BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, 222 223 /* Properties unique to remote device */ 224 /** 225 * Description - User defined friendly name of the remote device 226 * Access mode - GET and SET 227 * Data type - bt_bdname_t. 228 */ 229 BT_PROPERTY_REMOTE_FRIENDLY_NAME, 230 /** 231 * Description - RSSI value of the inquired remote device 232 * Access mode - Only GET. 233 * Data type - int8_t. 234 */ 235 BT_PROPERTY_REMOTE_RSSI, 236 /** 237 * Description - Remote version info 238 * Access mode - SET/GET. 239 * Data type - bt_remote_version_t. 240 */ 241 242 BT_PROPERTY_REMOTE_VERSION_INFO, 243 244 /** 245 * Description - Local LE features 246 * Access mode - GET. 247 * Data type - bt_local_le_features_t. 248 */ 249 BT_PROPERTY_LOCAL_LE_FEATURES, 250 251 /** 252 * Description - Local Input/Output Capabilities for classic Bluetooth 253 * Access mode - GET and SET 254 * Data Type - bt_io_cap_t. 255 */ 256 BT_PROPERTY_LOCAL_IO_CAPS, 257 258 /** 259 * Description - Local Input/Output Capabilities for BLE 260 * Access mode - GET and SET 261 * Data Type - bt_io_cap_t. 262 */ 263 BT_PROPERTY_LOCAL_IO_CAPS_BLE, 264 265 BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF, 266 } bt_property_type_t; 267 268 /** Bluetooth Adapter Property data structure */ 269 typedef struct { 270 bt_property_type_t type; 271 int len; 272 void* val; 273 } bt_property_t; 274 275 /** Bluetooth Out Of Band data for bonding */ 276 typedef struct { 277 uint8_t le_bt_dev_addr[7]; /* LE Bluetooth Device Address */ 278 uint8_t c192[16]; /* Simple Pairing Hash C-192 */ 279 uint8_t r192[16]; /* Simple Pairing Randomizer R-192 */ 280 uint8_t c256[16]; /* Simple Pairing Hash C-256 */ 281 uint8_t r256[16]; /* Simple Pairing Randomizer R-256 */ 282 uint8_t sm_tk[16]; /* Security Manager TK Value */ 283 uint8_t le_sc_c[16]; /* LE Secure Connections Confirmation Value */ 284 uint8_t le_sc_r[16]; /* LE Secure Connections Random Value */ 285 } bt_out_of_band_data_t; 286 287 /** Bluetooth Device Type */ 288 typedef enum { 289 BT_DEVICE_DEVTYPE_BREDR = 0x1, 290 BT_DEVICE_DEVTYPE_BLE, 291 BT_DEVICE_DEVTYPE_DUAL 292 } bt_device_type_t; 293 /** Bluetooth Bond state */ 294 typedef enum { 295 BT_BOND_STATE_NONE, 296 BT_BOND_STATE_BONDING, 297 BT_BOND_STATE_BONDED 298 } bt_bond_state_t; 299 300 /** Bluetooth SSP Bonding Variant */ 301 typedef enum { 302 BT_SSP_VARIANT_PASSKEY_CONFIRMATION, 303 BT_SSP_VARIANT_PASSKEY_ENTRY, 304 BT_SSP_VARIANT_CONSENT, 305 BT_SSP_VARIANT_PASSKEY_NOTIFICATION 306 } bt_ssp_variant_t; 307 308 #define BT_MAX_NUM_UUIDS 32 309 310 /** Bluetooth Interface callbacks */ 311 312 /** Bluetooth Enable/Disable Callback. */ 313 typedef void (*adapter_state_changed_callback)(bt_state_t state); 314 315 /** GET/SET Adapter Properties callback */ 316 /* TODO: For the GET/SET property APIs/callbacks, we may need a session 317 * identifier to associate the call with the callback. This would be needed 318 * whenever more than one simultaneous instance of the same adapter_type 319 * is get/set. 320 * 321 * If this is going to be handled in the Java framework, then we do not need 322 * to manage sessions here. 323 */ 324 typedef void (*adapter_properties_callback)(bt_status_t status, 325 int num_properties, 326 bt_property_t* properties); 327 328 /** GET/SET Remote Device Properties callback */ 329 /** TODO: For remote device properties, do not see a need to get/set 330 * multiple properties - num_properties shall be 1 331 */ 332 typedef void (*remote_device_properties_callback)(bt_status_t status, 333 RawAddress* bd_addr, 334 int num_properties, 335 bt_property_t* properties); 336 337 /** New device discovered callback */ 338 /** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1 339 * respectively */ 340 typedef void (*device_found_callback)(int num_properties, 341 bt_property_t* properties); 342 343 /** Discovery state changed callback */ 344 typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state); 345 346 /** Bluetooth Legacy PinKey Request callback */ 347 typedef void (*pin_request_callback)(RawAddress* remote_bd_addr, 348 bt_bdname_t* bd_name, uint32_t cod, 349 bool min_16_digit); 350 351 /** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/ 352 /** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT & 353 * BT_SSP_PAIRING_PASSKEY_ENTRY */ 354 /* TODO: Passkey request callback shall not be needed for devices with display 355 * capability. We still need support this in the stack for completeness */ 356 typedef void (*ssp_request_callback)(RawAddress* remote_bd_addr, 357 bt_bdname_t* bd_name, uint32_t cod, 358 bt_ssp_variant_t pairing_variant, 359 uint32_t pass_key); 360 361 /** Bluetooth Bond state changed callback */ 362 /* Invoked in response to create_bond, cancel_bond or remove_bond */ 363 typedef void (*bond_state_changed_callback)(bt_status_t status, 364 RawAddress* remote_bd_addr, 365 bt_bond_state_t state); 366 367 /** Bluetooth ACL connection state changed callback */ 368 typedef void (*acl_state_changed_callback)(bt_status_t status, 369 RawAddress* remote_bd_addr, 370 bt_acl_state_t state); 371 372 typedef enum { ASSOCIATE_JVM, DISASSOCIATE_JVM } bt_cb_thread_evt; 373 374 /** Thread Associate/Disassociate JVM Callback */ 375 /* Callback that is invoked by the callback thread to allow upper layer to 376 * attach/detach to/from the JVM */ 377 typedef void (*callback_thread_event)(bt_cb_thread_evt evt); 378 379 /** Bluetooth Test Mode Callback */ 380 /* Receive any HCI event from controller. Must be in DUT Mode for this callback 381 * to be received */ 382 typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t* buf, 383 uint8_t len); 384 385 /* LE Test mode callbacks 386 * This callback shall be invoked whenever the le_tx_test, le_rx_test or 387 * le_test_end is invoked The num_packets is valid only for le_test_end command 388 */ 389 typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets); 390 391 /** Callback invoked when energy details are obtained */ 392 /* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as 393 * defined by HCI spec. If the ctrl_state value is 0, it means the API call 394 * failed Time values-In milliseconds as returned by the controller Energy 395 * used-Value as returned by the controller Status-Provides the status of the 396 * read_energy_info API call uid_data provides an array of bt_uid_traffic_t, 397 * where the array is terminated by an element with app_uid set to -1. 398 */ 399 typedef void (*energy_info_callback)(bt_activity_energy_info* energy_info, 400 bt_uid_traffic_t* uid_data); 401 402 /** TODO: Add callbacks for Link Up/Down and other generic 403 * notifications/callbacks */ 404 405 /** Bluetooth DM callback structure. */ 406 typedef struct { 407 /** set to sizeof(bt_callbacks_t) */ 408 size_t size; 409 adapter_state_changed_callback adapter_state_changed_cb; 410 adapter_properties_callback adapter_properties_cb; 411 remote_device_properties_callback remote_device_properties_cb; 412 device_found_callback device_found_cb; 413 discovery_state_changed_callback discovery_state_changed_cb; 414 pin_request_callback pin_request_cb; 415 ssp_request_callback ssp_request_cb; 416 bond_state_changed_callback bond_state_changed_cb; 417 acl_state_changed_callback acl_state_changed_cb; 418 callback_thread_event thread_evt_cb; 419 dut_mode_recv_callback dut_mode_recv_cb; 420 le_test_mode_callback le_test_mode_cb; 421 energy_info_callback energy_info_cb; 422 } bt_callbacks_t; 423 424 typedef void (*alarm_cb)(void* data); 425 typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, 426 alarm_cb cb, void* data); 427 typedef int (*acquire_wake_lock_callout)(const char* lock_name); 428 typedef int (*release_wake_lock_callout)(const char* lock_name); 429 430 /** The set of functions required by bluedroid to set wake alarms and 431 * grab wake locks. This struct is passed into the stack through the 432 * |set_os_callouts| function on |bt_interface_t|. 433 */ 434 typedef struct { 435 /* set to sizeof(bt_os_callouts_t) */ 436 size_t size; 437 438 set_wake_alarm_callout set_wake_alarm; 439 acquire_wake_lock_callout acquire_wake_lock; 440 release_wake_lock_callout release_wake_lock; 441 } bt_os_callouts_t; 442 443 /** NOTE: By default, no profiles are initialized at the time of init/enable. 444 * Whenever the application invokes the 'init' API of a profile, then one of 445 * the following shall occur: 446 * 447 * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the 448 * profile as enabled. Subsequently, when the application invokes the 449 * Bluetooth 'enable', as part of the enable sequence the profile that 450 * were marked shall be enabled by calling appropriate stack APIs. The 451 * 'adapter_properties_cb' shall return the list of UUIDs of the 452 * enabled profiles. 453 * 454 * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the 455 * stack profile API to initialize the profile and trigger a 456 * 'adapter_properties_cb' with the current list of UUIDs including the 457 * newly added profile's UUID. 458 * 459 * The reverse shall occur whenever the profile 'cleanup' APIs are invoked 460 */ 461 462 /** Represents the standard Bluetooth DM interface. */ 463 typedef struct { 464 /** set to sizeof(bt_interface_t) */ 465 size_t size; 466 /** 467 * Opens the interface and provides the callback routines 468 * to the implemenation of this interface. 469 * The |start_restricted| flag inits the adapter in restricted mode. In 470 * restricted mode, bonds that are created are marked as restricted in the 471 * config file. These devices are deleted upon leaving restricted mode. 472 * The |is_single_user_mode| flag inits the adapter in NIAP mode. 473 */ 474 int (*init)(bt_callbacks_t* callbacks, bool guest_mode, 475 bool is_single_user_mode); 476 477 /** Enable Bluetooth. */ 478 int (*enable)(); 479 480 /** Disable Bluetooth. */ 481 int (*disable)(void); 482 483 /** Closes the interface. */ 484 void (*cleanup)(void); 485 486 /** Get all Bluetooth Adapter properties at init */ 487 int (*get_adapter_properties)(void); 488 489 /** Get Bluetooth Adapter property of 'type' */ 490 int (*get_adapter_property)(bt_property_type_t type); 491 492 /** Set Bluetooth Adapter property of 'type' */ 493 /* Based on the type, val shall be one of 494 * RawAddress or bt_bdname_t or bt_scanmode_t etc 495 */ 496 int (*set_adapter_property)(const bt_property_t* property); 497 498 /** Get all Remote Device properties */ 499 int (*get_remote_device_properties)(RawAddress* remote_addr); 500 501 /** Get Remote Device property of 'type' */ 502 int (*get_remote_device_property)(RawAddress* remote_addr, 503 bt_property_type_t type); 504 505 /** Set Remote Device property of 'type' */ 506 int (*set_remote_device_property)(RawAddress* remote_addr, 507 const bt_property_t* property); 508 509 /** Get Remote Device's service record for the given UUID */ 510 int (*get_remote_service_record)(const RawAddress& remote_addr, 511 const bluetooth::Uuid& uuid); 512 513 /** Start SDP to get remote services */ 514 int (*get_remote_services)(RawAddress* remote_addr); 515 516 /** Start Discovery */ 517 int (*start_discovery)(void); 518 519 /** Cancel Discovery */ 520 int (*cancel_discovery)(void); 521 522 /** Create Bluetooth Bonding */ 523 int (*create_bond)(const RawAddress* bd_addr, int transport); 524 525 /** Create Bluetooth Bond using out of band data */ 526 int (*create_bond_out_of_band)(const RawAddress* bd_addr, int transport, 527 const bt_out_of_band_data_t* oob_data); 528 529 /** Remove Bond */ 530 int (*remove_bond)(const RawAddress* bd_addr); 531 532 /** Cancel Bond */ 533 int (*cancel_bond)(const RawAddress* bd_addr); 534 535 /** 536 * Get the connection status for a given remote device. 537 * return value of 0 means the device is not connected, 538 * non-zero return status indicates an active connection. 539 */ 540 int (*get_connection_state)(const RawAddress* bd_addr); 541 542 /** BT Legacy PinKey Reply */ 543 /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */ 544 int (*pin_reply)(const RawAddress* bd_addr, uint8_t accept, uint8_t pin_len, 545 bt_pin_code_t* pin_code); 546 547 /** BT SSP Reply - Just Works, Numeric Comparison and Passkey 548 * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON & 549 * BT_SSP_VARIANT_CONSENT 550 * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey 551 * shall be zero */ 552 int (*ssp_reply)(const RawAddress* bd_addr, bt_ssp_variant_t variant, 553 uint8_t accept, uint32_t passkey); 554 555 /** Get Bluetooth profile interface */ 556 const void* (*get_profile_interface)(const char* profile_id); 557 558 /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */ 559 /* Configure DUT Mode - Use this mode to enter/exit DUT mode */ 560 int (*dut_mode_configure)(uint8_t enable); 561 562 /* Send any test HCI (vendor-specific) command to the controller. Must be in 563 * DUT Mode */ 564 int (*dut_mode_send)(uint16_t opcode, uint8_t* buf, uint8_t len); 565 /** BLE Test Mode APIs */ 566 /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End 567 */ 568 int (*le_test_mode)(uint16_t opcode, uint8_t* buf, uint8_t len); 569 570 /** Sets the OS call-out functions that bluedroid needs for alarms and wake 571 * locks. This should be called immediately after a successful |init|. 572 */ 573 int (*set_os_callouts)(bt_os_callouts_t* callouts); 574 575 /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or 576 * BT_STATUS_NOT_READY Success indicates that the VSC command was sent to 577 * controller 578 */ 579 int (*read_energy_info)(); 580 581 /** 582 * Native support for dumpsys function 583 * Function is synchronous and |fd| is owned by caller. 584 * |arguments| are arguments which may affect the output, encoded as 585 * UTF-8 strings. 586 */ 587 void (*dump)(int fd, const char** arguments); 588 589 /** 590 * Native support for metrics protobuf dumping. The dumping format will be 591 * raw byte array 592 * 593 * @param output an externally allocated string to dump serialized protobuf 594 */ 595 void (*dumpMetrics)(std::string* output); 596 597 /** 598 * Clear /data/misc/bt_config.conf and erase all stored connections 599 */ 600 int (*config_clear)(void); 601 602 /** 603 * Clear (reset) the dynamic portion of the device interoperability database. 604 */ 605 void (*interop_database_clear)(void); 606 607 /** 608 * Add a new device interoperability workaround for a remote device whose 609 * first |len| bytes of the its device address match |addr|. 610 * NOTE: |feature| has to match an item defined in interop_feature_t 611 * (interop.h). 612 */ 613 void (*interop_database_add)(uint16_t feature, const RawAddress* addr, 614 size_t len); 615 616 /** 617 * Get the AvrcpTarget Service interface to interact with the Avrcp Service 618 */ 619 bluetooth::avrcp::ServiceInterface* (*get_avrcp_service)(void); 620 621 /** 622 * Obfuscate Bluetooth MAC address into a PII free ID string 623 * 624 * @param address Bluetooth MAC address to be obfuscated 625 * @return a string of uint8_t that is unique to this MAC address 626 */ 627 std::string (*obfuscate_address)(const RawAddress& address); 628 } bt_interface_t; 629 630 #define BLUETOOTH_INTERFACE_STRING "bluetoothInterface" 631 632 #endif /* ANDROID_INCLUDE_BLUETOOTH_H */ 633