bluetooth.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <hardware/hardware.h>

Go to the source code of this file.

Data Structures

struct  __attribute__
 
struct  __attribute__
 
struct  __attribute__
 
struct  __attribute__
 
struct  bt_uuid_t
 
struct  bt_service_record_t
 
struct  bt_remote_version_t
 
struct  bt_local_le_features_t
 
struct  bt_property_t
 
struct  bt_callbacks_t
 
struct  bt_os_callouts_t
 
struct  bt_interface_t
 
struct  bluetooth_device_t
 

Macros

#define BT_HARDWARE_MODULE_ID   "bluetooth"
 
#define BT_STACK_MODULE_ID   "bluetooth"
 
#define BT_STACK_TEST_MODULE_ID   "bluetooth_test"
 
#define BT_PROFILE_HANDSFREE_ID   "handsfree"
 
#define BT_PROFILE_HANDSFREE_CLIENT_ID   "handsfree_client"
 
#define BT_PROFILE_ADVANCED_AUDIO_ID   "a2dp"
 
#define BT_PROFILE_ADVANCED_AUDIO_SINK_ID   "a2dp_sink"
 
#define BT_PROFILE_HEALTH_ID   "health"
 
#define BT_PROFILE_SOCKETS_ID   "socket"
 
#define BT_PROFILE_HIDHOST_ID   "hidhost"
 
#define BT_PROFILE_PAN_ID   "pan"
 
#define BT_PROFILE_MAP_CLIENT_ID   "map_client"
 
#define BT_PROFILE_GATT_ID   "gatt"
 
#define BT_PROFILE_AV_RC_ID   "avrcp"
 
#define BT_PROFILE_AV_RC_CTRL_ID   "avrcp_ctrl"
 
#define BT_MAX_NUM_UUIDS   32
 

Typedefs

typedef void(* adapter_state_changed_callback )(bt_state_t state)
 
typedef void(* adapter_properties_callback )(bt_status_t status, int num_properties, bt_property_t *properties)
 
typedef void(* remote_device_properties_callback )(bt_status_t status, bt_bdaddr_t *bd_addr, int num_properties, bt_property_t *properties)
 
typedef void(* device_found_callback )(int num_properties, bt_property_t *properties)
 
typedef void(* discovery_state_changed_callback )(bt_discovery_state_t state)
 
typedef void(* pin_request_callback )(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name, uint32_t cod)
 
typedef void(* ssp_request_callback )(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name, uint32_t cod, bt_ssp_variant_t pairing_variant, uint32_t pass_key)
 
typedef void(* bond_state_changed_callback )(bt_status_t status, bt_bdaddr_t *remote_bd_addr, bt_bond_state_t state)
 
typedef void(* acl_state_changed_callback )(bt_status_t status, bt_bdaddr_t *remote_bd_addr, bt_acl_state_t state)
 
typedef void(* callback_thread_event )(bt_cb_thread_evt evt)
 
typedef void(* dut_mode_recv_callback )(uint16_t opcode, uint8_t *buf, uint8_t len)
 
typedef void(* le_test_mode_callback )(bt_status_t status, uint16_t num_packets)
 
typedef void(* energy_info_callback )(bt_activity_energy_info *energy_info)
 
typedef void(* alarm_cb )(void *data)
 
typedef bool(* set_wake_alarm_callout )(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data)
 
typedef int(* acquire_wake_lock_callout )(const char *lock_name)
 
typedef int(* release_wake_lock_callout )(const char *lock_name)
 
typedef bluetooth_device_t bluetooth_module_t
 

Enumerations

enum  bt_scan_mode_t { BT_SCAN_MODE_NONE, BT_SCAN_MODE_CONNECTABLE, BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE }
 
enum  bt_state_t { BT_STATE_OFF, BT_STATE_ON }
 
enum  bt_status_t {
  BT_STATUS_SUCCESS, BT_STATUS_FAIL, BT_STATUS_NOT_READY, BT_STATUS_NOMEM,
  BT_STATUS_BUSY, BT_STATUS_DONE, BT_STATUS_UNSUPPORTED, BT_STATUS_PARM_INVALID,
  BT_STATUS_UNHANDLED, BT_STATUS_AUTH_FAILURE, BT_STATUS_RMT_DEV_DOWN, BT_STATUS_AUTH_REJECTED
}
 
enum  bt_discovery_state_t { BT_DISCOVERY_STOPPED, BT_DISCOVERY_STARTED }
 
enum  bt_acl_state_t { BT_ACL_STATE_CONNECTED, BT_ACL_STATE_DISCONNECTED }
 
enum  bt_property_type_t {
  BT_PROPERTY_BDNAME = 0x1, BT_PROPERTY_BDADDR, BT_PROPERTY_UUIDS, BT_PROPERTY_CLASS_OF_DEVICE,
  BT_PROPERTY_TYPE_OF_DEVICE, BT_PROPERTY_SERVICE_RECORD, BT_PROPERTY_ADAPTER_SCAN_MODE, BT_PROPERTY_ADAPTER_BONDED_DEVICES,
  BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, BT_PROPERTY_REMOTE_FRIENDLY_NAME, BT_PROPERTY_REMOTE_RSSI, BT_PROPERTY_REMOTE_VERSION_INFO,
  BT_PROPERTY_LOCAL_LE_FEATURES, BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF
}
 
enum  bt_device_type_t { BT_DEVICE_DEVTYPE_BREDR = 0x1, BT_DEVICE_DEVTYPE_BLE, BT_DEVICE_DEVTYPE_DUAL }
 
enum  bt_bond_state_t { BT_BOND_STATE_NONE, BT_BOND_STATE_BONDING, BT_BOND_STATE_BONDED }
 
enum  bt_ssp_variant_t { BT_SSP_VARIANT_PASSKEY_CONFIRMATION, BT_SSP_VARIANT_PASSKEY_ENTRY, BT_SSP_VARIANT_CONSENT, BT_SSP_VARIANT_PASSKEY_NOTIFICATION }
 
enum  bt_cb_thread_evt { ASSOCIATE_JVM, DISASSOCIATE_JVM }
 

Macro Definition Documentation

#define BT_HARDWARE_MODULE_ID   "bluetooth"

The Bluetooth Hardware Module ID

Definition at line 33 of file bluetooth.h.

#define BT_MAX_NUM_UUIDS   32

Definition at line 278 of file bluetooth.h.

#define BT_PROFILE_ADVANCED_AUDIO_ID   "a2dp"

Definition at line 42 of file bluetooth.h.

#define BT_PROFILE_ADVANCED_AUDIO_SINK_ID   "a2dp_sink"

Definition at line 43 of file bluetooth.h.

#define BT_PROFILE_AV_RC_CTRL_ID   "avrcp_ctrl"

Definition at line 52 of file bluetooth.h.

#define BT_PROFILE_AV_RC_ID   "avrcp"

Definition at line 51 of file bluetooth.h.

#define BT_PROFILE_GATT_ID   "gatt"

Definition at line 50 of file bluetooth.h.

#define BT_PROFILE_HANDSFREE_CLIENT_ID   "handsfree_client"

Definition at line 41 of file bluetooth.h.

#define BT_PROFILE_HANDSFREE_ID   "handsfree"

Definition at line 40 of file bluetooth.h.

#define BT_PROFILE_HEALTH_ID   "health"

Definition at line 44 of file bluetooth.h.

#define BT_PROFILE_HIDHOST_ID   "hidhost"

Definition at line 46 of file bluetooth.h.

#define BT_PROFILE_MAP_CLIENT_ID   "map_client"

Definition at line 48 of file bluetooth.h.

#define BT_PROFILE_PAN_ID   "pan"

Definition at line 47 of file bluetooth.h.

#define BT_PROFILE_SOCKETS_ID   "socket"

Definition at line 45 of file bluetooth.h.

#define BT_STACK_MODULE_ID   "bluetooth"

Definition at line 34 of file bluetooth.h.

#define BT_STACK_TEST_MODULE_ID   "bluetooth_test"

Definition at line 35 of file bluetooth.h.

Typedef Documentation

typedef void(* acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr, bt_acl_state_t state)

Bluetooth ACL connection state changed callback

Definition at line 338 of file bluetooth.h.

typedef int(* acquire_wake_lock_callout)(const char *lock_name)

Definition at line 392 of file bluetooth.h.

typedef void(* adapter_properties_callback)(bt_status_t status, int num_properties, bt_property_t *properties)

GET/SET Adapter Properties callback

Definition at line 294 of file bluetooth.h.

typedef void(* adapter_state_changed_callback)(bt_state_t state)

Bluetooth Interface callbacks Bluetooth Enable/Disable Callback.

Definition at line 283 of file bluetooth.h.

typedef void(* alarm_cb)(void *data)

Definition at line 390 of file bluetooth.h.

Definition at line 547 of file bluetooth.h.

typedef void(* bond_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr, bt_bond_state_t state)

Bluetooth Bond state changed callback

Definition at line 333 of file bluetooth.h.

typedef void(* callback_thread_event)(bt_cb_thread_evt evt)

Thread Associate/Disassociate JVM Callback

Definition at line 349 of file bluetooth.h.

typedef void(* device_found_callback)(int num_properties, bt_property_t *properties)

New device discovered callback If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1 respectively

Definition at line 310 of file bluetooth.h.

typedef void(* discovery_state_changed_callback)(bt_discovery_state_t state)

Discovery state changed callback

Definition at line 314 of file bluetooth.h.

typedef void(* dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len)

Bluetooth Test Mode Callback

Definition at line 353 of file bluetooth.h.

typedef void(* energy_info_callback)(bt_activity_energy_info *energy_info)

Callback invoked when energy details are obtained

Definition at line 366 of file bluetooth.h.

typedef void(* le_test_mode_callback)(bt_status_t status, uint16_t num_packets)

Definition at line 358 of file bluetooth.h.

typedef void(* pin_request_callback)(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name, uint32_t cod)

Bluetooth Legacy PinKey Request callback

Definition at line 317 of file bluetooth.h.

typedef int(* release_wake_lock_callout)(const char *lock_name)

Definition at line 393 of file bluetooth.h.

typedef void(* remote_device_properties_callback)(bt_status_t status, bt_bdaddr_t *bd_addr, int num_properties, bt_property_t *properties)

GET/SET Remote Device Properties callback TODO: For remote device properties, do not see a need to get/set multiple properties - num_properties shall be 1

Definition at line 302 of file bluetooth.h.

typedef bool(* set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data)

Definition at line 391 of file bluetooth.h.

typedef void(* ssp_request_callback)(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name, uint32_t cod, bt_ssp_variant_t pairing_variant, uint32_t pass_key)

Bluetooth SSP Request callback - Just Works & Numeric Comparison pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT & BT_SSP_PAIRING_PASSKEY_ENTRY

Definition at line 325 of file bluetooth.h.

Enumeration Type Documentation

Bluetooth ACL connection state

Enumerator
BT_ACL_STATE_CONNECTED 
BT_ACL_STATE_DISCONNECTED 

Definition at line 117 of file bluetooth.h.

Bluetooth Bond state

Enumerator
BT_BOND_STATE_NONE 
BT_BOND_STATE_BONDING 
BT_BOND_STATE_BONDED 

Definition at line 264 of file bluetooth.h.

Enumerator
ASSOCIATE_JVM 
DISASSOCIATE_JVM 

Definition at line 341 of file bluetooth.h.

Bluetooth Device Type

Enumerator
BT_DEVICE_DEVTYPE_BREDR 
BT_DEVICE_DEVTYPE_BLE 
BT_DEVICE_DEVTYPE_DUAL 

Definition at line 258 of file bluetooth.h.

Bluetooth Adapter Discovery state

Enumerator
BT_DISCOVERY_STOPPED 
BT_DISCOVERY_STARTED 

Definition at line 111 of file bluetooth.h.

Enumerator
BT_PROPERTY_BDNAME 

Description - Bluetooth Device Name Access mode - Adapter name can be GET/SET. Remote device can be GET Data type - bt_bdname_t

BT_PROPERTY_BDADDR 

Description - Bluetooth Device Address Access mode - Only GET. Data type - bt_bdaddr_t

BT_PROPERTY_UUIDS 

Description - Bluetooth Service 128-bit UUIDs Access mode - Only GET. Data type - Array of bt_uuid_t (Array size inferred from property length).

BT_PROPERTY_CLASS_OF_DEVICE 

Description - Bluetooth Class of Device as found in Assigned Numbers Access mode - Only GET. Data type - uint32_t.

BT_PROPERTY_TYPE_OF_DEVICE 

Description - Device Type - BREDR, BLE or DUAL Mode Access mode - Only GET. Data type - bt_device_type_t

BT_PROPERTY_SERVICE_RECORD 

Description - Bluetooth Service Record Access mode - Only GET. Data type - bt_service_record_t

BT_PROPERTY_ADAPTER_SCAN_MODE 

Description - Bluetooth Adapter scan mode Access mode - GET and SET Data type - bt_scan_mode_t.

BT_PROPERTY_ADAPTER_BONDED_DEVICES 

Description - List of bonded devices Access mode - Only GET. Data type - Array of bt_bdaddr_t of the bonded remote devices (Array size inferred from property length).

BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT 

Description - Bluetooth Adapter Discovery timeout (in seconds) Access mode - GET and SET Data type - uint32_t

BT_PROPERTY_REMOTE_FRIENDLY_NAME 

Description - User defined friendly name of the remote device Access mode - GET and SET Data type - bt_bdname_t.

BT_PROPERTY_REMOTE_RSSI 

Description - RSSI value of the inquired remote device Access mode - Only GET. Data type - int32_t.

BT_PROPERTY_REMOTE_VERSION_INFO 

Description - Remote version info Access mode - SET/GET. Data type - bt_remote_version_t.

BT_PROPERTY_LOCAL_LE_FEATURES 

Description - Local LE features Access mode - GET. Data type - bt_local_le_features_t.

BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP 

Definition at line 157 of file bluetooth.h.

Bluetooth Adapter Visibility Modes

Enumerator
BT_SCAN_MODE_NONE 
BT_SCAN_MODE_CONNECTABLE 
BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE 

Definition at line 65 of file bluetooth.h.

Bluetooth SSP Bonding Variant

Enumerator
BT_SSP_VARIANT_PASSKEY_CONFIRMATION 
BT_SSP_VARIANT_PASSKEY_ENTRY 
BT_SSP_VARIANT_CONSENT 
BT_SSP_VARIANT_PASSKEY_NOTIFICATION 

Definition at line 271 of file bluetooth.h.

enum bt_state_t

Bluetooth Adapter State

Enumerator
BT_STATE_OFF 
BT_STATE_ON 

Definition at line 72 of file bluetooth.h.

Bluetooth Error Status We need to build on this

Enumerator
BT_STATUS_SUCCESS 
BT_STATUS_FAIL 
BT_STATUS_NOT_READY 
BT_STATUS_NOMEM 
BT_STATUS_BUSY 
BT_STATUS_DONE 
BT_STATUS_UNSUPPORTED 
BT_STATUS_PARM_INVALID 
BT_STATUS_UNHANDLED 
BT_STATUS_AUTH_FAILURE 
BT_STATUS_RMT_DEV_DOWN 
BT_STATUS_AUTH_REJECTED 

Definition at line 80 of file bluetooth.h.