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