2 * Copyright (C) 2012 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ANDROID_INCLUDE_BLUETOOTH_H
18 #define ANDROID_INCLUDE_BLUETOOTH_H
22 #include <sys/cdefs.h>
23 #include <sys/types.h>
25 #include <hardware/hardware.h>
30 * The Bluetooth Hardware Module ID
33 #define BT_HARDWARE_MODULE_ID "bluetooth"
34 #define BT_STACK_MODULE_ID "bluetooth"
35 #define BT_STACK_TEST_MODULE_ID "bluetooth_test"
38 /* Bluetooth profile interface IDs */
40 #define BT_PROFILE_HANDSFREE_ID "handsfree"
41 #define BT_PROFILE_HANDSFREE_CLIENT_ID "handsfree_client"
42 #define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp"
43 #define BT_PROFILE_ADVANCED_AUDIO_SINK_ID "a2dp_sink"
44 #define BT_PROFILE_HEALTH_ID "health"
45 #define BT_PROFILE_SOCKETS_ID "socket"
46 #define BT_PROFILE_HIDHOST_ID "hidhost"
47 #define BT_PROFILE_PAN_ID "pan"
48 #define BT_PROFILE_MAP_CLIENT_ID "map_client"
50 #define BT_PROFILE_GATT_ID "gatt"
51 #define BT_PROFILE_AV_RC_ID "avrcp"
52 #define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl"
54 /** Bluetooth Address */
57 } __attribute__((packed))bt_bdaddr_t;
59 /** Bluetooth Device Name */
62 } __attribute__((packed))bt_bdname_t;
64 /** Bluetooth Adapter Visibility Modes*/
67 BT_SCAN_MODE_CONNECTABLE,
68 BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
71 /** Bluetooth Adapter State */
77 /** Bluetooth Error Status */
78 /** We need to build on this */
86 BT_STATUS_DONE, /* request already completed */
87 BT_STATUS_UNSUPPORTED,
88 BT_STATUS_PARM_INVALID,
90 BT_STATUS_AUTH_FAILURE,
91 BT_STATUS_RMT_DEV_DOWN,
92 BT_STATUS_AUTH_REJECTED
96 /** Bluetooth PinKey Code */
99 } __attribute__((packed))bt_pin_code_t;
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;
110 /** Bluetooth Adapter Discovery state */
112 BT_DISCOVERY_STOPPED,
114 } bt_discovery_state_t;
116 /** Bluetooth ACL connection state */
118 BT_ACL_STATE_CONNECTED,
119 BT_ACL_STATE_DISCONNECTED
122 /** Remote Device Trusted state */
125 BT_DEVICE_NOT_TRUSTED
126 } bt_device_trust_state_t;
128 /** Bluetooth 128-bit UUID */
133 /** Bluetooth SDP service record */
138 char name[256]; // what's the maximum length
139 } bt_service_record_t;
142 /** Bluetooth Remote Version info */
148 } bt_remote_version_t;
152 uint8_t local_privacy_enabled;
153 uint8_t max_adv_instance;
154 uint8_t rpa_offload_supported;
155 uint8_t max_irk_list_size;
156 uint8_t max_adv_filter_supported;
157 uint8_t scan_result_storage_size_lobyte;
158 uint8_t scan_result_storage_size_hibyte;
159 uint8_t activity_energy_info_supported;
160 }bt_local_le_features_t;
162 /* Bluetooth Adapter and Remote Device property types */
164 /* Properties common to both adapter and remote device */
166 * Description - Bluetooth Device Name
167 * Access mode - Adapter name can be GET/SET. Remote device can be GET
168 * Data type - bt_bdname_t
170 BT_PROPERTY_BDNAME = 0x1,
172 * Description - Bluetooth Device Address
173 * Access mode - Only GET.
174 * Data type - bt_bdaddr_t
178 * Description - Bluetooth Service 128-bit UUIDs
179 * Access mode - Only GET.
180 * Data type - Array of bt_uuid_t (Array size inferred from property length).
184 * Description - Bluetooth Class of Device as found in Assigned Numbers
185 * Access mode - Only GET.
186 * Data type - uint32_t.
188 BT_PROPERTY_CLASS_OF_DEVICE,
190 * Description - Device Type - BREDR, BLE or DUAL Mode
191 * Access mode - Only GET.
192 * Data type - bt_device_type_t
194 BT_PROPERTY_TYPE_OF_DEVICE,
196 * Description - Bluetooth Service Record
197 * Access mode - Only GET.
198 * Data type - bt_service_record_t
200 BT_PROPERTY_SERVICE_RECORD,
202 /* Properties unique to adapter */
204 * Description - Bluetooth Adapter scan mode
205 * Access mode - GET and SET
206 * Data type - bt_scan_mode_t.
208 BT_PROPERTY_ADAPTER_SCAN_MODE,
210 * Description - List of bonded devices
211 * Access mode - Only GET.
212 * Data type - Array of bt_bdaddr_t of the bonded remote devices
213 * (Array size inferred from property length).
215 BT_PROPERTY_ADAPTER_BONDED_DEVICES,
217 * Description - Bluetooth Adapter Discovery timeout (in seconds)
218 * Access mode - GET and SET
219 * Data type - uint32_t
221 BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
223 /* Properties unique to remote device */
225 * Description - User defined friendly name of the remote device
226 * Access mode - GET and SET
227 * Data type - bt_bdname_t.
229 BT_PROPERTY_REMOTE_FRIENDLY_NAME,
231 * Description - RSSI value of the inquired remote device
232 * Access mode - Only GET.
233 * Data type - int32_t.
235 BT_PROPERTY_REMOTE_RSSI,
237 * Description - Remote version info
238 * Access mode - SET/GET.
239 * Data type - bt_remote_version_t.
242 BT_PROPERTY_REMOTE_VERSION_INFO,
244 /* Tizen Specific Adapter and Remote Device properties */
246 * Description - Remote Device paired Info
248 * Data type - uint8_t.
250 BT_PROPERTY_REMOTE_PAIRED,
253 * Description - Remote Device connected Info
255 * Data type - unsigned int.
257 BT_PROPERTY_REMOTE_CONNECTED,
260 * Description - Remote Device Trusted info
262 * Data type - uint8_t.
264 BT_PROPERTY_REMOTE_TRUST,
267 * Description - Adapter Pairable info
268 * Access mode - GET\SET.
269 * Data type - uint8_t
271 BT_PROPERTY_PAIRABLE,
274 * Description - Adapter pairable Timeout value
276 * Data type - uint32_t
278 BT_PROPERTY_PAIRABLE_TIMEOUT,
281 * Description - Adapter version
283 * Data type - Array of character string
288 * Description - Adapter IPSP initialized state info
290 * Data type - uint8_t
292 BT_PROPERTY_IPSP_INITIALIZED,
295 * Description - Adapter Modalias info
297 * Data type - Array of character string
299 BT_PROPERTY_MODALIAS,
302 * Description - BLE Device manufacturer data length
304 * Data type - uint32_t
306 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN,
309 * Description - BLE Device manufacturer data
311 * Data type - Array of character string
313 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA,
316 * Description - Remote BLE advertising data
317 * Access mode - Only received during device found callback.
318 * Data type - Array of uint8_t of remote BLE adv data.
319 * (Array size inferred from property length).
321 BT_PROPERTY_REMOTE_BLE_ADV_DATA,
324 * Description - Local LE features
326 * Data type - bt_local_le_features_t.
328 BT_PROPERTY_LOCAL_LE_FEATURES,
331 * Description - Remote device friendly name set?
333 * Data type - uint8_t
335 BT_PROPERTY_REMOTE_IS_ALIAS_SET,
337 BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
338 } bt_property_type_t;
340 /** Bluetooth Adapter Property data structure */
343 bt_property_type_t type;
349 /** Bluetooth Device Type */
351 BT_DEVICE_DEVTYPE_BREDR = 0x1,
352 BT_DEVICE_DEVTYPE_BLE,
353 BT_DEVICE_DEVTYPE_DUAL
355 /** Bluetooth Bond state */
358 BT_BOND_STATE_BONDING,
362 /** Bluetooth SSP Bonding Variant */
364 BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
365 BT_SSP_VARIANT_PASSKEY_ENTRY,
366 BT_SSP_VARIANT_CONSENT,
367 BT_SSP_VARIANT_PASSKEY_NOTIFICATION
370 /** Bluetooth Profile Service IDs */
372 BT_RES_SERVICE_ID, /* Reserved */
373 BT_SPP_SERVICE_ID, /* Serial port profile. */
374 BT_DUN_SERVICE_ID, /* Dial-up networking profile. */
375 BT_A2DP_SRC_SERVICE_ID, /* A2DP Source profile. */
376 BT_LAP_SERVICE_ID, /* LAN access profile. */
377 BT_HSP_SERVICE_ID, /* Headset profile. */
378 BT_HFP_SERVICE_ID, /* Hands-free profile. */
379 BT_OPP_SERVICE_ID, /* Object push */
380 BT_FTP_SERVICE_ID, /* File transfer */
381 BT_AVRCP_CT_SERVICE_ID, /* AVRC Controller Terminal */
382 BT_ICP_SERVICE_ID, /* Intercom Terminal */
383 BT_SYNC_SERVICE_ID, /* Synchronization */
384 BT_BPP_SERVICE_ID, /* Basic printing profile */
385 BT_BIP_SERVICE_ID, /* Basic Imaging profile */
386 BT_PANU_SERVICE_ID, /* PAN User */
387 BT_NAP_SERVICE_ID, /* PAN Network access point */
388 BT_GN_SERVICE_ID, /* PAN Group Ad-hoc networks */
389 BT_SAP_SERVICE_ID, /* SIM Access profile */
390 BT_A2DP_SERVICE_ID, /* A2DP Sink */
391 BT_AVRCP_SERVICE_ID, /* A/V remote control */
392 BT_HID_SERVICE_ID, /* HID */
393 BT_VDP_SERVICE_ID, /* Video distribution */
394 BT_PBAP_SERVICE_ID, /* PhoneBook Access Server*/
395 BT_HSP_HS_SERVICE_ID, /* HFP HS role */
396 BT_HFP_HS_SERVICE_ID, /* HSP HS role */
397 BT_MAP_SERVICE_ID, /* Message Access Profile */
398 BT_MN_SERVICE_ID, /* Message Notification Service */
399 BT_HDP_SERVICE_ID, /* Health Device Profile */
400 BT_PCE_SERVICE_ID, /* PhoneBook Access Client*/
402 BT_IOTIVITY_SERVICE_ID, /* Custom IOTIVITY UUID */
406 #define BT_MAX_NUM_UUIDS 32
409 #define BT_OSP_SERVER_OBEX 0x00
410 /* TODO: Add more types If and when required */
411 #define BT_OSP_SERVER_MAX 0xFF
413 /* Tizen BT discovery Types */
415 BT_DISC_ROLE_BREDR = 0x01,
418 } bt_disc_role_type_t;
420 /** Bluetooth Trusted Profiles */
422 BT_TRUSTED_PROFILE_PBAP = 1,
423 BT_TRUSTED_PROFILE_MAP,
424 BT_TRUSTED_PROFILE_SAP,
425 BT_TRUSTED_PROFILE_HFP_HF,
426 BT_TRUSTED_PROFILE_A2DP,
427 BT_TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
428 } bt_trusted_profile_t;
430 /** Bluetooth Bonding Authentication Notifications */
432 BT_PASSKEY_CONFIRMATION = 1,
436 } bt_gap_auth_variant_t;
439 /** Bluetooth Interface callbacks */
441 /** Bluetooth Enable/Disable Callback. */
442 typedef void (*adapter_state_changed_callback)(bt_state_t state);
445 /** BLE Enable/Disable Callback. */
446 typedef void (*le_state_changed_callback)(bt_state_t state);
449 /** GET/SET Adapter Properties callback */
450 /* TODO: For the GET/SET property APIs/callbacks, we may need a session
451 * identifier to associate the call with the callback. This would be needed
452 * whenever more than one simultaneous instance of the same adapter_type
455 * If this is going to be handled in the Java framework, then we do not need
456 * to manage sessions here.
458 typedef void (*adapter_properties_callback)(bt_status_t status,
460 bt_property_t *properties);
462 /** GET/SET Remote Device Properties callback */
463 /** TODO: For remote device properties, do not see a need to get/set
464 * multiple properties - num_properties shall be 1
466 typedef void (*remote_device_properties_callback)(bt_status_t status,
467 bt_bdaddr_t *bd_addr,
469 bt_property_t *properties);
471 /** New device discovered callback */
472 /** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
474 typedef void (*device_found_callback)(int num_properties,
475 bt_property_t *properties);
477 /** Discovery state changed callback */
478 typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
480 /** Bluetooth Legacy PinKey Request callback */
481 typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
482 bt_bdname_t *bd_name, uint32_t cod);
484 /** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
485 /** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
486 * BT_SSP_PAIRING_PASSKEY_ENTRY */
487 /* TODO: Passkey request callback shall not be needed for devices with display
488 * capability. We still need support this in the stack for completeness */
489 typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
490 bt_bdname_t *bd_name,
492 bt_ssp_variant_t pairing_variant,
495 /** Bluetooth Bond state changed callback */
496 /* Invoked in response to create_bond, cancel_bond or remove_bond */
497 typedef void (*bond_state_changed_callback)(bt_status_t status,
498 bt_bdaddr_t *remote_bd_addr,
499 bt_bond_state_t state);
501 /** Bluetooth ACL connection state changed callback */
502 typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
503 bt_acl_state_t state);
510 /** Thread Associate/Disassociate JVM Callback */
511 /* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
513 typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
515 /** Bluetooth Test Mode Callback */
516 /* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
517 typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
519 /* LE Test mode callbacks
520 * This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
521 * The num_packets is valid only for le_test_end command */
522 typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
524 /** Callback invoked when energy details are obtained */
525 /* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
526 * If the ctrl_state value is 0, it means the API call failed
527 * Time values-In milliseconds as returned by the controller
528 * Energy used-Value as returned by the controller
529 * Status-Provides the status of the read_energy_info API call */
530 typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
532 /* Service level Authorization request callback */
533 typedef void (*authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
536 /* Service level Authorization request callback */
537 typedef void (*sock_authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
539 /** Bluetooth ACL connection state */
541 BT_LE_CONN_STATE_CONNECTED,
542 BT_LE_CONN_STATE_DISCONNECTED
543 } bt_le_conn_state_t;
545 /** Bluetooth ACL connection state changed callback */
546 typedef void (*le_conn_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
547 bt_le_conn_state_t state);
549 /** Remote device trusted profiles changed callback */
550 typedef void (*device_trusted_profiles_changed_callback)(bt_bdaddr_t *bd_addr, uint32_t trust_val);
552 /** Remote device RSSI monitoring state changed callback */
553 typedef void (*rssi_monitor_state_changed_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, uint8_t state);
555 /** Remote device RSSI alert callback */
556 typedef void (*rssi_alert_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
558 /** Remote device Raw RSSI received callback */
559 typedef void (*raw_rssi_received_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
562 /** TODO: Add callbacks for Link Up/Down and other generic
563 * notifications/callbacks */
565 /** Remote Device Trust state changed callback */
566 typedef void (*device_trust_state_changed_callback)(bt_bdaddr_t *remote_bd_addr,
567 bt_device_trust_state_t trust);
569 /** Bluetooth DM callback structure. */
571 /** set to sizeof(bt_callbacks_t) */
573 adapter_state_changed_callback adapter_state_changed_cb;
574 adapter_properties_callback adapter_properties_cb;
575 remote_device_properties_callback remote_device_properties_cb;
576 device_found_callback device_found_cb;
577 discovery_state_changed_callback discovery_state_changed_cb;
578 pin_request_callback pin_request_cb;
579 ssp_request_callback ssp_request_cb;
580 bond_state_changed_callback bond_state_changed_cb;
581 acl_state_changed_callback acl_state_changed_cb;
582 callback_thread_event thread_evt_cb;
583 dut_mode_recv_callback dut_mode_recv_cb;
584 le_test_mode_callback le_test_mode_cb;
585 energy_info_callback energy_info_cb;
586 authorize_request_callback authorize_request_cb;
587 device_trust_state_changed_callback device_trust_state_changed_cb;
589 sock_authorize_request_callback socket_authorize_request_cb;
590 le_state_changed_callback le_state_changed_cb;
591 le_conn_state_changed_callback le_conn_state_changed_cb;
592 device_trusted_profiles_changed_callback device_trusted_profiles_changed_cb;
593 rssi_monitor_state_changed_callback rssi_monitor_state_changed_cb;
594 rssi_alert_callback rssi_alert_cb;
595 raw_rssi_received_callback raw_rssi_received_cb;
599 typedef void (*alarm_cb)(void *data);
600 typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data);
601 typedef int (*acquire_wake_lock_callout)(const char *lock_name);
602 typedef int (*release_wake_lock_callout)(const char *lock_name);
604 /** The set of functions required by bluedroid to set wake alarms and
605 * grab wake locks. This struct is passed into the stack through the
606 * |set_os_callouts| function on |bt_interface_t|.
609 /* set to sizeof(bt_os_callouts_t) */
612 set_wake_alarm_callout set_wake_alarm;
613 acquire_wake_lock_callout acquire_wake_lock;
614 release_wake_lock_callout release_wake_lock;
617 /** NOTE: By default, no profiles are initialized at the time of init/enable.
618 * Whenever the application invokes the 'init' API of a profile, then one of
619 * the following shall occur:
621 * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
622 * profile as enabled. Subsequently, when the application invokes the
623 * Bluetooth 'enable', as part of the enable sequence the profile that were
624 * marked shall be enabled by calling appropriate stack APIs. The
625 * 'adapter_properties_cb' shall return the list of UUIDs of the
628 * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
629 * profile API to initialize the profile and trigger a
630 * 'adapter_properties_cb' with the current list of UUIDs including the
631 * newly added profile's UUID.
633 * The reverse shall occur whenever the profile 'cleanup' APIs are invoked
636 /** Represents the standard Bluetooth DM interface. */
638 /** set to sizeof(bt_interface_t) */
641 * Opens the interface and provides the callback routines
642 * to the implemenation of this interface.
644 int (*init)(bt_callbacks_t* callbacks );
646 /** Enable Bluetooth. */
649 /** Disable Bluetooth. */
650 int (*disable)(void);
653 /** Reset Bluetooth. */
658 /** Enable LE Bluetooth. */
659 int (*le_enable)(void);
661 /** Disable LE Bluetooth. */
662 int (*le_disable)(void);
664 int (*le_init)(void);
666 void (*le_deinit)(void);
669 /** Closes the interface. */
670 void (*cleanup)(void);
673 /** Get Bluetooth Adapter Powered status */
674 int (*get_adapter_powered_status)(uint8_t *status);
677 /** Get all Bluetooth Adapter properties at init */
678 int (*get_adapter_properties)(void);
680 /** Get Bluetooth Adapter property of 'type' */
681 int (*get_adapter_property)(bt_property_type_t type);
683 /** Set Bluetooth Adapter property of 'type' */
684 /* Based on the type, val shall be one of
685 * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
687 int (*set_adapter_property)(const bt_property_t *property);
689 /** Get all Remote Device properties */
690 int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
692 /** Get Remote Device property of 'type' */
693 int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
694 bt_property_type_t type);
696 /** Set Remote Device property of 'type' */
697 int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
698 const bt_property_t *property);
700 /** Get Remote Device's service record for the given UUID */
701 int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
704 /** Start SDP to get remote services */
705 int (*get_remote_services)(bt_bdaddr_t *remote_addr);
707 /** Start Discovery */
708 int (*start_discovery)(void);
711 int (*start_custom_discovery)(bt_disc_role_type_t disc_type);
714 /** Cancel Discovery */
715 int (*cancel_discovery)(void);
717 /** Create Bluetooth Bonding */
718 int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
721 int (*remove_bond)(const bt_bdaddr_t *bd_addr);
724 int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
727 * Get the connection status for a given remote device.
728 * return value of 0 means the device is not connected,
729 * non-zero return status indicates an active connection.
731 int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
733 /** BT Legacy PinKey Reply */
734 /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
735 int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
736 uint8_t pin_len, bt_pin_code_t *pin_code);
738 /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
739 * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
740 * BT_SSP_VARIANT_CONSENT
741 * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
743 int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
744 uint8_t accept, uint32_t passkey);
746 /** Get Bluetooth profile interface */
747 const void* (*get_profile_interface) (const char *profile_id);
749 /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
750 /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
751 int (*dut_mode_configure)(uint8_t enable);
753 /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
754 int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
755 /** BLE Test Mode APIs */
756 /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
757 int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
759 /* enable or disable bluetooth HCI snoop log */
760 int (*config_hci_snoop_log)(uint8_t enable);
762 /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
763 * This should be called immediately after a successful |init|.
765 int (*set_os_callouts)(bt_os_callouts_t *callouts);
767 /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
768 * Success indicates that the VSC command was sent to controller
770 int (*read_energy_info)();
772 /* Tizen Specific: Send service level Authorization response */
773 int (*authorize_response)(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
774 uint8_t authorize, uint8_t save_settings);
776 /** Set auto authorization for peer device. Should be a paired device */
777 int (*set_authorization)(bt_bdaddr_t *bd_addr, uint8_t auth);
780 * get the service connection status for a given remote device.
781 * return value of 0 means the device is not connected,
782 * non-zero return status indicates an active connection.
784 int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
787 * Enable/Disable osp server in gap agent.
788 * enable == 0/1 -> Register/Unregister osp server.
790 int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
793 * Set profile as trusted for remote device
795 int (*set_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust);
798 * Get profile trusted status for remote device
800 int (*get_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint32_t *trusted);
803 * Get raw RSSI strength of remote device for connected link type
804 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
806 int (*get_connected_link_rssi_strength)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type);
809 * Enable RSSI monitoring of remote device for connected link type
810 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
811 * Threshold : (low_threshold, in_range_threshold, high_threshold)
813 int (*enable_rssi_monitoring)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
814 int low_threshold, int in_range_threshold, int high_threshold);
816 * Enable/Disable GAP authentication notification to application
817 * enable == 0/1 -> Enable/Disable notification sending
818 * type == value from bt_gap_auth_variant_t
820 int (*enable_gap_auth_notifications)(uint32_t type, uint8_t enable);
825 /** TODO: Need to add APIs for Service Discovery, Service authorization and
826 * connection management. Also need to add APIs for configuring
827 * properties of remote bonded devices such as name, UUID etc. */
830 struct hw_device_t common;
831 const bt_interface_t* (*get_bluetooth_interface)();
832 } bluetooth_device_t;
834 typedef bluetooth_device_t bluetooth_module_t;
837 #endif /* ANDROID_INCLUDE_BLUETOOTH_H */