blob: 683e369c8a0ddbb7417c8ad9fb63efc1ec5d3f1e [file] [log] [blame]
Andre Eisenbach05f49542012-09-18 12:15:26 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#ifndef ANDROID_INCLUDE_BLUETOOTH_H
18#define ANDROID_INCLUDE_BLUETOOTH_H
19
Sharvil Nanavati3bd8cba2014-05-30 16:43:38 -070020#include <stdbool.h>
Andre Eisenbach05f49542012-09-18 12:15:26 -070021#include <stdint.h>
22#include <sys/cdefs.h>
23#include <sys/types.h>
24
25#include <hardware/hardware.h>
26
27__BEGIN_DECLS
28
29/**
30 * The Bluetooth Hardware Module ID
31 */
32
33#define BT_HARDWARE_MODULE_ID "bluetooth"
34#define BT_STACK_MODULE_ID "bluetooth"
35#define BT_STACK_TEST_MODULE_ID "bluetooth_test"
36
37
38/* Bluetooth profile interface IDs */
39
40#define BT_PROFILE_HANDSFREE_ID "handsfree"
Hemant Guptae7737c82013-08-19 18:02:54 +053041#define BT_PROFILE_HANDSFREE_CLIENT_ID "handsfree_client"
Andre Eisenbach05f49542012-09-18 12:15:26 -070042#define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp"
Mike Lockwood21e50b12014-06-07 14:05:22 -070043#define BT_PROFILE_ADVANCED_AUDIO_SINK_ID "a2dp_sink"
Andre Eisenbach05f49542012-09-18 12:15:26 -070044#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"
Hemant Gupta053cccf2014-04-18 12:25:24 +053048#define BT_PROFILE_MAP_CLIENT_ID "map_client"
kschulz9a92a7b2015-03-06 09:15:43 +010049#define BT_PROFILE_SDP_CLIENT_ID "sdp"
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -080050#define BT_PROFILE_GATT_ID "gatt"
Ravi Nagarajan482ba782013-02-26 10:34:41 -080051#define BT_PROFILE_AV_RC_ID "avrcp"
Mike Lockwood7da4cb82014-06-02 16:20:51 -070052#define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl"
Andre Eisenbach05f49542012-09-18 12:15:26 -070053
54/** Bluetooth Address */
55typedef struct {
56 uint8_t address[6];
57} __attribute__((packed))bt_bdaddr_t;
58
59/** Bluetooth Device Name */
60typedef struct {
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -080061 uint8_t name[249];
Andre Eisenbach05f49542012-09-18 12:15:26 -070062} __attribute__((packed))bt_bdname_t;
63
64/** Bluetooth Adapter Visibility Modes*/
65typedef enum {
66 BT_SCAN_MODE_NONE,
67 BT_SCAN_MODE_CONNECTABLE,
68 BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
69} bt_scan_mode_t;
70
71/** Bluetooth Adapter State */
72typedef enum {
73 BT_STATE_OFF,
74 BT_STATE_ON
75} bt_state_t;
76
77/** Bluetooth Error Status */
78/** We need to build on this */
79
80typedef enum {
81 BT_STATUS_SUCCESS,
82 BT_STATUS_FAIL,
83 BT_STATUS_NOT_READY,
84 BT_STATUS_NOMEM,
85 BT_STATUS_BUSY,
86 BT_STATUS_DONE, /* request already completed */
87 BT_STATUS_UNSUPPORTED,
88 BT_STATUS_PARM_INVALID,
89 BT_STATUS_UNHANDLED,
90 BT_STATUS_AUTH_FAILURE,
Hemant Gupta4d864552013-07-31 19:14:02 +053091 BT_STATUS_RMT_DEV_DOWN,
92 BT_STATUS_AUTH_REJECTED
Andre Eisenbach05f49542012-09-18 12:15:26 -070093
94} bt_status_t;
95
96/** Bluetooth PinKey Code */
97typedef struct {
98 uint8_t pin[16];
99} __attribute__((packed))bt_pin_code_t;
100
Satya Callojibe7f0442014-07-03 10:59:16 -0700101typedef struct {
102 uint8_t status;
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;
109
Andre Eisenbach05f49542012-09-18 12:15:26 -0700110/** Bluetooth Adapter Discovery state */
111typedef enum {
112 BT_DISCOVERY_STOPPED,
113 BT_DISCOVERY_STARTED
114} bt_discovery_state_t;
115
116/** Bluetooth ACL connection state */
117typedef enum {
118 BT_ACL_STATE_CONNECTED,
119 BT_ACL_STATE_DISCONNECTED
120} bt_acl_state_t;
121
122/** Bluetooth 128-bit UUID */
123typedef struct {
124 uint8_t uu[16];
125} bt_uuid_t;
126
127/** Bluetooth SDP service record */
128typedef struct
129{
130 bt_uuid_t uuid;
131 uint16_t channel;
132 char name[256]; // what's the maximum length
133} bt_service_record_t;
134
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800135
136/** Bluetooth Remote Version info */
137typedef struct
138{
139 int version;
140 int sub_ver;
141 int manufacturer;
142} bt_remote_version_t;
143
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700144typedef struct
145{
Satya Callojia8b49d32015-02-10 09:20:07 -0800146 uint16_t version_supported;
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700147 uint8_t local_privacy_enabled;
148 uint8_t max_adv_instance;
149 uint8_t rpa_offload_supported;
150 uint8_t max_irk_list_size;
151 uint8_t max_adv_filter_supported;
Satya Callojibe7f0442014-07-03 10:59:16 -0700152 uint8_t activity_energy_info_supported;
Satya Callojia8b49d32015-02-10 09:20:07 -0800153 uint16_t scan_result_storage_size;
154 uint16_t total_trackable_advertisers;
Satya Calloji51225022015-03-31 13:58:21 -0700155 bool extended_scan_support;
156 bool debug_logging_supported;
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700157}bt_local_le_features_t;
158
Andre Eisenbach05f49542012-09-18 12:15:26 -0700159/* Bluetooth Adapter and Remote Device property types */
160typedef enum {
161 /* Properties common to both adapter and remote device */
162 /**
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
166 */
167 BT_PROPERTY_BDNAME = 0x1,
168 /**
169 * Description - Bluetooth Device Address
170 * Access mode - Only GET.
171 * Data type - bt_bdaddr_t
172 */
173 BT_PROPERTY_BDADDR,
174 /**
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).
178 */
179 BT_PROPERTY_UUIDS,
180 /**
181 * Description - Bluetooth Class of Device as found in Assigned Numbers
182 * Access mode - Only GET.
183 * Data type - uint32_t.
184 */
185 BT_PROPERTY_CLASS_OF_DEVICE,
186 /**
187 * Description - Device Type - BREDR, BLE or DUAL Mode
188 * Access mode - Only GET.
189 * Data type - bt_device_type_t
190 */
191 BT_PROPERTY_TYPE_OF_DEVICE,
192 /**
193 * Description - Bluetooth Service Record
194 * Access mode - Only GET.
195 * Data type - bt_service_record_t
196 */
197 BT_PROPERTY_SERVICE_RECORD,
198
199 /* Properties unique to adapter */
200 /**
201 * Description - Bluetooth Adapter scan mode
202 * Access mode - GET and SET
203 * Data type - bt_scan_mode_t.
204 */
205 BT_PROPERTY_ADAPTER_SCAN_MODE,
206 /**
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).
211 */
212 BT_PROPERTY_ADAPTER_BONDED_DEVICES,
213 /**
214 * Description - Bluetooth Adapter Discovery timeout (in seconds)
215 * Access mode - GET and SET
216 * Data type - uint32_t
217 */
218 BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
219
220 /* Properties unique to remote device */
221 /**
222 * Description - User defined friendly name of the remote device
223 * Access mode - GET and SET
224 * Data type - bt_bdname_t.
225 */
226 BT_PROPERTY_REMOTE_FRIENDLY_NAME,
227 /**
228 * Description - RSSI value of the inquired remote device
229 * Access mode - Only GET.
230 * Data type - int32_t.
231 */
232 BT_PROPERTY_REMOTE_RSSI,
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800233 /**
234 * Description - Remote version info
235 * Access mode - SET/GET.
236 * Data type - bt_remote_version_t.
237 */
238
239 BT_PROPERTY_REMOTE_VERSION_INFO,
Andre Eisenbach05f49542012-09-18 12:15:26 -0700240
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700241 /**
242 * Description - Local LE features
243 * Access mode - GET.
244 * Data type - bt_local_le_features_t.
245 */
246 BT_PROPERTY_LOCAL_LE_FEATURES,
247
Andre Eisenbach05f49542012-09-18 12:15:26 -0700248 BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
249} bt_property_type_t;
250
251/** Bluetooth Adapter Property data structure */
252typedef struct
253{
254 bt_property_type_t type;
255 int len;
256 void *val;
257} bt_property_t;
258
Jakub Pawlowski00202ff2015-12-01 12:06:23 -0800259/** Bluetooth Out Of Band data for bonding */
260typedef struct
261{
262 uint8_t c192[16]; /* Simple Pairing Hash C-192 */
263 uint8_t r192[16]; /* Simple Pairing Randomizer R-192 */
264 uint8_t c256[16]; /* Simple Pairing Hash C-256 */
265 uint8_t r256[16]; /* Simple Pairing Randomizer R-256 */
266 uint8_t sm_tk[16]; /* Security Manager TK Value */
267 uint8_t le_sc_c[16]; /* LE Secure Connections Random Value */
268 uint8_t le_sc_r[16]; /* LE Secure Connections Random Value */
269} bt_out_of_band_data_t;
270
271
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700272
Andre Eisenbach05f49542012-09-18 12:15:26 -0700273/** Bluetooth Device Type */
274typedef enum {
275 BT_DEVICE_DEVTYPE_BREDR = 0x1,
276 BT_DEVICE_DEVTYPE_BLE,
277 BT_DEVICE_DEVTYPE_DUAL
278} bt_device_type_t;
279/** Bluetooth Bond state */
280typedef enum {
281 BT_BOND_STATE_NONE,
282 BT_BOND_STATE_BONDING,
283 BT_BOND_STATE_BONDED
284} bt_bond_state_t;
285
286/** Bluetooth SSP Bonding Variant */
287typedef enum {
288 BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
289 BT_SSP_VARIANT_PASSKEY_ENTRY,
290 BT_SSP_VARIANT_CONSENT,
291 BT_SSP_VARIANT_PASSKEY_NOTIFICATION
292} bt_ssp_variant_t;
293
294#define BT_MAX_NUM_UUIDS 32
295
296/** Bluetooth Interface callbacks */
297
298/** Bluetooth Enable/Disable Callback. */
299typedef void (*adapter_state_changed_callback)(bt_state_t state);
300
301/** GET/SET Adapter Properties callback */
302/* TODO: For the GET/SET property APIs/callbacks, we may need a session
303 * identifier to associate the call with the callback. This would be needed
304 * whenever more than one simultaneous instance of the same adapter_type
305 * is get/set.
306 *
307 * If this is going to be handled in the Java framework, then we do not need
308 * to manage sessions here.
309 */
310typedef void (*adapter_properties_callback)(bt_status_t status,
311 int num_properties,
312 bt_property_t *properties);
313
314/** GET/SET Remote Device Properties callback */
315/** TODO: For remote device properties, do not see a need to get/set
316 * multiple properties - num_properties shall be 1
317 */
318typedef void (*remote_device_properties_callback)(bt_status_t status,
319 bt_bdaddr_t *bd_addr,
320 int num_properties,
321 bt_property_t *properties);
322
323/** New device discovered callback */
324/** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
325 * respectively */
326typedef void (*device_found_callback)(int num_properties,
327 bt_property_t *properties);
328
329/** Discovery state changed callback */
330typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
331
332/** Bluetooth Legacy PinKey Request callback */
333typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
Casper Bonde5ccdc512015-05-08 14:33:58 +0200334 bt_bdname_t *bd_name, uint32_t cod, bool min_16_digit);
Andre Eisenbach05f49542012-09-18 12:15:26 -0700335
336/** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
337/** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
338 * BT_SSP_PAIRING_PASSKEY_ENTRY */
339/* TODO: Passkey request callback shall not be needed for devices with display
340 * capability. We still need support this in the stack for completeness */
341typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
342 bt_bdname_t *bd_name,
343 uint32_t cod,
344 bt_ssp_variant_t pairing_variant,
345 uint32_t pass_key);
346
347/** Bluetooth Bond state changed callback */
348/* Invoked in response to create_bond, cancel_bond or remove_bond */
349typedef void (*bond_state_changed_callback)(bt_status_t status,
350 bt_bdaddr_t *remote_bd_addr,
351 bt_bond_state_t state);
352
353/** Bluetooth ACL connection state changed callback */
354typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
355 bt_acl_state_t state);
356
357typedef enum {
358 ASSOCIATE_JVM,
359 DISASSOCIATE_JVM
360} bt_cb_thread_evt;
361
362/** Thread Associate/Disassociate JVM Callback */
363/* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
364 * the JVM */
365typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
366
367/** Bluetooth Test Mode Callback */
368/* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
369typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
370
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800371/* LE Test mode callbacks
372* This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
373* The num_packets is valid only for le_test_end command */
374typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
Satya Callojibe7f0442014-07-03 10:59:16 -0700375
376/** Callback invoked when energy details are obtained */
377/* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
378 * If the ctrl_state value is 0, it means the API call failed
379 * Time values-In milliseconds as returned by the controller
380 * Energy used-Value as returned by the controller
381 * Status-Provides the status of the read_energy_info API call */
382typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
383
Andre Eisenbach05f49542012-09-18 12:15:26 -0700384/** TODO: Add callbacks for Link Up/Down and other generic
385 * notifications/callbacks */
386
387/** Bluetooth DM callback structure. */
388typedef struct {
389 /** set to sizeof(bt_callbacks_t) */
390 size_t size;
391 adapter_state_changed_callback adapter_state_changed_cb;
392 adapter_properties_callback adapter_properties_cb;
393 remote_device_properties_callback remote_device_properties_cb;
394 device_found_callback device_found_cb;
395 discovery_state_changed_callback discovery_state_changed_cb;
396 pin_request_callback pin_request_cb;
397 ssp_request_callback ssp_request_cb;
398 bond_state_changed_callback bond_state_changed_cb;
399 acl_state_changed_callback acl_state_changed_cb;
400 callback_thread_event thread_evt_cb;
401 dut_mode_recv_callback dut_mode_recv_cb;
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800402 le_test_mode_callback le_test_mode_cb;
Satya Callojibe7f0442014-07-03 10:59:16 -0700403 energy_info_callback energy_info_cb;
Andre Eisenbach05f49542012-09-18 12:15:26 -0700404} bt_callbacks_t;
405
Sharvil Nanavati3bd8cba2014-05-30 16:43:38 -0700406typedef void (*alarm_cb)(void *data);
407typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data);
408typedef int (*acquire_wake_lock_callout)(const char *lock_name);
409typedef int (*release_wake_lock_callout)(const char *lock_name);
410
411/** The set of functions required by bluedroid to set wake alarms and
412 * grab wake locks. This struct is passed into the stack through the
413 * |set_os_callouts| function on |bt_interface_t|.
414 */
415typedef struct {
416 /* set to sizeof(bt_os_callouts_t) */
417 size_t size;
418
419 set_wake_alarm_callout set_wake_alarm;
420 acquire_wake_lock_callout acquire_wake_lock;
421 release_wake_lock_callout release_wake_lock;
422} bt_os_callouts_t;
423
Andre Eisenbach05f49542012-09-18 12:15:26 -0700424/** NOTE: By default, no profiles are initialized at the time of init/enable.
425 * Whenever the application invokes the 'init' API of a profile, then one of
426 * the following shall occur:
427 *
428 * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
429 * profile as enabled. Subsequently, when the application invokes the
430 * Bluetooth 'enable', as part of the enable sequence the profile that were
431 * marked shall be enabled by calling appropriate stack APIs. The
432 * 'adapter_properties_cb' shall return the list of UUIDs of the
433 * enabled profiles.
434 *
435 * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
436 * profile API to initialize the profile and trigger a
437 * 'adapter_properties_cb' with the current list of UUIDs including the
438 * newly added profile's UUID.
439 *
440 * The reverse shall occur whenever the profile 'cleanup' APIs are invoked
441 */
442
443/** Represents the standard Bluetooth DM interface. */
444typedef struct {
445 /** set to sizeof(bt_interface_t) */
446 size_t size;
447 /**
448 * Opens the interface and provides the callback routines
449 * to the implemenation of this interface.
450 */
451 int (*init)(bt_callbacks_t* callbacks );
452
453 /** Enable Bluetooth. */
454 int (*enable)(void);
455
456 /** Disable Bluetooth. */
457 int (*disable)(void);
458
459 /** Closes the interface. */
460 void (*cleanup)(void);
461
462 /** Get all Bluetooth Adapter properties at init */
463 int (*get_adapter_properties)(void);
464
465 /** Get Bluetooth Adapter property of 'type' */
466 int (*get_adapter_property)(bt_property_type_t type);
467
468 /** Set Bluetooth Adapter property of 'type' */
469 /* Based on the type, val shall be one of
470 * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
471 */
472 int (*set_adapter_property)(const bt_property_t *property);
473
474 /** Get all Remote Device properties */
475 int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
476
477 /** Get Remote Device property of 'type' */
478 int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
479 bt_property_type_t type);
480
481 /** Set Remote Device property of 'type' */
482 int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
483 const bt_property_t *property);
484
485 /** Get Remote Device's service record for the given UUID */
486 int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
487 bt_uuid_t *uuid);
488
489 /** Start SDP to get remote services */
490 int (*get_remote_services)(bt_bdaddr_t *remote_addr);
491
492 /** Start Discovery */
493 int (*start_discovery)(void);
494
495 /** Cancel Discovery */
496 int (*cancel_discovery)(void);
497
498 /** Create Bluetooth Bonding */
Andre Eisenbach01206e52014-08-04 17:22:29 -0700499 int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
Andre Eisenbach05f49542012-09-18 12:15:26 -0700500
Jakub Pawlowski00202ff2015-12-01 12:06:23 -0800501 /** Create Bluetooth Bond using out of band data */
502 int (*create_bond_out_of_band)(const bt_bdaddr_t *bd_addr, int transport,
503 const bt_out_of_band_data_t *oob_data);
504
Andre Eisenbach05f49542012-09-18 12:15:26 -0700505 /** Remove Bond */
506 int (*remove_bond)(const bt_bdaddr_t *bd_addr);
507
508 /** Cancel Bond */
509 int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
510
Andre Eisenbach0d553bc2014-06-18 12:18:34 -0700511 /**
512 * Get the connection status for a given remote device.
513 * return value of 0 means the device is not connected,
514 * non-zero return status indicates an active connection.
515 */
516 int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
517
Andre Eisenbach05f49542012-09-18 12:15:26 -0700518 /** BT Legacy PinKey Reply */
519 /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
520 int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
521 uint8_t pin_len, bt_pin_code_t *pin_code);
522
523 /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
524 * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
525 * BT_SSP_VARIANT_CONSENT
526 * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
527 * shall be zero */
528 int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
529 uint8_t accept, uint32_t passkey);
530
531 /** Get Bluetooth profile interface */
532 const void* (*get_profile_interface) (const char *profile_id);
533
534 /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
535 /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
536 int (*dut_mode_configure)(uint8_t enable);
537
538 /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
539 int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800540 /** BLE Test Mode APIs */
541 /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
542 int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
543
Zhihai Xua17b75b2013-06-10 20:23:45 -0700544 /* enable or disable bluetooth HCI snoop log */
545 int (*config_hci_snoop_log)(uint8_t enable);
Sharvil Nanavati3bd8cba2014-05-30 16:43:38 -0700546
547 /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
548 * This should be called immediately after a successful |init|.
549 */
550 int (*set_os_callouts)(bt_os_callouts_t *callouts);
Satya Callojibe7f0442014-07-03 10:59:16 -0700551
552 /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
553 * Success indicates that the VSC command was sent to controller
554 */
555 int (*read_energy_info)();
Andre Eisenbach34ab95a2014-12-05 09:35:57 -0800556
557 /**
558 * Native support for dumpsys function
559 * Function is synchronous and |fd| is owned by caller.
560 */
561 void (*dump)(int fd);
Ajay Panickerb3759712015-07-28 16:53:53 -0700562
563 /**
564 * Clear /data/misc/bt_config.conf and erase all stored connections
565 */
566 int (*config_clear)(void);
567
Andre Eisenbach05f49542012-09-18 12:15:26 -0700568} bt_interface_t;
569
570/** TODO: Need to add APIs for Service Discovery, Service authorization and
571 * connection management. Also need to add APIs for configuring
572 * properties of remote bonded devices such as name, UUID etc. */
573
574typedef struct {
575 struct hw_device_t common;
576 const bt_interface_t* (*get_bluetooth_interface)();
577} bluetooth_device_t;
578
579typedef bluetooth_device_t bluetooth_module_t;
kschulz9a92a7b2015-03-06 09:15:43 +0100580
581
Andre Eisenbach05f49542012-09-18 12:15:26 -0700582__END_DECLS
583
584#endif /* ANDROID_INCLUDE_BLUETOOTH_H */