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 */
137 char name[256]; // what's the maximum length
138 } bt_service_record_t;
141 /** Bluetooth Remote Version info */
146 } bt_remote_version_t;
149 uint8_t local_privacy_enabled;
150 uint8_t max_adv_instance;
151 uint8_t rpa_offload_supported;
152 uint8_t max_irk_list_size;
153 uint8_t max_adv_filter_supported;
154 uint8_t scan_result_storage_size_lobyte;
155 uint8_t scan_result_storage_size_hibyte;
156 uint8_t activity_energy_info_supported;
157 } bt_local_le_features_t;
159 /* Bluetooth Adapter and Remote Device property types */
161 /* Properties common to both adapter and remote device */
163 * Description - Bluetooth Device Name
164 * Access mode - Adapter name can be GET/SET. Remote device can be GET
165 * Data type - bt_bdname_t
167 BT_PROPERTY_BDNAME = 0x1,
169 * Description - Bluetooth Device Address
170 * Access mode - Only GET.
171 * Data type - bt_bdaddr_t
175 * Description - Bluetooth Service 128-bit UUIDs
176 * Access mode - Only GET.
177 * Data type - Array of bt_uuid_t (Array size inferred from property length).
181 * Description - Bluetooth Class of Device as found in Assigned Numbers
182 * Access mode - Only GET.
183 * Data type - uint32_t.
185 BT_PROPERTY_CLASS_OF_DEVICE,
187 * Description - Device Type - BREDR, BLE or DUAL Mode
188 * Access mode - Only GET.
189 * Data type - bt_device_type_t
191 BT_PROPERTY_TYPE_OF_DEVICE,
193 * Description - Bluetooth Service Record
194 * Access mode - Only GET.
195 * Data type - bt_service_record_t
197 BT_PROPERTY_SERVICE_RECORD,
199 /* Properties unique to adapter */
201 * Description - Bluetooth Adapter scan mode
202 * Access mode - GET and SET
203 * Data type - bt_scan_mode_t.
205 BT_PROPERTY_ADAPTER_SCAN_MODE,
207 * Description - List of bonded devices
208 * Access mode - Only GET.
209 * Data type - Array of bt_bdaddr_t of the bonded remote devices
210 * (Array size inferred from property length).
212 BT_PROPERTY_ADAPTER_BONDED_DEVICES,
214 * Description - Bluetooth Adapter Discovery timeout (in seconds)
215 * Access mode - GET and SET
216 * Data type - uint32_t
218 BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
220 /* Properties unique to remote device */
222 * Description - User defined friendly name of the remote device
223 * Access mode - GET and SET
224 * Data type - bt_bdname_t.
226 BT_PROPERTY_REMOTE_FRIENDLY_NAME,
228 * Description - RSSI value of the inquired remote device
229 * Access mode - Only GET.
230 * Data type - int32_t.
232 BT_PROPERTY_REMOTE_RSSI,
234 * Description - Remote version info
235 * Access mode - SET/GET.
236 * Data type - bt_remote_version_t.
239 BT_PROPERTY_REMOTE_VERSION_INFO,
241 /* Tizen Specific Adapter and Remote Device properties */
243 * Description - Remote Device paired Info
245 * Data type - uint8_t.
247 BT_PROPERTY_REMOTE_PAIRED,
250 * Description - Remote Device connected Info
252 * Data type - unsigned int.
254 BT_PROPERTY_REMOTE_CONNECTED,
257 * Description - Remote Device Trusted info
259 * Data type - uint8_t.
261 BT_PROPERTY_REMOTE_TRUST,
264 * Description - Adapter Pairable info
265 * Access mode - GET\SET.
266 * Data type - uint8_t
268 BT_PROPERTY_PAIRABLE,
271 * Description - Adapter pairable Timeout value
273 * Data type - uint32_t
275 BT_PROPERTY_PAIRABLE_TIMEOUT,
278 * Description - Adapter version
280 * Data type - Array of character string
285 * Description - Adapter IPSP initialized state info
287 * Data type - uint8_t
289 BT_PROPERTY_IPSP_INITIALIZED,
292 * Description - Adapter Modalias info
294 * Data type - Array of character string
296 BT_PROPERTY_MODALIAS,
299 * Description - BLE Device manufacturer data length
301 * Data type - uint32_t
303 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN,
306 * Description - BLE Device manufacturer data
308 * Data type - Array of character string
310 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA,
313 * Description - Remote BLE advertising data
314 * Access mode - Only received during device found callback.
315 * Data type - Array of uint8_t of remote BLE adv data.
316 * (Array size inferred from property length).
318 BT_PROPERTY_REMOTE_BLE_ADV_DATA,
321 * Description - Local LE features
323 * Data type - bt_local_le_features_t.
325 BT_PROPERTY_LOCAL_LE_FEATURES,
328 * Description - Remote device friendly name set?
330 * Data type - uint8_t
332 BT_PROPERTY_REMOTE_IS_ALIAS_SET,
334 BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
335 } bt_property_type_t;
337 /** Bluetooth Adapter Property data structure */
339 bt_property_type_t type;
345 /** Bluetooth Device Type */
347 BT_DEVICE_DEVTYPE_BREDR = 0x1,
348 BT_DEVICE_DEVTYPE_BLE,
349 BT_DEVICE_DEVTYPE_DUAL
351 /** Bluetooth Bond state */
354 BT_BOND_STATE_BONDING,
358 /** Bluetooth SSP Bonding Variant */
360 BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
361 BT_SSP_VARIANT_PASSKEY_ENTRY,
362 BT_SSP_VARIANT_CONSENT,
363 BT_SSP_VARIANT_PASSKEY_NOTIFICATION
366 /** Bluetooth Profile Service IDs */
368 BT_RES_SERVICE_ID, /* Reserved */
369 BT_SPP_SERVICE_ID, /* Serial port profile. */
370 BT_DUN_SERVICE_ID, /* Dial-up networking profile. */
371 BT_A2DP_SRC_SERVICE_ID, /* A2DP Source profile. */
372 BT_LAP_SERVICE_ID, /* LAN access profile. */
373 BT_HSP_SERVICE_ID, /* Headset profile. */
374 BT_HFP_SERVICE_ID, /* Hands-free profile. */
375 BT_OPP_SERVICE_ID, /* Object push */
376 BT_FTP_SERVICE_ID, /* File transfer */
377 BT_AVRCP_CT_SERVICE_ID, /* AVRC Controller Terminal */
378 BT_ICP_SERVICE_ID, /* Intercom Terminal */
379 BT_SYNC_SERVICE_ID, /* Synchronization */
380 BT_BPP_SERVICE_ID, /* Basic printing profile */
381 BT_BIP_SERVICE_ID, /* Basic Imaging profile */
382 BT_PANU_SERVICE_ID, /* PAN User */
383 BT_NAP_SERVICE_ID, /* PAN Network access point */
384 BT_GN_SERVICE_ID, /* PAN Group Ad-hoc networks */
385 BT_SAP_SERVICE_ID, /* SIM Access profile */
386 BT_A2DP_SERVICE_ID, /* A2DP Sink */
387 BT_AVRCP_SERVICE_ID, /* A/V remote control */
388 BT_HID_SERVICE_ID, /* HID */
389 BT_VDP_SERVICE_ID, /* Video distribution */
390 BT_PBAP_SERVICE_ID, /* PhoneBook Access Server*/
391 BT_HSP_HS_SERVICE_ID, /* HFP HS role */
392 BT_HFP_HS_SERVICE_ID, /* HSP HS role */
393 BT_MAP_SERVICE_ID, /* Message Access Profile */
394 BT_MN_SERVICE_ID, /* Message Notification Service */
395 BT_HDP_SERVICE_ID, /* Health Device Profile */
396 BT_PCE_SERVICE_ID, /* PhoneBook Access Client*/
398 BT_IOTIVITY_SERVICE_ID, /* Custom IOTIVITY UUID */
402 #define BT_MAX_NUM_UUIDS 32
405 #define BT_OSP_SERVER_OBEX 0x00
406 /* TODO: Add more types If and when required */
407 #define BT_OSP_SERVER_MAX 0xFF
409 /* Tizen BT discovery Types */
411 BT_DISC_ROLE_BREDR = 0x01,
414 } bt_disc_role_type_t;
416 /** Bluetooth Trusted Profiles */
418 BT_TRUSTED_PROFILE_PBAP = 1,
419 BT_TRUSTED_PROFILE_MAP,
420 BT_TRUSTED_PROFILE_SAP,
421 BT_TRUSTED_PROFILE_HFP_HF,
422 BT_TRUSTED_PROFILE_A2DP,
423 BT_TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
424 } bt_trusted_profile_t;
426 /** Bluetooth Bonding Authentication Notifications */
428 BT_PASSKEY_CONFIRMATION = 1,
432 } bt_gap_auth_variant_t;
435 /** Bluetooth Interface callbacks */
437 /** Bluetooth Enable/Disable Callback. */
438 typedef void (*adapter_state_changed_callback)(bt_state_t state);
441 /** BLE Enable/Disable Callback. */
442 typedef void (*le_state_changed_callback)(bt_state_t state);
445 /** GET/SET Adapter Properties callback */
446 /* TODO: For the GET/SET property APIs/callbacks, we may need a session
447 * identifier to associate the call with the callback. This would be needed
448 * whenever more than one simultaneous instance of the same adapter_type
451 * If this is going to be handled in the Java framework, then we do not need
452 * to manage sessions here.
454 typedef void (*adapter_properties_callback)(bt_status_t status,
456 bt_property_t *properties);
458 /** GET/SET Remote Device Properties callback */
459 /** TODO: For remote device properties, do not see a need to get/set
460 * multiple properties - num_properties shall be 1
462 typedef void (*remote_device_properties_callback)(bt_status_t status,
463 bt_bdaddr_t *bd_addr,
465 bt_property_t *properties);
467 /** New device discovered callback */
468 /** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
470 typedef void (*device_found_callback)(int num_properties,
471 bt_property_t *properties);
473 /** Discovery state changed callback */
474 typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
476 /** Bluetooth Legacy PinKey Request callback */
477 typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
478 bt_bdname_t *bd_name, uint32_t cod);
480 /** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
481 /** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
482 * BT_SSP_PAIRING_PASSKEY_ENTRY */
483 /* TODO: Passkey request callback shall not be needed for devices with display
484 * capability. We still need support this in the stack for completeness */
485 typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
486 bt_bdname_t *bd_name,
488 bt_ssp_variant_t pairing_variant,
491 /** Bluetooth Bond state changed callback */
492 /* Invoked in response to create_bond, cancel_bond or remove_bond */
493 typedef void (*bond_state_changed_callback)(bt_status_t status,
494 bt_bdaddr_t *remote_bd_addr,
495 bt_bond_state_t state);
497 /** Bluetooth ACL connection state changed callback */
498 typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
499 bt_acl_state_t state);
506 /** Thread Associate/Disassociate JVM Callback */
507 /* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
509 typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
511 /** Bluetooth Test Mode Callback */
512 /* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
513 typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
515 /* LE Test mode callbacks
516 * This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
517 * The num_packets is valid only for le_test_end command */
518 typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
520 /** Callback invoked when energy details are obtained */
521 /* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
522 * If the ctrl_state value is 0, it means the API call failed
523 * Time values-In milliseconds as returned by the controller
524 * Energy used-Value as returned by the controller
525 * Status-Provides the status of the read_energy_info API call */
526 typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
528 /* Service level Authorization request callback */
529 typedef void (*authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
532 /* Service level Authorization request callback */
533 typedef void (*sock_authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
535 /** Bluetooth ACL connection state */
537 BT_LE_CONN_STATE_CONNECTED,
538 BT_LE_CONN_STATE_DISCONNECTED
539 } bt_le_conn_state_t;
541 /** Bluetooth ACL connection state changed callback */
542 typedef void (*le_conn_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
543 bt_le_conn_state_t state);
545 /** Remote device trusted profiles changed callback */
546 typedef void (*device_trusted_profiles_changed_callback)(bt_bdaddr_t *bd_addr, uint32_t trust_val);
548 /** Remote device RSSI monitoring state changed callback */
549 typedef void (*rssi_monitor_state_changed_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, uint8_t state);
551 /** Remote device RSSI alert callback */
552 typedef void (*rssi_alert_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
554 /** Remote device Raw RSSI received callback */
555 typedef void (*raw_rssi_received_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
558 /** TODO: Add callbacks for Link Up/Down and other generic
559 * notifications/callbacks */
561 /** Remote Device Trust state changed callback */
562 typedef void (*device_trust_state_changed_callback)(bt_bdaddr_t *remote_bd_addr,
563 bt_device_trust_state_t trust);
565 /** Bluetooth DM callback structure. */
567 /** set to sizeof(bt_callbacks_t) */
569 adapter_state_changed_callback adapter_state_changed_cb;
570 adapter_properties_callback adapter_properties_cb;
571 remote_device_properties_callback remote_device_properties_cb;
572 device_found_callback device_found_cb;
573 discovery_state_changed_callback discovery_state_changed_cb;
574 pin_request_callback pin_request_cb;
575 ssp_request_callback ssp_request_cb;
576 bond_state_changed_callback bond_state_changed_cb;
577 acl_state_changed_callback acl_state_changed_cb;
578 callback_thread_event thread_evt_cb;
579 dut_mode_recv_callback dut_mode_recv_cb;
580 le_test_mode_callback le_test_mode_cb;
581 energy_info_callback energy_info_cb;
582 authorize_request_callback authorize_request_cb;
583 device_trust_state_changed_callback device_trust_state_changed_cb;
585 sock_authorize_request_callback socket_authorize_request_cb;
586 le_state_changed_callback le_state_changed_cb;
587 le_conn_state_changed_callback le_conn_state_changed_cb;
588 device_trusted_profiles_changed_callback device_trusted_profiles_changed_cb;
589 rssi_monitor_state_changed_callback rssi_monitor_state_changed_cb;
590 rssi_alert_callback rssi_alert_cb;
591 raw_rssi_received_callback raw_rssi_received_cb;
595 typedef void (*alarm_cb)(void *data);
596 typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data);
597 typedef int (*acquire_wake_lock_callout)(const char *lock_name);
598 typedef int (*release_wake_lock_callout)(const char *lock_name);
600 /** The set of functions required by bluedroid to set wake alarms and
601 * grab wake locks. This struct is passed into the stack through the
602 * |set_os_callouts| function on |bt_interface_t|.
605 /* set to sizeof(bt_os_callouts_t) */
608 set_wake_alarm_callout set_wake_alarm;
609 acquire_wake_lock_callout acquire_wake_lock;
610 release_wake_lock_callout release_wake_lock;
613 /** NOTE: By default, no profiles are initialized at the time of init/enable.
614 * Whenever the application invokes the 'init' API of a profile, then one of
615 * the following shall occur:
617 * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
618 * profile as enabled. Subsequently, when the application invokes the
619 * Bluetooth 'enable', as part of the enable sequence the profile that were
620 * marked shall be enabled by calling appropriate stack APIs. The
621 * 'adapter_properties_cb' shall return the list of UUIDs of the
624 * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
625 * profile API to initialize the profile and trigger a
626 * 'adapter_properties_cb' with the current list of UUIDs including the
627 * newly added profile's UUID.
629 * The reverse shall occur whenever the profile 'cleanup' APIs are invoked
632 /** Represents the standard Bluetooth DM interface. */
634 /** set to sizeof(bt_interface_t) */
637 * Opens the interface and provides the callback routines
638 * to the implemenation of this interface.
640 int (*init)(bt_callbacks_t*callbacks);
642 /** Enable Bluetooth. */
645 /** Disable Bluetooth. */
646 int (*disable)(void);
649 /** Reset Bluetooth. */
654 /** Enable LE Bluetooth. */
655 int (*le_enable)(void);
657 /** Disable LE Bluetooth. */
658 int (*le_disable)(void);
660 int (*le_init)(void);
662 void (*le_deinit)(void);
664 int (*is_advertising) (void);
667 /** Closes the interface. */
668 void (*cleanup)(void);
671 /** Get Bluetooth Adapter Powered status */
672 int (*get_adapter_powered_status)(uint8_t *status);
675 /** Get all Bluetooth Adapter properties at init */
676 int (*get_adapter_properties)(void);
678 /** Get Bluetooth Adapter property of 'type' */
679 int (*get_adapter_property)(bt_property_type_t type);
681 /** Set Bluetooth Adapter property of 'type' */
682 /* Based on the type, val shall be one of
683 * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
685 int (*set_adapter_property)(const bt_property_t *property);
687 /** Get all Remote Device properties */
688 int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
690 /** Get Remote Device property of 'type' */
691 int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
692 bt_property_type_t type);
694 /** Set Remote Device property of 'type' */
695 int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
696 const bt_property_t *property);
698 /** Get Remote Device's service record for the given UUID */
699 int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
702 /** Start SDP to get remote services */
703 int (*get_remote_services)(bt_bdaddr_t *remote_addr);
705 /** Start Discovery */
706 int (*start_discovery)(void);
709 int (*start_custom_discovery)(bt_disc_role_type_t disc_type);
712 /** Cancel Discovery */
713 int (*cancel_discovery)(void);
715 /** Create Bluetooth Bonding */
716 int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
719 int (*remove_bond)(const bt_bdaddr_t *bd_addr);
722 int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
725 * Get the connection status for a given remote device.
726 * return value of 0 means the device is not connected,
727 * non-zero return status indicates an active connection.
729 int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
731 /** BT Legacy PinKey Reply */
732 /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
733 int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
734 uint8_t pin_len, bt_pin_code_t *pin_code);
736 /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
737 * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
738 * BT_SSP_VARIANT_CONSENT
739 * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
741 int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
742 uint8_t accept, uint32_t passkey);
744 /** Get Bluetooth profile interface */
745 const void* (*get_profile_interface) (const char *profile_id);
747 /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
748 /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
749 int (*dut_mode_configure)(uint8_t enable);
751 /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
752 int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
753 /** BLE Test Mode APIs */
754 /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
755 int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
757 /* enable or disable bluetooth HCI snoop log */
758 int (*config_hci_snoop_log)(uint8_t enable);
760 /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
761 * This should be called immediately after a successful |init|.
763 int (*set_os_callouts)(bt_os_callouts_t *callouts);
765 /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
766 * Success indicates that the VSC command was sent to controller
768 int (*read_energy_info)();
770 /* Tizen Specific: Send service level Authorization response */
771 int (*authorize_response)(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
772 uint8_t authorize, uint8_t save_settings);
774 /** Set auto authorization for peer device. Should be a paired device */
775 int (*set_authorization)(bt_bdaddr_t *bd_addr, uint8_t auth);
778 * get the service connection status for a given remote device.
779 * return value of 0 means the device is not connected,
780 * non-zero return status indicates an active connection.
782 int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
785 * Enable/Disable osp server in gap agent.
786 * enable == 0/1 -> Register/Unregister osp server.
788 int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
791 * Set profile as trusted for remote device
793 int (*set_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust);
796 * Get profile trusted status for remote device
798 int (*get_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint32_t *trusted);
801 * Get raw RSSI strength of remote device for connected link type
802 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
804 int (*get_connected_link_rssi_strength)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type);
807 * Enable RSSI monitoring of remote device for connected link type
808 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
809 * Threshold : (low_threshold, in_range_threshold, high_threshold)
811 int (*enable_rssi_monitoring)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
812 int low_threshold, int in_range_threshold, int high_threshold);
814 * Enable/Disable GAP authentication notification to application
815 * enable == 0/1 -> Enable/Disable notification sending
816 * type == value from bt_gap_auth_variant_t
818 int (*enable_gap_auth_notifications)(uint32_t type, uint8_t enable);
823 /** TODO: Need to add APIs for Service Discovery, Service authorization and
824 * connection management. Also need to add APIs for configuring
825 * properties of remote bonded devices such as name, UUID etc. */
828 struct hw_device_t common;
829 const bt_interface_t* (*get_bluetooth_interface)();
830 } bluetooth_device_t;
832 typedef bluetooth_device_t bluetooth_module_t;
835 #endif /* ANDROID_INCLUDE_BLUETOOTH_H */