blob: 368e70db81dbc29f6e6b6a942204ce7f4d66cef3 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
3 * Copyright (C) 1999-2012 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19/******************************************************************************
20 *
21 * This file contains the Bluetooth Manager (BTM) API function external
22 * definitions.
23 *
24 ******************************************************************************/
25#ifndef BTM_API_H
26#define BTM_API_H
27
28#include "bt_target.h"
29#include "sdp_api.h"
30#include "hcidefs.h"
31
32#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
33#include "smp_api.h"
34#endif
35/*****************************************************************************
36** DEVICE CONTROL and COMMON
37*****************************************************************************/
38/*****************************
39** Device Control Constants
40******************************/
41/* Maximum number of bytes allowed for vendor specific command parameters */
42#define BTM_MAX_VENDOR_SPECIFIC_LEN HCI_COMMAND_SIZE
43
44/* BTM application return status codes */
45enum
46{
47 BTM_SUCCESS = 0, /* 0 Command succeeded */
48 BTM_CMD_STARTED, /* 1 Command started OK. */
49 BTM_BUSY, /* 2 Device busy with another command */
50 BTM_NO_RESOURCES, /* 3 No resources to issue command */
51 BTM_MODE_UNSUPPORTED, /* 4 Request for 1 or more unsupported modes */
52 BTM_ILLEGAL_VALUE, /* 5 Illegal parameter value */
53 BTM_WRONG_MODE, /* 6 Device in wrong mode for request */
54 BTM_UNKNOWN_ADDR, /* 7 Unknown remote BD address */
55 BTM_DEVICE_TIMEOUT, /* 8 Device timeout */
56 BTM_BAD_VALUE_RET, /* 9 A bad value was received from HCI */
57 BTM_ERR_PROCESSING, /* 10 Generic error */
58 BTM_NOT_AUTHORIZED, /* 11 Authorization failed */
59 BTM_DEV_RESET, /* 12 Device has been reset */
60 BTM_CMD_STORED, /* 13 request is stored in control block */
61 BTM_ILLEGAL_ACTION, /* 14 state machine gets illegal command */
62 BTM_DELAY_CHECK, /* 15 delay the check on encryption */
63 BTM_SCO_BAD_LENGTH, /* 16 Bad SCO over HCI data length */
64 BTM_SUCCESS_NO_SECURITY, /* 17 security passed, no security set */
65 BTM_FAILED_ON_SECURITY , /* 18 security failed */
66 BTM_REPEATED_ATTEMPTS /* 19 repeated attempts for LE security requests */
67};
68typedef UINT8 tBTM_STATUS;
69
Matthew Xie7f3e4292013-09-30 12:44:10 -070070#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
71typedef enum
72{
73 BTM_BR_ONE, /*0 First state or BR/EDR scan 1*/
74 BTM_BLE_ONE, /*1BLE scan 1*/
75 BTM_BR_TWO, /*2 BR/EDR scan 2*/
76 BTM_BLE_TWO, /*3 BLE scan 2*/
77 BTM_FINISH, /*4 End of Interleave Scan, or normal scan*/
78 BTM_NO_INTERLEAVING /*5 No Interleaving*/
79}btm_inq_state;
80#endif
81
82
83
The Android Open Source Project5738f832012-12-12 16:00:35 -080084/*************************
85** Device Control Types
86**************************/
87#define BTM_DEVICE_ROLE_BR 0x01
88#define BTM_DEVICE_ROLE_DUAL 0x02
89#define BTM_MAX_DEVICE_ROLE BTM_DEVICE_ROLE_DUAL
90typedef UINT8 tBTM_DEVICE_ROLE;
91
92/* Device name of peer (may be truncated to save space in BTM database) */
93typedef UINT8 tBTM_BD_NAME[BTM_MAX_REM_BD_NAME_LEN + 1];
94
95/* Structure returned with local version information */
96typedef struct
97{
98 UINT8 hci_version;
99 UINT16 hci_revision;
100 UINT8 lmp_version;
101 UINT16 manufacturer;
102 UINT16 lmp_subversion;
103} tBTM_VERSION_INFO;
104
105/* Structure returned with Vendor Specific Command complete callback */
106typedef struct
107{
108 UINT16 opcode;
109 UINT16 param_len;
110 UINT8 *p_param_buf;
111} tBTM_VSC_CMPL;
112
113#define BTM_VSC_CMPL_DATA_SIZE (BTM_MAX_VENDOR_SPECIFIC_LEN + sizeof(tBTM_VSC_CMPL))
114/**************************************************
115** Device Control and General Callback Functions
116***************************************************/
117/* Callback function for when device status changes. Appl must poll for
118** what the new state is (BTM_IsDeviceUp). The event occurs whenever the stack
119** has detected that the controller status has changed. This asynchronous event
120** is enabled/disabled by calling BTM_RegisterForDeviceStatusNotif().
121*/
122enum
123{
124 BTM_DEV_STATUS_UP,
125 BTM_DEV_STATUS_DOWN,
126 BTM_DEV_STATUS_CMD_TOUT
127};
128
129typedef UINT8 tBTM_DEV_STATUS;
130
131
132typedef void (tBTM_DEV_STATUS_CB) (tBTM_DEV_STATUS status);
133
134
135/* Callback function for when a vendor specific event occurs. The length and
136** array of returned parameter bytes are included. This asynchronous event
137** is enabled/disabled by calling BTM_RegisterForVSEvents().
138*/
139typedef void (tBTM_VS_EVT_CB) (UINT8 len, UINT8 *p);
140
141
142/* General callback function for notifying an application that a synchronous
143** BTM function is complete. The pointer contains the address of any returned data.
144*/
145typedef void (tBTM_CMPL_CB) (void *p1);
146
147/* VSC callback function for notifying an application that a synchronous
148** BTM function is complete. The pointer contains the address of any returned data.
149*/
150typedef void (tBTM_VSC_CMPL_CB) (tBTM_VSC_CMPL *p1);
151
152/* Callback for apps to check connection and inquiry filters.
153** Parameters are the BD Address of remote and the Dev Class of remote.
154** If the app returns none zero, the connection or inquiry result will be dropped.
155*/
156typedef UINT8 (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
157
158/*****************************************************************************
159** DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device
160*****************************************************************************/
161/*******************************
162** Device Discovery Constants
163********************************/
164/* Discoverable modes */
165#define BTM_NON_DISCOVERABLE 0
166#define BTM_LIMITED_DISCOVERABLE 1
167#define BTM_GENERAL_DISCOVERABLE 2
168#define BTM_DISCOVERABLE_MASK (BTM_LIMITED_DISCOVERABLE|BTM_GENERAL_DISCOVERABLE)
169#define BTM_MAX_DISCOVERABLE BTM_GENERAL_DISCOVERABLE
170/* high byte for BLE Discoverable modes */
171#define BTM_BLE_NON_DISCOVERABLE 0x0000
172#define BTM_BLE_LIMITED_DISCOVERABLE 0x0100
173#define BTM_BLE_GENERAL_DISCOVERABLE 0x0200
174#define BTM_BLE_MAX_DISCOVERABLE BTM_BLE_GENERAL_DISCOVERABLE
175#define BTM_BLE_DISCOVERABLE_MASK (BTM_BLE_NON_DISCOVERABLE|BTM_BLE_LIMITED_DISCOVERABLE|BTM_BLE_GENERAL_DISCOVERABLE)
176
177/* Connectable modes */
178#define BTM_NON_CONNECTABLE 0
179#define BTM_CONNECTABLE 1
180#define BTM_CONNECTABLE_MASK (BTM_NON_CONNECTABLE | BTM_CONNECTABLE)
181/* high byte for BLE Connectable modes */
182#define BTM_BLE_NON_CONNECTABLE 0x0000
183#define BTM_BLE_CONNECTABLE 0x0100
184#define BTM_BLE_MAX_CONNECTABLE BTM_BLE_CONNECTABLE
185#define BTM_BLE_CONNECTABLE_MASK (BTM_BLE_NON_CONNECTABLE | BTM_BLE_CONNECTABLE)
186
187/* Inquiry modes
188 * Note: These modes are associated with the inquiry active values (BTM_*ACTIVE) */
Andre Eisenbach3aa60542013-03-22 18:00:51 -0700189#define BTM_INQUIRY_NONE 0
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800190#define BTM_GENERAL_INQUIRY 0x01
191#define BTM_LIMITED_INQUIRY 0x02
192#define BTM_BR_INQUIRY_MASK (BTM_GENERAL_INQUIRY | BTM_LIMITED_INQUIRY)
193
The Android Open Source Project5738f832012-12-12 16:00:35 -0800194/* high byte of inquiry mode for BLE inquiry mode */
195#define BTM_BLE_INQUIRY_NONE 0x00
196#define BTM_BLE_GENERAL_INQUIRY 0x10
197#define BTM_BLE_LIMITED_INQUIRY 0x20
198#define BTM_BLE_INQUIRY_MASK (BTM_BLE_GENERAL_INQUIRY|BTM_BLE_LIMITED_INQUIRY)
199
200/* BTM_IsInquiryActive return values (Bit Mask)
201 * Note: These bit masks are associated with the inquiry modes (BTM_*_INQUIRY) */
202#define BTM_INQUIRY_INACTIVE 0x0 /* no inquiry in progress */
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700203#define BTM_GENERAL_INQUIRY_ACTIVE BTM_GENERAL_INQUIRY /* a general inquiry is in progress */
204#define BTM_LIMITED_INQUIRY_ACTIVE BTM_LIMITED_INQUIRY /* a limited inquiry is in progress */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800205#define BTM_PERIODIC_INQUIRY_ACTIVE 0x8 /* a periodic inquiry is active */
206#define BTM_SSP_INQUIRY_ACTIVE 0x4 /* SSP is active, so inquiry is disallowed (work around for FW bug) */
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700207#define BTM_LE_GENERAL_INQUIRY_ACTIVE BTM_BLE_GENERAL_INQUIRY /* a general inquiry is in progress */
208#define BTM_LE_LIMITED_INQUIRY_ACTIVE BTM_BLE_LIMITED_INQUIRY /* a limited inquiry is in progress */
209#define BTM_LE_SELECT_CONN_ACTIVE 0x40 /* selection connection is in progress */
210#define BTM_LE_OBSERVE_ACTIVE 0x80 /* selection connection is in progress */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800211
212/* inquiry activity mask */
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700213#define BTM_BR_INQ_ACTIVE_MASK (BTM_GENERAL_INQUIRY_ACTIVE|BTM_LIMITED_INQUIRY_ACTIVE|BTM_PERIODIC_INQUIRY_ACTIVE) /* BR/EDR inquiry activity mask */
214#define BTM_BLE_SCAN_ACTIVE_MASK 0xF0 /* LE scan activity mask */
215#define BTM_BLE_INQ_ACTIVE_MASK (BTM_LE_GENERAL_INQUIRY_ACTIVE|BTM_LE_LIMITED_INQUIRY_ACTIVE) /* LE inquiry activity mask*/
216#define BTM_INQUIRY_ACTIVE_MASK (BTM_BR_INQ_ACTIVE_MASK | BTM_BLE_INQ_ACTIVE_MASK) /* inquiry activity mask */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800217
218/* Define scan types */
219#define BTM_SCAN_TYPE_STANDARD 0
220#define BTM_SCAN_TYPE_INTERLACED 1 /* 1.2 devices only */
221
222/* Define inquiry results mode */
223#define BTM_INQ_RESULT_STANDARD 0
224#define BTM_INQ_RESULT_WITH_RSSI 1
225#define BTM_INQ_RESULT_EXTENDED 2
226
227#define BTM_INQ_RES_IGNORE_RSSI 0x7f /* RSSI value not supplied (ignore it) */
228
229/* Inquiry Filter Condition types (see tBTM_INQ_PARMS) */
230#define BTM_CLR_INQUIRY_FILTER 0 /* Inquiry Filtering is turned off */
231#define BTM_FILTER_COND_DEVICE_CLASS HCI_FILTER_COND_DEVICE_CLASS /* Filter on device class */
232#define BTM_FILTER_COND_BD_ADDR HCI_FILTER_COND_BD_ADDR /* Filter on device addr */
233
234/* State of the remote name retrieval during inquiry operations.
235** Used in the tBTM_INQ_INFO structure, and returned in the
236** BTM_InqDbRead, BTM_InqDbFirst, and BTM_InqDbNext functions.
237** The name field is valid when the state returned is
238** BTM_INQ_RMT_NAME_DONE */
239#define BTM_INQ_RMT_NAME_EMPTY 0
240#define BTM_INQ_RMT_NAME_PENDING 1
241#define BTM_INQ_RMT_NAME_DONE 2
242#define BTM_INQ_RMT_NAME_FAILED 3
243
244/*********************************
245 *** Class of Device constants ***
246 *********************************/
247#define BTM_FORMAT_TYPE_1 0x00
248
249/****************************
250** minor device class field
251*****************************/
252
253/* 0x00 is used as unclassified for all minor device classes */
254#define BTM_COD_MINOR_UNCLASSIFIED 0x00
255
256/* minor device class field for Computer Major Class */
257/* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */
258#define BTM_COD_MINOR_DESKTOP_WORKSTATION 0x04
259#define BTM_COD_MINOR_SERVER_COMPUTER 0x08
260#define BTM_COD_MINOR_LAPTOP 0x0C
261#define BTM_COD_MINOR_HANDHELD_PC_PDA 0x10 /* clam shell */
262#define BTM_COD_MINOR_PALM_SIZE_PC_PDA 0x14
263#define BTM_COD_MINOR_WEARABLE_COMPUTER 0x18 /* watch sized */
264
265/* minor device class field for Phone Major Class */
266/* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */
267#define BTM_COD_MINOR_CELLULAR 0x04
268#define BTM_COD_MINOR_CORDLESS 0x08
269#define BTM_COD_MINOR_SMART_PHONE 0x0C
270#define BTM_COD_MINOR_WIRED_MDM_V_GTWY 0x10 /* wired modem or voice gatway */
271#define BTM_COD_MINOR_ISDN_ACCESS 0x14
272
273/* minor device class field for LAN Access Point Major Class */
274/* Load Factor Field bit 5-7 */
275#define BTM_COD_MINOR_FULLY_AVAILABLE 0x00
276#define BTM_COD_MINOR_1_17_UTILIZED 0x20
277#define BTM_COD_MINOR_17_33_UTILIZED 0x40
278#define BTM_COD_MINOR_33_50_UTILIZED 0x60
279#define BTM_COD_MINOR_50_67_UTILIZED 0x80
280#define BTM_COD_MINOR_67_83_UTILIZED 0xA0
281#define BTM_COD_MINOR_83_99_UTILIZED 0xC0
282#define BTM_COD_MINOR_NO_SERVICE_AVAILABLE 0xE0
283/* sub-Field bit 2-4 */
284/* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */
285
286/* minor device class field for Audio/Video Major Class */
287/* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */
288#define BTM_COD_MINOR_CONFM_HEADSET 0x04
289#define BTM_COD_MINOR_CONFM_HANDSFREE 0x08
290#define BTM_COD_MINOR_MICROPHONE 0x10
291#define BTM_COD_MINOR_LOUDSPEAKER 0x14
292#define BTM_COD_MINOR_HEADPHONES 0x18
293#define BTM_COD_MINOR_PORTABLE_AUDIO 0x1C
294#define BTM_COD_MINOR_CAR_AUDIO 0x20
295#define BTM_COD_MINOR_SET_TOP_BOX 0x24
296#define BTM_COD_MINOR_HIFI_AUDIO 0x28
297#define BTM_COD_MINOR_VCR 0x2C
298#define BTM_COD_MINOR_VIDEO_CAMERA 0x30
299#define BTM_COD_MINOR_CAMCORDER 0x34
300#define BTM_COD_MINOR_VIDEO_MONITOR 0x38
301#define BTM_COD_MINOR_VIDDISP_LDSPKR 0x3C
302#define BTM_COD_MINOR_VIDEO_CONFERENCING 0x40
303#define BTM_COD_MINOR_GAMING_TOY 0x48
304
305/* minor device class field for Peripheral Major Class */
306/* Bits 6-7 independently specify mouse, keyboard, or combo mouse/keyboard */
307#define BTM_COD_MINOR_KEYBOARD 0x40
308#define BTM_COD_MINOR_POINTING 0x80
309#define BTM_COD_MINOR_COMBO 0xC0
310/* Bits 2-5 OR'd with selection from bits 6-7 */
311/* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */
312#define BTM_COD_MINOR_JOYSTICK 0x04
313#define BTM_COD_MINOR_GAMEPAD 0x08
314#define BTM_COD_MINOR_REMOTE_CONTROL 0x0C
315#define BTM_COD_MINOR_SENSING_DEVICE 0x10
316#define BTM_COD_MINOR_DIGITIZING_TABLET 0x14
317#define BTM_COD_MINOR_CARD_READER 0x18 /* e.g. SIM card reader */
318#define BTM_COD_MINOR_DIGITAL_PAN 0x1C
319#define BTM_COD_MINOR_HAND_SCANNER 0x20
320#define BTM_COD_MINOR_HAND_GESTURAL_INPUT 0x24
321
322/* minor device class field for Imaging Major Class */
323/* Bits 5-7 independently specify display, camera, scanner, or printer */
324#define BTM_COD_MINOR_DISPLAY 0x10
325#define BTM_COD_MINOR_CAMERA 0x20
326#define BTM_COD_MINOR_SCANNER 0x40
327#define BTM_COD_MINOR_PRINTER 0x80
328/* Bits 2-3 Reserved */
329/* #define BTM_COD_MINOR_UNCLASSIFIED 0x00 */
330
331/* minor device class field for Wearable Major Class */
332/* Bits 2-7 meaningful */
333#define BTM_COD_MINOR_WRIST_WATCH 0x04
334#define BTM_COD_MINOR_PAGER 0x08
335#define BTM_COD_MINOR_JACKET 0x0C
336#define BTM_COD_MINOR_HELMET 0x10
337#define BTM_COD_MINOR_GLASSES 0x14
338
339/* minor device class field for Toy Major Class */
340/* Bits 2-7 meaningful */
341#define BTM_COD_MINOR_ROBOT 0x04
342#define BTM_COD_MINOR_VEHICLE 0x08
343#define BTM_COD_MINOR_DOLL_ACTION_FIGURE 0x0C
344#define BTM_COD_MINOR_CONTROLLER 0x10
345#define BTM_COD_MINOR_GAME 0x14
346
347/* minor device class field for Health Major Class */
348/* Bits 2-7 meaningful */
349#define BTM_COD_MINOR_BLOOD_MONITOR 0x04
350#define BTM_COD_MINOR_THERMOMETER 0x08
351#define BTM_COD_MINOR_WEIGHING_SCALE 0x0C
352#define BTM_COD_MINOR_GLUCOSE_METER 0x10
353#define BTM_COD_MINOR_PULSE_OXIMETER 0x14
354#define BTM_COD_MINOR_HEART_PULSE_MONITOR 0x18
355#define BTM_COD_MINOR_HEALTH_DATA_DISPLAY 0x1C
356#define BTM_COD_MINOR_STEP_COUNTER 0x20
357#define BTM_COD_MINOR_BODY_COM_ANALYZER 0x24
358#define BTM_COD_MINOR_PEAK_FLOW_MONITOR 0x28
359#define BTM_COD_MINOR_MEDICATION_MONITOR 0x2C
360#define BTM_COD_MINOR_KNEE_PROSTHESIS 0x30
361#define BTM_COD_MINOR_ANKLE_PROSTHESIS 0x34
362
363
364/***************************
365** major device class field
366****************************/
367#define BTM_COD_MAJOR_MISCELLANEOUS 0x00
368#define BTM_COD_MAJOR_COMPUTER 0x01
369#define BTM_COD_MAJOR_PHONE 0x02
370#define BTM_COD_MAJOR_LAN_ACCESS_PT 0x03
371#define BTM_COD_MAJOR_AUDIO 0x04
372#define BTM_COD_MAJOR_PERIPHERAL 0x05
373#define BTM_COD_MAJOR_IMAGING 0x06
374#define BTM_COD_MAJOR_WEARABLE 0x07
375#define BTM_COD_MAJOR_TOY 0x08
376#define BTM_COD_MAJOR_HEALTH 0x09
377#define BTM_COD_MAJOR_UNCLASSIFIED 0x1F
378
379/***************************
380** service class fields
381****************************/
382#define BTM_COD_SERVICE_LMTD_DISCOVER 0x0020
383#define BTM_COD_SERVICE_POSITIONING 0x0100
384#define BTM_COD_SERVICE_NETWORKING 0x0200
385#define BTM_COD_SERVICE_RENDERING 0x0400
386#define BTM_COD_SERVICE_CAPTURING 0x0800
387#define BTM_COD_SERVICE_OBJ_TRANSFER 0x1000
388#define BTM_COD_SERVICE_AUDIO 0x2000
389#define BTM_COD_SERVICE_TELEPHONY 0x4000
390#define BTM_COD_SERVICE_INFORMATION 0x8000
391
392/* class of device field macros */
393#define BTM_COD_FORMAT_TYPE(u8, pd) {u8 = pd[2]&0x03;}
394#define BTM_COD_MINOR_CLASS(u8, pd) {u8 = pd[2]&0xFC;}
395#define BTM_COD_MAJOR_CLASS(u8, pd) {u8 = pd[1]&0x1F;}
396#define BTM_COD_SERVICE_CLASS(u16, pd) {u16 = pd[0]; u16<<=8; u16 += pd[1]&0xE0;}
397
398/* to set the fields (assumes that format type is always 0) */
399#define FIELDS_TO_COD(pd, mn, mj, sv) {pd[2] = mn; pd[1] = \
400 mj+ ((sv)&BTM_COD_SERVICE_CLASS_LO_B); \
401 pd[0] = (sv) >> 8;}
402
403/* the COD masks */
404#define BTM_COD_FORMAT_TYPE_MASK 0x03
405#define BTM_COD_MINOR_CLASS_MASK 0xFC
406#define BTM_COD_MAJOR_CLASS_MASK 0x1F
407#define BTM_COD_SERVICE_CLASS_LO_B 0x00E0
408#define BTM_COD_SERVICE_CLASS_MASK 0xFFE0
409
410
411/* BTM service definitions
412** Used for storing EIR data to bit mask
413*/
414#ifndef BTM_EIR_UUID_LKUP_TBL
415enum
416{
417 BTM_EIR_UUID_SERVCLASS_SERVICE_DISCOVERY_SERVER,
418/* BTM_EIR_UUID_SERVCLASS_BROWSE_GROUP_DESCRIPTOR, */
419/* BTM_EIR_UUID_SERVCLASS_PUBLIC_BROWSE_GROUP, */
420 BTM_EIR_UUID_SERVCLASS_SERIAL_PORT,
421 BTM_EIR_UUID_SERVCLASS_LAN_ACCESS_USING_PPP,
422 BTM_EIR_UUID_SERVCLASS_DIALUP_NETWORKING,
423 BTM_EIR_UUID_SERVCLASS_IRMC_SYNC,
424 BTM_EIR_UUID_SERVCLASS_OBEX_OBJECT_PUSH,
425 BTM_EIR_UUID_SERVCLASS_OBEX_FILE_TRANSFER,
426 BTM_EIR_UUID_SERVCLASS_IRMC_SYNC_COMMAND,
427 BTM_EIR_UUID_SERVCLASS_HEADSET,
428 BTM_EIR_UUID_SERVCLASS_CORDLESS_TELEPHONY,
429 BTM_EIR_UUID_SERVCLASS_AUDIO_SOURCE,
430 BTM_EIR_UUID_SERVCLASS_AUDIO_SINK,
431 BTM_EIR_UUID_SERVCLASS_AV_REM_CTRL_TARGET,
432/* BTM_EIR_UUID_SERVCLASS_ADV_AUDIO_DISTRIBUTION, */
433 BTM_EIR_UUID_SERVCLASS_AV_REMOTE_CONTROL,
434/* BTM_EIR_UUID_SERVCLASS_VIDEO_CONFERENCING, */
435 BTM_EIR_UUID_SERVCLASS_INTERCOM,
436 BTM_EIR_UUID_SERVCLASS_FAX,
437 BTM_EIR_UUID_SERVCLASS_HEADSET_AUDIO_GATEWAY,
438/* BTM_EIR_UUID_SERVCLASS_WAP, */
439/* BTM_EIR_UUID_SERVCLASS_WAP_CLIENT, */
440 BTM_EIR_UUID_SERVCLASS_PANU,
441 BTM_EIR_UUID_SERVCLASS_NAP,
442 BTM_EIR_UUID_SERVCLASS_GN,
443 BTM_EIR_UUID_SERVCLASS_DIRECT_PRINTING,
444/* BTM_EIR_UUID_SERVCLASS_REFERENCE_PRINTING, */
445 BTM_EIR_UUID_SERVCLASS_IMAGING,
446 BTM_EIR_UUID_SERVCLASS_IMAGING_RESPONDER,
447 BTM_EIR_UUID_SERVCLASS_IMAGING_AUTO_ARCHIVE,
448 BTM_EIR_UUID_SERVCLASS_IMAGING_REF_OBJECTS,
449 BTM_EIR_UUID_SERVCLASS_HF_HANDSFREE,
450 BTM_EIR_UUID_SERVCLASS_AG_HANDSFREE,
451 BTM_EIR_UUID_SERVCLASS_DIR_PRT_REF_OBJ_SERVICE,
452/* BTM_EIR_UUID_SERVCLASS_REFLECTED_UI, */
453 BTM_EIR_UUID_SERVCLASS_BASIC_PRINTING,
454 BTM_EIR_UUID_SERVCLASS_PRINTING_STATUS,
455 BTM_EIR_UUID_SERVCLASS_HUMAN_INTERFACE,
456 BTM_EIR_UUID_SERVCLASS_CABLE_REPLACEMENT,
457 BTM_EIR_UUID_SERVCLASS_HCRP_PRINT,
458 BTM_EIR_UUID_SERVCLASS_HCRP_SCAN,
459/* BTM_EIR_UUID_SERVCLASS_COMMON_ISDN_ACCESS, */
460/* BTM_EIR_UUID_SERVCLASS_VIDEO_CONFERENCING_GW, */
461/* BTM_EIR_UUID_SERVCLASS_UDI_MT, */
462/* BTM_EIR_UUID_SERVCLASS_UDI_TA, */
463/* BTM_EIR_UUID_SERVCLASS_VCP, */
464 BTM_EIR_UUID_SERVCLASS_SAP,
465 BTM_EIR_UUID_SERVCLASS_PBAP_PCE,
466 BTM_EIR_UUID_SERVCLASS_PBAP_PSE,
467/* BTM_EIR_UUID_SERVCLASS_TE_PHONE_ACCESS, */
468/* BTM_EIR_UUID_SERVCLASS_ME_PHONE_ACCESS, */
469 BTM_EIR_UUID_SERVCLASS_PHONE_ACCESS,
470 BTM_EIR_UUID_SERVCLASS_HEADSET_HS,
471 BTM_EIR_UUID_SERVCLASS_PNP_INFORMATION,
472/* BTM_EIR_UUID_SERVCLASS_GENERIC_NETWORKING, */
473/* BTM_EIR_UUID_SERVCLASS_GENERIC_FILETRANSFER, */
474/* BTM_EIR_UUID_SERVCLASS_GENERIC_AUDIO, */
475/* BTM_EIR_UUID_SERVCLASS_GENERIC_TELEPHONY, */
476/* BTM_EIR_UUID_SERVCLASS_UPNP_SERVICE, */
477/* BTM_EIR_UUID_SERVCLASS_UPNP_IP_SERVICE, */
478/* BTM_EIR_UUID_SERVCLASS_ESDP_UPNP_IP_PAN, */
479/* BTM_EIR_UUID_SERVCLASS_ESDP_UPNP_IP_LAP, */
480/* BTM_EIR_UUID_SERVCLASS_ESDP_UPNP_IP_L2CAP, */
481 BTM_EIR_UUID_SERVCLASS_VIDEO_SOURCE,
482 BTM_EIR_UUID_SERVCLASS_VIDEO_SINK,
483/* BTM_EIR_UUID_SERVCLASS_VIDEO_DISTRIBUTION */
484/* BTM_EIR_UUID_SERVCLASS_HDP_PROFILE */
485 BTM_EIR_UUID_SERVCLASS_MESSAGE_ACCESS,
486 BTM_EIR_UUID_SERVCLASS_MESSAGE_NOTIFICATION,
487 BTM_EIR_UUID_SERVCLASS_HDP_SOURCE,
488 BTM_EIR_UUID_SERVCLASS_HDP_SINK,
489 BTM_EIR_MAX_SERVICES
490};
491#endif /* BTM_EIR_UUID_LKUP_TBL */
492
493/* search result in EIR of inquiry database */
494#define BTM_EIR_FOUND 0
495#define BTM_EIR_NOT_FOUND 1
496#define BTM_EIR_UNKNOWN 2
497
498typedef UINT8 tBTM_EIR_SEARCH_RESULT;
499
500#define BTM_EIR_FLAGS_TYPE HCI_EIR_FLAGS_TYPE /* 0x01 */
501#define BTM_EIR_MORE_16BITS_UUID_TYPE HCI_EIR_MORE_16BITS_UUID_TYPE /* 0x02 */
502#define BTM_EIR_COMPLETE_16BITS_UUID_TYPE HCI_EIR_COMPLETE_16BITS_UUID_TYPE /* 0x03 */
503#define BTM_EIR_MORE_32BITS_UUID_TYPE HCI_EIR_MORE_32BITS_UUID_TYPE /* 0x04 */
504#define BTM_EIR_COMPLETE_32BITS_UUID_TYPE HCI_EIR_COMPLETE_32BITS_UUID_TYPE /* 0x05 */
505#define BTM_EIR_MORE_128BITS_UUID_TYPE HCI_EIR_MORE_128BITS_UUID_TYPE /* 0x06 */
506#define BTM_EIR_COMPLETE_128BITS_UUID_TYPE HCI_EIR_COMPLETE_128BITS_UUID_TYPE /* 0x07 */
507#define BTM_EIR_SHORTENED_LOCAL_NAME_TYPE HCI_EIR_SHORTENED_LOCAL_NAME_TYPE /* 0x08 */
508#define BTM_EIR_COMPLETE_LOCAL_NAME_TYPE HCI_EIR_COMPLETE_LOCAL_NAME_TYPE /* 0x09 */
509#define BTM_EIR_TX_POWER_LEVEL_TYPE HCI_EIR_TX_POWER_LEVEL_TYPE /* 0x0A */
510#define BTM_EIR_MANUFACTURER_SPECIFIC_TYPE HCI_EIR_MANUFACTURER_SPECIFIC_TYPE /* 0xFF */
511
512/* the following EIR tags are defined to OOB, not regular EIR data */
513#define BTM_EIR_OOB_BD_ADDR_TYPE HCI_EIR_OOB_BD_ADDR_TYPE /* 6 bytes */
514#define BTM_EIR_OOB_COD_TYPE HCI_EIR_OOB_COD_TYPE /* 3 bytes */
515#define BTM_EIR_OOB_SSP_HASH_C_TYPE HCI_EIR_OOB_SSP_HASH_C_TYPE /* 16 bytes */
516#define BTM_EIR_OOB_SSP_RAND_R_TYPE HCI_EIR_OOB_SSP_RAND_R_TYPE /* 16 bytes */
517
518#define BTM_OOB_MANDATORY_SIZE 8 /* include 2 bytes length & 6 bytes bd_addr */
519#define BTM_OOB_DATA_LEN_SIZE 2
520#define BTM_OOB_BD_ADDR_SIZE 6
521#define BTM_OOB_COD_SIZE BT_OOB_COD_SIZE
522#define BTM_OOB_HASH_C_SIZE BT_OOB_HASH_C_SIZE
523#define BTM_OOB_RAND_R_SIZE BT_OOB_RAND_R_SIZE
524
525
526#if BLE_INCLUDED == TRUE
527#define BTM_BLE_SEC_NONE 0
528#define BTM_BLE_SEC_ENCRYPT 1 /* encrypt the link using current key */
529#define BTM_BLE_SEC_ENCRYPT_NO_MITM 2
530#define BTM_BLE_SEC_ENCRYPT_MITM 3
531typedef UINT8 tBTM_BLE_SEC_ACT;
532#endif
533/************************************************************************************************
534** BTM Services MACROS handle array of UINT32 bits for more than 32 services
535*************************************************************************************************/
536/* Determine the number of UINT32's necessary for services */
537#define BTM_EIR_ARRAY_BITS 32 /* Number of bits in each array element */
538#define BTM_EIR_SERVICE_ARRAY_SIZE (((UINT32)BTM_EIR_MAX_SERVICES / BTM_EIR_ARRAY_BITS) + \
539 (((UINT32)BTM_EIR_MAX_SERVICES % BTM_EIR_ARRAY_BITS) ? 1 : 0))
540
541/* MACRO to set the service bit mask in a bit stream */
542#define BTM_EIR_SET_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] |= \
543 ((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS)))
544
545
546/* MACRO to clear the service bit mask in a bit stream */
547#define BTM_EIR_CLR_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] &= \
548 ~((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS)))
549
550/* MACRO to check the service bit mask in a bit stream */
551#define BTM_EIR_HAS_SERVICE(p, service) ((((UINT32 *)(p))[(((UINT32)(service)) / BTM_EIR_ARRAY_BITS)] & \
552 ((UINT32)1 << (((UINT32)(service)) % BTM_EIR_ARRAY_BITS))) >> (((UINT32)(service)) % BTM_EIR_ARRAY_BITS))
553
554/* start of EIR in HCI buffer, 4 bytes = HCI Command(2) + Length(1) + FEC_Req(1) */
555#define BTM_HCI_EIR_OFFSET (BT_HDR_SIZE + 4)
556
557/***************************
558** Device Discovery Types
559****************************/
560/* Definitions of the parameters passed to BTM_StartInquiry and
561** BTM_SetPeriodicInquiryMode.
562*/
563typedef struct /* contains the two device class condition fields */
564{
565 DEV_CLASS dev_class;
566 DEV_CLASS dev_class_mask;
567} tBTM_COD_COND;
568
569
570typedef union /* contains the inquiry filter condition */
571{
572 BD_ADDR bdaddr_cond;
573 tBTM_COD_COND cod_cond;
574} tBTM_INQ_FILT_COND;
575
576
577typedef struct /* contains the parameters passed to the inquiry functions */
578{
579 UINT8 mode; /* general or limited */
580 UINT8 duration; /* duration of the inquiry (1.28 sec increments) */
581 UINT8 max_resps; /* maximum number of responses to return */
582 BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */
583 UINT8 filter_cond_type; /* new devices, BD ADDR, COD, or No filtering */
584 tBTM_INQ_FILT_COND filter_cond; /* filter value based on filter cond type */
Matthew Xie7f3e4292013-09-30 12:44:10 -0700585#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
586 UINT8 intl_duration[4]; /*duration array storing the interleave scan's time portions*/
587#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -0800588} tBTM_INQ_PARMS;
589
590#define BTM_INQ_RESULT_BR 0x01
591#define BTM_INQ_RESULT_BLE 0x02
592
593#if (BLE_INCLUDED == TRUE)
594#define BTM_BLE_EVT_CONN_ADV 0x00
595#define BTM_BLE_EVT_CONN_DIR_ADV 0x01
596#define BTM_BLE_EVT_DISC_ADV 0x02
597#define BTM_BLE_EVT_NON_CONN_ADV 0x03
598#define BTM_BLE_EVT_SCAN_RSP 0x04
599typedef UINT8 tBTM_BLE_EVT_TYPE;
600#endif
601
602/* These are the fields returned in each device's response to the inquiry. It
603** is returned in the results callback if registered.
604*/
605typedef struct
606{
607 UINT16 clock_offset;
608 BD_ADDR remote_bd_addr;
609 DEV_CLASS dev_class;
610 UINT8 page_scan_rep_mode;
611 UINT8 page_scan_per_mode;
612 UINT8 page_scan_mode;
613 INT8 rssi; /* Set to BTM_INQ_RES_IGNORE_RSSI if not valid */
614#if (BTM_EIR_CLIENT_INCLUDED == TRUE)
615 UINT32 eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
616 BOOLEAN eir_complete_list;
617#endif
618#if (BLE_INCLUDED == TRUE)
619 tBT_DEVICE_TYPE device_type;
620 UINT8 inq_result_type;
621 UINT8 ble_addr_type;
622 tBTM_BLE_EVT_TYPE ble_evt_type;
623 UINT8 flag;
624#endif
625} tBTM_INQ_RESULTS;
626
627
628/* This is the inquiry response information held in its database by BTM, and available
629** to applications via BTM_InqDbRead, BTM_InqDbFirst, and BTM_InqDbNext.
630*/
631typedef struct
632{
633 tBTM_INQ_RESULTS results;
634
635 BOOLEAN appl_knows_rem_name; /* set by application if it knows the remote name of the peer device.
636 This is later used by application to determine if remote name request is
637 required to be done. Having the flag here avoid duplicate store of inquiry results */
638
639
640#if (BTM_INQ_GET_REMOTE_NAME == TRUE || BLE_INCLUDED == TRUE)
641 UINT16 remote_name_len;
642 tBTM_BD_NAME remote_name;
643 UINT8 remote_name_state;
644 UINT8 remote_name_type;
645#endif
646
647} tBTM_INQ_INFO;
648
649
650/* Structure returned with inquiry complete callback */
651typedef struct
652{
653 tBTM_STATUS status;
654 UINT8 num_resp; /* Number of results from the current inquiry */
655} tBTM_INQUIRY_CMPL;
656
657
658/* Structure returned with remote name request */
659typedef struct
660{
661 UINT16 status;
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700662 BD_ADDR bd_addr;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800663 UINT16 length;
664 BD_NAME remote_bd_name;
665} tBTM_REMOTE_DEV_NAME;
666
667typedef struct
668{
669 UINT8 pcm_intf_rate; /* PCM interface rate: 0: 128kbps, 1: 256 kbps;
670 2:512 bps; 3: 1024kbps; 4: 2048kbps */
671 UINT8 frame_type; /* frame type: 0: short; 1: long */
672 UINT8 sync_mode; /* sync mode: 0: slave; 1: master */
673 UINT8 clock_mode; /* clock mode: 0: slave; 1: master */
674
675}tBTM_SCO_PCM_PARAM;
676
677/****************************************
678** Device Discovery Callback Functions
679*****************************************/
680/* Callback function for asynchronous notifications when the BTM inquiry DB
681** changes. First param is inquiry database, second is if added to or removed
682** from the inquiry database.
683*/
684typedef void (tBTM_INQ_DB_CHANGE_CB) (void *p1, BOOLEAN is_new);
685
686/* Callback function for notifications when the BTM gets inquiry response.
687** First param is inquiry results database, second is pointer of EIR.
688*/
689typedef void (tBTM_INQ_RESULTS_CB) (tBTM_INQ_RESULTS *p_inq_results, UINT8 *p_eir);
690
691/*****************************************************************************
692** ACL CHANNEL MANAGEMENT
693*****************************************************************************/
694/******************
695** ACL Constants
696*******************/
697
698/* ACL modes */
699#define BTM_ACL_MODE_NORMAL HCI_MODE_ACTIVE
700#define BTM_ACL_MODE_HOLD HCI_MODE_HOLD
701#define BTM_ACL_MODE_SNIFF HCI_MODE_SNIFF
702#define BTM_ACL_MODE_PARK HCI_MODE_PARK
703
704/* Returned with structure in role switch callback (tBTM_ROLE_SWITCH_CMPL) */
705#define BTM_ROLE_MASTER HCI_ROLE_MASTER
706#define BTM_ROLE_SLAVE HCI_ROLE_SLAVE
707#define BTM_ROLE_UNDEFINED 0xff /* undefined value (error status) */
708
709/* ACL Packet Types */
710#define BTM_ACL_PKT_TYPES_MASK_DM1 HCI_PKT_TYPES_MASK_DM1
711#define BTM_ACL_PKT_TYPES_MASK_DH1 HCI_PKT_TYPES_MASK_DH1
712#define BTM_ACL_PKT_TYPES_MASK_DM3 HCI_PKT_TYPES_MASK_DM3
713#define BTM_ACL_PKT_TYPES_MASK_DH3 HCI_PKT_TYPES_MASK_DH3
714#define BTM_ACL_PKT_TYPES_MASK_DM5 HCI_PKT_TYPES_MASK_DM5
715#define BTM_ACL_PKT_TYPES_MASK_DH5 HCI_PKT_TYPES_MASK_DH5
716#define BTM_ACL_PKT_TYPES_MASK_NO_2_DH1 HCI_PKT_TYPES_MASK_NO_2_DH1
717#define BTM_ACL_PKT_TYPES_MASK_NO_3_DH1 HCI_PKT_TYPES_MASK_NO_3_DH1
718#define BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 HCI_PKT_TYPES_MASK_NO_2_DH3
719#define BTM_ACL_PKT_TYPES_MASK_NO_3_DH3 HCI_PKT_TYPES_MASK_NO_3_DH3
720#define BTM_ACL_PKT_TYPES_MASK_NO_2_DH5 HCI_PKT_TYPES_MASK_NO_2_DH5
721#define BTM_ACL_PKT_TYPES_MASK_NO_3_DH5 HCI_PKT_TYPES_MASK_NO_3_DH5
722
723/***************
724** ACL Types
725****************/
726
727/* Structure returned with link policy information (in tBTM_CMPL_CB callback function)
728** in response to BTM_ReadLinkPolicy call.
729*/
730typedef struct
731{
732 tBTM_STATUS status;
733 UINT8 hci_status;
734 BD_ADDR rem_bda;
735 UINT16 settings;
736} tBTM_LNK_POLICY_RESULTS;
737
738/* Structure returned with Role Switch information (in tBTM_CMPL_CB callback function)
739** in response to BTM_SwitchRole call.
740*/
741typedef struct
742{
743 UINT8 hci_status; /* HCI status returned with the event */
744 UINT8 role; /* BTM_ROLE_MASTER or BTM_ROLE_SLAVE */
745 BD_ADDR remote_bd_addr; /* Remote BD addr involved with the switch */
746} tBTM_ROLE_SWITCH_CMPL;
747
748
749/* Structure returned with Change Link Key information (in tBTM_CMPL_CB callback function)
750** in response to BTM_ChangeLinkKey call.
751*/
752typedef struct
753{
754 UINT8 hci_status; /* HCI status returned with the event */
755 BD_ADDR remote_bd_addr; /* Remote BD addr involved with the change link key */
756} tBTM_CHANGE_KEY_CMPL;
757
758
759/* Structure returned with QoS information (in tBTM_CMPL_CB callback function)
760** in response to BTM_SetQoS call.
761*/
762typedef struct
763{
764 FLOW_SPEC flow;
765 UINT16 handle;
766 UINT8 status;
767} tBTM_QOS_SETUP_CMPL;
768
769
770/* Structure returned with read RSSI event (in tBTM_CMPL_CB callback function)
771** in response to BTM_ReadRSSI call.
772*/
773typedef struct
774{
775 tBTM_STATUS status;
776 UINT8 hci_status;
777 INT8 rssi;
778 BD_ADDR rem_bda;
779} tBTM_RSSI_RESULTS;
780
781/* Structure returned with read current TX power event (in tBTM_CMPL_CB callback function)
782** in response to BTM_ReadTxPower call.
783*/
784typedef struct
785{
786 tBTM_STATUS status;
787 UINT8 hci_status;
788 INT8 tx_power;
789 BD_ADDR rem_bda;
790} tBTM_TX_POWER_RESULTS;
791
792/* Structure returned with read link quality event (in tBTM_CMPL_CB callback function)
793** in response to BTM_ReadLinkQuality call.
794*/
795typedef struct
796{
797 tBTM_STATUS status;
798 UINT8 hci_status;
799 UINT8 link_quality;
800 BD_ADDR rem_bda;
801} tBTM_LINK_QUALITY_RESULTS;
802
803/* Structure returned with read inq tx power quality event (in tBTM_CMPL_CB callback function)
804** in response to BTM_ReadInquiryRspTxPower call.
805*/
806typedef struct
807{
808 tBTM_STATUS status;
809 UINT8 hci_status;
810 INT8 tx_power;
811} tBTM_INQ_TXPWR_RESULTS;
812
813enum
814{
815 BTM_BL_CONN_EVT,
816 BTM_BL_DISCN_EVT,
817 BTM_BL_UPDATE_EVT,
818 BTM_BL_ROLE_CHG_EVT,
819 BTM_BL_COLLISION_EVT
820};
821typedef UINT8 tBTM_BL_EVENT;
822typedef UINT16 tBTM_BL_EVENT_MASK;
823
824#define BTM_BL_CONN_MASK 0x0001
825#define BTM_BL_DISCN_MASK 0x0002
826#define BTM_BL_UPDATE_MASK 0x0004
827#define BTM_BL_ROLE_CHG_MASK 0x0008
828
Andre Eisenbach3aa60542013-03-22 18:00:51 -0700829/* Device features mask definitions */
830#define BTM_FEATURE_BYTES_PER_PAGE HCI_FEATURE_BYTES_PER_PAGE
831#define BTM_EXT_FEATURES_PAGE_MAX HCI_EXT_FEATURES_PAGE_MAX
832
The Android Open Source Project5738f832012-12-12 16:00:35 -0800833/* the data type associated with BTM_BL_CONN_EVT */
834typedef struct
835{
836 tBTM_BL_EVENT event; /* The event reported. */
837 BD_ADDR_PTR p_bda; /* The address of the newly connected device */
838 DEV_CLASS_PTR p_dc; /* The device class */
839 BD_NAME_PTR p_bdn; /* The device name */
Andre Eisenbach3aa60542013-03-22 18:00:51 -0700840 UINT8 *p_features; /* pointer to the remote device's features page[0] (supported features page) */
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700841#if BLE_INCLUDED == TRUE
842 UINT16 handle; /* connection handle */
843 tBT_TRANSPORT transport; /* link is LE or not */
844#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -0800845} tBTM_BL_CONN_DATA;
846
847/* the data type associated with BTM_BL_DISCN_EVT */
848typedef struct
849{
850 tBTM_BL_EVENT event; /* The event reported. */
851 BD_ADDR_PTR p_bda; /* The address of the disconnected device */
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700852#if BLE_INCLUDED == TRUE
853 UINT16 handle; /* disconnected connection handle */
854 tBT_TRANSPORT transport; /* link is LE link or not */
855#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -0800856} tBTM_BL_DISCN_DATA;
857
858/* Busy-Level shall have the inquiry_paging mask set when
859 * inquiry/paging is in progress, Else the number of ACL links */
860#define BTM_BL_INQUIRY_PAGING_MASK 0x10
861#define BTM_BL_INQUIRY_STARTED (BTM_BL_INQUIRY_PAGING_MASK | 0x1)
862#define BTM_BL_INQUIRY_CANCELLED (BTM_BL_INQUIRY_PAGING_MASK | 0x2)
863#define BTM_BL_INQUIRY_COMPLETE (BTM_BL_INQUIRY_PAGING_MASK | 0x3)
864#define BTM_BL_PAGING_STARTED (BTM_BL_INQUIRY_PAGING_MASK | 0x4)
865#define BTM_BL_PAGING_COMPLETE (BTM_BL_INQUIRY_PAGING_MASK | 0x5)
866/* the data type associated with BTM_BL_UPDATE_EVT */
867typedef struct
868{
869 tBTM_BL_EVENT event; /* The event reported. */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800870 UINT8 busy_level;/* when paging or inquiring, level is 10.
The Android Open Source Project5738f832012-12-12 16:00:35 -0800871 * Otherwise, the number of ACL links. */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800872 UINT8 busy_level_flags; /* Notifies actual inquiry/page activities */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800873} tBTM_BL_UPDATE_DATA;
874
875/* the data type associated with BTM_BL_ROLE_CHG_EVT */
876typedef struct
877{
878 tBTM_BL_EVENT event; /* The event reported. */
879 BD_ADDR_PTR p_bda; /* The address of the peer connected device */
880 UINT8 new_role;
881 UINT8 hci_status; /* HCI status returned with the event */
882} tBTM_BL_ROLE_CHG_DATA;
883
884typedef union
885{
886 tBTM_BL_EVENT event; /* The event reported. */
887 tBTM_BL_CONN_DATA conn; /* The data associated with BTM_BL_CONN_EVT */
888 tBTM_BL_DISCN_DATA discn; /* The data associated with BTM_BL_DISCN_EVT */
889 tBTM_BL_UPDATE_DATA update; /* The data associated with BTM_BL_UPDATE_EVT */
890 tBTM_BL_ROLE_CHG_DATA role_chg;/*The data associated with BTM_BL_ROLE_CHG_EVT */
891} tBTM_BL_EVENT_DATA;
892
893/* Callback function for notifications when the BTM busy level
894** changes.
895*/
896typedef void (tBTM_BL_CHANGE_CB) (tBTM_BL_EVENT_DATA *p_data);
897
898/***************************
899** ACL Callback Functions
900****************************/
901/* Callback function for notifications when the BTM ACL connection DB
902** changes. First param is BD address, second is if added or removed.
903** Registered through BTM_AclRegisterForChanges call.
904*/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700905#if BLE_INCLUDED == TRUE
906typedef void (tBTM_ACL_DB_CHANGE_CB) (BD_ADDR p_bda, DEV_CLASS p_dc,
907 BD_NAME p_bdn, UINT8 *features,
908 BOOLEAN is_new, UINT16 handle,
909 tBT_TRANSPORT transport);
910#else
The Android Open Source Project5738f832012-12-12 16:00:35 -0800911typedef void (tBTM_ACL_DB_CHANGE_CB) (BD_ADDR p_bda, DEV_CLASS p_dc,
Andre Eisenbach3aa60542013-03-22 18:00:51 -0700912 BD_NAME p_bdn, UINT8 *features,
The Android Open Source Project5738f832012-12-12 16:00:35 -0800913 BOOLEAN is_new);
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700914#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -0800915/*****************************************************************************
916** SCO CHANNEL MANAGEMENT
917*****************************************************************************/
918/******************
919** SCO Constants
920*******************/
921
922/* Define an invalid SCO index and an invalid HCI handle */
923#define BTM_INVALID_SCO_INDEX 0xFFFF
924#define BTM_INVALID_HCI_HANDLE 0xFFFF
925
926/* Define an invalid SCO disconnect reason */
927#define BTM_INVALID_SCO_DISC_REASON 0xFFFF
928
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800929/* Define first active SCO index */
930#define BTM_FIRST_ACTIVE_SCO_INDEX BTM_MAX_SCO_LINKS
931
The Android Open Source Project5738f832012-12-12 16:00:35 -0800932/* Define SCO packet types used in APIs */
933#define BTM_SCO_PKT_TYPES_MASK_HV1 HCI_ESCO_PKT_TYPES_MASK_HV1
934#define BTM_SCO_PKT_TYPES_MASK_HV2 HCI_ESCO_PKT_TYPES_MASK_HV2
935#define BTM_SCO_PKT_TYPES_MASK_HV3 HCI_ESCO_PKT_TYPES_MASK_HV3
936#define BTM_SCO_PKT_TYPES_MASK_EV3 HCI_ESCO_PKT_TYPES_MASK_EV3
937#define BTM_SCO_PKT_TYPES_MASK_EV4 HCI_ESCO_PKT_TYPES_MASK_EV4
938#define BTM_SCO_PKT_TYPES_MASK_EV5 HCI_ESCO_PKT_TYPES_MASK_EV5
939#define BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 HCI_ESCO_PKT_TYPES_MASK_NO_2_EV3
940#define BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 HCI_ESCO_PKT_TYPES_MASK_NO_3_EV3
941#define BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 HCI_ESCO_PKT_TYPES_MASK_NO_2_EV5
942#define BTM_SCO_PKT_TYPES_MASK_NO_3_EV5 HCI_ESCO_PKT_TYPES_MASK_NO_3_EV5
943
944#define BTM_SCO_LINK_ONLY_MASK (BTM_SCO_PKT_TYPES_MASK_HV1 | \
945 BTM_SCO_PKT_TYPES_MASK_HV2 | \
946 BTM_SCO_PKT_TYPES_MASK_HV3)
947
948#define BTM_ESCO_LINK_ONLY_MASK (BTM_SCO_PKT_TYPES_MASK_EV3 | \
949 BTM_SCO_PKT_TYPES_MASK_EV4 | \
950 BTM_SCO_PKT_TYPES_MASK_EV5)
951
952#define BTM_SCO_LINK_ALL_PKT_MASK (BTM_SCO_LINK_ONLY_MASK | \
953 BTM_ESCO_LINK_ONLY_MASK)
954
955#define BTM_VALID_SCO_ALL_PKT_TYPE HCI_VALID_SCO_ALL_PKT_TYPE
956
957/* Passed in BTM_CreateSco if the packet type parameter should be ignored */
958#define BTM_IGNORE_SCO_PKT_TYPE 0
959
960/***************
961** SCO Types
962****************/
963#define BTM_LINK_TYPE_SCO HCI_LINK_TYPE_SCO
964#define BTM_LINK_TYPE_ESCO HCI_LINK_TYPE_ESCO
965typedef UINT8 tBTM_SCO_TYPE;
966
967
968/*******************
969** SCO Routing Path
970********************/
971#define BTM_SCO_ROUTE_PCM HCI_BRCM_SCO_ROUTE_PCM
972#define BTM_SCO_ROUTE_HCI HCI_BRCM_SCO_ROUTE_HCI
973typedef UINT8 tBTM_SCO_ROUTE_TYPE;
974
975
976/*******************
977** SCO Codec Types
978********************/
979#define BTM_SCO_CODEC_NONE 0x0000
980#define BTM_SCO_CODEC_CVSD 0x0001
981#define BTM_SCO_CODEC_MSBC 0x0002
982typedef UINT16 tBTM_SCO_CODEC_TYPE;
983
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800984
985
986/*******************
987** SCO Air Mode Types
988********************/
989#define BTM_SCO_AIR_MODE_U_LAW 0
990#define BTM_SCO_AIR_MODE_A_LAW 1
991#define BTM_SCO_AIR_MODE_CVSD 2
992#define BTM_SCO_AIR_MODE_TRANSPNT 3
993typedef UINT8 tBTM_SCO_AIR_MODE_TYPE;
994
The Android Open Source Project5738f832012-12-12 16:00:35 -0800995/*******************
996** SCO Voice Settings
997********************/
998#define BTM_VOICE_SETTING_CVSD ((UINT16) (HCI_INP_CODING_LINEAR | \
999 HCI_INP_DATA_FMT_2S_COMPLEMENT | \
1000 HCI_INP_SAMPLE_SIZE_16BIT | \
1001 HCI_AIR_CODING_FORMAT_CVSD))
1002
1003#define BTM_VOICE_SETTING_TRANS ((UINT16) (HCI_INP_CODING_LINEAR | \
1004 HCI_INP_DATA_FMT_2S_COMPLEMENT | \
1005 HCI_INP_SAMPLE_SIZE_16BIT | \
1006 HCI_AIR_CODING_FORMAT_TRANSPNT))
1007
1008/*******************
1009** SCO Data Status
1010********************/
1011enum
1012{
1013 BTM_SCO_DATA_CORRECT,
1014 BTM_SCO_DATA_PAR_ERR,
1015 BTM_SCO_DATA_NONE,
1016 BTM_SCO_DATA_PAR_LOST
1017};
1018typedef UINT8 tBTM_SCO_DATA_FLAG;
1019
1020/***************************
1021** SCO Callback Functions
1022****************************/
1023typedef void (tBTM_SCO_CB) (UINT16 sco_inx);
1024typedef void (tBTM_SCO_DATA_CB) (UINT16 sco_inx, BT_HDR *p_data, tBTM_SCO_DATA_FLAG status);
1025
1026/******************
1027** eSCO Constants
1028*******************/
1029#define BTM_64KBITS_RATE 0x00001f40 /* 64 kbits/sec data rate */
1030
1031/* Retransmission effort */
1032#define BTM_ESCO_RETRANS_OFF 0
1033#define BTM_ESCO_RETRANS_POWER 1
1034#define BTM_ESCO_RETRANS_QUALITY 2
1035#define BTM_ESCO_RETRANS_DONTCARE 0xff
1036
1037/* Max Latency Don't Care */
1038#define BTM_ESCO_MAX_LAT_DONTCARE 0xffff
1039
1040/***************
1041** eSCO Types
1042****************/
1043/* tBTM_ESCO_CBACK event types */
1044#define BTM_ESCO_CHG_EVT 1
1045#define BTM_ESCO_CONN_REQ_EVT 2
1046typedef UINT8 tBTM_ESCO_EVT;
1047
1048/* Passed into BTM_SetEScoMode() */
1049typedef struct
1050{
1051 UINT32 tx_bw;
1052 UINT32 rx_bw;
1053 UINT16 max_latency;
1054 UINT16 voice_contfmt; /* Voice Settings or Content Format */
1055 UINT16 packet_types;
1056 UINT8 retrans_effort;
1057} tBTM_ESCO_PARAMS;
1058
1059typedef struct
1060{
1061 UINT16 max_latency;
1062 UINT16 packet_types;
1063 UINT8 retrans_effort;
1064} tBTM_CHG_ESCO_PARAMS;
1065
1066/* Returned by BTM_ReadEScoLinkParms() */
1067typedef struct
1068{
1069 UINT16 rx_pkt_len;
1070 UINT16 tx_pkt_len;
1071 BD_ADDR bd_addr;
1072 UINT8 link_type; /* BTM_LINK_TYPE_SCO or BTM_LINK_TYPE_ESCO */
1073 UINT8 tx_interval;
1074 UINT8 retrans_window;
1075 UINT8 air_mode;
1076} tBTM_ESCO_DATA;
1077
1078typedef struct
1079{
1080 UINT16 sco_inx;
1081 UINT16 rx_pkt_len;
1082 UINT16 tx_pkt_len;
1083 BD_ADDR bd_addr;
1084 UINT8 hci_status;
1085 UINT8 tx_interval;
1086 UINT8 retrans_window;
1087} tBTM_CHG_ESCO_EVT_DATA;
1088
1089typedef struct
1090{
1091 UINT16 sco_inx;
1092 BD_ADDR bd_addr;
1093 DEV_CLASS dev_class;
1094 tBTM_SCO_TYPE link_type;
1095} tBTM_ESCO_CONN_REQ_EVT_DATA;
1096
1097typedef union
1098{
1099 tBTM_CHG_ESCO_EVT_DATA chg_evt;
1100 tBTM_ESCO_CONN_REQ_EVT_DATA conn_evt;
1101} tBTM_ESCO_EVT_DATA;
1102
1103/***************************
1104** eSCO Callback Functions
1105****************************/
1106typedef void (tBTM_ESCO_CBACK) (tBTM_ESCO_EVT event, tBTM_ESCO_EVT_DATA *p_data);
1107
1108
1109/*****************************************************************************
1110** SECURITY MANAGEMENT
1111*****************************************************************************/
1112/*******************************
1113** Security Manager Constants
1114********************************/
1115
1116/* Security Mode (BTM_SetSecurityMode) */
1117#define BTM_SEC_MODE_UNDEFINED 0
1118#define BTM_SEC_MODE_NONE 1
1119#define BTM_SEC_MODE_SERVICE 2
1120#define BTM_SEC_MODE_LINK 3
1121#define BTM_SEC_MODE_SP 4
1122#define BTM_SEC_MODE_SP_DEBUG 5
1123
1124/* Security Service Levels [bit mask] (BTM_SetSecurityLevel)
1125** Encryption should not be used without authentication
1126*/
1127#define BTM_SEC_NONE 0x0000 /* Nothing required */
1128#define BTM_SEC_IN_AUTHORIZE 0x0001 /* Inbound call requires authorization */
1129#define BTM_SEC_IN_AUTHENTICATE 0x0002 /* Inbound call requires authentication */
1130#define BTM_SEC_IN_ENCRYPT 0x0004 /* Inbound call requires encryption */
1131#define BTM_SEC_OUT_AUTHORIZE 0x0008 /* Outbound call requires authorization */
1132#define BTM_SEC_OUT_AUTHENTICATE 0x0010 /* Outbound call requires authentication */
1133#define BTM_SEC_OUT_ENCRYPT 0x0020 /* Outbound call requires encryption */
1134#define BTM_SEC_BOND 0x0040 /* Bonding */
1135#define BTM_SEC_BOND_CONN 0x0080 /* bond_created_connection */
1136#define BTM_SEC_FORCE_MASTER 0x0100 /* Need to switch connection to be master */
1137#define BTM_SEC_ATTEMPT_MASTER 0x0200 /* Try to switch connection to be master */
1138#define BTM_SEC_FORCE_SLAVE 0x0400 /* Need to switch connection to be master */
1139#define BTM_SEC_ATTEMPT_SLAVE 0x0800 /* Try to switch connection to be slave */
1140#define BTM_SEC_IN_MITM 0x1000 /* inbound Do man in the middle protection */
1141#define BTM_SEC_OUT_MITM 0x2000 /* outbound Do man in the middle protection */
1142
1143/* Security Flags [bit mask] (BTM_GetSecurityFlags)
1144*/
1145#define BTM_SEC_FLAG_AUTHORIZED 0x01
1146#define BTM_SEC_FLAG_AUTHENTICATED 0x02
1147#define BTM_SEC_FLAG_ENCRYPTED 0x04
1148#define BTM_SEC_FLAG_LKEY_KNOWN 0x10
1149#define BTM_SEC_FLAG_LKEY_AUTHED 0x20
1150
1151/* PIN types */
1152#define BTM_PIN_TYPE_VARIABLE HCI_PIN_TYPE_VARIABLE
1153#define BTM_PIN_TYPE_FIXED HCI_PIN_TYPE_FIXED
1154
1155/* Link Key types used to generate the new link key.
1156** returned in link key notification callback function
1157*/
1158#define BTM_LKEY_TYPE_COMBINATION HCI_LKEY_TYPE_COMBINATION
1159#define BTM_LKEY_TYPE_LOCAL_UNIT HCI_LKEY_TYPE_LOCAL_UNIT
1160#define BTM_LKEY_TYPE_REMOTE_UNIT HCI_LKEY_TYPE_REMOTE_UNIT
1161#define BTM_LKEY_TYPE_DEBUG_COMB HCI_LKEY_TYPE_DEBUG_COMB
1162#define BTM_LKEY_TYPE_UNAUTH_COMB HCI_LKEY_TYPE_UNAUTH_COMB
1163#define BTM_LKEY_TYPE_AUTH_COMB HCI_LKEY_TYPE_AUTH_COMB
1164#define BTM_LKEY_TYPE_CHANGED_COMB HCI_LKEY_TYPE_CHANGED_COMB
1165#define BTM_LKEY_TYPE_IGNORE 0xff /* used when event is response from
1166 hci return link keys request */
1167
1168/* Protocol level security (BTM_SetSecurityLevel) */
1169#define BTM_SEC_PROTO_L2CAP 0
1170#define BTM_SEC_PROTO_SDP 1
1171#define BTM_SEC_PROTO_TCS 2
1172#define BTM_SEC_PROTO_RFCOMM 3
1173#define BTM_SEC_PROTO_OBEX 4
1174#define BTM_SEC_PROTO_BNEP 5
1175#define BTM_SEC_PROTO_HID 6 /* HID */
1176#define BTM_SEC_PROTO_AVDT 7
1177#define BTM_SEC_PROTO_MCA 8
1178
1179/* Determine the number of UINT32's necessary for security services */
1180#define BTM_SEC_ARRAY_BITS 32 /* Number of bits in each array element */
1181#define BTM_SEC_SERVICE_ARRAY_SIZE (((UINT32)BTM_SEC_MAX_SERVICES / BTM_SEC_ARRAY_BITS) + \
1182 (((UINT32)BTM_SEC_MAX_SERVICES % BTM_SEC_ARRAY_BITS) ? 1 : 0))
1183
1184/* Security service definitions (BTM_SetSecurityLevel)
1185** Used for Authorization APIs
1186*/
1187#define BTM_SEC_SERVICE_SDP_SERVER 0
1188#define BTM_SEC_SERVICE_SERIAL_PORT 1
1189#define BTM_SEC_SERVICE_LAN_ACCESS 2
1190#define BTM_SEC_SERVICE_DUN 3
1191#define BTM_SEC_SERVICE_IRMC_SYNC 4
1192#define BTM_SEC_SERVICE_IRMC_SYNC_CMD 5
1193#define BTM_SEC_SERVICE_OBEX 6
1194#define BTM_SEC_SERVICE_OBEX_FTP 7
1195#define BTM_SEC_SERVICE_HEADSET 8
1196#define BTM_SEC_SERVICE_CORDLESS 9
1197#define BTM_SEC_SERVICE_INTERCOM 10
1198#define BTM_SEC_SERVICE_FAX 11
1199#define BTM_SEC_SERVICE_HEADSET_AG 12
1200#define BTM_SEC_SERVICE_PNP_INFO 13
1201#define BTM_SEC_SERVICE_GEN_NET 14
1202#define BTM_SEC_SERVICE_GEN_FILE 15
1203#define BTM_SEC_SERVICE_GEN_AUDIO 16
1204#define BTM_SEC_SERVICE_GEN_TEL 17
1205#define BTM_SEC_SERVICE_CTP_DATA 18
1206#define BTM_SEC_SERVICE_HCRP_CTRL 19
1207#define BTM_SEC_SERVICE_HCRP_DATA 20
1208#define BTM_SEC_SERVICE_HCRP_NOTIF 21
1209#define BTM_SEC_SERVICE_BPP_JOB 22
1210#define BTM_SEC_SERVICE_BPP_STATUS 23
1211#define BTM_SEC_SERVICE_BPP_REF 24
1212#define BTM_SEC_SERVICE_BNEP_PANU 25
1213#define BTM_SEC_SERVICE_BNEP_GN 26
1214#define BTM_SEC_SERVICE_BNEP_NAP 27
1215#define BTM_SEC_SERVICE_HF_HANDSFREE 28
1216#define BTM_SEC_SERVICE_AG_HANDSFREE 29
1217#define BTM_SEC_SERVICE_TE_PHONE_ACCESS 30
1218#define BTM_SEC_SERVICE_ME_PHONE_ACCESS 31
1219
Andre Eisenbach2e7fa682013-08-08 15:42:48 -07001220#define BTM_SEC_SERVICE_HIDH_SEC_CTRL 32
1221#define BTM_SEC_SERVICE_HIDH_NOSEC_CTRL 33
1222#define BTM_SEC_SERVICE_HIDH_INTR 34
The Android Open Source Project5738f832012-12-12 16:00:35 -08001223#define BTM_SEC_SERVICE_BIP 35
1224#define BTM_SEC_SERVICE_BIP_REF 36
1225#define BTM_SEC_SERVICE_AVDTP 37
1226#define BTM_SEC_SERVICE_AVDTP_NOSEC 38
1227#define BTM_SEC_SERVICE_AVCTP 39
1228#define BTM_SEC_SERVICE_SAP 40
1229#define BTM_SEC_SERVICE_PBAP 41
1230#define BTM_SEC_SERVICE_RFC_MUX 42
1231#define BTM_SEC_SERVICE_AVCTP_BROWSE 43
1232#define BTM_SEC_SERVICE_MAP 44
1233#define BTM_SEC_SERVICE_MAP_NOTIF 45
1234#define BTM_SEC_SERVICE_MCAP_CTRL 46
1235#define BTM_SEC_SERVICE_MCAP_DATA 47
1236#define BTM_SEC_SERVICE_HDP_SNK 48
1237#define BTM_SEC_SERVICE_HDP_SRC 49
1238#define BTM_SEC_SERVICE_ATT 50
1239
1240/* Update these as services are added */
1241#define BTM_SEC_SERVICE_FIRST_EMPTY 51
1242
1243#ifndef BTM_SEC_MAX_SERVICES
1244#define BTM_SEC_MAX_SERVICES 65
1245#endif
1246
1247/************************************************************************************************
1248** Security Services MACROS handle array of UINT32 bits for more than 32 trusted services
1249*************************************************************************************************/
1250/* MACRO to set the security service bit mask in a bit stream */
1251#define BTM_SEC_SET_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)] |= \
1252 ((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS)))
1253
1254
1255/* MACRO to clear the security service bit mask in a bit stream */
1256#define BTM_SEC_CLR_SERVICE(p, service) (((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)] &= \
1257 ~((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS)))
1258
1259/* MACRO to check the security service bit mask in a bit stream (Returns TRUE or FALSE) */
1260#define BTM_SEC_IS_SERVICE_TRUSTED(p, service) (((((UINT32 *)(p))[(((UINT32)(service)) / BTM_SEC_ARRAY_BITS)]) & \
1261 (UINT32)(((UINT32)1 << (((UINT32)(service)) % BTM_SEC_ARRAY_BITS)))) ? TRUE : FALSE)
1262
1263/* MACRO to copy two trusted device bitmask */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001264#define BTM_SEC_COPY_TRUSTED_DEVICE(p_src, p_dst) {UINT32 trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \
The Android Open Source Project5738f832012-12-12 16:00:35 -08001265 ((UINT32 *)(p_dst))[trst] = ((UINT32 *)(p_src))[trst];}
1266
1267/* MACRO to clear two trusted device bitmask */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001268#define BTM_SEC_CLR_TRUSTED_DEVICE(p_dst) {UINT32 trst; for (trst = 0; trst < BTM_SEC_SERVICE_ARRAY_SIZE; trst++) \
The Android Open Source Project5738f832012-12-12 16:00:35 -08001269 ((UINT32 *)(p_dst))[trst] = 0;}
1270
1271/* Following bits can be provided by host in the trusted_mask array */
1272/* 0..31 bits of mask[0] (Least Significant Word) */
1273#define BTM_SEC_TRUST_SDP_SERVER (1 << BTM_SEC_SERVICE_SDP_SERVER)
1274#define BTM_SEC_TRUST_SERIAL_PORT (1 << BTM_SEC_SERVICE_SERIAL_PORT)
1275#define BTM_SEC_TRUST_LAN_ACCESS (1 << BTM_SEC_SERVICE_LAN_ACCESS)
1276#define BTM_SEC_TRUST_DUN (1 << BTM_SEC_SERVICE_DUN)
1277#define BTM_SEC_TRUST_IRMC_SYNC (1 << BTM_SEC_SERVICE_IRMC_SYNC)
1278#define BTM_SEC_TRUST_IRMC_SYNC_CMD (1 << BTM_SEC_SERVICE_IRMC_SYNC_CMD)
1279#define BTM_SEC_TRUST_OBEX (1 << BTM_SEC_SERVICE_OBEX)
1280#define BTM_SEC_TRUST_OBEX_FTP (1 << BTM_SEC_SERVICE_OBEX_FTP)
1281#define BTM_SEC_TRUST_HEADSET (1 << BTM_SEC_SERVICE_HEADSET)
1282#define BTM_SEC_TRUST_CORDLESS (1 << BTM_SEC_SERVICE_CORDLESS)
1283#define BTM_SEC_TRUST_INTERCOM (1 << BTM_SEC_SERVICE_INTERCOM)
1284#define BTM_SEC_TRUST_FAX (1 << BTM_SEC_SERVICE_FAX)
1285#define BTM_SEC_TRUST_HEADSET_AG (1 << BTM_SEC_SERVICE_HEADSET_AG)
1286#define BTM_SEC_TRUST_PNP_INFO (1 << BTM_SEC_SERVICE_PNP_INFO)
1287#define BTM_SEC_TRUST_GEN_NET (1 << BTM_SEC_SERVICE_GEN_NET)
1288#define BTM_SEC_TRUST_GEN_FILE (1 << BTM_SEC_SERVICE_GEN_FILE)
1289#define BTM_SEC_TRUST_GEN_AUDIO (1 << BTM_SEC_SERVICE_GEN_AUDIO)
1290#define BTM_SEC_TRUST_GEN_TEL (1 << BTM_SEC_SERVICE_GEN_TEL)
1291#define BTM_SEC_TRUST_CTP_DATA (1 << BTM_SEC_SERVICE_CTP_DATA)
1292#define BTM_SEC_TRUST_HCRP_CTRL (1 << BTM_SEC_SERVICE_HCRP_CTRL)
1293#define BTM_SEC_TRUST_HCRP_DATA (1 << BTM_SEC_SERVICE_HCRP_DATA)
1294#define BTM_SEC_TRUST_HCRP_NOTIF (1 << BTM_SEC_SERVICE_HCRP_NOTIF)
1295#define BTM_SEC_TRUST_BPP_JOB (1 << BTM_SEC_SERVICE_JOB)
1296#define BTM_SEC_TRUST_BPP_STATUS (1 << BTM_SEC_SERVICE_STATUS)
1297#define BTM_SEC_TRUST_BPP_REF (1 << BTM_SEC_SERVICE_REF)
1298#define BTM_SEC_TRUST_BNEP_PANU (1 << BTM_SEC_SERVICE_BNEP_PANU)
1299#define BTM_SEC_TRUST_BNEP_GN (1 << BTM_SEC_SERVICE_BNEP_GN)
1300#define BTM_SEC_TRUST_BNEP_NAP (1 << BTM_SEC_SERVICE_BNEP_NAP)
1301#define BTM_SEC_TRUST_HFP_HF (1 << BTM_SEC_SERVICE_HF_HANDSFREE)
1302#define BTM_SEC_TRUST_HFP_AG (1 << BTM_SEC_SERVICE_AG_HANDSFREE)
1303#define BTM_SEC_TRUST_TE_PHONE_ACCESS (1 << BTM_SEC_SERVICE_TE_PHONE_ACCESS)
1304#define BTM_SEC_TRUST_ME_PHONE_ACCESS (1 << BTM_SEC_SERVICE_ME_PHONE_ACCESS)
1305
1306/* 0..31 bits of mask[1] (Most Significant Word) */
Andre Eisenbach2e7fa682013-08-08 15:42:48 -07001307#define BTM_SEC_TRUST_HIDH_CTRL (1 << (BTM_SEC_SERVICE_HIDH_SEC_CTRL - 32))
1308#define BTM_SEC_TRUST_HIDH_NOSEC_CTRL (1 << (BTM_SEC_SERVICE_HIDH_NOSEC_CTRL - 32))
1309#define BTM_SEC_TRUST_HIDH_INTR (1 << (BTM_SEC_SERVICE_HIDH_INTR - 32))
The Android Open Source Project5738f832012-12-12 16:00:35 -08001310#define BTM_SEC_TRUST_BIP (1 << (BTM_SEC_SERVICE_BIP - 32))
1311#define BTM_SEC_TRUST_BIP_REF (1 << (BTM_SEC_SERVICE_BIP_REF - 32))
1312#define BTM_SEC_TRUST_AVDTP (1 << (BTM_SEC_SERVICE_AVDTP - 32))
1313#define BTM_SEC_TRUST_AVDTP_NOSEC (1 << (BTM_SEC_SERVICE_AVDTP_NOSEC - 32))
1314#define BTM_SEC_TRUST_AVCTP (1 << (BTM_SEC_SERVICE_AVCTP - 32))
1315#define BTM_SEC_TRUST_SAP (1 << (BTM_SEC_SERVICE_SAP - 32))
1316#define BTM_SEC_TRUST_PBAP (1 << (BTM_SEC_SERVICE_PBAP - 32))
1317#define BTM_SEC_TRUST_RFC_MUX (1 << (BTM_SEC_SERVICE_RFC_MUX - 32))
1318#define BTM_SEC_TRUST_AVCTP_BROWSE (1 << (BTM_SEC_SERVICE_AVCTP_BROWSE - 32))
1319#define BTM_SEC_TRUST_MAP (1 << (BTM_SEC_SERVICE_MAP - 32))
1320#define BTM_SEC_TRUST_MAP_NOTIF (1 << (BTM_SEC_SERVICE_MAP_NOTIF - 32))
1321#define BTM_SEC_TRUST_MCAP_CTRL (1 << (BTM_SEC_SERVICE_MCAP_CTRL - 32))
1322#define BTM_SEC_TRUST_MCAP_DATA (1 << (BTM_SEC_SERVICE_MCAP_DATA - 32))
1323#define BTM_SEC_TRUST_HDP_SNK (1 << (BTM_SEC_SERVICE_HDP_SNK - 32))
1324#define BTM_SEC_TRUST_HDP_SRC (1 << (BTM_SEC_SERVICE_HDP_SRC - 32))
1325
1326#define BTM_SEC_TRUST_ALL 0xFFFFFFFF /* for each array element */
1327
1328/****************************************
1329** Security Manager Callback Functions
1330*****************************************/
1331/* Authorize device for service. Parameters are
1332** BD Address of remote
1333** Device Class of remote
1334** BD Name of remote
1335** Service name
1336** Service Id (NULL - unknown service or unused
1337** [BTM_SEC_SERVICE_NAME_LEN set to 0])
1338** Is originator of the connection
1339** Result of the operation
1340*/
1341typedef UINT8 (tBTM_AUTHORIZE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
1342 tBTM_BD_NAME bd_name, UINT8 *service_name,
1343 UINT8 service_id, BOOLEAN is_originator);
1344
1345/* Get PIN for the connection. Parameters are
1346** BD Address of remote
1347** Device Class of remote
1348** BD Name of remote
1349*/
1350typedef UINT8 (tBTM_PIN_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
1351 tBTM_BD_NAME bd_name);
1352
1353
1354/* Get Link Key for the connection. Parameters are
1355** BD Address of remote
1356** Link Key
1357*/
1358typedef UINT8 (tBTM_LINK_KEY_REQ_CALLBACK) (BD_ADDR bd_addr, LINK_KEY key);
1359
1360/* New Link Key for the connection. Parameters are
1361** BD Address of remote
1362** Link Key
1363** Key Type: Combination, Local Unit, or Remote Unit
1364*/
1365typedef UINT8 (tBTM_LINK_KEY_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
1366 tBTM_BD_NAME bd_name, UINT8 *key,
1367 UINT8 key_type);
1368
1369
1370/* Remote Name Resolved. Parameters are
1371** BD Address of remote
1372** BD Name of remote
1373*/
1374typedef void (tBTM_RMT_NAME_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dc,
1375 tBTM_BD_NAME bd_name);
1376
1377
1378/* Authentication complete for the connection. Parameters are
1379** BD Address of remote
1380** Device Class of remote
1381** BD Name of remote
1382**
1383*/
1384typedef UINT8 (tBTM_AUTH_COMPLETE_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
1385 tBTM_BD_NAME bd_name, int result);
1386
1387/* Operation abort. Called by the stack when link goes down during. Pin code
1388** request or authorization. Parameters are
1389** BD Address of remote
1390**
1391*/
1392typedef UINT8 (tBTM_ABORT_CALLBACK) (BD_ADDR bd_addr, DEV_CLASS dev_class,
1393 tBTM_BD_NAME bd_name);
1394
1395enum
1396{
1397 BTM_SP_IO_REQ_EVT, /* received IO_CAPABILITY_REQUEST event */
1398 BTM_SP_IO_RSP_EVT, /* received IO_CAPABILITY_RESPONSE event */
1399 BTM_SP_CFM_REQ_EVT, /* received USER_CONFIRMATION_REQUEST event */
1400 BTM_SP_KEY_NOTIF_EVT, /* received USER_PASSKEY_NOTIFY event */
1401 BTM_SP_KEY_REQ_EVT, /* received USER_PASSKEY_REQUEST event */
1402 BTM_SP_KEYPRESS_EVT, /* received KEYPRESS_NOTIFY event */
1403 BTM_SP_LOC_OOB_EVT, /* received result for READ_LOCAL_OOB_DATA command */
1404 BTM_SP_RMT_OOB_EVT, /* received REMOTE_OOB_DATA_REQUEST event */
1405 BTM_SP_COMPLT_EVT, /* received SIMPLE_PAIRING_COMPLETE event */
1406 BTM_SP_UPGRADE_EVT /* check if the application wants to upgrade the link key */
1407};
1408typedef UINT8 tBTM_SP_EVT;
1409
1410#define BTM_IO_CAP_OUT 0 /* DisplayOnly */
1411#define BTM_IO_CAP_IO 1 /* DisplayYesNo */
1412#define BTM_IO_CAP_IN 2 /* KeyboardOnly */
1413#define BTM_IO_CAP_NONE 3 /* NoInputNoOutput */
1414#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
1415#define BTM_IO_CAP_KBDISP 4 /* Keyboard display */
1416#define BTM_IO_CAP_MAX 5
1417#else
1418#define BTM_IO_CAP_MAX 4
1419#endif
1420
1421typedef UINT8 tBTM_IO_CAP;
1422
1423#define BTM_MAX_PASSKEY_VAL (999999)
1424#define BTM_MIN_PASSKEY_VAL (0)
1425
1426#define BTM_AUTH_SP_NO 0 /* MITM Protection Not Required - Single Profile/non-bonding
1427 Numeric comparison with automatic accept allowed */
1428#define BTM_AUTH_SP_YES 1 /* MITM Protection Required - Single Profile/non-bonding
1429 Use IO Capabilities to determine authentication procedure */
1430#define BTM_AUTH_AP_NO 2 /* MITM Protection Not Required - All Profiles/dedicated bonding
1431 Numeric comparison with automatic accept allowed */
1432#define BTM_AUTH_AP_YES 3 /* MITM Protection Required - All Profiles/dedicated bonding
1433 Use IO Capabilities to determine authentication procedure */
1434#define BTM_AUTH_SPGB_NO 4 /* MITM Protection Not Required - Single Profiles/general bonding
1435 Numeric comparison with automatic accept allowed */
1436#define BTM_AUTH_SPGB_YES 5 /* MITM Protection Required - Single Profiles/general bonding
1437 Use IO Capabilities to determine authentication procedure */
1438#define BTM_AUTH_DD_BOND 2 /* this bit is ORed to the BTM_AUTH_SP_* when IO exchange for dedicated bonding */
1439#define BTM_AUTH_GB_BIT 4 /* the genernal bonding bit */
1440#define BTM_AUTH_BONDS 6 /* the general/dedicated bonding bits */
1441#define BTM_AUTH_YN_BIT 1 /* this is the Yes or No bit */
1442
1443typedef UINT8 tBTM_AUTH_REQ;
1444
1445enum
1446{
1447 BTM_OOB_NONE,
1448 BTM_OOB_PRESENT
1449#if BTM_OOB_INCLUDED == TRUE
1450 ,BTM_OOB_UNKNOWN
1451#endif
1452};
1453typedef UINT8 tBTM_OOB_DATA;
1454
1455/* data type for BTM_SP_IO_REQ_EVT */
1456typedef struct
1457{
1458 BD_ADDR bd_addr; /* peer address */
1459 tBTM_IO_CAP io_cap; /* local IO capabilities */
1460 tBTM_OOB_DATA oob_data; /* OOB data present (locally) for the peer device */
1461 tBTM_AUTH_REQ auth_req; /* Authentication required (for local device) */
1462 BOOLEAN is_orig; /* TRUE, if local device initiated the SP process */
1463} tBTM_SP_IO_REQ;
1464
1465/* data type for BTM_SP_IO_RSP_EVT */
1466typedef struct
1467{
1468 BD_ADDR bd_addr; /* peer address */
1469 tBTM_IO_CAP io_cap; /* peer IO capabilities */
1470 tBTM_OOB_DATA oob_data; /* OOB data present at peer device for the local device */
1471 tBTM_AUTH_REQ auth_req; /* Authentication required for peer device */
1472} tBTM_SP_IO_RSP;
1473
1474/* data type for BTM_SP_CFM_REQ_EVT */
1475typedef struct
1476{
1477 BD_ADDR bd_addr; /* peer address */
1478 DEV_CLASS dev_class; /* peer CoD */
1479 tBTM_BD_NAME bd_name; /* peer device name */
1480 UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */
1481 BOOLEAN just_works; /* TRUE, if "Just Works" association model */
1482 tBTM_AUTH_REQ loc_auth_req; /* Authentication required for local device */
1483 tBTM_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
1484 tBTM_IO_CAP loc_io_caps; /* IO Capabilities of the local device */
1485 tBTM_IO_CAP rmt_io_caps; /* IO Capabilities of the remot device */
1486} tBTM_SP_CFM_REQ;
1487
1488/* data type for BTM_SP_KEY_REQ_EVT */
1489typedef struct
1490{
1491 BD_ADDR bd_addr; /* peer address */
1492 DEV_CLASS dev_class; /* peer CoD */
1493 tBTM_BD_NAME bd_name; /* peer device name */
1494} tBTM_SP_KEY_REQ;
1495
1496/* data type for BTM_SP_KEY_NOTIF_EVT */
1497typedef struct
1498{
1499 BD_ADDR bd_addr; /* peer address */
1500 DEV_CLASS dev_class; /* peer CoD */
1501 tBTM_BD_NAME bd_name; /* peer device name */
1502 UINT32 passkey; /* passkey */
1503} tBTM_SP_KEY_NOTIF;
1504
1505enum
1506{
1507 BTM_SP_KEY_STARTED, /* passkey entry started */
1508 BTM_SP_KEY_ENTERED, /* passkey digit entered */
1509 BTM_SP_KEY_ERASED, /* passkey digit erased */
1510 BTM_SP_KEY_CLEARED, /* passkey cleared */
1511 BTM_SP_KEY_COMPLT /* passkey entry completed */
1512};
1513typedef UINT8 tBTM_SP_KEY_TYPE;
1514
1515/* data type for BTM_SP_KEYPRESS_EVT */
1516typedef struct
1517{
1518 BD_ADDR bd_addr; /* peer address */
1519 tBTM_SP_KEY_TYPE notif_type;
1520} tBTM_SP_KEYPRESS;
1521
1522/* data type for BTM_SP_LOC_OOB_EVT */
1523typedef struct
1524{
1525 tBTM_STATUS status; /* */
1526 BT_OCTET16 c; /* Simple Pairing Hash C */
1527 BT_OCTET16 r; /* Simple Pairing Randomnizer R */
1528} tBTM_SP_LOC_OOB;
1529
1530/* data type for BTM_SP_RMT_OOB_EVT */
1531typedef struct
1532{
1533 BD_ADDR bd_addr; /* peer address */
1534 DEV_CLASS dev_class; /* peer CoD */
1535 tBTM_BD_NAME bd_name; /* peer device name */
1536} tBTM_SP_RMT_OOB;
1537
1538
1539/* data type for BTM_SP_COMPLT_EVT */
1540typedef struct
1541{
1542 BD_ADDR bd_addr; /* peer address */
1543 DEV_CLASS dev_class; /* peer CoD */
1544 tBTM_BD_NAME bd_name; /* peer device name */
1545 tBTM_STATUS status; /* status of the simple pairing process */
1546} tBTM_SP_COMPLT;
1547
1548/* data type for BTM_SP_UPGRADE_EVT */
1549typedef struct
1550{
1551 BD_ADDR bd_addr; /* peer address */
1552 BOOLEAN upgrade; /* TRUE, to upgrade the link key */
1553} tBTM_SP_UPGRADE;
1554
1555typedef union
1556{
1557 tBTM_SP_IO_REQ io_req; /* BTM_SP_IO_REQ_EVT */
1558 tBTM_SP_IO_RSP io_rsp; /* BTM_SP_IO_RSP_EVT */
1559 tBTM_SP_CFM_REQ cfm_req; /* BTM_SP_CFM_REQ_EVT */
1560 tBTM_SP_KEY_NOTIF key_notif; /* BTM_SP_KEY_NOTIF_EVT */
1561 tBTM_SP_KEY_REQ key_req; /* BTM_SP_KEY_REQ_EVT */
1562 tBTM_SP_KEYPRESS key_press; /* BTM_SP_KEYPRESS_EVT */
1563 tBTM_SP_LOC_OOB loc_oob; /* BTM_SP_LOC_OOB_EVT */
1564 tBTM_SP_RMT_OOB rmt_oob; /* BTM_SP_RMT_OOB_EVT */
1565 tBTM_SP_COMPLT complt; /* BTM_SP_COMPLT_EVT */
1566 tBTM_SP_UPGRADE upgrade; /* BTM_SP_UPGRADE_EVT */
1567} tBTM_SP_EVT_DATA;
1568
1569/* Simple Pairing Events. Called by the stack when Simple Pairing related
1570** events occur.
1571*/
1572typedef UINT8 (tBTM_SP_CALLBACK) (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data);
1573
1574
1575typedef void (tBTM_MKEY_CALLBACK) (BD_ADDR bd_addr, UINT8 status, UINT8 key_flag) ;
1576
1577/* Encryption enabled/disabled complete: Optionally passed with BTM_SetEncryption.
1578** Parameters are
1579** BD Address of remote
1580** optional data passed in by BTM_SetEncryption
1581** tBTM_STATUS - result of the operation
1582*/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07001583typedef void (tBTM_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
1584 void *p_ref_data, tBTM_STATUS result);
The Android Open Source Project5738f832012-12-12 16:00:35 -08001585
1586/* Bond Cancel complete. Parameters are
1587** Result of the cancel operation
1588**
1589*/
1590typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
1591
1592/* LE related event and data structure
1593*/
1594enum
1595{
1596 BTM_LE_IO_REQ_EVT = 1, /* received IO_CAPABILITY_REQUEST event */
1597 BTM_LE_SEC_REQUEST_EVT, /* security request event */
1598 BTM_LE_KEY_NOTIF_EVT, /* received USER_PASSKEY_NOTIFY event */
1599 BTM_LE_KEY_REQ_EVT, /* received USER_PASSKEY_REQUEST event */
1600 BTM_LE_OOB_REQ_EVT, /* OOB data request event */
1601 BTM_LE_COMPLT_EVT, /* received SIMPLE_PAIRING_COMPLETE event */
1602 BTM_LE_KEY_EVT /* KEY update event */
1603};
1604typedef UINT8 tBTM_LE_EVT;
1605
1606#define BTM_LE_KEY_PENC SMP_SEC_KEY_TYPE_ENC /* encryption information of peer device */
1607#define BTM_LE_KEY_PID SMP_SEC_KEY_TYPE_ID /* identity key of the peer device */
1608#define BTM_LE_KEY_PCSRK SMP_SEC_KEY_TYPE_CSRK /* peer SRK */
1609#define BTM_LE_KEY_LENC (SMP_SEC_KEY_TYPE_ENC << 3) /* master role security information:div */
1610#define BTM_LE_KEY_LID (SMP_SEC_KEY_TYPE_ID << 3) /* master device ID key */
1611#define BTM_LE_KEY_LCSRK (SMP_SEC_KEY_TYPE_CSRK << 3) /* local CSRK has been deliver to peer */
1612typedef UINT8 tBTM_LE_KEY_TYPE;
1613
1614#define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND /* 0 */
1615#define BTM_LE_AUTH_REQ_BOND SMP_AUTH_GEN_BOND /* 1 << 0 */
1616#define BTM_LE_AUTH_REQ_MITM SMP_AUTH_YN_BIT /* 1 << 2 */
1617typedef UINT8 tBTM_LE_AUTH_REQ;
1618
1619#define BTM_LE_AUTH_REQ_MASK SMP_AUTH_MASK /* 0x03*/
1620
1621/* LE security level */
1622#define BTM_LE_SEC_NONE SMP_SEC_NONE
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001623#define BTM_LE_SEC_UNAUTHENTICATE SMP_SEC_UNAUTHENTICATE /* 1 */
1624#define BTM_LE_SEC_AUTHENTICATED SMP_SEC_AUTHENTICATED /* 4 */
The Android Open Source Project5738f832012-12-12 16:00:35 -08001625typedef UINT8 tBTM_LE_SEC;
1626
1627
1628typedef struct
1629{
1630 tBTM_IO_CAP io_cap; /* local IO capabilities */
1631 UINT8 oob_data; /* OOB data present (locally) for the peer device */
1632 tBTM_LE_AUTH_REQ auth_req; /* Authentication request (for local device) contain bonding and MITM info */
1633 UINT8 max_key_size; /* max encryption key size */
1634 tBTM_LE_KEY_TYPE init_keys; /* keys to be distributed, bit mask */
1635 tBTM_LE_KEY_TYPE resp_keys; /* keys to be distributed, bit mask */
1636} tBTM_LE_IO_REQ;
1637
1638#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
1639/* data type for tBTM_LE_COMPLT */
1640typedef struct
1641{
1642 UINT8 reason;
1643 UINT8 sec_level;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001644 BOOLEAN privacy_supported;
1645 BOOLEAN is_pair_cancel;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001646}tBTM_LE_COMPLT;
1647#endif
1648
1649/* BLE encryption keys */
1650typedef struct
1651{
1652 BT_OCTET16 ltk;
1653 BT_OCTET8 rand;
1654 UINT16 ediv;
1655 UINT8 sec_level;
1656 UINT8 key_size;
1657}tBTM_LE_PENC_KEYS;
1658
1659/* BLE CSRK keys */
1660typedef struct
1661{
1662 UINT32 counter;
1663 BT_OCTET16 csrk;
1664 UINT8 sec_level;
1665}tBTM_LE_PCSRK_KEYS;
1666
1667/* BLE Encryption reproduction keys */
1668typedef struct
1669{
1670 UINT16 div;
1671 UINT8 key_size;
1672 UINT8 sec_level;
1673}tBTM_LE_LENC_KEYS;
1674
1675/* BLE SRK keys */
1676typedef struct
1677{
1678 UINT32 counter;
1679 UINT16 div;
1680 UINT8 sec_level;
1681
1682}tBTM_LE_LCSRK_KEYS;
1683
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001684typedef struct
1685{
1686 BT_OCTET16 irk;
1687 tBLE_ADDR_TYPE addr_type;
1688 BD_ADDR static_addr;
1689}tBTM_LE_PID_KEYS;
The Android Open Source Project5738f832012-12-12 16:00:35 -08001690
1691typedef union
1692{
1693 tBTM_LE_PENC_KEYS penc_key; /* received peer encryption key */
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08001694 tBTM_LE_PCSRK_KEYS pcsrk_key; /* received peer device SRK */
1695 tBTM_LE_PID_KEYS pid_key; /* peer device ID key */
The Android Open Source Project5738f832012-12-12 16:00:35 -08001696 tBTM_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
1697 tBTM_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
1698}tBTM_LE_KEY_VALUE;
1699
1700typedef struct
1701{
1702 tBTM_LE_KEY_TYPE key_type;
1703 tBTM_LE_KEY_VALUE *p_key_value;
1704}tBTM_LE_KEY;
1705
1706typedef union
1707{
1708 tBTM_LE_IO_REQ io_req; /* BTM_LE_IO_REQ_EVT */
1709 UINT32 key_notif; /* BTM_LE_KEY_NOTIF_EVT */
1710 /* no callback dta for BTM_LE_KEY_REQ_EVT & BTM_LE_OOB_REQ_EVT */
1711#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
1712 tBTM_LE_COMPLT complt; /* BTM_LE_COMPLT_EVT */
1713#endif
1714 tBTM_LE_KEY key;
1715} tBTM_LE_EVT_DATA;
1716
1717/* Simple Pairing Events. Called by the stack when Simple Pairing related
1718** events occur.
1719*/
1720typedef UINT8 (tBTM_LE_CALLBACK) (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_DATA *p_data);
1721
1722#define BTM_BLE_KEY_TYPE_ID 1
1723#define BTM_BLE_KEY_TYPE_ER 2
1724#define BTM_BLE_KEY_TYPE_COUNTER 3 //tobe obsolete
1725
1726typedef struct
1727{
1728 BT_OCTET16 ir;
1729 BT_OCTET16 irk;
1730 BT_OCTET16 dhk;
1731
1732}tBTM_BLE_LOCAL_ID_KEYS;
1733
1734typedef union
1735{
1736 tBTM_BLE_LOCAL_ID_KEYS id_keys;
1737 BT_OCTET16 er;
1738}tBTM_BLE_LOCAL_KEYS;
1739
1740
1741/* New LE identity key for local device.
1742*/
1743typedef void (tBTM_LE_KEY_CALLBACK) (UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key);
1744
1745
1746/***************************
1747** Security Manager Types
1748****************************/
1749/* Structure that applications use to register with BTM_SecRegister */
1750typedef struct
1751{
1752 tBTM_AUTHORIZE_CALLBACK *p_authorize_callback;
1753 tBTM_PIN_CALLBACK *p_pin_callback;
1754 tBTM_LINK_KEY_CALLBACK *p_link_key_callback;
1755 tBTM_LINK_KEY_REQ_CALLBACK *p_link_key_req_callback;
1756 tBTM_AUTH_COMPLETE_CALLBACK *p_auth_complete_callback;
1757 tBTM_ABORT_CALLBACK *p_abort_callback;
1758 tBTM_BOND_CANCEL_CMPL_CALLBACK *p_bond_cancel_cmpl_callback;
1759 tBTM_SP_CALLBACK *p_sp_callback;
1760#if BLE_INCLUDED == TRUE
1761#if SMP_INCLUDED == TRUE
1762 tBTM_LE_CALLBACK *p_le_callback;
1763#endif
1764 tBTM_LE_KEY_CALLBACK *p_le_key_callback;
1765#endif
1766} tBTM_APPL_INFO;
1767
1768/* Callback function for when a link supervision timeout event occurs.
1769** This asynchronous event is enabled/disabled by calling BTM_RegForLstoEvt().
1770*/
1771typedef void (tBTM_LSTO_CBACK) (BD_ADDR remote_bda, UINT16 timeout);
1772
1773/*****************************************************************************
1774** POWER MANAGEMENT
1775*****************************************************************************/
1776/****************************
1777** Power Manager Constants
1778*****************************/
1779/* BTM Power manager status codes */
1780enum
1781{
1782 BTM_PM_STS_ACTIVE = HCI_MODE_ACTIVE,
1783 BTM_PM_STS_HOLD = HCI_MODE_HOLD,
1784 BTM_PM_STS_SNIFF = HCI_MODE_SNIFF,
1785 BTM_PM_STS_PARK = HCI_MODE_PARK,
1786 BTM_PM_STS_SSR, /* report the SSR parameters in HCI_SNIFF_SUB_RATE_EVT */
1787 BTM_PM_STS_PENDING, /* when waiting for status from controller */
1788 BTM_PM_STS_ERROR /* when HCI command status returns error */
1789};
1790typedef UINT8 tBTM_PM_STATUS;
1791
1792/* BTM Power manager modes */
1793enum
1794{
1795 BTM_PM_MD_ACTIVE = BTM_PM_STS_ACTIVE,
1796 BTM_PM_MD_HOLD = BTM_PM_STS_HOLD,
1797 BTM_PM_MD_SNIFF = BTM_PM_STS_SNIFF,
1798 BTM_PM_MD_PARK = BTM_PM_STS_PARK,
1799 BTM_PM_MD_FORCE = 0x10 /* OR this to force ACL link to a certain mode */
1800};
1801typedef UINT8 tBTM_PM_MODE;
1802
1803#define BTM_PM_SET_ONLY_ID 0x80
1804
1805/* Operation codes */
1806#define BTM_PM_REG_SET 1 /* The module wants to set the desired power mode */
1807#define BTM_PM_REG_NOTIF 2 /* The module wants to receive mode change event */
1808#define BTM_PM_DEREG 4 /* The module does not want to involve with PM anymore */
1809
1810/************************
1811** Power Manager Types
1812*************************/
1813typedef struct
1814{
1815 UINT16 max;
1816 UINT16 min;
1817 UINT16 attempt;
1818 UINT16 timeout;
1819 tBTM_PM_MODE mode;
1820} tBTM_PM_PWR_MD;
1821
1822/*************************************
1823** Power Manager Callback Functions
1824**************************************/
1825typedef void (tBTM_PM_STATUS_CBACK) (BD_ADDR p_bda, tBTM_PM_STATUS status,
1826 UINT16 value, UINT8 hci_status);
1827
1828
1829/************************
1830** Stored Linkkey Types
1831*************************/
1832#define BTM_CB_EVT_RETURN_LINK_KEYS 1
1833#define BTM_CB_EVT_READ_STORED_LINK_KEYS 2
1834#define BTM_CB_EVT_WRITE_STORED_LINK_KEYS 3
1835#define BTM_CB_EVT_DELETE_STORED_LINK_KEYS 4
1836
1837typedef struct
1838{
1839 UINT8 event;
1840
1841} tBTM_STORED_LINK_KEYS_EVT;
1842
1843
1844typedef struct
1845{
1846 UINT8 event;
1847 UINT8 num_keys;
1848
1849} tBTM_RETURN_LINK_KEYS_EVT;
1850
1851
1852typedef struct
1853{
1854 BD_ADDR bd_addr;
1855 LINK_KEY link_key;
1856
1857} tBTM_BD_ADDR_LINK_KEY_PAIR;
1858
1859
1860typedef struct
1861{
1862 UINT8 event;
1863 UINT8 status;
1864 UINT16 max_keys;
1865 UINT16 read_keys;
1866
1867} tBTM_READ_STORED_LINK_KEY_COMPLETE;
1868
1869
1870typedef struct
1871{
1872 UINT8 event;
1873 UINT8 status;
1874 UINT8 num_keys;
1875
1876} tBTM_WRITE_STORED_LINK_KEY_COMPLETE;
1877
1878
1879typedef struct
1880{
1881 UINT8 event;
1882 UINT8 status;
1883 UINT16 num_keys;
1884
1885} tBTM_DELETE_STORED_LINK_KEY_COMPLETE;
1886
1887
1888/* These macros are defined to check the Broadcom features supported in controller
1889 * (the return value for BTM_ReadBrcmFeatures() */
1890/* multi-av */
1891#define BTM_FEATURE_MULTI_AV_MASK 0x01
1892#define BTM_FEATURE_MULTI_AV_OFF 0
1893#define BTM_VSC_MULTI_AV_SUPPORTED(x) ((x)[BTM_FEATURE_MULTI_AV_OFF] & BTM_FEATURE_MULTI_AV_MASK)
1894
1895/* WBS SBC codec */
1896#define BTM_FEATURE_WBS_SBC_MASK 0x02
1897#define BTM_FEATURE_WBS_SBC_OFF 0
1898#define BTM_VSC_WBS_SBC_SUPPORTED(x) ((x)[BTM_FEATURE_WBS_SBC_OFF] & BTM_FEATURE_WBS_SBC_MASK)
1899
1900/* Advanced Audio LC-PLC */
1901#define BTM_FEATURE_AUDIO_LC_PLC_MASK 0x04
1902#define BTM_FEATURE_AUDIO_LC_PLC_OFF 0
1903#define BTM_VSC_AUDIO_LC_PLC_SUPPORTED(x) ((x)[BTM_FEATURE_AUDIO_LC_PLC_OFF] & BTM_FEATURE_AUDIO_LC_PLC_MASK)
1904
1905/* Light stack for audio routing in Controller */
1906#define BTM_FEATURE_LIGHT_STACK_MASK 0x08
1907#define BTM_FEATURE_LIGHT_STACK_OFF 0
1908#define BTM_VSC_LIGHT_STACK_SUPPORTED(x) ((x)[BTM_FEATURE_LIGHT_STACK_OFF] & BTM_FEATURE_LIGHT_STACK_MASK)
1909
1910/* NFC support */
1911#define BTM_FEATURE_NFC_MASK (HCI_BRCM_FEATURE_NFC_MASK) /* 0x10 */
1912#define BTM_FEATURE_NFC_OFF (HCI_BRCM_FEATURE_NFC_OFF) /* 0 */
1913#define BTM_VSC_NFC_SUPPORTED(x) ((x)[BTM_FEATURE_NFC_OFF] & BTM_FEATURE_NFC_MASK)
1914
1915
The Android Open Source Project5738f832012-12-12 16:00:35 -08001916/* MIP evnets, callbacks */
1917enum
1918{
1919 BTM_MIP_MODE_CHG_EVT,
1920 BTM_MIP_DISCONNECT_EVT,
1921 BTM_MIP_PKTS_COMPL_EVT,
1922 BTM_MIP_RXDATA_EVT
1923};
1924typedef UINT8 tBTM_MIP_EVT;
1925
1926typedef struct
1927{
1928 tBTM_MIP_EVT event;
1929 BD_ADDR bd_addr;
1930 UINT16 mip_id;
1931} tBTM_MIP_MODE_CHANGE;
1932
1933typedef struct
1934{
1935 tBTM_MIP_EVT event;
1936 UINT16 mip_id;
1937 UINT8 disc_reason;
1938} tBTM_MIP_CONN_TIMEOUT;
1939
1940#define BTM_MIP_MAX_RX_LEN 17
1941
1942typedef struct
1943{
1944 tBTM_MIP_EVT event;
1945 UINT16 mip_id;
1946 UINT8 rx_len;
1947 UINT8 rx_data[BTM_MIP_MAX_RX_LEN];
1948} tBTM_MIP_RXDATA;
1949
1950typedef struct
1951{
1952 tBTM_MIP_EVT event;
1953 BD_ADDR bd_addr;
1954 UINT8 data[11]; /* data[0] shows Vender-specific device type */
1955} tBTM_MIP_EIR_HANDSHAKE;
1956
1957typedef struct
1958{
1959 tBTM_MIP_EVT event;
1960 UINT16 num_sent; /* Number of packets completed at the controller */
1961} tBTM_MIP_PKTS_COMPL;
1962
1963typedef union
1964{
1965 tBTM_MIP_EVT event;
1966 tBTM_MIP_MODE_CHANGE mod_chg;
1967 tBTM_MIP_CONN_TIMEOUT conn_tmo;
1968 tBTM_MIP_EIR_HANDSHAKE eir;
1969 tBTM_MIP_PKTS_COMPL completed;
1970 tBTM_MIP_RXDATA rxdata;
1971} tBTM_MIP_EVENT_DATA;
1972
1973/* MIP event callback function */
1974typedef void (tBTM_MIP_EVENTS_CB) (tBTM_MIP_EVT event, tBTM_MIP_EVENT_DATA data);
1975
1976/* MIP Device query callback function */
1977typedef BOOLEAN (tBTM_MIP_QUERY_CB) (BD_ADDR dev_addr, UINT8 *p_mode, LINK_KEY link_key);
1978
1979/*****************************************************************************
1980** EXTERNAL FUNCTION DECLARATIONS
1981*****************************************************************************/
1982#ifdef __cplusplus
1983extern "C" {
1984#endif
1985
1986/*****************************************************************************
1987** DEVICE CONTROL and COMMON FUNCTIONS
1988*****************************************************************************/
1989
1990/*******************************************************************************
1991**
1992** Function BTM_SetAfhChannels
1993**
1994** Description This function is called to disable channels
1995**
1996** Returns status
1997**
1998*******************************************************************************/
1999 BTM_API extern tBTM_STATUS BTM_SetAfhChannels (UINT8 first, UINT8 last);
2000
2001/*******************************************************************************
2002**
2003** Function BTM_SetAfhChannelAssessment
2004**
2005** Description This function is called to set the channel assessment mode on or off
2006**
2007** Returns status
2008**
2009*******************************************************************************/
2010 BTM_API extern tBTM_STATUS BTM_SetAfhChannelAssessment (BOOLEAN enable_or_disable);
2011
2012/*******************************************************************************
2013**
2014** Function BTM_DeviceReset
2015**
2016** Description This function is called to reset the controller.The Callback function
2017** if provided is called when startup of the device has
2018** completed.
2019**
2020** Returns void
2021**
2022*******************************************************************************/
2023 BTM_API extern void BTM_DeviceReset (tBTM_CMPL_CB *p_cb);
2024
2025
2026/*******************************************************************************
2027**
2028** Function BTM_IsDeviceUp
2029**
2030** Description This function is called to check if the device is up.
2031**
2032** Returns TRUE if device is up, else FALSE
2033**
2034*******************************************************************************/
2035 BTM_API extern BOOLEAN BTM_IsDeviceUp (void);
2036
2037
2038/*******************************************************************************
2039**
2040** Function BTM_SetLocalDeviceName
2041**
2042** Description This function is called to set the local device name.
2043**
2044** Returns BTM_CMD_STARTED if successful, otherwise an error
2045**
2046*******************************************************************************/
2047 BTM_API extern tBTM_STATUS BTM_SetLocalDeviceName (char *p_name);
2048
2049/*******************************************************************************
2050**
2051** Function BTM_SetDeviceClass
2052**
2053** Description This function is called to set the local device class
2054**
2055** Returns BTM_SUCCESS if successful, otherwise an error
2056**
2057*******************************************************************************/
2058 BTM_API extern tBTM_STATUS BTM_SetDeviceClass (DEV_CLASS dev_class);
2059
2060
2061/*******************************************************************************
2062**
2063** Function BTM_ReadLocalDeviceName
2064**
2065** Description This function is called to read the local device name.
2066**
2067** Returns status of the operation
2068** If success, BTM_SUCCESS is returned and p_name points stored
2069** local device name
2070** If BTM doesn't store local device name, BTM_NO_RESOURCES is
2071** is returned and p_name is set to NULL
2072**
2073*******************************************************************************/
2074 BTM_API extern tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name);
2075
2076/*******************************************************************************
2077**
2078** Function BTM_ReadLocalDeviceNameFromController
2079**
2080** Description Get local device name from controller. Do not use cached
2081** name (used to get chip-id prior to btm reset complete).
2082**
2083** Returns BTM_CMD_STARTED if successful, otherwise an error
2084**
2085*******************************************************************************/
2086 BTM_API extern tBTM_STATUS BTM_ReadLocalDeviceNameFromController (tBTM_CMPL_CB *p_rln_cmpl_cback);
2087
2088/*******************************************************************************
2089**
2090** Function BTM_ReadLocalVersion
2091**
2092** Description This function is called to read the local device version
2093**
2094** Returns BTM_SUCCESS if successful, otherwise an error
2095**
2096*******************************************************************************/
2097 BTM_API extern tBTM_STATUS BTM_ReadLocalVersion (tBTM_VERSION_INFO *p_vers);
2098
2099
2100/*******************************************************************************
2101**
2102** Function BTM_ReadLocalDeviceAddr
2103**
2104** Description This function is called to read the local device address
2105**
2106** Returns BTM_SUCCESS
2107** Callback returns the local device address
2108**
2109*******************************************************************************/
2110 BTM_API extern tBTM_STATUS BTM_ReadLocalDeviceAddr (tBTM_CMPL_CB *p_cb);
2111
2112
2113/*******************************************************************************
2114**
2115** Function BTM_GetLocalDeviceAddr
2116**
2117** Description This function is called to read the local device address
2118**
2119** Returns void
2120** the local device address is copied into bd_addr
2121**
2122*******************************************************************************/
2123 BTM_API extern void BTM_GetLocalDeviceAddr (BD_ADDR bd_addr);
2124
2125
2126/*******************************************************************************
2127**
2128** Function BTM_ReadDeviceClass
2129**
2130** Description This function is called to read the local device class
2131**
2132** Returns pointer to the device class
2133**
2134*******************************************************************************/
2135 BTM_API extern UINT8 *BTM_ReadDeviceClass (void);
2136
2137
2138/*******************************************************************************
2139**
2140** Function BTM_ReadLocalFeatures
2141**
2142** Description This function is called to read the local features
2143**
2144** Returns pointer to the local features string
2145**
2146*******************************************************************************/
2147 BTM_API extern UINT8 *BTM_ReadLocalFeatures (void);
2148
2149/*******************************************************************************
2150**
Andre Eisenbach3aa60542013-03-22 18:00:51 -07002151** Function BTM_ReadLocalExtendedFeatures
2152**
2153** Description This function is called to read the local extended features
2154**
2155** Returns pointer to the local extended features mask or NULL if bad
2156** page
2157**
2158*******************************************************************************/
2159 BTM_API extern UINT8 *BTM_ReadLocalExtendedFeatures (UINT8 page_number);
2160
2161/*******************************************************************************
2162**
The Android Open Source Project5738f832012-12-12 16:00:35 -08002163** Function BTM_ReadBrcmFeatures
2164**
2165** Description This function is called to read the Broadcom specific features
2166**
2167** Returns pointer to the Broadcom features string
2168**
2169*******************************************************************************/
2170 BTM_API extern UINT8 *BTM_ReadBrcmFeatures (void);
2171
2172/*******************************************************************************
2173**
2174** Function BTM_RegisterForDeviceStatusNotif
2175**
2176** Description This function is called to register for device status
2177** change notifications.
2178**
2179** Returns pointer to previous caller's callback function or NULL if first
2180** registration.
2181**
2182*******************************************************************************/
2183 BTM_API extern tBTM_DEV_STATUS_CB *BTM_RegisterForDeviceStatusNotif (tBTM_DEV_STATUS_CB *p_cb);
2184
2185
2186/*******************************************************************************
2187**
2188** Function BTM_RegisterForVSEvents
2189**
2190** Description This function is called to register/deregister for vendor
2191** specific HCI events.
2192**
2193** If is_register=TRUE, then the function will be registered;
2194** if is_register=FALSE, then the function will be deregistered.
2195**
2196** Returns BTM_SUCCESS if successful,
2197** BTM_BUSY if maximum number of callbacks have already been
2198** registered.
2199**
2200*******************************************************************************/
2201 BTM_API extern tBTM_STATUS BTM_RegisterForVSEvents (tBTM_VS_EVT_CB *p_cb, BOOLEAN is_register);
2202
2203
2204/*******************************************************************************
2205**
2206** Function BTM_ContinueReset
2207**
2208** Description Instructs stack to continue its stack initialization after
2209** an application has completed any vender specific commands
2210** sent to the controller.
2211**
2212** Note: This function is only called if an application
2213** initialization function has been inserted in the reset
2214** sequence. (BTM_APP_DEV_INIT is defined with a function).
2215**
2216** Returns void
2217**
2218*******************************************************************************/
2219 BTM_API extern void BTM_ContinueReset (void);
2220
2221
2222/*******************************************************************************
2223**
2224** Function BTM_VendorSpecificCommand
2225**
2226** Description Send a vendor specific HCI command to the controller.
2227**
2228** Returns
2229** BTM_SUCCESS Command sent. Does not expect command complete
2230** event. (command cmpl callback param is NULL)
2231** BTM_CMD_STARTED Command sent. Waiting for command cmpl event.
2232** BTM_BUSY Command not sent. Waiting for cmd cmpl event for
2233** prior command.
2234**
2235*******************************************************************************/
2236 BTM_API extern tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode,
2237 UINT8 param_len,
2238 UINT8 *p_param_buf,
2239 tBTM_VSC_CMPL_CB *p_cb);
2240
2241
2242/*******************************************************************************
2243**
2244** Function BTM_AllocateSCN
2245**
2246** Description Look through the Server Channel Numbers for a free one to be
2247** used with an RFCOMM connection.
2248**
2249** Returns Allocated SCN number or 0 if none.
2250**
2251*******************************************************************************/
2252 BTM_API extern UINT8 BTM_AllocateSCN(void);
2253
2254// btla-specific ++
2255/*******************************************************************************
2256**
2257** Function BTM_TryAllocateSCN
2258**
2259** Description Try to allocate a fixed server channel
2260**
2261** Returns Returns TRUE if server channel was available
2262**
2263*******************************************************************************/
2264BTM_API extern BOOLEAN BTM_TryAllocateSCN(UINT8 scn);
2265// btla-specific --
2266
2267
2268/*******************************************************************************
2269**
2270** Function BTM_FreeSCN
2271**
2272** Description Free the specified SCN.
2273**
2274** Returns TRUE if successful, FALSE if SCN is not in use or invalid
2275**
2276*******************************************************************************/
2277 BTM_API extern BOOLEAN BTM_FreeSCN(UINT8 scn);
2278
2279
2280/*******************************************************************************
2281**
2282** Function BTM_SetTraceLevel
2283**
2284** Description This function sets the trace level for BTM. If called with
2285** a value of 0xFF, it simply returns the current trace level.
2286**
2287** Returns The new or current trace level
2288**
2289*******************************************************************************/
2290 BTM_API extern UINT8 BTM_SetTraceLevel (UINT8 new_level);
2291
2292
2293/*******************************************************************************
2294**
2295** Function BTM_WritePageTimeout
2296**
2297** Description Send HCI Wite Page Timeout.
2298**
2299** Returns
2300** BTM_SUCCESS Command sent.
2301** BTM_NO_RESOURCES If out of resources to send the command.
2302**
2303*******************************************************************************/
2304 BTM_API extern tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout);
2305
2306/*******************************************************************************
2307**
2308** Function BTM_WriteVoiceSettings
2309**
2310** Description Send HCI Write Voice Settings command.
2311** See hcidefs.h for settings bitmask values.
2312**
2313** Returns
2314** BTM_SUCCESS Command sent.
2315** BTM_NO_RESOURCES If out of resources to send the command.
2316**
2317**
2318*******************************************************************************/
2319 BTM_API extern tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings);
2320
2321/*******************************************************************************
2322**
2323** Function BTM_EnableTestMode
2324**
2325** Description Send HCI the enable device under test command.
2326**
2327** Note: Controller can only be taken out of this mode by
2328** resetting the controller.
2329**
2330** Returns
2331** BTM_SUCCESS Command sent.
2332** BTM_NO_RESOURCES If out of resources to send the command.
2333**
2334**
2335*******************************************************************************/
2336 BTM_API extern tBTM_STATUS BTM_EnableTestMode(void);
2337
2338
2339/*****************************************************************************
2340** DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device
2341*****************************************************************************/
2342
2343/*******************************************************************************
2344**
2345** Function BTM_SetDiscoverability
2346**
2347** Description This function is called to set the device into or out of
2348** discoverable mode. Discoverable mode means inquiry
2349** scans are enabled. If a value of '0' is entered for window or
2350** interval, the default values are used.
2351**
2352** Returns BTM_SUCCESS if successful
2353** BTM_BUSY if a setting of the filter is already in progress
2354** BTM_NO_RESOURCES if couldn't get a memory pool buffer
2355** BTM_ILLEGAL_VALUE if a bad parameter was detected
2356** BTM_WRONG_MODE if the device is not up.
2357**
2358*******************************************************************************/
2359 BTM_API extern tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window,
2360 UINT16 interval);
2361
2362
2363/*******************************************************************************
2364**
2365** Function BTM_ReadDiscoverability
2366**
2367** Description This function is called to read the current discoverability
2368** mode of the device.
2369**
2370** Output Params: p_window - current inquiry scan duration
2371** p_interval - current inquiry scan interval
2372**
2373** Returns BTM_NON_DISCOVERABLE, BTM_LIMITED_DISCOVERABLE, or
2374** BTM_GENERAL_DISCOVERABLE
2375**
2376*******************************************************************************/
2377 BTM_API extern UINT16 BTM_ReadDiscoverability (UINT16 *p_window,
2378 UINT16 *p_interval);
2379
2380
2381/*******************************************************************************
2382**
2383** Function BTM_SetPeriodicInquiryMode
2384**
2385** Description This function is called to set the device periodic inquiry mode.
2386** If the duration is zero, the periodic inquiry mode is cancelled.
2387**
2388** Parameters: p_inqparms - pointer to the inquiry information
2389** mode - GENERAL or LIMITED inquiry
2390** duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED)
2391** max_resps - maximum amount of devices to search for before ending the inquiry
2392** filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or
2393** BTM_FILTER_COND_BD_ADDR
2394** filter_cond - value for the filter (based on filter_cond_type)
2395**
2396** max_delay - maximum amount of time between successive inquiries
2397** min_delay - minimum amount of time between successive inquiries
2398** p_results_cb - callback returning pointer to results (tBTM_INQ_RESULTS)
2399**
2400** Returns BTM_CMD_STARTED if successfully started
2401** BTM_ILLEGAL_VALUE if a bad parameter is detected
2402** BTM_NO_RESOURCES if could not allocate a message buffer
2403** BTM_SUCCESS - if cancelling the periodic inquiry
2404** BTM_BUSY - if an inquiry is already active
2405** BTM_WRONG_MODE if the device is not up.
2406**
2407*******************************************************************************/
2408 BTM_API extern tBTM_STATUS BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms,
2409 UINT16 max_delay, UINT16 min_delay,
2410 tBTM_INQ_RESULTS_CB *p_results_cb);
2411
2412
2413/*******************************************************************************
2414**
2415** Function BTM_StartInquiry
2416**
2417** Description This function is called to start an inquiry.
2418**
2419** Parameters: p_inqparms - pointer to the inquiry information
2420** mode - GENERAL or LIMITED inquiry
2421** duration - length in 1.28 sec intervals (If '0', the inquiry is CANCELLED)
2422** max_resps - maximum amount of devices to search for before ending the inquiry
2423** filter_cond_type - BTM_CLR_INQUIRY_FILTER, BTM_FILTER_COND_DEVICE_CLASS, or
2424** BTM_FILTER_COND_BD_ADDR
2425** filter_cond - value for the filter (based on filter_cond_type)
2426**
2427** p_results_cb - Pointer to the callback routine which gets called
2428** upon receipt of an inquiry result. If this field is
2429** NULL, the application is not notified.
2430**
2431** p_cmpl_cb - Pointer to the callback routine which gets called
2432** upon completion. If this field is NULL, the
2433** application is not notified when completed.
2434** Returns tBTM_STATUS
2435** BTM_CMD_STARTED if successfully initiated
2436** BTM_BUSY if already in progress
2437** BTM_ILLEGAL_VALUE if parameter(s) are out of range
2438** BTM_NO_RESOURCES if could not allocate resources to start the command
2439** BTM_WRONG_MODE if the device is not up.
2440**
2441*******************************************************************************/
2442 BTM_API extern tBTM_STATUS BTM_StartInquiry (tBTM_INQ_PARMS *p_inqparms,
2443 tBTM_INQ_RESULTS_CB *p_results_cb,
2444 tBTM_CMPL_CB *p_cmpl_cb);
2445
2446
2447/*******************************************************************************
2448**
2449** Function BTM_IsInquiryActive
2450**
2451** Description This function returns a bit mask of the current inquiry state
2452**
2453** Returns BTM_INQUIRY_INACTIVE if inactive (0)
2454** BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active
2455** BTM_GENERAL_INQUIRY_ACTIVE if a general inquiry is active
2456** BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active
2457**
2458*******************************************************************************/
2459 BTM_API extern UINT16 BTM_IsInquiryActive (void);
2460
2461
2462/*******************************************************************************
2463**
2464** Function BTM_CancelInquiry
2465**
2466** Description This function cancels an inquiry if active
2467**
2468** Returns BTM_SUCCESS if successful
2469** BTM_NO_RESOURCES if could not allocate a message buffer
2470** BTM_WRONG_MODE if the device is not up.
2471**
2472*******************************************************************************/
2473 BTM_API extern tBTM_STATUS BTM_CancelInquiry(void);
2474
2475
2476/*******************************************************************************
2477**
2478** Function BTM_CancelPeriodicInquiry
2479**
2480** Description This function cancels a periodic inquiry
2481**
2482** Returns
2483** BTM_NO_RESOURCES if could not allocate a message buffer
2484** BTM_SUCCESS - if cancelling the periodic inquiry
2485** BTM_WRONG_MODE if the device is not up.
2486**
2487*******************************************************************************/
2488 BTM_API extern tBTM_STATUS BTM_CancelPeriodicInquiry(void);
2489
2490
2491/*******************************************************************************
2492**
2493** Function BTM_SetInquiryFilterCallback
2494**
2495** Description Host can register to be asked whenever an inquiry result
2496** is received. If host does not like the device no name
2497** request is issued for the device
2498**
2499** Returns void
2500**
2501*******************************************************************************/
2502 BTM_API extern void BTM_SetInquiryFilterCallback(tBTM_FILTER_CB *p_callback);
2503
2504
2505/*******************************************************************************
2506**
2507** Function BTM_SetConnectability
2508**
2509** Description This function is called to set the device into or out of
2510** connectable mode. Discoverable mode means page scans enabled.
2511**
2512** Returns BTM_SUCCESS if successful
2513** BTM_ILLEGAL_VALUE if a bad parameter is detected
2514** BTM_NO_RESOURCES if could not allocate a message buffer
2515** BTM_WRONG_MODE if the device is not up.
2516**
2517*******************************************************************************/
2518 BTM_API extern tBTM_STATUS BTM_SetConnectability (UINT16 page_mode, UINT16 window,
2519 UINT16 interval);
2520
2521
2522/*******************************************************************************
2523**
2524** Function BTM_ReadConnectability
2525**
2526** Description This function is called to read the current discoverability
2527** mode of the device.
2528** Output Params p_window - current page scan duration
2529** p_interval - current time between page scans
2530**
2531** Returns BTM_NON_CONNECTABLE or BTM_CONNECTABLE
2532**
2533*******************************************************************************/
2534 BTM_API extern UINT16 BTM_ReadConnectability (UINT16 *p_window, UINT16 *p_interval);
2535
2536
2537/*******************************************************************************
2538**
2539** Function BTM_SetInquiryMode
2540**
2541** Description This function is called to set standard, with RSSI
2542** mode or extended of the inquiry for local device.
2543**
2544** Input Params: BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or
2545** BTM_INQ_RESULT_EXTENDED
2546**
2547** Returns BTM_SUCCESS if successful
2548** BTM_NO_RESOURCES if couldn't get a memory pool buffer
2549** BTM_ILLEGAL_VALUE if a bad parameter was detected
2550** BTM_WRONG_MODE if the device is not up.
2551**
2552*******************************************************************************/
2553 BT_API extern tBTM_STATUS BTM_SetInquiryMode (UINT8 mode);
2554
2555/*******************************************************************************
2556**
2557** Function BTM_SetInquiryScanType
2558**
2559** Description This function is called to set the iquiry scan-type to
2560** standard or interlaced.
2561**
2562** Input Params: BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
2563**
2564** Returns BTM_SUCCESS if successful
2565** BTM_MODE_UNSUPPORTED if not a 1.2 device
2566** BTM_WRONG_MODE if the device is not up.
2567**
2568*******************************************************************************/
2569 BT_API extern tBTM_STATUS BTM_SetInquiryScanType (UINT16 scan_type);
2570
2571/*******************************************************************************
2572**
2573** Function BTM_SetPageScanType
2574**
2575** Description This function is called to set the page scan-type to
2576** standard or interlaced.
2577**
2578** Input Params: BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
2579**
2580** Returns BTM_SUCCESS if successful
2581** BTM_MODE_UNSUPPORTED if not a 1.2 device
2582** BTM_WRONG_MODE if the device is not up.
2583**
2584*******************************************************************************/
2585
2586 BT_API extern tBTM_STATUS BTM_SetPageScanType (UINT16 scan_type);
2587
2588/*******************************************************************************
2589**
2590** Function BTM_ReadRemoteDeviceName
2591**
2592** Description This function initiates a remote device HCI command to the
2593** controller and calls the callback when the process has completed.
2594**
2595** Input Params: remote_bda - device address of name to retrieve
2596** p_cb - callback function called when BTM_CMD_STARTED
2597** is returned.
2598** A pointer to tBTM_REMOTE_DEV_NAME is passed to the
2599** callback.
2600**
2601** Returns
2602** BTM_CMD_STARTED is returned if the request was successfully sent
2603** to HCI.
2604** BTM_BUSY if already in progress
2605** BTM_UNKNOWN_ADDR if device address is bad
2606** BTM_NO_RESOURCES if could not allocate resources to start the command
2607** BTM_WRONG_MODE if the device is not up.
2608**
2609*******************************************************************************/
2610 BTM_API extern tBTM_STATUS BTM_ReadRemoteDeviceName (BD_ADDR remote_bda,
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07002611 tBTM_CMPL_CB *p_cb,
2612 tBT_TRANSPORT transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -08002613
2614
2615/*******************************************************************************
2616**
2617** Function BTM_CancelRemoteDeviceName
2618**
2619** Description This function initiates the cancel request for the specified
2620** remote device.
2621**
2622** Input Params: None
2623**
2624** Returns
2625** BTM_CMD_STARTED is returned if the request was successfully sent
2626** to HCI.
2627** BTM_NO_RESOURCES if could not allocate resources to start the command
2628** BTM_WRONG_MODE if there is not an active remote name request.
2629**
2630*******************************************************************************/
2631 BTM_API extern tBTM_STATUS BTM_CancelRemoteDeviceName (void);
2632
2633/*******************************************************************************
2634**
2635** Function BTM_ReadRemoteVersion
2636**
2637** Description This function is called to read a remote device's version
2638**
2639** Returns BTM_SUCCESS if successful, otherwise an error
2640**
2641*******************************************************************************/
2642 BTM_API extern tBTM_STATUS BTM_ReadRemoteVersion (BD_ADDR addr,
2643 UINT8 *lmp_version,
2644 UINT16 *manufacturer,
2645 UINT16 *lmp_sub_version);
2646
2647/*******************************************************************************
2648**
2649** Function BTM_ReadRemoteFeatures
2650**
Ganesh Ganapathi Batta9d140a92013-04-11 16:13:14 -07002651** Description This function is called to read a remote device's
Andre Eisenbach3aa60542013-03-22 18:00:51 -07002652** supported features mask (features mask located at page 0)
The Android Open Source Project5738f832012-12-12 16:00:35 -08002653**
Andre Eisenbach3aa60542013-03-22 18:00:51 -07002654** Note: The size of device features mask page is
2655** BTM_FEATURE_BYTES_PER_PAGE bytes.
2656**
2657** Returns pointer to the remote supported features mask
The Android Open Source Project5738f832012-12-12 16:00:35 -08002658**
2659*******************************************************************************/
2660 BTM_API extern UINT8 *BTM_ReadRemoteFeatures (BD_ADDR addr);
2661
2662/*******************************************************************************
2663**
Andre Eisenbach3aa60542013-03-22 18:00:51 -07002664** Function BTM_ReadRemoteExtendedFeatures
2665**
2666** Description This function is called to read a specific extended features
2667** page of the remote device
2668**
2669** Note1: The size of device features mask page is
2670** BTM_FEATURE_BYTES_PER_PAGE bytes.
2671** Note2: The valid device features mask page number depends on
2672** the remote device capabilities. It is expected to be in the
2673** range [0 - BTM_EXT_FEATURES_PAGE_MAX].
2674
2675** Returns pointer to the remote extended features mask
2676** or NULL if page_number is not valid
2677**
2678*******************************************************************************/
2679 BTM_API extern UINT8 *BTM_ReadRemoteExtendedFeatures (BD_ADDR addr, UINT8 page_number);
2680
2681/*******************************************************************************
2682**
2683** Function BTM_ReadNumberRemoteFeaturesPages
2684**
2685** Description This function is called to retrieve the number of feature pages
2686** read from the remote device
2687**
2688** Returns number of features pages read from the remote device
2689**
2690*******************************************************************************/
2691 BTM_API extern UINT8 BTM_ReadNumberRemoteFeaturesPages (BD_ADDR addr);
2692
2693/*******************************************************************************
2694**
2695** Function BTM_ReadAllRemoteFeatures
2696**
2697** Description This function is called to read all features of the remote device
2698**
2699** Returns pointer to the byte[0] of the page[0] of the remote device
2700** feature mask.
2701**
2702** Note: the function returns the pointer to the array of the size
2703** BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1).
2704**
2705*******************************************************************************/
2706 BTM_API extern UINT8 *BTM_ReadAllRemoteFeatures (BD_ADDR addr);
2707
2708/*******************************************************************************
2709**
The Android Open Source Project5738f832012-12-12 16:00:35 -08002710** Function BTM_InqFirstResult
2711**
2712** Description This function looks through the inquiry database for the first
2713** used entrysince the LAST inquiry. This is used in conjunction
2714** with BTM_InqNext by applications as a way to walk through the
2715** inquiry results database.
2716**
2717** Returns pointer to first in-use entry, or NULL if DB is empty
2718**
2719*******************************************************************************/
2720 BTM_API extern tBTM_INQ_INFO *BTM_InqFirstResult (void);
2721
2722
2723/*******************************************************************************
2724**
2725** Function BTM_InqNextResult
2726**
2727** Description This function looks through the inquiry database for the next
2728** used entrysince the LAST inquiry. If the input parameter is NULL,
2729** the first entry is returned.
2730**
2731** Returns pointer to next in-use entry, or NULL if no more found.
2732**
2733*******************************************************************************/
2734 BTM_API extern tBTM_INQ_INFO *BTM_InqNextResult (tBTM_INQ_INFO *p_cur);
2735
2736
2737/*******************************************************************************
2738**
2739** Function BTM_InqDbRead
2740**
2741** Description This function looks through the inquiry database for a match
2742** based on Bluetooth Device Address. This is the application's
2743** interface to get the inquiry details of a specific BD address.
2744**
2745** Returns pointer to entry, or NULL if not found
2746**
2747*******************************************************************************/
2748 BTM_API extern tBTM_INQ_INFO *BTM_InqDbRead (BD_ADDR p_bda);
2749
2750
2751/*******************************************************************************
2752**
2753** Function BTM_InqDbFirst
2754**
2755** Description This function looks through the inquiry database for the first
2756** used entry, and returns that. This is used in conjunction with
2757** BTM_InqDbNext by applications as a way to walk through the
2758** inquiry database.
2759**
2760** Returns pointer to first in-use entry, or NULL if DB is empty
2761**
2762*******************************************************************************/
2763 BTM_API extern tBTM_INQ_INFO *BTM_InqDbFirst (void);
2764
2765
2766/*******************************************************************************
2767**
2768** Function BTM_InqDbNext
2769**
2770** Description This function looks through the inquiry database for the next
2771** used entry, and returns that. If the input parameter is NULL,
2772** the first entry is returned.
2773**
2774** Returns pointer to next in-use entry, or NULL if no more found.
2775**
2776*******************************************************************************/
2777 BTM_API extern tBTM_INQ_INFO *BTM_InqDbNext (tBTM_INQ_INFO *p_cur);
2778
2779
2780/*******************************************************************************
2781**
2782** Function BTM_ClearInqDb
2783**
2784** Description This function is called to clear out a device or all devices
2785** from the inquiry database.
2786**
2787** Parameter p_bda - (input) BD_ADDR -> Address of device to clear
2788** (NULL clears all entries)
2789**
2790** Returns BTM_BUSY if an inquiry, get remote name, or event filter
2791** is active, otherwise BTM_SUCCESS
2792**
2793*******************************************************************************/
2794 BTM_API extern tBTM_STATUS BTM_ClearInqDb (BD_ADDR p_bda);
2795
2796
2797/*******************************************************************************
2798**
2799** Function BTM_ReadNumInqDbEntries
2800**
2801** Returns This function returns the number of entries in the inquiry database.
2802**
2803*******************************************************************************/
2804 BTM_API extern UINT8 BTM_ReadNumInqDbEntries (void);
2805
2806
2807/*******************************************************************************
2808**
2809** Function BTM_InquiryRegisterForChanges
2810**
2811** Description This function is called to register a callback for when the
2812** inquiry database changes, i.e. new entry or entry deleted.
2813**
2814** Returns BTM_SUCCESS if successful, otherwise error code
2815**
2816*******************************************************************************/
2817 BTM_API extern tBTM_STATUS BTM_InquiryRegisterForChanges (tBTM_INQ_DB_CHANGE_CB *p_cb);
2818
2819/*******************************************************************************
2820**
2821** Function BTM_ReadInquiryRspTxPower
2822**
2823** Description This command will read the inquiry Transmit Power level used
2824** to transmit the FHS and EIR data packets.
2825** This can be used directly in the Tx Power Level EIR data type.
2826**
2827** Returns BTM_SUCCESS if successful
2828**
2829*******************************************************************************/
2830 BTM_API extern tBTM_STATUS BTM_ReadInquiryRspTxPower (tBTM_CMPL_CB *p_cb);
2831
2832/*******************************************************************************
2833**
2834** Function BTM_WriteInquiryTxPower
2835**
2836** Description This command is used to write the inquiry transmit power level
2837** used to transmit the inquiry (ID) data packets. The Controller
2838** should use the supported TX power level closest to the Tx_Power
2839** parameter.
2840**
2841** Returns BTM_SUCCESS if successful
2842**
2843*******************************************************************************/
2844 BTM_API extern tBTM_STATUS BTM_WriteInquiryTxPower (INT8 tx_power);
2845
2846/*******************************************************************************
2847**
2848** Function BTM_StartDiscovery
2849**
2850** Description This function is called by an application (or profile)
2851** when it wants to trigger an service discovery using the
2852** BTM's discovery database.
2853**
2854** Returns tBTM_STATUS
2855** BTM_CMD_STARTED if the discovery was initiated
2856** BTM_BUSY if one is already in progress
2857** BTM_UNKNOWN_ADDR if no addresses are in the INQ DB
2858** BTM_ERR_PROCESSING if err initiating the command
2859**
2860*******************************************************************************/
2861 BTM_API extern tBTM_STATUS BTM_StartDiscovery (tBTM_CMPL_CB *p_cmpl_cb,
2862 BD_ADDR_PTR p_rem_addr);
2863
2864
2865/*******************************************************************************
2866**
2867** Function BTM_FindAttribute
2868**
2869** Description This function is called by an application (or profile)
2870** when it wants to see if an attribute exists in the BTM
2871** discovery database.
2872**
2873** Returns Pointer to matching record, or NULL
2874**
2875*******************************************************************************/
2876 BTM_API extern tSDP_DISC_REC *BTM_FindAttribute (UINT16 attr_id,
2877 tSDP_DISC_REC *p_start_rec);
2878
2879
2880/*******************************************************************************
2881**
2882** Function BTM_FindService
2883**
2884** Description This function is called by an application (or profile)
2885** when it wants to see if a service exists in the BTM
2886** discovery database.
2887**
2888** Returns Pointer to matching record, or NULL
2889**
2890*******************************************************************************/
2891 BTM_API extern tSDP_DISC_REC *BTM_FindService (UINT16 service_uuid,
2892 tSDP_DISC_REC *p_start_rec);
2893
2894
2895/*******************************************************************************
2896**
2897** Function BTM_SetDiscoveryParams
2898**
2899** Description This function is called to set the BTM default discovery parameters.
2900** These UUID and attribute filters are used during the call to
2901** BTM_StartDiscovery.
2902**
2903** Returns void
2904**
2905*******************************************************************************/
2906 BTM_API extern void BTM_SetDiscoveryParams (UINT16 num_uuid, tSDP_UUID *p_uuid_list,
2907 UINT16 num_attr, UINT16 *p_attr_list);
2908
2909
2910/*****************************************************************************
2911** ACL CHANNEL MANAGEMENT FUNCTIONS
2912*****************************************************************************/
2913/*******************************************************************************
2914**
2915** Function BTM_SetLinkPolicy
2916**
2917** Description Create and send HCI "Write Policy Set" command
2918**
2919** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
2920**
2921*******************************************************************************/
2922 BTM_API extern tBTM_STATUS BTM_SetLinkPolicy (BD_ADDR remote_bda,
2923 UINT16 *settings);
2924
2925
2926/*******************************************************************************
2927**
2928** Function BTM_ReadLinkPolicy
2929**
2930** Description This function is called to read the link policy settings.
2931** The address of link policy results are returned in the callback.
2932** (tBTM_LNK_POLICY_RESULTS)
2933**
2934** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
2935**
2936*******************************************************************************/
2937 BTM_API extern tBTM_STATUS BTM_ReadLinkPolicy (BD_ADDR remote_bda,
2938 tBTM_CMPL_CB *p_cb);
2939
2940
2941/*******************************************************************************
2942**
2943** Function BTM_SetDefaultLinkPolicy
2944**
2945** Description Set the default value for HCI "Write Policy Set" command
2946** to use when an ACL link is created.
2947**
2948** Returns void
2949**
2950*******************************************************************************/
2951 BTM_API extern void BTM_SetDefaultLinkPolicy (UINT16 settings);
2952
2953
2954/*******************************************************************************
2955**
2956** Function BTM_SetDefaultLinkSuperTout
2957**
2958** Description Set the default value for HCI "Write Link Supervision Timeout"
2959** command to use when an ACL link is created.
2960**
2961** Returns void
2962**
2963*******************************************************************************/
2964 BTM_API extern void BTM_SetDefaultLinkSuperTout (UINT16 timeout);
2965
2966
2967/*******************************************************************************
2968**
2969** Function BTM_SetLinkSuperTout
2970**
2971** Description Create and send HCI "Write Link Supervision Timeout" command
2972**
2973** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
2974**
2975*******************************************************************************/
2976 BTM_API extern tBTM_STATUS BTM_SetLinkSuperTout (BD_ADDR remote_bda,
2977 UINT16 timeout);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08002978/*******************************************************************************
2979**
2980** Function BTM_GetLinkSuperTout
2981**
2982** Description Read the link supervision timeout value of the connection
2983**
2984** Returns status of the operation
2985**
2986*******************************************************************************/
2987 BTM_API extern tBTM_STATUS BTM_GetLinkSuperTout (BD_ADDR remote_bda,
2988 UINT16 *p_timeout);
The Android Open Source Project5738f832012-12-12 16:00:35 -08002989
2990/*******************************************************************************
2991**
2992** Function BTM_RegForLstoEvt
2993**
2994** Description register for the HCI "Link Supervision Timeout Change" event
2995**
2996** Returns void
2997**
2998*******************************************************************************/
2999 BTM_API extern void BTM_RegForLstoEvt (tBTM_LSTO_CBACK *p_cback);
3000
3001
3002/* These next APIs are available if the power manager is not compiled in */
3003#if BTM_PWR_MGR_INCLUDED == FALSE
3004/*******************************************************************************
3005**
3006** Function BTM_SetHoldMode
3007**
3008** Description This function is called to set a connection into hold mode.
3009** A check is made if the connection is in sniff or park mode,
3010** and if yes, the hold mode is ignored.
3011**
3012** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3013**
3014*******************************************************************************/
3015 BTM_API extern tBTM_STATUS BTM_SetHoldMode (BD_ADDR remote_bda, UINT16 min_interval,
3016 UINT16 max_interval);
3017
3018
3019/*******************************************************************************
3020**
3021** Function BTM_SetSniffMode
3022**
3023** Description This function is called to set a connection into sniff mode.
3024** A check is made if the connection is already in sniff or park
3025** mode, and if yes, the sniff mode is ignored.
3026**
3027** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3028**
3029*******************************************************************************/
3030 BTM_API extern tBTM_STATUS BTM_SetSniffMode (BD_ADDR remote_bda, UINT16 min_period,
3031 UINT16 max_period, UINT16 attempt,
3032 UINT16 timeout);
3033
3034
3035/*******************************************************************************
3036**
3037** Function BTM_CancelSniffMode
3038**
3039** Description This function is called to put a connection out of sniff mode.
3040** A check is made if the connection is already in sniff mode,
3041** and if not, the cancel sniff mode is ignored.
3042**
3043** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3044**
3045*******************************************************************************/
3046 BTM_API extern tBTM_STATUS BTM_CancelSniffMode (BD_ADDR remote_bda);
3047
3048
3049/*******************************************************************************
3050**
3051** Function BTM_SetParkMode
3052**
3053** Description This function is called to set a connection into park mode.
3054** A check is made if the connection is already in sniff or park
3055** mode, and if yes, the park mode is ignored.
3056**
3057** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3058**
3059*******************************************************************************/
3060 BTM_API extern tBTM_STATUS BTM_SetParkMode (BD_ADDR remote_bda,
3061 UINT16 beacon_min_period,
3062 UINT16 beacon_max_period);
3063
3064
3065/*******************************************************************************
3066**
3067** Function BTM_CancelParkMode
3068**
3069** Description This function is called to put a connection out of park mode.
3070** A check is made if the connection is already in park mode,
3071** and if not, the cancel sniff mode is ignored.
3072**
3073** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3074**
3075*******************************************************************************/
3076 BTM_API extern tBTM_STATUS BTM_CancelParkMode (BD_ADDR remote_bda);
3077
3078
3079/*******************************************************************************
3080**
3081** Function BTM_ReadAclMode
3082**
3083** Description This returns the current mode for a specific
3084** ACL connection.
3085**
3086** Input Param remote_bda - device address of desired ACL connection
3087**
3088** Output Param p_mode - address where the current mode is copied into.
3089** BTM_ACL_MODE_NORMAL
3090** BTM_ACL_MODE_HOLD
3091** BTM_ACL_MODE_SNIFF
3092** BTM_ACL_MODE_PARK
3093** (valid only if return code is BTM_SUCCESS)
3094**
3095** Returns BTM_SUCCESS if successful,
3096** BTM_UNKNOWN_ADDR if bd addr is not active or bad
3097**
3098*******************************************************************************/
3099 BTM_API extern tBTM_STATUS BTM_ReadAclMode (BD_ADDR remote_bda, UINT8 *p_mode);
3100
3101#endif /* if BTM_PWR_MGR_INCLUDED == FALSE */
3102
3103
3104/*******************************************************************************
3105**
3106** Function BTM_SetPacketTypes
3107**
3108** Description This function is set the packet types used for a specific
3109** ACL connection,
3110**
3111** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3112**
3113*******************************************************************************/
3114 BTM_API extern tBTM_STATUS BTM_SetPacketTypes (BD_ADDR remote_bda, UINT16 pkt_types);
3115
3116
3117/*******************************************************************************
3118**
3119** Function BTM_ReadPacketTypes
3120**
3121** Description This function is set the packet types used for the specified
3122** ACL connection,
3123**
3124** Returns packet types supported for the connection, or 0 if no BD address
3125**
3126*******************************************************************************/
3127 BTM_API extern UINT16 BTM_ReadPacketTypes (BD_ADDR remote_bda);
3128
3129
3130/*******************************************************************************
3131**
3132** Function BTM_IsAclConnectionUp
3133**
3134** Description This function is called to check if an ACL connection exists
3135** to a specific remote BD Address.
3136**
3137** Returns TRUE if connection is up, else FALSE.
3138**
3139*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003140 BTM_API extern BOOLEAN BTM_IsAclConnectionUp (BD_ADDR remote_bda, tBT_TRANSPORT transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003141
3142
3143/*******************************************************************************
3144**
3145** Function BTM_GetRole
3146**
3147** Description This function is called to get the role of the local device
3148** for the ACL connection with the specified remote device
3149**
3150** Returns BTM_SUCCESS if connection exists.
3151** BTM_UNKNOWN_ADDR if no active link with bd addr specified
3152**
3153*******************************************************************************/
3154 BTM_API extern tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, UINT8 *p_role);
3155
3156
3157
3158/*******************************************************************************
3159**
3160** Function BTM_SwitchRole
3161**
3162** Description This function is called to switch role between master and
3163** slave. If role is already set it will do nothing. If the
3164** command was initiated, the callback function is called upon
3165** completion.
3166**
3167** Returns BTM_SUCCESS if already in specified role.
3168** BTM_CMD_STARTED if command issued to controller.
3169** BTM_NO_RESOURCES if couldn't allocate memory to issue command
3170** BTM_UNKNOWN_ADDR if no active link with bd addr specified
3171** BTM_MODE_UNSUPPORTED if local device does not support role switching
3172**
3173*******************************************************************************/
3174 BTM_API extern tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr,
3175 UINT8 new_role,
3176 tBTM_CMPL_CB *p_cb);
3177
3178/*******************************************************************************
3179**
3180** Function BTM_ChangeLinkKey
3181**
3182** Description This function is called to change the link key of the
3183** connection.
3184**
3185** Returns BTM_CMD_STARTED if command issued to controller.
3186** BTM_NO_RESOURCES if couldn't allocate memory to issue command
3187** BTM_UNKNOWN_ADDR if no active link with bd addr specified
3188** BTM_BUSY if the previous command is not completed
3189**
3190*******************************************************************************/
3191 BTM_API extern tBTM_STATUS BTM_ChangeLinkKey (BD_ADDR remote_bd_addr,
3192 tBTM_CMPL_CB *p_cb);
3193
3194/*******************************************************************************
3195**
3196** Function BTM_ReadRSSI
3197**
3198** Description This function is called to read the link policy settings.
3199** The address of link policy results are returned in the callback.
3200** (tBTM_RSSI_RESULTS)
3201**
3202** Returns BTM_CMD_STARTED if command issued to controller.
3203** BTM_NO_RESOURCES if couldn't allocate memory to issue command
3204** BTM_UNKNOWN_ADDR if no active link with bd addr specified
3205** BTM_BUSY if command is already in progress
3206**
3207*******************************************************************************/
3208 BTM_API extern tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb);
3209
3210
3211/*******************************************************************************
3212**
3213** Function BTM_ReadTxPower
3214**
3215** Description This function is called to read the current connection
3216** TX power of the connection. The TX power level results
3217** are returned in the callback.
3218** (tBTM_RSSI_RESULTS)
3219**
3220** Returns BTM_CMD_STARTED if command issued to controller.
3221** BTM_NO_RESOURCES if couldn't allocate memory to issue command
3222** BTM_UNKNOWN_ADDR if no active link with bd addr specified
3223** BTM_BUSY if command is already in progress
3224**
3225*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003226 BTM_API extern tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda,
3227 tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003228
3229/*******************************************************************************
3230**
3231** Function BTM_ReadLinkQuality
3232**
3233** Description This function is called to read the link quality.
3234** The value of the link quality is returned in the callback.
3235** (tBTM_LINK_QUALITY_RESULTS)
3236**
3237** Returns BTM_CMD_STARTED if command issued to controller.
3238** BTM_NO_RESOURCES if couldn't allocate memory to issue command
3239** BTM_UNKNOWN_ADDR if no active link with bd addr specified
3240** BTM_BUSY if command is already in progress
3241**
3242*******************************************************************************/
3243 BTM_API extern tBTM_STATUS BTM_ReadLinkQuality (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb);
3244
3245/*******************************************************************************
3246**
3247** Function BTM_RegBusyLevelNotif
3248**
3249** Description This function is called to register a callback to receive
3250** busy level change events.
3251**
3252** Returns BTM_SUCCESS if successfully registered, otherwise error
3253**
3254*******************************************************************************/
3255 BTM_API extern tBTM_STATUS BTM_RegBusyLevelNotif (tBTM_BL_CHANGE_CB *p_cb, UINT8 *p_level,
3256 tBTM_BL_EVENT_MASK evt_mask);
3257
3258/*******************************************************************************
3259**
3260** Function BTM_AclRegisterForChanges
3261**
3262** Description This function is called to register a callback to receive
3263** ACL database change events, i.e. new connection or removed.
3264**
3265** Returns BTM_SUCCESS if successfully initiated, otherwise error
3266**
3267*******************************************************************************/
3268 BTM_API extern tBTM_STATUS BTM_AclRegisterForChanges (tBTM_ACL_DB_CHANGE_CB *p_cb);
3269
3270/*******************************************************************************
3271**
3272** Function BTM_GetNumAclLinks
3273**
3274** Description This function is called to count the number of
3275** ACL links that are active.
3276**
3277** Returns UINT16 Number of active ACL links
3278**
3279*******************************************************************************/
3280 BTM_API extern UINT16 BTM_GetNumAclLinks (void);
3281
3282
3283/*******************************************************************************
3284**
3285** Function BTM_ReadClockOffset
3286**
3287** Description This returns the clock offset for a specific
3288** ACL connection.
3289**
3290** Returns clock-offset or 0 if unknown
3291**
3292*******************************************************************************/
3293 BTM_API extern UINT16 BTM_ReadClockOffset (BD_ADDR remote_bda);
3294
3295
3296/*******************************************************************************
3297**
3298** Function BTM_SetQoS
3299**
3300** Description This function is called to setup QoS
3301**
3302** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3303**
3304*******************************************************************************/
3305 BTM_API extern tBTM_STATUS BTM_SetQoS(BD_ADDR bd, FLOW_SPEC *p_flow,
3306 tBTM_CMPL_CB *p_cb);
3307
3308
3309/*****************************************************************************
3310** (e)SCO CHANNEL MANAGEMENT FUNCTIONS
3311*****************************************************************************/
3312/*******************************************************************************
3313**
3314** Function BTM_CreateSco
3315**
3316** Description This function is called to create an SCO connection. If the
3317** "is_orig" flag is TRUE, the connection will be originated,
3318** otherwise BTM will wait for the other side to connect.
3319**
3320** Returns BTM_UNKNOWN_ADDR if the ACL connection is not up
3321** BTM_BUSY if another SCO being set up to
3322** the same BD address
3323** BTM_NO_RESOURCES if the max SCO limit has been reached
3324** BTM_CMD_STARTED if the connection establishment is started.
3325** In this case, "*p_sco_inx" is filled in
3326** with the sco index used for the connection.
3327**
3328*******************************************************************************/
3329 BTM_API extern tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig,
3330 UINT16 pkt_types, UINT16 *p_sco_inx,
3331 tBTM_SCO_CB *p_conn_cb,
3332 tBTM_SCO_CB *p_disc_cb);
3333
3334
3335/*******************************************************************************
3336**
3337** Function BTM_RemoveSco
3338**
3339** Description This function is called to remove a specific SCO connection.
3340**
3341** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3342**
3343*******************************************************************************/
3344 BTM_API extern tBTM_STATUS BTM_RemoveSco (UINT16 sco_inx);
3345
3346
3347/*******************************************************************************
3348**
3349** Function BTM_SetScoPacketTypes
3350**
3351** Description This function is called to set the packet types used for
3352** a specific SCO connection,
3353**
3354** Parameters pkt_types - One or more of the following
3355** BTM_SCO_PKT_TYPES_MASK_HV1
3356** BTM_SCO_PKT_TYPES_MASK_HV2
3357** BTM_SCO_PKT_TYPES_MASK_HV3
3358** BTM_SCO_PKT_TYPES_MASK_EV3
3359** BTM_SCO_PKT_TYPES_MASK_EV4
3360** BTM_SCO_PKT_TYPES_MASK_EV5
3361**
3362** BTM_SCO_LINK_ALL_MASK - enables all supported types
3363**
3364** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3365**
3366*******************************************************************************/
3367 BTM_API extern tBTM_STATUS BTM_SetScoPacketTypes (UINT16 sco_inx, UINT16 pkt_types);
3368
3369
3370/*******************************************************************************
3371**
3372** Function BTM_ReadScoPacketTypes
3373**
3374** Description This function is read the packet types used for a specific
3375** SCO connection.
3376**
3377** Returns One or more of the following (bitmask)
3378** BTM_SCO_PKT_TYPES_MASK_HV1
3379** BTM_SCO_PKT_TYPES_MASK_HV2
3380** BTM_SCO_PKT_TYPES_MASK_HV3
3381** BTM_SCO_PKT_TYPES_MASK_EV3
3382** BTM_SCO_PKT_TYPES_MASK_EV4
3383** BTM_SCO_PKT_TYPES_MASK_EV5
3384**
3385** Returns packet types supported for the connection
3386**
3387*******************************************************************************/
3388 BTM_API extern UINT16 BTM_ReadScoPacketTypes (UINT16 sco_inx);
3389
3390
3391/*******************************************************************************
3392**
3393** Function BTM_ReadDeviceScoPacketTypes
3394**
3395** Description This function is read the SCO packet types that
3396** the device supports.
3397**
3398** Returns packet types supported by the device.
3399**
3400*******************************************************************************/
3401 BTM_API extern UINT16 BTM_ReadDeviceScoPacketTypes (void);
3402
3403
3404/*******************************************************************************
3405**
3406** Function BTM_ReadScoHandle
3407**
3408** Description This function is used to read the HCI handle used for a specific
3409** SCO connection,
3410**
3411** Returns handle for the connection, or 0xFFFF if invalid SCO index.
3412**
3413*******************************************************************************/
3414 BTM_API extern UINT16 BTM_ReadScoHandle (UINT16 sco_inx);
3415
3416
3417/*******************************************************************************
3418**
3419** Function BTM_ReadScoBdAddr
3420**
3421** Description This function is read the remote BD Address for a specific
3422** SCO connection,
3423**
3424** Returns pointer to BD address or NULL if not known
3425**
3426*******************************************************************************/
3427 BTM_API extern UINT8 *BTM_ReadScoBdAddr (UINT16 sco_inx);
3428
3429
3430/*******************************************************************************
3431**
3432** Function BTM_ReadScoDiscReason
3433**
3434** Description This function is returns the reason why an (e)SCO connection
3435** has been removed. It contains the value until read, or until
3436** another (e)SCO connection has disconnected.
3437**
3438** Returns HCI reason or BTM_INVALID_SCO_DISC_REASON if not set.
3439**
3440*******************************************************************************/
3441 BTM_API extern UINT16 BTM_ReadScoDiscReason (void);
3442
3443
3444/*******************************************************************************
3445**
3446** Function BTM_SetEScoMode
3447**
3448** Description This function sets up the negotiated parameters for SCO or
3449** eSCO, and sets as the default mode used for calls to
3450** BTM_CreateSco. It can be called only when there are no
3451** active (e)SCO links.
3452**
3453** Returns BTM_SUCCESS if the successful.
3454** BTM_BUSY if there are one or more active (e)SCO links.
3455**
3456*******************************************************************************/
3457 BTM_API extern tBTM_STATUS BTM_SetEScoMode (tBTM_SCO_TYPE sco_mode,
3458 tBTM_ESCO_PARAMS *p_parms);
3459
3460/*******************************************************************************
3461**
3462** Function BTM_SetWBSCodec
3463**
3464** Description This function sends command to the controller to setup
3465** WBS codec for the upcoming eSCO connection.
3466**
3467** Returns BTM_SUCCESS.
3468**
3469**
3470*******************************************************************************/
3471BTM_API extern tBTM_STATUS BTM_SetWBSCodec (tBTM_SCO_CODEC_TYPE codec_type);
3472
3473/*******************************************************************************
3474**
3475** Function BTM_RegForEScoEvts
3476**
3477** Description This function registers a SCO event callback with the
3478** specified instance. It should be used to received
3479** connection indication events and change of link parameter
3480** events.
3481**
3482** Returns BTM_SUCCESS if the successful.
3483** BTM_ILLEGAL_VALUE if there is an illegal sco_inx
3484**
3485*******************************************************************************/
3486 BTM_API extern tBTM_STATUS BTM_RegForEScoEvts (UINT16 sco_inx,
3487 tBTM_ESCO_CBACK *p_esco_cback);
3488
3489/*******************************************************************************
3490**
3491** Function BTM_ReadEScoLinkParms
3492**
3493** Description This function returns the current eSCO link parameters for
3494** the specified handle. This can be called anytime a connection
3495** is active, but is typically called after receiving the SCO
3496** opened callback.
3497**
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -08003498** Note: If called over a 1.1 controller, only the packet types
3499** field has meaning.
3500** Note: If the upper layer doesn't know the current sco index,
3501** BTM_FIRST_ACTIVE_SCO_INDEX can be used as the first parameter to
3502** find the first active SCO index
The Android Open Source Project5738f832012-12-12 16:00:35 -08003503**
3504** Returns BTM_SUCCESS if returned data is valid connection.
3505** BTM_ILLEGAL_VALUE if no connection for specified sco_inx.
3506** BTM_MODE_UNSUPPORTED if local controller does not support
3507** 1.2 specification.
3508**
3509*******************************************************************************/
3510 BTM_API extern tBTM_STATUS BTM_ReadEScoLinkParms (UINT16 sco_inx,
3511 tBTM_ESCO_DATA *p_parms);
3512
3513/*******************************************************************************
3514**
3515** Function BTM_ChangeEScoLinkParms
3516**
3517** Description This function requests renegotiation of the parameters on
3518** the current eSCO Link. If any of the changes are accepted
3519** by the controllers, the BTM_ESCO_CHG_EVT event is sent in
3520** the tBTM_ESCO_CBACK function with the current settings of
3521** the link. The callback is registered through the call to
3522** BTM_SetEScoMode.
3523**
3524**
3525** Returns BTM_CMD_STARTED if command is successfully initiated.
3526** BTM_ILLEGAL_VALUE if no connection for specified sco_inx.
3527** BTM_NO_RESOURCES - not enough resources to initiate command.
3528** BTM_MODE_UNSUPPORTED if local controller does not support
3529** 1.2 specification.
3530**
3531*******************************************************************************/
3532 BTM_API extern tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx,
3533 tBTM_CHG_ESCO_PARAMS *p_parms);
3534
3535/*******************************************************************************
3536**
3537** Function BTM_EScoConnRsp
3538**
3539** Description This function is called upon receipt of an (e)SCO connection
3540** request event (BTM_ESCO_CONN_REQ_EVT) to accept or reject
3541** the request. Parameters used to negotiate eSCO links.
3542** If p_parms is NULL, then values set through BTM_SetEScoMode
3543** are used.
3544** If the link type of the incoming request is SCO, then only
3545** the tx_bw, max_latency, content format, and packet_types are
3546** valid. The hci_status parameter should be
3547** ([0x0] to accept, [0x0d..0x0f] to reject)
3548**
3549**
3550** Returns void
3551**
3552*******************************************************************************/
3553 BTM_API extern void BTM_EScoConnRsp (UINT16 sco_inx, UINT8 hci_status,
3554 tBTM_ESCO_PARAMS *p_parms);
3555
3556/*******************************************************************************
3557**
3558** Function BTM_GetNumScoLinks
3559**
3560** Description This function returns the number of active SCO links.
3561**
3562** Returns UINT8
3563**
3564*******************************************************************************/
3565 BTM_API extern UINT8 BTM_GetNumScoLinks (void);
3566
3567/*****************************************************************************
3568** SECURITY MANAGEMENT FUNCTIONS
3569*****************************************************************************/
3570/*******************************************************************************
3571**
3572** Function BTM_SecRegister
3573**
3574** Description Application manager calls this function to register for
3575** security services. There can be one and only one application
3576** saving link keys. BTM allows only first registration.
3577**
3578** Returns TRUE if registered OK, else FALSE
3579**
3580*******************************************************************************/
3581 BTM_API extern BOOLEAN BTM_SecRegister (tBTM_APPL_INFO *p_cb_info);
3582
3583
3584/*******************************************************************************
3585**
3586** Function BTM_SecRegisterLinkKeyNotificationCallback
3587**
3588** Description Profiles can register to be notified when a new Link Key
3589** is generated per connection.
3590**
3591** Returns TRUE if registered OK, else FALSE
3592**
3593*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003594 BTM_API extern BOOLEAN BTM_SecRegisterLinkKeyNotificationCallback (
3595 tBTM_LINK_KEY_CALLBACK *p_callback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003596
3597
3598/*******************************************************************************
3599**
3600** Function BTM_SecAddRmtNameNotifyCallback
3601**
3602** Description Profiles can register to be notified when name of the
3603** remote device is resolved (up to BTM_SEC_MAX_RMT_NAME_CALLBACKS).
3604**
3605** Returns TRUE if registered OK, else FALSE
3606**
3607*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003608 BTM_API extern BOOLEAN BTM_SecAddRmtNameNotifyCallback (
3609 tBTM_RMT_NAME_CALLBACK *p_callback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003610
3611
3612/*******************************************************************************
3613**
3614** Function BTM_SecDeleteRmtNameNotifyCallback
3615**
3616** Description A profile can deregister notification when a new Link Key
3617** is generated per connection.
3618**
3619** Returns TRUE if OK, else FALSE
3620**
3621*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003622 BTM_API extern BOOLEAN BTM_SecDeleteRmtNameNotifyCallback (
3623 tBTM_RMT_NAME_CALLBACK *p_callback);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003624
3625
3626/*******************************************************************************
3627**
3628** Function BTM_SecSetConnectFilterCallback
3629**
3630** Description Host can register to be asked whenever an HCI connection
3631** request is received. In the registered function host
3632** suppose to check connectibility filters. Yes/No result
3633** should be returned synchronously.
3634**
3635** Returns void
3636**
3637*******************************************************************************/
3638 BTM_API extern void BTM_SecSetConnectFilterCallback (tBTM_FILTER_CB *p_callback);
3639
3640
3641/*******************************************************************************
3642**
3643** Function BTM_GetSecurityMode
3644**
3645** Description Get security mode for the device
3646**
3647** Returns void
3648**
3649*******************************************************************************/
3650 BTM_API extern UINT8 BTM_GetSecurityMode (void);
3651
3652
3653/*******************************************************************************
3654**
3655** Function BTM_GetSecurityFlags
3656**
3657** Description Get security flags for the device
3658**
3659** Returns BOOLEAN TRUE or FALSE is device found
3660**
3661*******************************************************************************/
3662 BTM_API extern BOOLEAN BTM_GetSecurityFlags (BD_ADDR bd_addr, UINT8 * p_sec_flags);
3663
3664/*******************************************************************************
3665**
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003666** Function BTM_GetSecurityFlagsByTransport
3667**
3668** Description Get security flags for the device on a particular transport
3669**
3670** Parameters bd_addr: BD address of remote device
3671** p_sec_flags : Out parameter to be filled with security flags for the connection
3672** transport : Physical transport of the connection (BR/EDR or LE)
3673**
3674** Returns BOOLEAN TRUE or FALSE is device found
3675**
3676*******************************************************************************/
3677 BTM_API extern BOOLEAN BTM_GetSecurityFlagsByTransport (BD_ADDR bd_addr,
3678 UINT8 * p_sec_flags, tBT_TRANSPORT transport);
3679
3680/*******************************************************************************
3681**
The Android Open Source Project5738f832012-12-12 16:00:35 -08003682** Function BTM_ReadTrustedMask
3683**
3684** Description Get trusted mask for the device
3685**
3686** Returns NULL, if the device record is not found.
3687** otherwise, the trusted mask
3688**
3689*******************************************************************************/
3690 BTM_API extern UINT32 * BTM_ReadTrustedMask (BD_ADDR bd_addr);
3691
3692
3693/*******************************************************************************
3694**
3695** Function BTM_SetSecurityMode
3696**
3697** Description Set security mode for the device
3698**
3699** Returns void
3700**
3701*******************************************************************************/
3702 BTM_API extern void BTM_SetSecurityMode (UINT8 sec_mode);
3703
3704
3705/*******************************************************************************
3706**
3707** Function BTM_SetPinType
3708**
3709** Description Set PIN type for the device.
3710**
3711** Returns void
3712**
3713*******************************************************************************/
3714 BTM_API extern void BTM_SetPinType (UINT8 pin_type, PIN_CODE pin_code, UINT8 pin_code_len);
3715
3716
3717/*******************************************************************************
3718**
3719** Function BTM_SetPairableMode
3720**
3721** Description Enable or disable pairing
3722**
3723** Parameters allow_pairing - (TRUE or FALSE) whether or not the device
3724** allows pairing.
3725** connect_only_paired - (TRUE or FALSE) whether or not to
3726** only allow paired devices to connect.
3727**
3728** Returns void
3729**
3730*******************************************************************************/
3731 BTM_API extern void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired);
3732
3733/*******************************************************************************
3734**
3735** Function BTM_SetSecurityLevel
3736**
3737** Description Register service security level with Security Manager. Each
3738** service must register its requirements regardless of the
3739** security level that is used. This API is called once for originators
3740** nad again for acceptors of connections.
3741**
3742** Returns TRUE if registered OK, else FALSE
3743**
3744*******************************************************************************/
3745 BTM_API extern BOOLEAN BTM_SetSecurityLevel (BOOLEAN is_originator, char *p_name,
3746 UINT8 service_id, UINT16 sec_level,
3747 UINT16 psm, UINT32 mx_proto_id,
3748 UINT32 mx_chan_id);
3749
3750/*******************************************************************************
3751**
3752** Function BTM_SetUCDSecurityLevel
3753**
3754** Description Register UCD service security level with Security Manager. Each
3755** service must register its requirements regardless of the
3756** security level that is used. This API is called once for originators
3757** and again for acceptors of connections.
3758**
3759** Returns TRUE if registered OK, else FALSE
3760**
3761*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003762 BTM_API extern BOOLEAN BTM_SetUCDSecurityLevel (BOOLEAN is_originator, char *p_name,
3763 UINT8 service_id, UINT16 sec_level,
3764 UINT16 psm, UINT32 mx_proto_id,
3765 UINT32 mx_chan_id);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003766
3767/*******************************************************************************
3768**
3769** Function BTM_SetOutService
3770**
3771** Description This function is called to set the service for
3772** outgoing connection.
3773**
3774** Returns void
3775**
3776*******************************************************************************/
3777 BTM_API extern void BTM_SetOutService(BD_ADDR bd_addr, UINT8 service_id, UINT32 mx_chan_id);
3778
3779/*******************************************************************************
3780**
3781** Function BTM_SecClrService
3782**
3783** Description Removes specified service record(s) from the security database.
3784** All service records with the specified name are removed.
3785** Typically used only by devices with limited RAM so that it can
3786** reuse an old security service record.
3787** records (except SDP).
3788**
3789** Returns Number of records that were freed.
3790**
3791*******************************************************************************/
3792 BTM_API extern UINT8 BTM_SecClrService (UINT8 service_id);
3793
3794/*******************************************************************************
3795**
3796** Function BTM_SecClrUCDService
3797**
3798** Description
3799**
3800** Parameters Service ID - Id of the service to remove. ('0' removes all service
3801** records.
3802**
3803** Returns Number of records that were freed.
3804**
3805*******************************************************************************/
3806 BTM_API extern UINT8 BTM_SecClrUCDService (UINT8 service_id);
3807
3808/*******************************************************************************
3809**
3810** Function BTM_SecAddDevice
3811**
3812** Description Add/modify device. This function will be normally called
3813** during host startup to restore all required information
3814** stored in the NVRAM.
3815** dev_class, bd_name, link_key, and features are NULL if unknown
3816**
3817** Returns TRUE if added OK, else FALSE
3818**
3819*******************************************************************************/
3820 BTM_API extern BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class,
Andre Eisenbach3aa60542013-03-22 18:00:51 -07003821 BD_NAME bd_name, UINT8 *features,
The Android Open Source Project5738f832012-12-12 16:00:35 -08003822 UINT32 trusted_mask[], LINK_KEY link_key,
3823 UINT8 key_type, tBTM_IO_CAP io_cap);
3824
3825
3826/*******************************************************************************
3827**
3828** Function BTM_SecDeleteDevice
3829**
3830** Description Free resources associated with the device.
3831**
3832** Returns TRUE if rmoved OK, FALSE if not found
3833**
3834*******************************************************************************/
3835 BTM_API extern BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr);
3836
3837
3838/*******************************************************************************
3839**
3840** Function BTM_SecUseMasterLinkKey
3841**
3842** Description This function is called to tell master of the piconet to
3843** switch to master link key
3844**
3845** Returns BTM_SUCCESS if command is successully initiated
3846**
3847*******************************************************************************/
3848 BTM_API extern tBTM_STATUS BTM_SecUseMasterLinkKey (BOOLEAN use_master_key);
3849
3850
3851/*******************************************************************************
3852**
3853** Function BTM_SetMasterKeyCompCback
3854**
3855** Description This function is called to register for the master key complete
3856** status event.
3857**
3858** Parameters: mkey_cback - callback registered with the security manager
3859**
3860** Returns void
3861**
3862*******************************************************************************/
3863 BTM_API extern void BTM_SetMasterKeyCompCback(tBTM_MKEY_CALLBACK *mkey_cback );
3864
3865
3866/*******************************************************************************
3867**
3868** Function BTM_SecGetDeviceLinkKey
3869**
3870** Description This function is called to obtain link key for the device
3871** it returns BTM_SUCCESS if link key is available, or
3872** BTM_UNKNOWN_ADDR if Security Manager does not know about
3873** the device or device record does not contain link key info
3874**
3875** Returns BTM_SUCCESS if successful, otherwise error code
3876**
3877*******************************************************************************/
3878 BTM_API extern tBTM_STATUS BTM_SecGetDeviceLinkKey (BD_ADDR bd_addr,
3879 LINK_KEY link_key);
3880
3881
3882/*******************************************************************************
3883**
3884** Function BTM_PINCodeReply
3885**
3886** Description This function is called after Security Manager submitted
3887** PIN code request to the UI.
3888**
3889** Parameters: bd_addr - Address of the device for which PIN was requested
3890** res - result of the operation BTM_SUCCESS if success
3891** pin_len - length in bytes of the PIN Code
3892** p_pin - pointer to array with the PIN Code
3893** trusted_mask - bitwise OR of trusted services (array of UINT32)
3894**
3895** Returns void
3896**
3897*******************************************************************************/
3898 BTM_API extern void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len,
3899 UINT8 *p_pin, UINT32 trusted_mask[]);
3900
3901
3902/*******************************************************************************
3903**
3904** Function BTM_DeviceAuthorized
3905**
3906** Description This function is called after Security Manager submitted
3907** authorization request to the UI.
3908**
3909** Parameters: bd_addr - Address of the device for which PIN was requested
3910** res - result of the operation BTM_SUCCESS if success
3911**
3912** Returns void
3913**
3914*******************************************************************************/
3915 BTM_API extern void BTM_DeviceAuthorized (BD_ADDR bd_addr, UINT8 res,
3916 UINT32 trusted_mask[]);
3917
3918
3919/*******************************************************************************
3920**
3921** Function BTM_SecBond
3922**
3923** Description This function is called to perform bonding with peer device.
3924**
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003925** Parameters: bd_addr - Address of the device to bond
3926** pin_len - length in bytes of the PIN Code
3927** p_pin - pointer to array with the PIN Code
3928** trusted_mask - bitwise OR of trusted services (array of UINT32)
3929
The Android Open Source Project5738f832012-12-12 16:00:35 -08003930** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3931**
3932*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003933 BTM_API extern tBTM_STATUS BTM_SecBond (BD_ADDR bd_addr,
3934 UINT8 pin_len, UINT8 *p_pin,
3935 UINT32 trusted_mask[]);
3936
3937/*******************************************************************************
3938**
3939** Function BTM_SecBondByTransport
3940**
3941** Description This function is called to perform bonding by designated transport
3942**
3943** Parameters: bd_addr - Address of the device to bond
3944** pin_len - length in bytes of the PIN Code
3945** p_pin - pointer to array with the PIN Code
3946** trusted_mask - bitwise OR of trusted services (array of UINT32)
3947** transport : Physical transport to use for bonding (BR/EDR or LE)
3948**
3949** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3950**
3951*******************************************************************************/
3952 BTM_API extern tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr,
3953 tBT_TRANSPORT transport,
3954 UINT8 pin_len, UINT8 *p_pin,
3955 UINT32 trusted_mask[]);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003956
3957/*******************************************************************************
3958**
3959** Function BTM_SecBondCancel
3960**
3961** Description This function is called to cancel ongoing bonding process
3962** with peer device.
3963**
3964** Returns BTM_CMD_STARTED if successfully initiated, otherwise error
3965**
3966*******************************************************************************/
3967 BTM_API extern tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr);
3968
3969/*******************************************************************************
3970**
3971** Function BTM_SetEncryption
3972**
3973** Description This function is called to ensure that connection is
3974** encrypted. Should be called only on an open connection.
3975** Typically only needed for connections that first want to
3976** bring up unencrypted links, then later encrypt them.
3977**
3978** Parameters: bd_addr - Address of the peer device
3979** p_callback - Pointer to callback function called if
3980** this function returns PENDING after required
3981** procedures are completed. Can be set to NULL
3982** if status is not desired.
3983** p_ref_data - pointer to any data the caller wishes to receive
3984** in the callback function upon completion.
3985* can be set to NULL if not used.
3986**
3987** Returns BTM_SUCCESS - already encrypted
3988** BTM_PENDING - command will be returned in the callback
3989** BTM_WRONG_MODE- connection not up.
3990** BTM_BUSY - security procedures are currently active
3991** BTM_MODE_UNSUPPORTED - if security manager not linked in.
3992**
3993*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07003994 BTM_API extern tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport,
3995 tBTM_SEC_CBACK *p_callback, void *p_ref_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -08003996
3997/*******************************************************************************
3998**
3999** Function BTM_ConfirmReqReply
4000**
4001** Description This function is called to confirm the numeric value for
4002** Simple Pairing in response to BTM_SP_CFM_REQ_EVT
4003**
4004** Parameters: res - result of the operation BTM_SUCCESS if success
4005** bd_addr - Address of the peer device
4006**
4007*******************************************************************************/
4008 BTM_API extern void BTM_ConfirmReqReply(tBTM_STATUS res, BD_ADDR bd_addr);
4009
4010/*******************************************************************************
4011**
4012** Function BTM_PasskeyReqReply
4013**
4014** Description This function is called to provide the passkey for
4015** Simple Pairing in response to BTM_SP_KEY_REQ_EVT
4016**
4017** Parameters: res - result of the operation BTM_SUCCESS if success
4018** bd_addr - Address of the peer device
4019** passkey - numeric value in the range of 0 - 999999(0xF423F).
4020**
4021*******************************************************************************/
4022 BTM_API extern void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, UINT32 passkey);
4023
4024/*******************************************************************************
4025**
4026** Function BTM_SendKeypressNotif
4027**
4028** Description This function is used during the passkey entry model
4029** by a device with KeyboardOnly IO capabilities
4030** (very likely to be a HID Device).
4031** It is called by a HID Device to inform the remote device when
4032** a key has been entered or erased.
4033**
4034** Parameters: bd_addr - Address of the peer device
4035** type - notification type
4036**
4037*******************************************************************************/
4038 BTM_API extern void BTM_SendKeypressNotif(BD_ADDR bd_addr, tBTM_SP_KEY_TYPE type);
4039
4040/*******************************************************************************
4041**
4042** Function BTM_IoCapRsp
4043**
4044** Description This function is called in response to BTM_SP_IO_REQ_EVT
4045** When the event data io_req.oob_data is set to BTM_OOB_UNKNOWN
4046** by the tBTM_SP_CALLBACK implementation, this function is
4047** called to provide the actual response
4048**
4049** Parameters: bd_addr - Address of the peer device
4050** io_cap - The IO capability of local device.
4051** oob - BTM_OOB_NONE or BTM_OOB_PRESENT.
4052** auth_req- MITM protection required or not.
4053**
4054*******************************************************************************/
4055 BTM_API extern void BTM_IoCapRsp(BD_ADDR bd_addr, tBTM_IO_CAP io_cap,
4056 tBTM_OOB_DATA oob, tBTM_AUTH_REQ auth_req);
4057
4058/*******************************************************************************
4059**
4060** Function BTM_ReadLocalOobData
4061**
4062** Description This function is called to read the local OOB data from
4063** LM
4064**
4065*******************************************************************************/
4066 BTM_API extern tBTM_STATUS BTM_ReadLocalOobData(void);
4067
4068/*******************************************************************************
4069**
4070** Function BTM_RemoteOobDataReply
4071**
4072** Description This function is called to provide the remote OOB data for
4073** Simple Pairing in response to BTM_SP_RMT_OOB_EVT
4074**
4075** Parameters: bd_addr - Address of the peer device
4076** c - simple pairing Hash C.
4077** r - simple pairing Randomizer C.
4078**
4079*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07004080 BTM_API extern void BTM_RemoteOobDataReply(tBTM_STATUS res, BD_ADDR bd_addr,
4081 BT_OCTET16 c, BT_OCTET16 r);
The Android Open Source Project5738f832012-12-12 16:00:35 -08004082
4083/*******************************************************************************
4084**
4085** Function BTM_BuildOobData
4086**
4087** Description This function is called to build the OOB data payload to
4088** be sent over OOB (non-Bluetooth) link
4089**
4090** Parameters: p_data - the location for OOB data
4091** max_len - p_data size.
4092** c - simple pairing Hash C.
4093** r - simple pairing Randomizer C.
4094** name_len- 0, local device name would not be included.
4095** otherwise, the local device name is included for
4096** up to this specified length
4097**
4098** Returns Number of bytes in p_data.
4099**
4100*******************************************************************************/
4101 BTM_API extern UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
4102 BT_OCTET16 r, UINT8 name_len);
4103
4104/*******************************************************************************
4105**
4106** Function BTM_ReadOobData
4107**
4108** Description This function is called to parse the OOB data payload
4109** received over OOB (non-Bluetooth) link
4110**
4111** Parameters: p_data - the location for OOB data
4112** eir_tag - The associated EIR tag to read the data.
4113** *p_len(output) - the length of the data with the given tag.
4114**
4115** Returns the beginning of the data with the given tag.
4116** NULL, if the tag is not found.
4117**
4118*******************************************************************************/
4119 BTM_API extern UINT8 * BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len);
4120
4121/*******************************************************************************
4122**
4123** Function BTM_SecReadDevName
4124**
4125** Description Looks for the device name in the security database for the
4126** specified BD address.
4127**
4128** Returns Pointer to the name or NULL
4129**
4130*******************************************************************************/
4131 BTM_API extern char *BTM_SecReadDevName (BD_ADDR bd_addr);
4132
4133
4134/*****************************************************************************
4135** POWER MANAGEMENT FUNCTIONS
4136*****************************************************************************/
4137/*******************************************************************************
4138**
4139** Function BTM_PmRegister
4140**
4141** Description register or deregister with power manager
4142**
4143** Returns BTM_SUCCESS if successful,
4144** BTM_NO_RESOURCES if no room to hold registration
4145** BTM_ILLEGAL_VALUE
4146**
4147*******************************************************************************/
4148 BTM_API extern tBTM_STATUS BTM_PmRegister (UINT8 mask, UINT8 *p_pm_id,
4149 tBTM_PM_STATUS_CBACK *p_cb);
4150
4151
4152/*******************************************************************************
4153**
4154** Function BTM_SetPowerMode
4155**
4156** Description store the mode in control block or
4157** alter ACL connection behavior.
4158**
4159** Returns BTM_SUCCESS if successful,
4160** BTM_UNKNOWN_ADDR if bd addr is not active or bad
4161**
4162*******************************************************************************/
4163 BTM_API extern tBTM_STATUS BTM_SetPowerMode (UINT8 pm_id, BD_ADDR remote_bda,
4164 tBTM_PM_PWR_MD *p_mode);
4165
4166
4167/*******************************************************************************
4168**
4169** Function BTM_ReadPowerMode
4170**
4171** Description This returns the current mode for a specific
4172** ACL connection.
4173**
4174** Input Param remote_bda - device address of desired ACL connection
4175**
4176** Output Param p_mode - address where the current mode is copied into.
4177** BTM_ACL_MODE_NORMAL
4178** BTM_ACL_MODE_HOLD
4179** BTM_ACL_MODE_SNIFF
4180** BTM_ACL_MODE_PARK
4181** (valid only if return code is BTM_SUCCESS)
4182**
4183** Returns BTM_SUCCESS if successful,
4184** BTM_UNKNOWN_ADDR if bd addr is not active or bad
4185**
4186*******************************************************************************/
4187 BTM_API extern tBTM_STATUS BTM_ReadPowerMode (BD_ADDR remote_bda,
4188 tBTM_PM_MODE *p_mode);
4189
4190/*******************************************************************************
4191**
4192** Function BTM_SetSsrParams
4193**
4194** Description This sends the given SSR parameters for the given ACL
4195** connection if it is in ACTIVE mode.
4196**
4197** Input Param remote_bda - device address of desired ACL connection
4198** max_lat - maximum latency (in 0.625ms)(0-0xFFFE)
4199** min_rmt_to - minimum remote timeout
4200** min_loc_to - minimum local timeout
4201**
4202**
4203** Returns BTM_SUCCESS if the HCI command is issued successful,
4204** BTM_UNKNOWN_ADDR if bd addr is not active or bad
4205** BTM_CMD_STORED if the command is stored
4206**
4207*******************************************************************************/
4208 BTM_API extern tBTM_STATUS BTM_SetSsrParams (BD_ADDR remote_bda, UINT16 max_lat,
4209 UINT16 min_rmt_to, UINT16 min_loc_to);
4210
4211/*******************************************************************************
4212**
4213** Function BTM_IsPowerManagerOn
4214**
4215** Description This function is called to check if power manager is included.
4216** in the BTE version.
4217**
4218** Returns TRUE if power manager is compiled in, otherwise FALSE.
4219**
4220*******************************************************************************/
4221 BTM_API extern BOOLEAN BTM_IsPowerManagerOn (void);
4222
4223
4224/*******************************************************************************
4225**
4226** Function BTM_GetHCIConnHandle
4227**
4228** Description This function is called to get the handle for an ACL connection
4229** to a specific remote BD Address.
4230**
4231** Returns the handle of the connection, or 0xFFFF if none.
4232**
4233*******************************************************************************/
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -07004234 BTM_API extern UINT16 BTM_GetHCIConnHandle (BD_ADDR remote_bda, tBT_TRANSPORT transport);
The Android Open Source Project5738f832012-12-12 16:00:35 -08004235
4236
4237/*******************************************************************************
4238**
4239** Function BTM_ReadStoredLinkKey
4240**
4241** Description This function is called to obtain link key for the specified
4242** device from the NVRAM storage attached to the Bluetooth
4243** controller.
4244**
4245** Parameters: bd_addr - Address of the device
4246** p_cb - Call back function to be called to return
4247** the results
4248**
4249*******************************************************************************/
4250 BTM_API extern tBTM_STATUS BTM_ReadStoredLinkKey (BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb);
4251
4252
4253/*******************************************************************************
4254**
4255** Function BTM_WriteStoredLinkKey
4256**
4257** Description This function is called to write link keys for the specified
4258** device addresses to the NVRAM storage attached to the Bluetooth
4259** controller.
4260**
4261** Parameters: num_keys - Number of link keys
4262** bd_addr - Addresses of the devices
4263** link_key - Link Keys to be stored
4264** p_cb - Call back function to be called to return
4265** the results
4266**
4267*******************************************************************************/
4268 BTM_API extern tBTM_STATUS BTM_WriteStoredLinkKey (UINT8 num_keys,
4269 BD_ADDR *bd_addr,
4270 LINK_KEY *link_key,
4271 tBTM_CMPL_CB *p_cb);
4272
4273
4274/*******************************************************************************
4275**
4276** Function BTM_DeleteStoredLinkKey
4277**
4278** Description This function is called to delete link key for the specified
4279** device addresses from the NVRAM storage attached to the Bluetooth
4280** controller.
4281**
4282** Parameters: bd_addr - Addresses of the devices
4283** p_cb - Call back function to be called to return
4284** the results
4285**
4286*******************************************************************************/
4287 BTM_API extern tBTM_STATUS BTM_DeleteStoredLinkKey(BD_ADDR bd_addr, tBTM_CMPL_CB *p_cb);
4288
4289/*******************************************************************************
4290**
4291** Function BTM_WriteEIR
4292**
4293** Description This function is called to write EIR data to controller.
4294**
4295** Parameters p_buff - allocated HCI command buffer including extended
4296** inquriry response
4297**
4298** Returns BTM_SUCCESS - if successful
4299** BTM_MODE_UNSUPPORTED - if local device cannot support it
4300**
4301*******************************************************************************/
4302 BTM_API extern tBTM_STATUS BTM_WriteEIR( BT_HDR * p_buff );
4303
4304/*******************************************************************************
4305**
4306** Function BTM_CheckEirData
4307**
4308** Description This function is called to get EIR data from significant part.
4309**
4310** Parameters p_eir - pointer of EIR significant part
4311** type - finding EIR data type
4312** p_length - return the length of EIR data
4313**
4314** Returns pointer of EIR data
4315**
4316*******************************************************************************/
4317 BTM_API extern UINT8 *BTM_CheckEirData( UINT8 *p_eir, UINT8 type, UINT8 *p_length );
4318
4319/*******************************************************************************
4320**
4321** Function BTM_HasEirService
4322**
4323** Description This function is called to know if UUID in bit map of UUID.
4324**
4325** Parameters p_eir_uuid - bit map of UUID list
4326** uuid16 - UUID 16-bit
4327**
4328** Returns TRUE - if found
4329** FALSE - if not found
4330**
4331*******************************************************************************/
4332 BTM_API extern BOOLEAN BTM_HasEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
4333
4334/*******************************************************************************
4335**
4336** Function BTM_HasInquiryEirService
4337**
4338** Description This function is called to know if UUID in bit map of UUID list.
4339**
4340** Parameters p_results - inquiry results
4341** uuid16 - UUID 16-bit
4342**
4343** Returns BTM_EIR_FOUND - if found
4344** BTM_EIR_NOT_FOUND - if not found and it is complete list
4345** BTM_EIR_UNKNOWN - if not found and it is not complete list
4346**
4347*******************************************************************************/
4348 BTM_API extern tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService( tBTM_INQ_RESULTS *p_results,
4349 UINT16 uuid16 );
4350
4351/*******************************************************************************
4352**
4353** Function BTM_AddEirService
4354**
4355** Description This function is called to add a service in bit map of UUID list.
4356**
4357** Parameters p_eir_uuid - bit mask of UUID list for EIR
4358** uuid16 - UUID 16-bit
4359**
4360** Returns None
4361**
4362*******************************************************************************/
4363 BTM_API extern void BTM_AddEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
4364
4365/*******************************************************************************
4366**
4367** Function BTM_RemoveEirService
4368**
4369** Description This function is called to remove a service in bit map of UUID list.
4370**
4371** Parameters p_eir_uuid - bit mask of UUID list for EIR
4372** uuid16 - UUID 16-bit
4373**
4374** Returns None
4375**
4376*******************************************************************************/
4377 BTM_API extern void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 );
4378
4379/*******************************************************************************
4380**
4381** Function BTM_GetEirSupportedServices
4382**
4383** Description This function is called to get UUID list from bit map of UUID list.
4384**
4385** Parameters p_eir_uuid - bit mask of UUID list for EIR
4386** p - reference of current pointer of EIR
4387** max_num_uuid16 - max number of UUID can be written in EIR
4388** num_uuid16 - number of UUID have been written in EIR
4389**
4390** Returns BTM_EIR_MORE_16BITS_UUID_TYPE, if it has more than max
4391** BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
4392**
4393*******************************************************************************/
4394 BTM_API extern UINT8 BTM_GetEirSupportedServices( UINT32 *p_eir_uuid, UINT8 **p,
4395 UINT8 max_num_uuid16, UINT8 *p_num_uuid16);
4396
4397/*******************************************************************************
4398**
4399** Function BTM_GetEirUuidList
4400**
4401** Description This function parses EIR and returns UUID list.
4402**
4403** Parameters p_eir - EIR
4404** uuid_size - LEN_UUID_16, LEN_UUID_32, LEN_UUID_128
4405** p_num_uuid - return number of UUID in found list
4406** p_uuid_list - return UUID 16-bit list
4407** max_num_uuid - maximum number of UUID to be returned
4408**
4409** Returns 0 - if not found
4410** BTM_EIR_COMPLETE_16BITS_UUID_TYPE
4411** BTM_EIR_MORE_16BITS_UUID_TYPE
4412** BTM_EIR_COMPLETE_32BITS_UUID_TYPE
4413** BTM_EIR_MORE_32BITS_UUID_TYPE
4414** BTM_EIR_COMPLETE_128BITS_UUID_TYPE
4415** BTM_EIR_MORE_128BITS_UUID_TYPE
4416**
4417*******************************************************************************/
4418 BTM_API extern UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
4419 UINT8 *p_uuid_list, UINT8 max_num_uuid);
4420
The Android Open Source Project5738f832012-12-12 16:00:35 -08004421/*****************************************************************************
4422** SCO OVER HCI
4423*****************************************************************************/
4424/*******************************************************************************
4425**
4426** Function BTM_ConfigScoPath
4427**
4428** Description This function enable/disable SCO over HCI and registers SCO
4429** data callback if SCO over HCI is enabled.
4430**
4431** Parameter path: SCO or HCI
4432** p_sco_data_cb: callback function or SCO data if path is set
4433** to transport.
4434** p_pcm_param: pointer to the PCM interface parameter. If a NULL
4435** pointer is used, PCM parameter maintained in
4436** the control block will be used; otherwise update
4437** control block value.
4438** err_data_rpt: Lisbon feature to enable the erronous data report
4439** or not.
4440**
4441** Returns BTM_SUCCESS if the successful.
4442** BTM_NO_RESOURCES: no rsource to start the command.
4443** BTM_ILLEGAL_VALUE: invalid callback function pointer.
4444** BTM_CMD_STARTED :Command sent. Waiting for command cmpl event.
4445**
4446**
4447*******************************************************************************/
4448 BTM_API extern tBTM_STATUS BTM_ConfigScoPath (tBTM_SCO_ROUTE_TYPE path,
4449 tBTM_SCO_DATA_CB *p_sco_data_cb,
4450 tBTM_SCO_PCM_PARAM *p_pcm_param,
4451 BOOLEAN err_data_rpt);
4452
4453/*******************************************************************************
4454**
4455** Function BTM_WriteScoData
4456**
4457** Description This function write SCO data to a specified instance. The data
4458** to be written p_buf needs to carry an offset of
4459** HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not
4460** exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is set
4461** to 60 and is configurable. Data longer than the maximum bytes
4462** will be truncated.
4463**
4464** Returns BTM_SUCCESS: data write is successful
4465** BTM_ILLEGAL_VALUE: SCO data contains illegal offset value.
4466** BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO packet
4467** size.
4468** BTM_NO_RESOURCES: no resources.
4469** BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is not
4470** routed via HCI.
4471**
4472**
4473*******************************************************************************/
4474 BTM_API extern tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf);
4475
4476/*******************************************************************************
4477**
4478** Function BTM_SetARCMode
4479**
4480** Description Send Audio Routing Control command.
4481**
4482** Returns void
4483**
4484*******************************************************************************/
4485BTM_API extern void BTM_SetARCMode (UINT8 iface, UINT8 arc_mode, tBTM_VSC_CMPL_CB *p_arc_cb);
4486
4487
4488/*******************************************************************************
4489**
4490** Function BTM_PCM2Setup_Write
4491**
4492** Description Send PCM2_Setup write command.
4493**
4494** Returns void
4495**
4496*******************************************************************************/
4497BTM_API extern void BTM_PCM2Setup_Write (BOOLEAN clk_master, tBTM_VSC_CMPL_CB *p_arc_cb);
4498
4499#ifdef __cplusplus
4500}
4501#endif
4502
4503#endif /* BTM_API_H */