blob: 66cd9120f06d4fe830f32b6b80709b970bb895a5 [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"
Hemant Guptae338c362013-11-11 11:53:48 +053047#define BT_PROFILE_HIDDEV_ID "hiddev"
Andre Eisenbach05f49542012-09-18 12:15:26 -070048#define BT_PROFILE_PAN_ID "pan"
Hemant Gupta053cccf2014-04-18 12:25:24 +053049#define BT_PROFILE_MAP_CLIENT_ID "map_client"
kschulz9a92a7b2015-03-06 09:15:43 +010050#define BT_PROFILE_SDP_CLIENT_ID "sdp"
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -080051#define BT_PROFILE_GATT_ID "gatt"
Ravi Nagarajan482ba782013-02-26 10:34:41 -080052#define BT_PROFILE_AV_RC_ID "avrcp"
Kiran Kelageridee0c782015-07-13 12:12:18 -070053#define WIPOWER_PROFILE_ID "wipower"
Mike Lockwood7da4cb82014-06-02 16:20:51 -070054#define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl"
Andre Eisenbach05f49542012-09-18 12:15:26 -070055
56/** Bluetooth Address */
57typedef struct {
58 uint8_t address[6];
59} __attribute__((packed))bt_bdaddr_t;
60
61/** Bluetooth Device Name */
62typedef struct {
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -080063 uint8_t name[249];
Andre Eisenbach05f49542012-09-18 12:15:26 -070064} __attribute__((packed))bt_bdname_t;
65
66/** Bluetooth Adapter Visibility Modes*/
67typedef enum {
68 BT_SCAN_MODE_NONE,
69 BT_SCAN_MODE_CONNECTABLE,
70 BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
71} bt_scan_mode_t;
72
73/** Bluetooth Adapter State */
74typedef enum {
75 BT_STATE_OFF,
76 BT_STATE_ON
77} bt_state_t;
78
79/** Bluetooth Error Status */
80/** We need to build on this */
81
82typedef enum {
83 BT_STATUS_SUCCESS,
84 BT_STATUS_FAIL,
85 BT_STATUS_NOT_READY,
86 BT_STATUS_NOMEM,
87 BT_STATUS_BUSY,
88 BT_STATUS_DONE, /* request already completed */
89 BT_STATUS_UNSUPPORTED,
90 BT_STATUS_PARM_INVALID,
91 BT_STATUS_UNHANDLED,
92 BT_STATUS_AUTH_FAILURE,
Hemant Gupta4d864552013-07-31 19:14:02 +053093 BT_STATUS_RMT_DEV_DOWN,
94 BT_STATUS_AUTH_REJECTED
Andre Eisenbach05f49542012-09-18 12:15:26 -070095
96} bt_status_t;
97
98/** Bluetooth PinKey Code */
99typedef struct {
100 uint8_t pin[16];
101} __attribute__((packed))bt_pin_code_t;
102
Satya Callojibe7f0442014-07-03 10:59:16 -0700103typedef struct {
104 uint8_t status;
105 uint8_t ctrl_state; /* stack reported state */
106 uint64_t tx_time; /* in ms */
107 uint64_t rx_time; /* in ms */
108 uint64_t idle_time; /* in ms */
109 uint64_t energy_used; /* a product of mA, V and ms */
110} __attribute__((packed))bt_activity_energy_info;
111
Andre Eisenbach05f49542012-09-18 12:15:26 -0700112/** Bluetooth Adapter Discovery state */
113typedef enum {
114 BT_DISCOVERY_STOPPED,
115 BT_DISCOVERY_STARTED
116} bt_discovery_state_t;
117
118/** Bluetooth ACL connection state */
119typedef enum {
120 BT_ACL_STATE_CONNECTED,
121 BT_ACL_STATE_DISCONNECTED
122} bt_acl_state_t;
123
124/** Bluetooth 128-bit UUID */
125typedef struct {
126 uint8_t uu[16];
127} bt_uuid_t;
128
129/** Bluetooth SDP service record */
130typedef struct
131{
132 bt_uuid_t uuid;
133 uint16_t channel;
134 char name[256]; // what's the maximum length
135} bt_service_record_t;
136
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800137
138/** Bluetooth Remote Version info */
139typedef struct
140{
141 int version;
142 int sub_ver;
143 int manufacturer;
144} bt_remote_version_t;
145
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700146typedef struct
147{
Satya Callojia8b49d32015-02-10 09:20:07 -0800148 uint16_t version_supported;
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700149 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;
Satya Callojibe7f0442014-07-03 10:59:16 -0700154 uint8_t activity_energy_info_supported;
Satya Callojia8b49d32015-02-10 09:20:07 -0800155 uint16_t scan_result_storage_size;
156 uint16_t total_trackable_advertisers;
Satya Calloji51225022015-03-31 13:58:21 -0700157 bool extended_scan_support;
158 bool debug_logging_supported;
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700159}bt_local_le_features_t;
160
Andre Eisenbach05f49542012-09-18 12:15:26 -0700161/* Bluetooth Adapter and Remote Device property types */
162typedef enum {
163 /* Properties common to both adapter and remote device */
164 /**
165 * Description - Bluetooth Device Name
166 * Access mode - Adapter name can be GET/SET. Remote device can be GET
167 * Data type - bt_bdname_t
168 */
169 BT_PROPERTY_BDNAME = 0x1,
170 /**
171 * Description - Bluetooth Device Address
172 * Access mode - Only GET.
173 * Data type - bt_bdaddr_t
174 */
175 BT_PROPERTY_BDADDR,
176 /**
177 * Description - Bluetooth Service 128-bit UUIDs
178 * Access mode - Only GET.
179 * Data type - Array of bt_uuid_t (Array size inferred from property length).
180 */
181 BT_PROPERTY_UUIDS,
182 /**
183 * Description - Bluetooth Class of Device as found in Assigned Numbers
184 * Access mode - Only GET.
185 * Data type - uint32_t.
186 */
187 BT_PROPERTY_CLASS_OF_DEVICE,
188 /**
189 * Description - Device Type - BREDR, BLE or DUAL Mode
190 * Access mode - Only GET.
191 * Data type - bt_device_type_t
192 */
193 BT_PROPERTY_TYPE_OF_DEVICE,
194 /**
195 * Description - Bluetooth Service Record
196 * Access mode - Only GET.
197 * Data type - bt_service_record_t
198 */
199 BT_PROPERTY_SERVICE_RECORD,
200
201 /* Properties unique to adapter */
202 /**
203 * Description - Bluetooth Adapter scan mode
204 * Access mode - GET and SET
205 * Data type - bt_scan_mode_t.
206 */
207 BT_PROPERTY_ADAPTER_SCAN_MODE,
208 /**
209 * Description - List of bonded devices
210 * Access mode - Only GET.
211 * Data type - Array of bt_bdaddr_t of the bonded remote devices
212 * (Array size inferred from property length).
213 */
214 BT_PROPERTY_ADAPTER_BONDED_DEVICES,
215 /**
216 * Description - Bluetooth Adapter Discovery timeout (in seconds)
217 * Access mode - GET and SET
218 * Data type - uint32_t
219 */
220 BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
221
222 /* Properties unique to remote device */
223 /**
224 * Description - User defined friendly name of the remote device
225 * Access mode - GET and SET
226 * Data type - bt_bdname_t.
227 */
228 BT_PROPERTY_REMOTE_FRIENDLY_NAME,
229 /**
230 * Description - RSSI value of the inquired remote device
231 * Access mode - Only GET.
232 * Data type - int32_t.
233 */
234 BT_PROPERTY_REMOTE_RSSI,
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800235 /**
236 * Description - Remote version info
237 * Access mode - SET/GET.
238 * Data type - bt_remote_version_t.
239 */
240
241 BT_PROPERTY_REMOTE_VERSION_INFO,
Andre Eisenbach05f49542012-09-18 12:15:26 -0700242
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700243 /**
244 * Description - Local LE features
245 * Access mode - GET.
246 * Data type - bt_local_le_features_t.
247 */
248 BT_PROPERTY_LOCAL_LE_FEATURES,
249
Andre Eisenbach05f49542012-09-18 12:15:26 -0700250 BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
251} bt_property_type_t;
252
253/** Bluetooth Adapter Property data structure */
254typedef struct
255{
256 bt_property_type_t type;
257 int len;
258 void *val;
259} bt_property_t;
260
Ganesh Ganapathi Batta460343a2014-05-27 16:03:11 -0700261
Andre Eisenbach05f49542012-09-18 12:15:26 -0700262/** Bluetooth Device Type */
263typedef enum {
264 BT_DEVICE_DEVTYPE_BREDR = 0x1,
265 BT_DEVICE_DEVTYPE_BLE,
266 BT_DEVICE_DEVTYPE_DUAL
267} bt_device_type_t;
268/** Bluetooth Bond state */
269typedef enum {
270 BT_BOND_STATE_NONE,
271 BT_BOND_STATE_BONDING,
272 BT_BOND_STATE_BONDED
273} bt_bond_state_t;
274
275/** Bluetooth SSP Bonding Variant */
276typedef enum {
277 BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
278 BT_SSP_VARIANT_PASSKEY_ENTRY,
279 BT_SSP_VARIANT_CONSENT,
280 BT_SSP_VARIANT_PASSKEY_NOTIFICATION
281} bt_ssp_variant_t;
282
283#define BT_MAX_NUM_UUIDS 32
284
285/** Bluetooth Interface callbacks */
286
287/** Bluetooth Enable/Disable Callback. */
288typedef void (*adapter_state_changed_callback)(bt_state_t state);
289
290/** GET/SET Adapter Properties callback */
291/* TODO: For the GET/SET property APIs/callbacks, we may need a session
292 * identifier to associate the call with the callback. This would be needed
293 * whenever more than one simultaneous instance of the same adapter_type
294 * is get/set.
295 *
296 * If this is going to be handled in the Java framework, then we do not need
297 * to manage sessions here.
298 */
299typedef void (*adapter_properties_callback)(bt_status_t status,
300 int num_properties,
301 bt_property_t *properties);
302
303/** GET/SET Remote Device Properties callback */
304/** TODO: For remote device properties, do not see a need to get/set
305 * multiple properties - num_properties shall be 1
306 */
307typedef void (*remote_device_properties_callback)(bt_status_t status,
308 bt_bdaddr_t *bd_addr,
309 int num_properties,
310 bt_property_t *properties);
311
312/** New device discovered callback */
313/** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
314 * respectively */
315typedef void (*device_found_callback)(int num_properties,
316 bt_property_t *properties);
317
318/** Discovery state changed callback */
319typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
320
321/** Bluetooth Legacy PinKey Request callback */
322typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
Casper Bonde5ccdc512015-05-08 14:33:58 +0200323 bt_bdname_t *bd_name, uint32_t cod, bool min_16_digit);
Andre Eisenbach05f49542012-09-18 12:15:26 -0700324
325/** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
326/** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
327 * BT_SSP_PAIRING_PASSKEY_ENTRY */
328/* TODO: Passkey request callback shall not be needed for devices with display
329 * capability. We still need support this in the stack for completeness */
330typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
331 bt_bdname_t *bd_name,
332 uint32_t cod,
333 bt_ssp_variant_t pairing_variant,
334 uint32_t pass_key);
335
336/** Bluetooth Bond state changed callback */
337/* Invoked in response to create_bond, cancel_bond or remove_bond */
338typedef void (*bond_state_changed_callback)(bt_status_t status,
339 bt_bdaddr_t *remote_bd_addr,
340 bt_bond_state_t state);
341
342/** Bluetooth ACL connection state changed callback */
343typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
344 bt_acl_state_t state);
345
346typedef enum {
347 ASSOCIATE_JVM,
348 DISASSOCIATE_JVM
349} bt_cb_thread_evt;
350
351/** Thread Associate/Disassociate JVM Callback */
352/* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
353 * the JVM */
354typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
355
356/** Bluetooth Test Mode Callback */
357/* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
358typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
359
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800360/* LE Test mode callbacks
361* This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
362* The num_packets is valid only for le_test_end command */
363typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
Satya Callojibe7f0442014-07-03 10:59:16 -0700364
365/** Callback invoked when energy details are obtained */
366/* Ctrl_state-Current controller state-Active-1,scan-2,or idle-3 state as defined by HCI spec.
367 * If the ctrl_state value is 0, it means the API call failed
368 * Time values-In milliseconds as returned by the controller
369 * Energy used-Value as returned by the controller
370 * Status-Provides the status of the read_energy_info API call */
371typedef void (*energy_info_callback)(bt_activity_energy_info *energy_info);
372
Andre Eisenbach05f49542012-09-18 12:15:26 -0700373/** TODO: Add callbacks for Link Up/Down and other generic
374 * notifications/callbacks */
375
376/** Bluetooth DM callback structure. */
377typedef struct {
378 /** set to sizeof(bt_callbacks_t) */
379 size_t size;
380 adapter_state_changed_callback adapter_state_changed_cb;
381 adapter_properties_callback adapter_properties_cb;
382 remote_device_properties_callback remote_device_properties_cb;
383 device_found_callback device_found_cb;
384 discovery_state_changed_callback discovery_state_changed_cb;
385 pin_request_callback pin_request_cb;
386 ssp_request_callback ssp_request_cb;
387 bond_state_changed_callback bond_state_changed_cb;
388 acl_state_changed_callback acl_state_changed_cb;
389 callback_thread_event thread_evt_cb;
390 dut_mode_recv_callback dut_mode_recv_cb;
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800391 le_test_mode_callback le_test_mode_cb;
Satya Callojibe7f0442014-07-03 10:59:16 -0700392 energy_info_callback energy_info_cb;
Andre Eisenbach05f49542012-09-18 12:15:26 -0700393} bt_callbacks_t;
394
Sharvil Nanavati3bd8cba2014-05-30 16:43:38 -0700395typedef void (*alarm_cb)(void *data);
396typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void *data);
397typedef int (*acquire_wake_lock_callout)(const char *lock_name);
398typedef int (*release_wake_lock_callout)(const char *lock_name);
399
400/** The set of functions required by bluedroid to set wake alarms and
401 * grab wake locks. This struct is passed into the stack through the
402 * |set_os_callouts| function on |bt_interface_t|.
403 */
404typedef struct {
405 /* set to sizeof(bt_os_callouts_t) */
406 size_t size;
407
408 set_wake_alarm_callout set_wake_alarm;
409 acquire_wake_lock_callout acquire_wake_lock;
410 release_wake_lock_callout release_wake_lock;
411} bt_os_callouts_t;
412
Andre Eisenbach05f49542012-09-18 12:15:26 -0700413/** NOTE: By default, no profiles are initialized at the time of init/enable.
414 * Whenever the application invokes the 'init' API of a profile, then one of
415 * the following shall occur:
416 *
417 * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
418 * profile as enabled. Subsequently, when the application invokes the
419 * Bluetooth 'enable', as part of the enable sequence the profile that were
420 * marked shall be enabled by calling appropriate stack APIs. The
421 * 'adapter_properties_cb' shall return the list of UUIDs of the
422 * enabled profiles.
423 *
424 * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
425 * profile API to initialize the profile and trigger a
426 * 'adapter_properties_cb' with the current list of UUIDs including the
427 * newly added profile's UUID.
428 *
429 * The reverse shall occur whenever the profile 'cleanup' APIs are invoked
430 */
431
432/** Represents the standard Bluetooth DM interface. */
433typedef struct {
434 /** set to sizeof(bt_interface_t) */
435 size_t size;
436 /**
437 * Opens the interface and provides the callback routines
438 * to the implemenation of this interface.
439 */
440 int (*init)(bt_callbacks_t* callbacks );
441
442 /** Enable Bluetooth. */
443 int (*enable)(void);
444
445 /** Disable Bluetooth. */
446 int (*disable)(void);
447
448 /** Closes the interface. */
449 void (*cleanup)(void);
450
451 /** Get all Bluetooth Adapter properties at init */
452 int (*get_adapter_properties)(void);
453
454 /** Get Bluetooth Adapter property of 'type' */
455 int (*get_adapter_property)(bt_property_type_t type);
456
457 /** Set Bluetooth Adapter property of 'type' */
458 /* Based on the type, val shall be one of
459 * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
460 */
461 int (*set_adapter_property)(const bt_property_t *property);
462
463 /** Get all Remote Device properties */
464 int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
465
466 /** Get Remote Device property of 'type' */
467 int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
468 bt_property_type_t type);
469
470 /** Set Remote Device property of 'type' */
471 int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
472 const bt_property_t *property);
473
474 /** Get Remote Device's service record for the given UUID */
475 int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
476 bt_uuid_t *uuid);
477
478 /** Start SDP to get remote services */
479 int (*get_remote_services)(bt_bdaddr_t *remote_addr);
480
481 /** Start Discovery */
482 int (*start_discovery)(void);
483
484 /** Cancel Discovery */
485 int (*cancel_discovery)(void);
486
487 /** Create Bluetooth Bonding */
Andre Eisenbach01206e52014-08-04 17:22:29 -0700488 int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
Andre Eisenbach05f49542012-09-18 12:15:26 -0700489
490 /** Remove Bond */
491 int (*remove_bond)(const bt_bdaddr_t *bd_addr);
492
493 /** Cancel Bond */
494 int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
495
Andre Eisenbach0d553bc2014-06-18 12:18:34 -0700496 /**
497 * Get the connection status for a given remote device.
498 * return value of 0 means the device is not connected,
499 * non-zero return status indicates an active connection.
500 */
501 int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
502
Andre Eisenbach05f49542012-09-18 12:15:26 -0700503 /** BT Legacy PinKey Reply */
504 /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
505 int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
506 uint8_t pin_len, bt_pin_code_t *pin_code);
507
508 /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
509 * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
510 * BT_SSP_VARIANT_CONSENT
511 * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
512 * shall be zero */
513 int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
514 uint8_t accept, uint32_t passkey);
515
516 /** Get Bluetooth profile interface */
517 const void* (*get_profile_interface) (const char *profile_id);
518
519 /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
520 /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
521 int (*dut_mode_configure)(uint8_t enable);
522
523 /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
524 int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
Ganesh Ganapathi Battafefb3342013-02-05 15:23:45 -0800525 /** BLE Test Mode APIs */
526 /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
527 int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
528
Zhihai Xua17b75b2013-06-10 20:23:45 -0700529 /* enable or disable bluetooth HCI snoop log */
530 int (*config_hci_snoop_log)(uint8_t enable);
Sharvil Nanavati3bd8cba2014-05-30 16:43:38 -0700531
532 /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
533 * This should be called immediately after a successful |init|.
534 */
535 int (*set_os_callouts)(bt_os_callouts_t *callouts);
Satya Callojibe7f0442014-07-03 10:59:16 -0700536
537 /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
538 * Success indicates that the VSC command was sent to controller
539 */
540 int (*read_energy_info)();
Andre Eisenbach34ab95a2014-12-05 09:35:57 -0800541
542 /**
543 * Native support for dumpsys function
544 * Function is synchronous and |fd| is owned by caller.
545 */
546 void (*dump)(int fd);
Ajay Panickerb3759712015-07-28 16:53:53 -0700547
548 /**
549 * Clear /data/misc/bt_config.conf and erase all stored connections
550 */
551 int (*config_clear)(void);
552
Srinu Jella2bf78392015-04-08 17:09:09 +0530553 /** BT stack Test interface */
554 const void* (*get_testapp_interface)(int test_app_profile);
Andre Eisenbach05f49542012-09-18 12:15:26 -0700555} bt_interface_t;
556
557/** TODO: Need to add APIs for Service Discovery, Service authorization and
558 * connection management. Also need to add APIs for configuring
559 * properties of remote bonded devices such as name, UUID etc. */
560
561typedef struct {
562 struct hw_device_t common;
563 const bt_interface_t* (*get_bluetooth_interface)();
564} bluetooth_device_t;
565
566typedef bluetooth_device_t bluetooth_module_t;
kschulz9a92a7b2015-03-06 09:15:43 +0100567
568
Andre Eisenbach05f49542012-09-18 12:15:26 -0700569__END_DECLS
570
571#endif /* ANDROID_INCLUDE_BLUETOOTH_H */