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;
150 uint16_t version_supported;
151 uint8_t local_privacy_enabled;
152 uint8_t max_adv_instance;
153 uint8_t rpa_offload_supported;
154 uint8_t max_irk_list_size;
155 uint8_t max_adv_filter_supported;
156 uint8_t activity_energy_info_supported;
157 uint16_t scan_result_storage_size;
158 uint16_t total_trackable_advertisers;
159 bool extended_scan_support;
160 bool debug_logging_supported;
161 bool le_2m_phy_supported;
162 bool le_coded_phy_supported;
163 bool le_extended_advertising_supported;
164 bool le_periodic_advertising_supported;
165 uint16_t le_maximum_advertising_data_length;
166 } bt_local_le_features_t;
170 uint8_t local_privacy_enabled;
171 uint8_t max_adv_instance;
172 uint8_t rpa_offload_supported;
173 uint8_t max_irk_list_size;
174 uint8_t max_adv_filter_supported;
175 uint8_t scan_result_storage_size_lobyte;
176 uint8_t scan_result_storage_size_hibyte;
177 uint8_t activity_energy_info_supported;
178 } bt_local_le_features_t;*/
180 /* Bluetooth Adapter and Remote Device property types */
182 /* Properties common to both adapter and remote device */
184 * Description - Bluetooth Device Name
185 * Access mode - Adapter name can be GET/SET. Remote device can be GET
186 * Data type - bt_bdname_t
188 BT_PROPERTY_BDNAME = 0x1,
190 * Description - Bluetooth Device Address
191 * Access mode - Only GET.
192 * Data type - bt_bdaddr_t
196 * Description - Bluetooth Service 128-bit UUIDs
197 * Access mode - Only GET.
198 * Data type - Array of bt_uuid_t (Array size inferred from property length).
202 * Description - Bluetooth Class of Device as found in Assigned Numbers
203 * Access mode - Only GET.
204 * Data type - uint32_t.
206 BT_PROPERTY_CLASS_OF_DEVICE,
208 * Description - Device Type - BREDR, BLE or DUAL Mode
209 * Access mode - Only GET.
210 * Data type - bt_device_type_t
212 BT_PROPERTY_TYPE_OF_DEVICE,
214 * Description - Bluetooth Service Record
215 * Access mode - Only GET.
216 * Data type - bt_service_record_t
218 BT_PROPERTY_SERVICE_RECORD,
220 /* Properties unique to adapter */
222 * Description - Bluetooth Adapter scan mode
223 * Access mode - GET and SET
224 * Data type - bt_scan_mode_t.
226 BT_PROPERTY_ADAPTER_SCAN_MODE,
228 * Description - List of bonded devices
229 * Access mode - Only GET.
230 * Data type - Array of bt_bdaddr_t of the bonded remote devices
231 * (Array size inferred from property length).
233 BT_PROPERTY_ADAPTER_BONDED_DEVICES,
235 * Description - Bluetooth Adapter Discovery timeout (in seconds)
236 * Access mode - GET and SET
237 * Data type - uint32_t
239 BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
241 /* Properties unique to remote device */
243 * Description - User defined friendly name of the remote device
244 * Access mode - GET and SET
245 * Data type - bt_bdname_t.
247 BT_PROPERTY_REMOTE_FRIENDLY_NAME,
249 * Description - RSSI value of the inquired remote device
250 * Access mode - Only GET.
251 * Data type - int32_t.
253 BT_PROPERTY_REMOTE_RSSI,
255 * Description - Remote version info
256 * Access mode - SET/GET.
257 * Data type - bt_remote_version_t.
260 BT_PROPERTY_REMOTE_VERSION_INFO,
262 /* Tizen Specific Adapter and Remote Device properties */
264 * Description - Remote Device paired Info
266 * Data type - uint8_t.
268 BT_PROPERTY_REMOTE_PAIRED,
271 * Description - Remote Device connected Info
273 * Data type - unsigned int.
275 BT_PROPERTY_REMOTE_CONNECTED,
278 * Description - Remote Device Trusted info
280 * Data type - uint8_t.
282 BT_PROPERTY_REMOTE_TRUST,
285 * Description - Adapter Pairable info
286 * Access mode - GET\SET.
287 * Data type - uint8_t
289 BT_PROPERTY_PAIRABLE,
292 * Description - Adapter pairable Timeout value
294 * Data type - uint32_t
296 BT_PROPERTY_PAIRABLE_TIMEOUT,
299 * Description - Adapter version
301 * Data type - Array of character string
306 * Description - Adapter IPSP initialized state info
308 * Data type - uint8_t
310 BT_PROPERTY_IPSP_INITIALIZED,
313 * Description - Adapter Modalias info
315 * Data type - Array of character string
317 BT_PROPERTY_MODALIAS,
320 * Description - BLE Device manufacturer data length
322 * Data type - uint32_t
324 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN,
327 * Description - BLE Device manufacturer data
329 * Data type - Array of character string
331 BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA,
334 * Description - Remote BLE advertising data
335 * Access mode - Only received during device found callback.
336 * Data type - Array of uint8_t of remote BLE adv data.
337 * (Array size inferred from property length).
339 BT_PROPERTY_REMOTE_BLE_ADV_DATA,
342 * Description - Local LE features
344 * Data type - bt_local_le_features_t.
346 BT_PROPERTY_LOCAL_LE_FEATURES,
349 * Description - Remote device friendly name set?
351 * Data type - uint8_t
353 BT_PROPERTY_REMOTE_IS_ALIAS_SET,
355 BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
356 } bt_property_type_t;
358 /** Bluetooth Adapter Property data structure */
360 bt_property_type_t type;
366 /** Bluetooth Device Type */
368 BT_DEVICE_DEVTYPE_BREDR = 0x1,
369 BT_DEVICE_DEVTYPE_BLE,
370 BT_DEVICE_DEVTYPE_DUAL
372 /** Bluetooth Bond state */
375 BT_BOND_STATE_BONDING,
379 /** Bluetooth SSP Bonding Variant */
381 BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
382 BT_SSP_VARIANT_PASSKEY_ENTRY,
383 BT_SSP_VARIANT_CONSENT,
384 BT_SSP_VARIANT_PASSKEY_NOTIFICATION
387 /** Bluetooth Profile Service IDs */
389 BT_RES_SERVICE_ID, /* Reserved */
390 BT_SPP_SERVICE_ID, /* Serial port profile. */
391 BT_DUN_SERVICE_ID, /* Dial-up networking profile. */
392 BT_A2DP_SRC_SERVICE_ID, /* A2DP Source profile. */
393 BT_LAP_SERVICE_ID, /* LAN access profile. */
394 BT_HSP_SERVICE_ID, /* Headset profile. */
395 BT_HFP_SERVICE_ID, /* Hands-free profile. */
396 BT_OPP_SERVICE_ID, /* Object push */
397 BT_FTP_SERVICE_ID, /* File transfer */
398 BT_AVRCP_CT_SERVICE_ID, /* AVRC Controller Terminal */
399 BT_ICP_SERVICE_ID, /* Intercom Terminal */
400 BT_SYNC_SERVICE_ID, /* Synchronization */
401 BT_BPP_SERVICE_ID, /* Basic printing profile */
402 BT_BIP_SERVICE_ID, /* Basic Imaging profile */
403 BT_PANU_SERVICE_ID, /* PAN User */
404 BT_NAP_SERVICE_ID, /* PAN Network access point */
405 BT_GN_SERVICE_ID, /* PAN Group Ad-hoc networks */
406 BT_SAP_SERVICE_ID, /* SIM Access profile */
407 BT_A2DP_SERVICE_ID, /* A2DP Sink */
408 BT_AVRCP_SERVICE_ID, /* A/V remote control */
409 BT_HID_SERVICE_ID, /* HID */
410 BT_VDP_SERVICE_ID, /* Video distribution */
411 BT_PBAP_SERVICE_ID, /* PhoneBook Access Server*/
412 BT_HSP_HS_SERVICE_ID, /* HFP HS role */
413 BT_HFP_HS_SERVICE_ID, /* HSP HS role */
414 BT_MAP_SERVICE_ID, /* Message Access Profile */
415 BT_MN_SERVICE_ID, /* Message Notification Service */
416 BT_HDP_SERVICE_ID, /* Health Device Profile */
417 BT_PCE_SERVICE_ID, /* PhoneBook Access Client*/
419 BT_IOTIVITY_SERVICE_ID, /* Custom IOTIVITY UUID */
423 #define BT_MAX_NUM_UUIDS 32
426 #define BT_OSP_SERVER_OBEX 0x00
427 /* TODO: Add more types If and when required */
428 #define BT_OSP_SERVER_MAX 0xFF
430 /* Tizen BT discovery Types */
432 BT_DISC_ROLE_BREDR = 0x01,
435 } bt_disc_role_type_t;
437 /** Bluetooth Trusted Profiles */
439 BT_TRUSTED_PROFILE_PBAP = 1,
440 BT_TRUSTED_PROFILE_MAP,
441 BT_TRUSTED_PROFILE_SAP,
442 BT_TRUSTED_PROFILE_HFP_HF,
443 BT_TRUSTED_PROFILE_A2DP,
444 BT_TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
445 } bt_trusted_profile_t;
447 /** Bluetooth Bonding Authentication Notifications */
449 BT_PASSKEY_CONFIRMATION = 1,
453 } bt_gap_auth_variant_t;
456 /** Bluetooth Interface callbacks */
458 /** Bluetooth Enable/Disable Callback. */
459 typedef void (*adapter_state_changed_callback)(bt_state_t state);
462 /** BLE Enable/Disable Callback. */
463 typedef void (*le_state_changed_callback)(bt_state_t state);
466 /** GET/SET Adapter Properties callback */
467 /* TODO: For the GET/SET property APIs/callbacks, we may need a session
468 * identifier to associate the call with the callback. This would be needed
469 * whenever more than one simultaneous instance of the same adapter_type
472 * If this is going to be handled in the Java framework, then we do not need
473 * to manage sessions here.
475 typedef void (*adapter_properties_callback)(bt_status_t status,
477 bt_property_t *properties);
479 /** GET/SET Remote Device Properties callback */
480 /** TODO: For remote device properties, do not see a need to get/set
481 * multiple properties - num_properties shall be 1
483 typedef void (*remote_device_properties_callback)(bt_status_t status,
484 bt_bdaddr_t *bd_addr,
486 bt_property_t *properties);
488 /** New device discovered callback */
489 /** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
491 typedef void (*device_found_callback)(int num_properties,
492 bt_property_t *properties);
494 /** Discovery state changed callback */
495 typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
497 /** Bluetooth Legacy PinKey Request callback */
498 typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
499 bt_bdname_t *bd_name, uint32_t cod);
501 /** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
502 /** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
503 * BT_SSP_PAIRING_PASSKEY_ENTRY */
504 /* TODO: Passkey request callback shall not be needed for devices with display
505 * capability. We still need support this in the stack for completeness */
506 typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
507 bt_bdname_t *bd_name,
509 bt_ssp_variant_t pairing_variant,
512 /** Bluetooth Bond state changed callback */
513 /* Invoked in response to create_bond, cancel_bond or remove_bond */
514 typedef void (*bond_state_changed_callback)(bt_status_t status,
515 bt_bdaddr_t *remote_bd_addr,
516 bt_bond_state_t state);
518 /** Bluetooth ACL connection state changed callback */
519 typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
520 bt_acl_state_t state);
527 /** Thread Associate/Disassociate JVM Callback */
528 /* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
530 typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
532 /** Bluetooth Test Mode Callback */
533 /* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
534 typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
536 /* LE Test mode callbacks
537 * This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
538 * The num_packets is valid only for le_test_end command */
539 typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
541 /** Callback invoked when energy details are obtained */
542 /* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
543 * If the ctrl_state value is 0, it means the API call failed
544 * Time values-In milliseconds as returned by the controller
545 * Energy used-Value as returned by the controller
546 * Status-Provides the status of the read_energy_info API call */
547 typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
549 /* Service level Authorization request callback */
550 typedef void (*authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_service_id_t service_d);
553 /* Service level Authorization request callback */
554 typedef void (*sock_authorize_request_callback) (bt_bdaddr_t *remote_bd_addr, bt_uuid_t *uuid);
556 /** Bluetooth ACL connection state */
558 BT_LE_CONN_STATE_CONNECTED,
559 BT_LE_CONN_STATE_DISCONNECTED
560 } bt_le_conn_state_t;
562 /** Bluetooth ACL connection state changed callback */
563 typedef void (*le_conn_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
564 bt_le_conn_state_t state);
566 /** Remote device trusted profiles changed callback */
567 typedef void (*device_trusted_profiles_changed_callback)(bt_bdaddr_t *bd_addr, uint32_t trust_val);
569 /** Remote device RSSI monitoring state changed callback */
570 typedef void (*rssi_monitor_state_changed_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, uint8_t state);
572 /** Remote device RSSI alert callback */
573 typedef void (*rssi_alert_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
575 /** Remote device Raw RSSI received callback */
576 typedef void (*raw_rssi_received_callback)(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
579 /** TODO: Add callbacks for Link Up/Down and other generic
580 * notifications/callbacks */
582 /** Remote Device Trust state changed callback */
583 typedef void (*device_trust_state_changed_callback)(bt_bdaddr_t *remote_bd_addr,
584 bt_device_trust_state_t trust);
586 /** Bluetooth DM callback structure. */
588 /** set to sizeof(bt_callbacks_t) */
590 adapter_state_changed_callback adapter_state_changed_cb;
591 adapter_properties_callback adapter_properties_cb;
592 remote_device_properties_callback remote_device_properties_cb;
593 device_found_callback device_found_cb;
594 discovery_state_changed_callback discovery_state_changed_cb;
595 pin_request_callback pin_request_cb;
596 ssp_request_callback ssp_request_cb;
597 bond_state_changed_callback bond_state_changed_cb;
598 acl_state_changed_callback acl_state_changed_cb;
599 callback_thread_event thread_evt_cb;
600 dut_mode_recv_callback dut_mode_recv_cb;
601 le_test_mode_callback le_test_mode_cb;
602 energy_info_callback energy_info_cb;
603 authorize_request_callback authorize_request_cb;
604 device_trust_state_changed_callback device_trust_state_changed_cb;
606 sock_authorize_request_callback socket_authorize_request_cb;
607 le_state_changed_callback le_state_changed_cb;
608 le_conn_state_changed_callback le_conn_state_changed_cb;
609 device_trusted_profiles_changed_callback device_trusted_profiles_changed_cb;
610 rssi_monitor_state_changed_callback rssi_monitor_state_changed_cb;
611 rssi_alert_callback rssi_alert_cb;
612 raw_rssi_received_callback raw_rssi_received_cb;
616 typedef void (*alarm_cb)(void *data);
617 typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data);
618 typedef int (*acquire_wake_lock_callout)(const char *lock_name);
619 typedef int (*release_wake_lock_callout)(const char *lock_name);
621 /** The set of functions required by bluedroid to set wake alarms and
622 * grab wake locks. This struct is passed into the stack through the
623 * |set_os_callouts| function on |bt_interface_t|.
626 /* set to sizeof(bt_os_callouts_t) */
629 set_wake_alarm_callout set_wake_alarm;
630 acquire_wake_lock_callout acquire_wake_lock;
631 release_wake_lock_callout release_wake_lock;
634 /** NOTE: By default, no profiles are initialized at the time of init/enable.
635 * Whenever the application invokes the 'init' API of a profile, then one of
636 * the following shall occur:
638 * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
639 * profile as enabled. Subsequently, when the application invokes the
640 * Bluetooth 'enable', as part of the enable sequence the profile that were
641 * marked shall be enabled by calling appropriate stack APIs. The
642 * 'adapter_properties_cb' shall return the list of UUIDs of the
645 * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
646 * profile API to initialize the profile and trigger a
647 * 'adapter_properties_cb' with the current list of UUIDs including the
648 * newly added profile's UUID.
650 * The reverse shall occur whenever the profile 'cleanup' APIs are invoked
653 /** Represents the standard Bluetooth DM interface. */
655 /** set to sizeof(bt_interface_t) */
658 * Opens the interface and provides the callback routines
659 * to the implemenation of this interface.
661 int (*init)(bt_callbacks_t*callbacks);
663 /** Enable Bluetooth. */
666 /** Disable Bluetooth. */
667 int (*disable)(void);
670 /** Reset Bluetooth. */
675 /** Enable LE Bluetooth. */
676 int (*le_enable)(void);
678 /** Disable LE Bluetooth. */
679 int (*le_disable)(void);
681 int (*le_init)(void);
683 void (*le_deinit)(void);
685 int (*is_advertising) (void);
688 /** Closes the interface. */
689 void (*cleanup)(void);
692 /** Get Bluetooth Adapter Powered status */
693 int (*get_adapter_powered_status)(uint8_t *status);
696 /** Get all Bluetooth Adapter properties at init */
697 int (*get_adapter_properties)(void);
699 /** Get Bluetooth Adapter property of 'type' */
700 int (*get_adapter_property)(bt_property_type_t type);
702 /** Set Bluetooth Adapter property of 'type' */
703 /* Based on the type, val shall be one of
704 * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
706 int (*set_adapter_property)(const bt_property_t *property);
708 /** Get all Remote Device properties */
709 int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
711 /** Get Remote Device property of 'type' */
712 int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
713 bt_property_type_t type);
715 /** Set Remote Device property of 'type' */
716 int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
717 const bt_property_t *property);
719 /** Get Remote Device's service record for the given UUID */
720 int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
723 /** Start SDP to get remote services */
724 int (*get_remote_services)(bt_bdaddr_t *remote_addr);
726 /** Start Discovery */
727 int (*start_discovery)(void);
730 int (*start_custom_discovery)(bt_disc_role_type_t disc_type);
733 /** Cancel Discovery */
734 int (*cancel_discovery)(void);
736 /** Create Bluetooth Bonding */
737 int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
740 int (*remove_bond)(const bt_bdaddr_t *bd_addr);
743 int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
746 * Get the connection status for a given remote device.
747 * return value of 0 means the device is not connected,
748 * non-zero return status indicates an active connection.
750 int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
752 /** BT Legacy PinKey Reply */
753 /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
754 int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
755 uint8_t pin_len, bt_pin_code_t *pin_code);
757 /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
758 * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
759 * BT_SSP_VARIANT_CONSENT
760 * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
762 int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
763 uint8_t accept, uint32_t passkey);
765 /** Get Bluetooth profile interface */
766 const void* (*get_profile_interface) (const char *profile_id);
768 /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
769 /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
770 int (*dut_mode_configure)(uint8_t enable);
772 /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
773 int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
774 /** BLE Test Mode APIs */
775 /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
776 int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
778 /* enable or disable bluetooth HCI snoop log */
779 int (*config_hci_snoop_log)(uint8_t enable);
781 /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
782 * This should be called immediately after a successful |init|.
784 int (*set_os_callouts)(bt_os_callouts_t *callouts);
786 /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
787 * Success indicates that the VSC command was sent to controller
789 int (*read_energy_info)();
791 /* Tizen Specific: Send service level Authorization response */
792 int (*authorize_response)(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
793 uint8_t authorize, uint8_t save_settings);
795 /** Set auto authorization for peer device. Should be a paired device */
796 int (*set_authorization)(bt_bdaddr_t *bd_addr, uint8_t auth);
799 * get the service connection status for a given remote device.
800 * return value of 0 means the device is not connected,
801 * non-zero return status indicates an active connection.
803 int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
806 * Enable/Disable osp server in gap agent.
807 * enable == 0/1 -> Register/Unregister osp server.
809 int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
812 * Set profile as trusted for remote device
814 int (*set_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust);
817 * Get profile trusted status for remote device
819 int (*get_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint32_t *trusted);
822 * Get raw RSSI strength of remote device for connected link type
823 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
825 int (*get_connected_link_rssi_strength)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type);
828 * Enable RSSI monitoring of remote device for connected link type
829 * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
830 * Threshold : (low_threshold, in_range_threshold, high_threshold)
832 int (*enable_rssi_monitoring)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
833 int low_threshold, int in_range_threshold, int high_threshold);
835 * Enable/Disable GAP authentication notification to application
836 * enable == 0/1 -> Enable/Disable notification sending
837 * type == value from bt_gap_auth_variant_t
839 int (*enable_gap_auth_notifications)(uint32_t type, uint8_t enable);
844 /** TODO: Need to add APIs for Service Discovery, Service authorization and
845 * connection management. Also need to add APIs for configuring
846 * properties of remote bonded devices such as name, UUID etc. */
849 struct hw_device_t common;
850 const bt_interface_t* (*get_bluetooth_interface)();
851 } bluetooth_device_t;
853 typedef bluetooth_device_t bluetooth_module_t;
856 #endif /* ANDROID_INCLUDE_BLUETOOTH_H */