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,
93 BT_STATUS_CONN_TOUT /* disconnection due to supervision timeout */
95 BT_STATUS_CONN_TOUT, /* disconnection due to supervision timeout */
96 BT_STATUS_AUTH_REJECTED,
97 BT_STATUS_CONN_TERM_LOCAL_HOST,
98 BT_STATUS_CONN_TERM_RMT_HOST
102 /** Bluetooth PinKey Code */
105 } __attribute__((packed))bt_pin_code_t;
109 uint8_t ctrl_state; /* stack reported state */
110 uint64_t tx_time; /* in ms */
111 uint64_t rx_time; /* in ms */
112 uint64_t idle_time; /* in ms */
113 uint64_t energy_used; /* a product of mA, V and ms */
114 } __attribute__((packed))bt_activity_energy_info;
116 /** Bluetooth Adapter Discovery state */
118 BT_DISCOVERY_STOPPED,
120 } bt_discovery_state_t;
122 /** Bluetooth ACL connection state */
124 BT_ACL_STATE_CONNECTED,
125 BT_ACL_STATE_DISCONNECTED
128 /** Remote Device Trusted state */
131 BT_DEVICE_NOT_TRUSTED
132 } bt_device_trust_state_t;
134 /** Bluetooth 128-bit UUID */
139 /** Bluetooth SDP service record */
143 char name[256]; // what's the maximum length
144 } bt_service_record_t;
147 /** Bluetooth Remote Version info */
152 } bt_remote_version_t;
156 uint16_t version_supported;
157 uint8_t local_privacy_enabled;
158 uint8_t max_adv_instance;
159 uint8_t rpa_offload_supported;
160 uint8_t max_irk_list_size;
161 uint8_t max_adv_filter_supported;
162 uint8_t activity_energy_info_supported;
163 uint16_t scan_result_storage_size;
164 uint16_t total_trackable_advertisers;
165 bool extended_scan_support;
166 bool debug_logging_supported;
167 bool le_2m_phy_supported;
168 bool le_coded_phy_supported;
169 bool le_extended_advertising_supported;
170 bool le_periodic_advertising_supported;
171 uint16_t le_maximum_advertising_data_length;
172 } bt_local_le_features_t;
176 uint8_t local_privacy_enabled;
177 uint8_t max_adv_instance;
178 uint8_t rpa_offload_supported;
179 uint8_t max_irk_list_size;
180 uint8_t max_adv_filter_supported;
181 uint8_t scan_result_storage_size_lobyte;
182 uint8_t scan_result_storage_size_hibyte;
183 uint8_t activity_energy_info_supported;
184 } bt_local_le_features_t;*/
186 /* Bluetooth Adapter and Remote Device property types */
188 /* Properties common to both adapter and remote device */
190 * Description - Bluetooth Device Name
191 * Access mode - Adapter name can be GET/SET. Remote device can be GET
192 * Data type - bt_bdname_t
194 BT_PROPERTY_BDNAME = 0x1,
196 * Description - Bluetooth Device Address
197 * Access mode - Only GET.
198 * Data type - bt_bdaddr_t
202 * Description - Bluetooth Service 128-bit UUIDs
203 * Access mode - Only GET.
204 * Data type - Array of bt_uuid_t (Array size inferred from property length).
208 * Description - Bluetooth Class of Device as found in Assigned Numbers
209 * Access mode - Only GET.
210 * Data type - uint32_t.
212 BT_PROPERTY_CLASS_OF_DEVICE,
214 * Description - Device Type - BREDR, BLE or DUAL Mode
215 * Access mode - Only GET.
216 * Data type - bt_device_type_t
218 BT_PROPERTY_TYPE_OF_DEVICE,
220 * Description - Bluetooth Service Record
221 * Access mode - Only GET.
222 * Data type - bt_service_record_t
224 BT_PROPERTY_SERVICE_RECORD,
226 /* Properties unique to adapter */
228 * Description - Bluetooth Adapter scan mode
229 * Access mode - GET and SET
230 * Data type - bt_scan_mode_t.
232 BT_PROPERTY_ADAPTER_SCAN_MODE,
234 * Description - List of bonded devices
235 * Access mode - Only GET.
236 * Data type - Array of bt_bdaddr_t of the bonded remote devices
237 * (Array size inferred from property length).
239 BT_PROPERTY_ADAPTER_BONDED_DEVICES,
241 * Description - Bluetooth Adapter Discovery timeout (in seconds)
242 * Access mode - GET and SET
243 * Data type - uint32_t
245 BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
247 /* Properties unique to remote device */
249 * Description - User defined friendly name of the remote device
250 * Access mode - GET and SET
251 * Data type - bt_bdname_t.
253 BT_PROPERTY_REMOTE_FRIENDLY_NAME,
255 * Description - RSSI value of the inquired remote device
256 * Access mode - Only GET.
257 * Data type - int32_t.
259 BT_PROPERTY_REMOTE_RSSI,
261 * Description - Remote version info
262 * Access mode - SET/GET.
263 * Data type - bt_remote_version_t.
266 BT_PROPERTY_REMOTE_VERSION_INFO,
268 /* Tizen Specific Adapter and Remote Device properties */
270 * Description - Remote Device paired Info
272 * Data type - uint8_t.
274 BT_PROPERTY_REMOTE_PAIRED,
277 * Description - Remote Device connected Info
279 * Data type - unsigned int.
281 BT_PROPERTY_REMOTE_CONNECTED,
284 * Description - Remote Device Trusted info
286 * Data type - uint8_t.
288 BT_PROPERTY_REMOTE_TRUST,
291 * Description - Adapter Pairable info
292 * Access mode - GET\SET.
293 * Data type - uint8_t
295 BT_PROPERTY_PAIRABLE,
298 * Description - Adapter pairable Timeout value
300 * Data type - uint32_t
302 BT_PROPERTY_PAIRABLE_TIMEOUT,
305 * Description - Adapter version
307 * Data type - Array of character string
312 * Description - Adapter IPSP initialized state info
314 * Data type - uint8_t
316 BT_PROPERTY_IPSP_INITIALIZED,
319 * Description - Adapter Modalias info
321 * Data type - Array of character string
323 BT_PROPERTY_MODALIAS,
326 * Description - BLE Device manufacturer data length
328 * Data type - uint32_t
330 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN,
333 * Description - BLE Device manufacturer data
335 * Data type - Array of character string
337 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA,
340 * Description - Remote BLE advertising data
341 * Access mode - Only received during device found callback.
342 * Data type - Array of uint8_t of remote BLE adv data.
343 * (Array size inferred from property length).
345 BT_PROPERTY_REMOTE_BLE_ADV_DATA,
348 * Description - Local LE features
350 * Data type - bt_local_le_features_t.
352 BT_PROPERTY_LOCAL_LE_FEATURES,
355 * Description - Remote device friendly name set?
357 * Data type - uint8_t
359 BT_PROPERTY_REMOTE_IS_ALIAS_SET,
361 BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
362 } bt_property_type_t;
364 /** Bluetooth Adapter Property data structure */
366 bt_property_type_t type;
372 /** Bluetooth Device Type */
374 BT_DEVICE_DEVTYPE_BREDR = 0x1,
375 BT_DEVICE_DEVTYPE_BLE,
376 BT_DEVICE_DEVTYPE_DUAL
378 /** Bluetooth Bond state */
381 BT_BOND_STATE_BONDING,
385 /** Bluetooth SSP Bonding Variant */
387 BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
388 BT_SSP_VARIANT_PASSKEY_ENTRY,
389 BT_SSP_VARIANT_CONSENT,
390 BT_SSP_VARIANT_PASSKEY_NOTIFICATION
393 /** Bluetooth Profile Service IDs */
395 BT_RES_SERVICE_ID, /* Reserved */
396 BT_SPP_SERVICE_ID, /* Serial port profile. */
397 BT_DUN_SERVICE_ID, /* Dial-up networking profile. */
398 BT_A2DP_SRC_SERVICE_ID, /* A2DP Source profile. */
399 BT_LAP_SERVICE_ID, /* LAN access profile. */
400 BT_HSP_SERVICE_ID, /* Headset profile. */
401 BT_HFP_SERVICE_ID, /* Hands-free profile. */
402 BT_OPP_SERVICE_ID, /* Object push */
403 BT_FTP_SERVICE_ID, /* File transfer */
404 BT_AVRCP_CT_SERVICE_ID, /* AVRC Controller Terminal */
405 BT_ICP_SERVICE_ID, /* Intercom Terminal */
406 BT_SYNC_SERVICE_ID, /* Synchronization */
407 BT_BPP_SERVICE_ID, /* Basic printing profile */
408 BT_BIP_SERVICE_ID, /* Basic Imaging profile */
409 BT_PANU_SERVICE_ID, /* PAN User */
410 BT_NAP_SERVICE_ID, /* PAN Network access point */
411 BT_GN_SERVICE_ID, /* PAN Group Ad-hoc networks */
412 BT_SAP_SERVICE_ID, /* SIM Access profile */
413 BT_A2DP_SERVICE_ID, /* A2DP Sink */
414 BT_AVRCP_SERVICE_ID, /* A/V remote control */
415 BT_HID_SERVICE_ID, /* HID */
416 BT_VDP_SERVICE_ID, /* Video distribution */
417 BT_PBAP_SERVICE_ID, /* PhoneBook Access Server*/
418 BT_HSP_HS_SERVICE_ID, /* HFP HS role */
419 BT_HFP_HS_SERVICE_ID, /* HSP HS role */
420 BT_MAP_SERVICE_ID, /* Message Access Profile */
421 BT_MN_SERVICE_ID, /* Message Notification Service */
422 BT_HDP_SERVICE_ID, /* Health Device Profile */
423 BT_PCE_SERVICE_ID, /* PhoneBook Access Client*/
425 BT_IOTIVITY_SERVICE_ID, /* Custom IOTIVITY UUID */
429 #define BT_MAX_NUM_UUIDS 32
432 #define BT_OSP_SERVER_OBEX 0x00
433 /* TODO: Add more types If and when required */
434 #define BT_OSP_SERVER_MAX 0xFF
436 /* Tizen BT discovery Types */
438 BT_DISC_ROLE_BREDR = 0x01,
441 } bt_disc_role_type_t;
443 /** Bluetooth Trusted Profiles */
445 BT_TRUSTED_PROFILE_PBAP = 1,
446 BT_TRUSTED_PROFILE_MAP,
447 BT_TRUSTED_PROFILE_SAP,
448 BT_TRUSTED_PROFILE_HFP_HF,
449 BT_TRUSTED_PROFILE_A2DP,
450 BT_TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
451 } bt_trusted_profile_t;
453 /** Bluetooth Bonding Authentication Notifications */
455 BT_PASSKEY_CONFIRMATION = 1,
459 } bt_gap_auth_variant_t;
462 /** Bluetooth Interface callbacks */
464 /** Bluetooth Enable/Disable Callback. */
465 typedef void (*adapter_state_changed_callback)(bt_state_t state);
468 /** BLE Enable/Disable Callback. */
469 typedef void (*le_state_changed_callback)(bt_state_t state);
472 /** GET/SET Adapter Properties callback */
473 /* TODO: For the GET/SET property APIs/callbacks, we may need a session
474 * identifier to associate the call with the callback. This would be needed
475 * whenever more than one simultaneous instance of the same adapter_type
478 * If this is going to be handled in the Java framework, then we do not need
479 * to manage sessions here.
481 typedef void (*adapter_properties_callback)(bt_status_t status,
483 bt_property_t *properties);
485 /** GET/SET Remote Device Properties callback */
486 /** TODO: For remote device properties, do not see a need to get/set
487 * multiple properties - num_properties shall be 1
489 typedef void (*remote_device_properties_callback)(bt_status_t status,
490 bt_bdaddr_t *bd_addr,
492 bt_property_t *properties);
494 /** New device discovered callback */
495 /** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
497 typedef void (*device_found_callback)(int num_properties,
498 bt_property_t *properties);
500 /** Discovery state changed callback */
501 typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
503 /** Bluetooth Legacy PinKey Request callback */
504 typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
505 bt_bdname_t *bd_name, uint32_t cod);
507 /** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
508 /** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
509 * BT_SSP_PAIRING_PASSKEY_ENTRY */
510 /* TODO: Passkey request callback shall not be needed for devices with display
511 * capability. We still need support this in the stack for completeness */
512 typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
513 bt_bdname_t *bd_name,
515 bt_ssp_variant_t pairing_variant,
518 /** Bluetooth Bond state changed callback */
519 /* Invoked in response to create_bond, cancel_bond or remove_bond */
520 typedef void (*bond_state_changed_callback)(bt_status_t status,
521 bt_bdaddr_t *remote_bd_addr,
522 bt_bond_state_t state);
524 /** Bluetooth ACL connection state changed callback */
525 typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
526 bt_acl_state_t state);
533 /** Thread Associate/Disassociate JVM Callback */
534 /* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
536 typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
538 /** Bluetooth Test Mode Callback */
539 /* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
540 typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
542 /* LE Test mode callbacks
543 * This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
544 * The num_packets is valid only for le_test_end command */
545 typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
547 /** Callback invoked when energy details are obtained */
548 /* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
549 * If the ctrl_state value is 0, it means the API call failed
550 * Time values-In milliseconds as returned by the controller
551 * Energy used-Value as returned by the controller
552 * Status-Provides the status of the read_energy_info API call */
553 typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
555 /* Service level Authorization request callback */
556 typedef void (*authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
559 /* Service level Authorization request callback */
560 typedef void (*sock_authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
562 /** Bluetooth ACL connection state */
564 BT_LE_CONN_STATE_CONNECTED,
565 BT_LE_CONN_STATE_DISCONNECTED
566 } bt_le_conn_state_t;
568 /** Bluetooth ACL connection state changed callback */
569 typedef void (*le_conn_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
570 bt_le_conn_state_t state);
572 /** Remote device trusted profiles changed callback */
573 typedef void (*device_trusted_profiles_changed_callback)(bt_bdaddr_t *bd_addr, uint32_t trust_val);
575 /** Remote device RSSI monitoring state changed callback */
576 typedef void (*rssi_monitor_state_changed_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, uint8_t state);
578 /** Remote device RSSI alert callback */
579 typedef void (*rssi_alert_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
581 /** Remote device Raw RSSI received callback */
582 typedef void (*raw_rssi_received_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
585 /** TODO: Add callbacks for Link Up/Down and other generic
586 * notifications/callbacks */
588 /** Remote Device Trust state changed callback */
589 typedef void (*device_trust_state_changed_callback)(bt_bdaddr_t *remote_bd_addr,
590 bt_device_trust_state_t trust);
592 /** Bluetooth DM callback structure. */
594 /** set to sizeof(bt_callbacks_t) */
596 adapter_state_changed_callback adapter_state_changed_cb;
597 adapter_properties_callback adapter_properties_cb;
598 remote_device_properties_callback remote_device_properties_cb;
599 device_found_callback device_found_cb;
600 discovery_state_changed_callback discovery_state_changed_cb;
601 pin_request_callback pin_request_cb;
602 ssp_request_callback ssp_request_cb;
603 bond_state_changed_callback bond_state_changed_cb;
604 acl_state_changed_callback acl_state_changed_cb;
605 callback_thread_event thread_evt_cb;
606 dut_mode_recv_callback dut_mode_recv_cb;
607 le_test_mode_callback le_test_mode_cb;
608 energy_info_callback energy_info_cb;
609 authorize_request_callback authorize_request_cb;
610 device_trust_state_changed_callback device_trust_state_changed_cb;
612 sock_authorize_request_callback socket_authorize_request_cb;
613 le_state_changed_callback le_state_changed_cb;
614 le_conn_state_changed_callback le_conn_state_changed_cb;
615 device_trusted_profiles_changed_callback device_trusted_profiles_changed_cb;
616 rssi_monitor_state_changed_callback rssi_monitor_state_changed_cb;
617 rssi_alert_callback rssi_alert_cb;
618 raw_rssi_received_callback raw_rssi_received_cb;
622 typedef void (*alarm_cb)(void *data);
623 typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data);
624 typedef int (*acquire_wake_lock_callout)(const char *lock_name);
625 typedef int (*release_wake_lock_callout)(const char *lock_name);
627 /** The set of functions required by bluedroid to set wake alarms and
628 * grab wake locks. This struct is passed into the stack through the
629 * |set_os_callouts| function on |bt_interface_t|.
632 /* set to sizeof(bt_os_callouts_t) */
635 set_wake_alarm_callout set_wake_alarm;
636 acquire_wake_lock_callout acquire_wake_lock;
637 release_wake_lock_callout release_wake_lock;
640 /** NOTE: By default, no profiles are initialized at the time of init/enable.
641 * Whenever the application invokes the 'init' API of a profile, then one of
642 * the following shall occur:
644 * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
645 * profile as enabled. Subsequently, when the application invokes the
646 * Bluetooth 'enable', as part of the enable sequence the profile that were
647 * marked shall be enabled by calling appropriate stack APIs. The
648 * 'adapter_properties_cb' shall return the list of UUIDs of the
651 * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
652 * profile API to initialize the profile and trigger a
653 * 'adapter_properties_cb' with the current list of UUIDs including the
654 * newly added profile's UUID.
656 * The reverse shall occur whenever the profile 'cleanup' APIs are invoked
659 /** Represents the standard Bluetooth DM interface. */
661 /** set to sizeof(bt_interface_t) */
664 * Opens the interface and provides the callback routines
665 * to the implemenation of this interface.
667 int (*init)(bt_callbacks_t*callbacks);
669 /** Enable Bluetooth. */
672 /** Disable Bluetooth. */
673 int (*disable)(void);
676 /** Reset Bluetooth. */
681 /** Enable LE Bluetooth. */
682 int (*le_enable)(void);
684 /** Disable LE Bluetooth. */
685 int (*le_disable)(void);
687 int (*le_init)(void);
689 void (*le_deinit)(void);
691 int (*is_advertising) (void);
694 /** Closes the interface. */
695 void (*cleanup)(void);
698 /** Get Bluetooth Adapter Powered status */
699 int (*get_adapter_powered_status)(uint8_t *status);
702 /** Get all Bluetooth Adapter properties at init */
703 int (*get_adapter_properties)(void);
705 /** Get Bluetooth Adapter property of 'type' */
706 int (*get_adapter_property)(bt_property_type_t type);
708 /** Set Bluetooth Adapter property of 'type' */
709 /* Based on the type, val shall be one of
710 * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
712 int (*set_adapter_property)(const bt_property_t *property);
714 /** Get all Remote Device properties */
715 int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
717 /** Get Remote Device property of 'type' */
718 int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
719 bt_property_type_t type);
721 /** Set Remote Device property of 'type' */
722 int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
723 const bt_property_t *property);
725 /** Get Remote Device's service record for the given UUID */
726 int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
729 /** Start SDP to get remote services */
730 int (*get_remote_services)(bt_bdaddr_t *remote_addr);
732 /** Start Discovery */
733 int (*start_discovery)(void);
736 int (*start_custom_discovery)(bt_disc_role_type_t disc_type);
739 /** Cancel Discovery */
740 int (*cancel_discovery)(void);
742 /** Create Bluetooth Bonding */
743 int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
746 int (*remove_bond)(const bt_bdaddr_t *bd_addr);
749 int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
752 * Get the connection status for a given remote device.
753 * return value of 0 means the device is not connected,
754 * non-zero return status indicates an active connection.
756 int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
758 /** BT Legacy PinKey Reply */
759 /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
760 int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
761 uint8_t pin_len, bt_pin_code_t *pin_code);
763 /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
764 * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
765 * BT_SSP_VARIANT_CONSENT
766 * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
768 int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
769 uint8_t accept, uint32_t passkey);
771 /** Get Bluetooth profile interface */
772 const void* (*get_profile_interface) (const char *profile_id);
774 /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
775 /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
776 int (*dut_mode_configure)(uint8_t enable);
778 /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
779 int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
780 /** BLE Test Mode APIs */
781 /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
782 int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
784 /* enable or disable bluetooth HCI snoop log */
785 int (*config_hci_snoop_log)(uint8_t enable);
787 /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
788 * This should be called immediately after a successful |init|.
790 int (*set_os_callouts)(bt_os_callouts_t *callouts);
792 /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
793 * Success indicates that the VSC command was sent to controller
795 int (*read_energy_info)();
797 /* Tizen Specific: Send service level Authorization response */
798 int (*authorize_response)(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
799 uint8_t authorize, uint8_t save_settings);
801 /** Set auto authorization for peer device. Should be a paired device */
802 int (*set_authorization)(bt_bdaddr_t *bd_addr, uint8_t auth);
805 * get the service connection status for a given remote device.
806 * return value of 0 means the device is not connected,
807 * non-zero return status indicates an active connection.
809 int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
812 * Enable/Disable osp server in gap agent.
813 * enable == 0/1 -> Register/Unregister osp server.
815 int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
818 * Set profile as trusted for remote device
820 int (*set_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust);
823 * Get profile trusted status for remote device
825 int (*get_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint32_t *trusted);
828 * Get raw RSSI strength of remote device for connected link type
829 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
831 int (*get_connected_link_rssi_strength)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type);
834 * Enable RSSI monitoring of remote device for connected link type
835 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
836 * Threshold : (low_threshold, in_range_threshold, high_threshold)
838 int (*enable_rssi_monitoring)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
839 int low_threshold, int in_range_threshold, int high_threshold);
841 * Enable/Disable GAP authentication notification to application
842 * enable == 0/1 -> Enable/Disable notification sending
843 * type == value from bt_gap_auth_variant_t
845 int (*enable_gap_auth_notifications)(uint32_t type, uint8_t enable);
850 /** TODO: Need to add APIs for Service Discovery, Service authorization and
851 * connection management. Also need to add APIs for configuring
852 * properties of remote bonded devices such as name, UUID etc. */
855 struct hw_device_t common;
856 const bt_interface_t* (*get_bluetooth_interface)();
857 } bluetooth_device_t;
859 typedef bluetooth_device_t bluetooth_module_t;
862 #endif /* ANDROID_INCLUDE_BLUETOOTH_H */