bta_api.h 100 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2003-2014 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This is the public interface file for BTA, Broadcom's Bluetooth
  21. * application layer for mobile phones.
  22. *
  23. ******************************************************************************/
  24. #ifndef BTA_API_H
  25. #define BTA_API_H
  26. #include "bt_target.h"
  27. #include "bt_types.h"
  28. #include "btm_api.h"
  29. // #include "uipc_msg.h"
  30. #include "sdp_api.h"
  31. #if BLE_INCLUDED == TRUE
  32. #include "btm_ble_api.h"
  33. #endif
  34. /*****************************************************************************
  35. ** Constants and data types
  36. *****************************************************************************/
  37. /* Status Return Value */
  38. #define BTA_SUCCESS 0 /* Successful operation. */
  39. #define BTA_FAILURE 1 /* Generic failure. */
  40. #define BTA_PENDING 2 /* API cannot be completed right now */
  41. #define BTA_BUSY 3
  42. #define BTA_NO_RESOURCES 4
  43. #define BTA_WRONG_MODE 5
  44. typedef UINT8 tBTA_STATUS;
  45. /*
  46. * Service ID
  47. *
  48. * NOTES: When you add a new Service ID for BTA AND require to change the value of BTA_MAX_SERVICE_ID,
  49. * make sure that the correct security ID of the new service from Security service definitions (btm_api.h)
  50. * should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in bta_dm_act.c.
  51. */
  52. #define BTA_RES_SERVICE_ID 0 /* Reserved */
  53. #define BTA_SPP_SERVICE_ID 1 /* Serial port profile. */
  54. #define BTA_DUN_SERVICE_ID 2 /* Dial-up networking profile. */
  55. #define BTA_A2DP_SOURCE_SERVICE_ID 3 /* A2DP Source profile. */
  56. #define BTA_LAP_SERVICE_ID 4 /* LAN access profile. */
  57. #define BTA_HSP_SERVICE_ID 5 /* Headset profile. */
  58. #define BTA_HFP_SERVICE_ID 6 /* Hands-free profile. */
  59. #define BTA_OPP_SERVICE_ID 7 /* Object push */
  60. #define BTA_FTP_SERVICE_ID 8 /* File transfer */
  61. #define BTA_CTP_SERVICE_ID 9 /* Cordless Terminal */
  62. #define BTA_ICP_SERVICE_ID 10 /* Intercom Terminal */
  63. #define BTA_SYNC_SERVICE_ID 11 /* Synchronization */
  64. #define BTA_BPP_SERVICE_ID 12 /* Basic printing profile */
  65. #define BTA_BIP_SERVICE_ID 13 /* Basic Imaging profile */
  66. #define BTA_PANU_SERVICE_ID 14 /* PAN User */
  67. #define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */
  68. #define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */
  69. #define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */
  70. #define BTA_A2DP_SINK_SERVICE_ID 18 /* A2DP Sink */
  71. #define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */
  72. #define BTA_HID_SERVICE_ID 20 /* HID */
  73. #define BTA_VDP_SERVICE_ID 21 /* Video distribution */
  74. #define BTA_PBAP_SERVICE_ID 22 /* PhoneBook Access Server*/
  75. #define BTA_HSP_HS_SERVICE_ID 23 /* HFP HS role */
  76. #define BTA_HFP_HS_SERVICE_ID 24 /* HSP HS role */
  77. #define BTA_MAP_SERVICE_ID 25 /* Message Access Profile */
  78. #define BTA_MN_SERVICE_ID 26 /* Message Notification Service */
  79. #define BTA_HDP_SERVICE_ID 27 /* Health Device Profile */
  80. #define BTA_PCE_SERVICE_ID 28 /* PhoneBook Access Client*/
  81. #define BTA_SDP_SERVICE_ID 29 /* SDP Search*/
  82. #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
  83. /* BLE profile service ID */
  84. #define BTA_BLE_SERVICE_ID 30 /* GATT profile */
  85. // btla-specific ++
  86. #define BTA_USER_SERVICE_ID 31 /* User requested UUID */
  87. #define BTA_MAX_SERVICE_ID 32
  88. // btla-specific --
  89. #else
  90. #define BTA_USER_SERVICE_ID 30 /* User requested UUID */
  91. #define BTA_MAX_SERVICE_ID 31
  92. #endif
  93. /* service IDs (BTM_SEC_SERVICE_FIRST_EMPTY + 1) to (BTM_SEC_MAX_SERVICES - 1)
  94. * are used by BTA JV */
  95. #define BTA_FIRST_JV_SERVICE_ID (BTM_SEC_SERVICE_FIRST_EMPTY + 1)
  96. #define BTA_LAST_JV_SERVICE_ID (BTM_SEC_MAX_SERVICES - 1)
  97. typedef UINT8 tBTA_SERVICE_ID;
  98. /* Service ID Mask */
  99. #define BTA_RES_SERVICE_MASK 0x00000001 /* Reserved */
  100. #define BTA_SPP_SERVICE_MASK 0x00000002 /* Serial port profile. */
  101. #define BTA_DUN_SERVICE_MASK 0x00000004 /* Dial-up networking profile. */
  102. #define BTA_FAX_SERVICE_MASK 0x00000008 /* Fax profile. */
  103. #define BTA_LAP_SERVICE_MASK 0x00000010 /* LAN access profile. */
  104. #define BTA_HSP_SERVICE_MASK 0x00000020 /* HSP AG role. */
  105. #define BTA_HFP_SERVICE_MASK 0x00000040 /* HFP AG role */
  106. #define BTA_OPP_SERVICE_MASK 0x00000080 /* Object push */
  107. #define BTA_FTP_SERVICE_MASK 0x00000100 /* File transfer */
  108. #define BTA_CTP_SERVICE_MASK 0x00000200 /* Cordless Terminal */
  109. #define BTA_ICP_SERVICE_MASK 0x00000400 /* Intercom Terminal */
  110. #define BTA_SYNC_SERVICE_MASK 0x00000800 /* Synchronization */
  111. #define BTA_BPP_SERVICE_MASK 0x00001000 /* Print server */
  112. #define BTA_BIP_SERVICE_MASK 0x00002000 /* Basic Imaging */
  113. #define BTA_PANU_SERVICE_MASK 0x00004000 /* PAN User */
  114. #define BTA_NAP_SERVICE_MASK 0x00008000 /* PAN Network access point */
  115. #define BTA_GN_SERVICE_MASK 0x00010000 /* PAN Group Ad-hoc networks */
  116. #define BTA_SAP_SERVICE_MASK 0x00020000 /* PAN Group Ad-hoc networks */
  117. #define BTA_A2DP_SERVICE_MASK 0x00040000 /* Advanced audio distribution */
  118. #define BTA_AVRCP_SERVICE_MASK 0x00080000 /* A/V remote control */
  119. #define BTA_HID_SERVICE_MASK 0x00100000 /* HID */
  120. #define BTA_VDP_SERVICE_MASK 0x00200000 /* Video distribution */
  121. #define BTA_PBAP_SERVICE_MASK 0x00400000 /* Phone Book Server */
  122. #define BTA_HSP_HS_SERVICE_MASK 0x00800000 /* HFP HS role */
  123. #define BTA_HFP_HS_SERVICE_MASK 0x01000000 /* HSP HS role */
  124. #define BTA_MAS_SERVICE_MASK 0x02000000 /* Message Access Profile */
  125. #define BTA_MN_SERVICE_MASK 0x04000000 /* Message Notification Profile */
  126. #define BTA_HL_SERVICE_MASK 0x08000000 /* Health Device Profile */
  127. #define BTA_PCE_SERVICE_MASK 0x10000000 /* Phone Book Client */
  128. #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
  129. #define BTA_BLE_SERVICE_MASK 0x20000000 /* GATT based service */
  130. // btla-specific ++
  131. #define BTA_USER_SERVICE_MASK 0x40000000 /* Message Notification Profile */
  132. // btla-specific --
  133. #else
  134. // btla-specific ++
  135. #define BTA_USER_SERVICE_MASK 0x20000000 /* Message Notification Profile */
  136. // btla-specific --
  137. #endif
  138. #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
  139. #define BTA_ALL_SERVICE_MASK 0x3FFFFFFF /* All services supported by BTA. */
  140. #else
  141. #define BTA_ALL_SERVICE_MASK 0x1FFFFFFF /* All services supported by BTA. */
  142. #endif
  143. typedef UINT32 tBTA_SERVICE_MASK;
  144. /* extended service mask, including mask with one or more GATT UUID */
  145. typedef struct {
  146. tBTA_SERVICE_MASK srvc_mask;
  147. UINT8 num_uuid;
  148. tBT_UUID *p_uuid;
  149. } tBTA_SERVICE_MASK_EXT;
  150. /* Security Setting Mask */
  151. #define BTA_SEC_NONE BTM_SEC_NONE /* No security. */
  152. #define BTA_SEC_AUTHORIZE (BTM_SEC_IN_AUTHORIZE ) /* Authorization required (only needed for out going connection )*/
  153. #define BTA_SEC_AUTHENTICATE (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */
  154. #define BTA_SEC_ENCRYPT (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */
  155. #define BTA_SEC_MODE4_LEVEL4 (BTM_SEC_MODE4_LEVEL4) /* Mode 4 level 4 service, i.e. incoming/outgoing MITM and P-256 encryption */
  156. #define BTA_SEC_MITM (BTM_SEC_IN_MITM | BTM_SEC_OUT_MITM) /* Man-In-The_Middle protection */
  157. #define BTA_SEC_IN_16_DIGITS (BTM_SEC_IN_MIN_16_DIGIT_PIN) /* Min 16 digit for pin code */
  158. typedef UINT16 tBTA_SEC;
  159. /* Ignore for Discoverable, Connectable, Pairable and Connectable Paired only device modes */
  160. #define BTA_DM_IGNORE 0x00FF
  161. /* Ignore for Discoverable, Connectable only for LE modes */
  162. #define BTA_DM_LE_IGNORE 0xFF00
  163. #define BTA_APP_ID_PAN_MULTI 0xFE /* app id for pan multiple connection */
  164. #define BTA_ALL_APP_ID 0xFF
  165. /* Discoverable Modes */
  166. #define BTA_DM_NON_DISC BTM_NON_DISCOVERABLE /* Device is not discoverable. */
  167. #define BTA_DM_GENERAL_DISC BTM_GENERAL_DISCOVERABLE /* General discoverable. */
  168. #define BTA_DM_LIMITED_DISC BTM_LIMITED_DISCOVERABLE /* Limited discoverable. */
  169. #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
  170. #define BTA_DM_BLE_NON_DISCOVERABLE BTM_BLE_NON_DISCOVERABLE /* Device is not LE discoverable */
  171. #define BTA_DM_BLE_GENERAL_DISCOVERABLE BTM_BLE_GENERAL_DISCOVERABLE /* Device is LE General discoverable */
  172. #define BTA_DM_BLE_LIMITED_DISCOVERABLE BTM_BLE_LIMITED_DISCOVERABLE /* Device is LE Limited discoverable */
  173. #endif
  174. typedef UINT16 tBTA_DM_DISC; /* this discoverability mode is a bit mask among BR mode and LE mode */
  175. /* Connectable Modes */
  176. #define BTA_DM_NON_CONN BTM_NON_CONNECTABLE /* Device is not connectable. */
  177. #define BTA_DM_CONN BTM_CONNECTABLE /* Device is connectable. */
  178. #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
  179. #define BTA_DM_BLE_NON_CONNECTABLE BTM_BLE_NON_CONNECTABLE /* Device is LE non-connectable. */
  180. #define BTA_DM_BLE_CONNECTABLE BTM_BLE_CONNECTABLE /* Device is LE connectable. */
  181. #endif
  182. // btla-specific ++
  183. typedef UINT16 tBTA_DM_CONN;
  184. #define BTA_TRANSPORT_UNKNOWN 0
  185. #define BTA_TRANSPORT_BR_EDR BT_TRANSPORT_BR_EDR
  186. #define BTA_TRANSPORT_LE BT_TRANSPORT_LE
  187. typedef tBT_TRANSPORT tBTA_TRANSPORT;
  188. /* Pairable Modes */
  189. #define BTA_DM_PAIRABLE 1
  190. #define BTA_DM_NON_PAIRABLE 0
  191. /* Connectable Paired Only Mode */
  192. #define BTA_DM_CONN_ALL 0
  193. #define BTA_DM_CONN_PAIRED 1
  194. /* Inquiry Modes */
  195. #define BTA_DM_INQUIRY_NONE BTM_INQUIRY_NONE /*No BR inquiry. */
  196. #define BTA_DM_GENERAL_INQUIRY BTM_GENERAL_INQUIRY /* Perform general inquiry. */
  197. #define BTA_DM_LIMITED_INQUIRY BTM_LIMITED_INQUIRY /* Perform limited inquiry. */
  198. #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
  199. #define BTA_BLE_INQUIRY_NONE BTM_BLE_INQUIRY_NONE
  200. #define BTA_BLE_GENERAL_INQUIRY BTM_BLE_GENERAL_INQUIRY /* Perform LE general inquiry. */
  201. #define BTA_BLE_LIMITED_INQUIRY BTM_BLE_LIMITED_INQUIRY /* Perform LE limited inquiry. */
  202. #endif
  203. typedef UINT8 tBTA_DM_INQ_MODE;
  204. /* Inquiry Filter Type */
  205. #define BTA_DM_INQ_CLR BTM_CLR_INQUIRY_FILTER /* Clear inquiry filter. */
  206. #define BTA_DM_INQ_DEV_CLASS BTM_FILTER_COND_DEVICE_CLASS /* Filter on device class. */
  207. #define BTA_DM_INQ_BD_ADDR BTM_FILTER_COND_BD_ADDR /* Filter on a specific BD address. */
  208. typedef UINT8 tBTA_DM_INQ_FILT;
  209. /* Authorize Response */
  210. #define BTA_DM_AUTH_PERM 0 /* Authorized for future connections to the service */
  211. #define BTA_DM_AUTH_TEMP 1 /* Authorized for current connection only */
  212. #define BTA_DM_NOT_AUTH 2 /* Not authorized for the service */
  213. typedef UINT8 tBTA_AUTH_RESP;
  214. /* M/S preferred roles */
  215. #define BTA_ANY_ROLE 0x00
  216. #define BTA_MASTER_ROLE_PREF 0x01
  217. #define BTA_MASTER_ROLE_ONLY 0x02
  218. #define BTA_SLAVE_ROLE_ONLY 0x03 /* Used for PANU only, skip role switch to master */
  219. typedef UINT8 tBTA_PREF_ROLES;
  220. enum {
  221. BTA_DM_NO_SCATTERNET, /* Device doesn't support scatternet, it might
  222. support "role switch during connection" for
  223. an incoming connection, when it already has
  224. another connection in master role */
  225. BTA_DM_PARTIAL_SCATTERNET, /* Device supports partial scatternet. It can have
  226. simulateous connection in Master and Slave roles
  227. for short period of time */
  228. BTA_DM_FULL_SCATTERNET /* Device can have simultaneous connection in master
  229. and slave roles */
  230. };
  231. /* Inquiry filter device class condition */
  232. typedef struct {
  233. DEV_CLASS dev_class; /* device class of interest */
  234. DEV_CLASS dev_class_mask; /* mask to determine the bits of device class of interest */
  235. } tBTA_DM_COD_COND;
  236. /* Inquiry Filter Condition */
  237. typedef union {
  238. BD_ADDR bd_addr; /* BD address of device to filter. */
  239. tBTA_DM_COD_COND dev_class_cond; /* Device class filter condition */
  240. } tBTA_DM_INQ_COND;
  241. /* Inquiry Parameters */
  242. typedef struct {
  243. tBTA_DM_INQ_MODE mode; /* Inquiry mode, limited or general. */
  244. UINT8 duration; /* Inquiry duration in 1.28 sec units. */
  245. UINT8 max_resps; /* Maximum inquiry responses. Set to zero for unlimited responses. */
  246. BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */
  247. tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */
  248. tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */
  249. #if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
  250. UINT8 intl_duration[4];/*duration array storing the interleave scan's time portions*/
  251. #endif
  252. } tBTA_DM_INQ;
  253. typedef struct {
  254. UINT8 bta_dm_eir_min_name_len; /* minimum length of local name when it is shortened */
  255. #if (BTA_EIR_CANNED_UUID_LIST == TRUE)
  256. UINT8 bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */
  257. UINT8 *bta_dm_eir_uuid16; /* 16-bit UUIDs */
  258. #else
  259. UINT32 uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */
  260. #endif
  261. INT8 *bta_dm_eir_inq_tx_power; /* Inquiry TX power */
  262. UINT8 bta_dm_eir_flag_len; /* length of flags in bytes */
  263. UINT8 *bta_dm_eir_flags; /* flags for EIR */
  264. UINT8 bta_dm_eir_manufac_spec_len; /* length of manufacturer specific in bytes */
  265. UINT8 *bta_dm_eir_manufac_spec; /* manufacturer specific */
  266. UINT8 bta_dm_eir_additional_len; /* length of additional data in bytes */
  267. UINT8 *bta_dm_eir_additional; /* additional data */
  268. } tBTA_DM_EIR_CONF;
  269. #if BLE_INCLUDED == TRUE
  270. /* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */
  271. #define BTA_BLE_LIMIT_DISC_FLAG BTM_BLE_LIMIT_DISC_FLAG
  272. #define BTA_BLE_GEN_DISC_FLAG BTM_BLE_GEN_DISC_FLAG
  273. #define BTA_BLE_BREDR_NOT_SPT BTM_BLE_BREDR_NOT_SPT
  274. #define BTA_BLE_DMT_CONTROLLER_SPT BTM_BLE_DMT_CONTROLLER_SPT
  275. #define BTA_BLE_DMT_HOST_SPT BTM_BLE_DMT_HOST_SPT
  276. #define BTA_BLE_NON_LIMIT_DISC_FLAG BTM_BLE_NON_LIMIT_DISC_FLAG
  277. #define BTA_BLE_ADV_FLAG_MASK BTM_BLE_ADV_FLAG_MASK
  278. #define BTA_BLE_LIMIT_DISC_MASK BTM_BLE_LIMIT_DISC_MASK
  279. /* ADV data bit mask */
  280. #define BTA_BLE_AD_BIT_DEV_NAME BTM_BLE_AD_BIT_DEV_NAME
  281. #define BTA_BLE_AD_BIT_FLAGS BTM_BLE_AD_BIT_FLAGS
  282. #define BTA_BLE_AD_BIT_MANU BTM_BLE_AD_BIT_MANU
  283. #define BTA_BLE_AD_BIT_TX_PWR BTM_BLE_AD_BIT_TX_PWR
  284. #define BTA_BLE_AD_BIT_INT_RANGE BTM_BLE_AD_BIT_INT_RANGE
  285. #define BTA_BLE_AD_BIT_SERVICE BTM_BLE_AD_BIT_SERVICE
  286. #define BTA_BLE_AD_BIT_APPEARANCE BTM_BLE_AD_BIT_APPEARANCE
  287. #define BTA_BLE_AD_BIT_PROPRIETARY BTM_BLE_AD_BIT_PROPRIETARY
  288. #define BTA_DM_BLE_AD_BIT_SERVICE_SOL BTM_BLE_AD_BIT_SERVICE_SOL
  289. #define BTA_DM_BLE_AD_BIT_SERVICE_DATA BTM_BLE_AD_BIT_SERVICE_DATA
  290. #define BTA_DM_BLE_AD_BIT_SIGN_DATA BTM_BLE_AD_BIT_SIGN_DATA
  291. #define BTA_DM_BLE_AD_BIT_SERVICE_128SOL BTM_BLE_AD_BIT_SERVICE_128SOL
  292. #define BTA_DM_BLE_AD_BIT_PUBLIC_ADDR BTM_BLE_AD_BIT_PUBLIC_ADDR
  293. #define BTA_DM_BLE_AD_BIT_RANDOM_ADDR BTM_BLE_AD_BIT_RANDOM_ADDR
  294. #define BTA_DM_BLE_AD_BIT_SERVICE_128 BTM_BLE_AD_BIT_SERVICE_128 /*128-bit Service UUIDs*/
  295. typedef tBTM_BLE_AD_MASK tBTA_BLE_AD_MASK;
  296. /* slave preferred connection interval range */
  297. typedef struct {
  298. UINT16 low;
  299. UINT16 hi;
  300. } tBTA_BLE_INT_RANGE;
  301. /* Service tag supported in the device */
  302. typedef struct {
  303. UINT8 num_service;
  304. BOOLEAN list_cmpl;
  305. UINT16 *p_uuid;
  306. } tBTA_BLE_SERVICE;
  307. typedef struct {
  308. UINT8 len;
  309. UINT8 *p_val;
  310. } tBTA_BLE_MANU;
  311. typedef struct {
  312. UINT8 adv_type;
  313. UINT8 len;
  314. UINT8 *p_val; /* number of len byte */
  315. } tBTA_BLE_PROP_ELEM;
  316. /* vendor proprietary adv type */
  317. typedef struct {
  318. UINT8 num_elem;
  319. tBTA_BLE_PROP_ELEM *p_elem;
  320. } tBTA_BLE_PROPRIETARY;
  321. typedef struct {
  322. tBT_UUID service_uuid;
  323. UINT8 len;
  324. UINT8 *p_val;
  325. } tBTA_BLE_SERVICE_DATA;
  326. typedef tBTM_BLE_128SERVICE tBTA_BLE_128SERVICE;
  327. typedef tBTM_BLE_32SERVICE tBTA_BLE_32SERVICE;
  328. typedef struct {
  329. tBTA_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
  330. tBTA_BLE_MANU *p_manu; /* manufacturer data */
  331. tBTA_BLE_SERVICE *p_services; /* 16 bits services */
  332. tBTA_BLE_128SERVICE *p_services_128b; /* 128 bits service */
  333. tBTA_BLE_32SERVICE *p_service_32b; /* 32 bits Service UUID */
  334. tBTA_BLE_SERVICE *p_sol_services; /* 16 bits services Solicitation UUIDs */
  335. tBTA_BLE_32SERVICE *p_sol_service_32b; /* List of 32 bit Service Solicitation UUIDs */
  336. tBTA_BLE_128SERVICE *p_sol_service_128b;/* List of 128 bit Service Solicitation UUIDs */
  337. tBTA_BLE_PROPRIETARY *p_proprietary; /* proprietary data */
  338. tBTA_BLE_SERVICE_DATA *p_service_data; /* service data */
  339. UINT16 appearance; /* appearance data */
  340. UINT8 flag;
  341. UINT8 tx_power;
  342. } tBTA_BLE_ADV_DATA;
  343. typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
  344. typedef void (tBTA_START_ADV_CMPL_CBACK) (tBTA_STATUS status);
  345. /* advertising channel map */
  346. #define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37
  347. #define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38
  348. #define BTA_BLE_ADV_CHNL_39 BTM_BLE_ADV_CHNL_39
  349. typedef tBTM_BLE_ADV_CHNL_MAP tBTA_BLE_ADV_CHNL_MAP; /* use as a bit mask */
  350. /* advertising filter policy */
  351. typedef tBTM_BLE_AFP tBTA_BLE_AFP;
  352. /* adv event type */
  353. #define BTA_BLE_CONNECT_EVT BTM_BLE_CONNECT_EVT /* Connectable undirected advertising */
  354. #define BTA_BLE_CONNECT_DIR_EVT BTM_BLE_CONNECT_DIR_EVT /* Connectable directed advertising */
  355. #define BTA_BLE_DISCOVER_EVT BTM_BLE_DISCOVER_EVT /* Scannable undirected advertising */
  356. #define BTA_BLE_NON_CONNECT_EVT BTM_BLE_NON_CONNECT_EVT /* Non connectable undirected advertising */
  357. typedef UINT8 tBTA_BLE_ADV_EVT;
  358. /* adv tx power level */
  359. #define BTA_BLE_ADV_TX_POWER_MIN 0 /* minimum tx power */
  360. #define BTA_BLE_ADV_TX_POWER_LOW 1 /* low tx power */
  361. #define BTA_BLE_ADV_TX_POWER_MID 2 /* middle tx power */
  362. #define BTA_BLE_ADV_TX_POWER_UPPER 3 /* upper tx power */
  363. #define BTA_BLE_ADV_TX_POWER_MAX 4 /* maximum tx power */
  364. typedef UINT8 tBTA_BLE_ADV_TX_POWER;
  365. /* advertising instance parameters */
  366. typedef struct {
  367. UINT16 adv_int_min; /* minimum adv interval */
  368. UINT16 adv_int_max; /* maximum adv interval */
  369. tBTA_BLE_ADV_EVT adv_type; /* adv event type */
  370. tBTA_BLE_ADV_CHNL_MAP channel_map; /* adv channel map */
  371. tBTA_BLE_AFP adv_filter_policy; /* advertising filter policy */
  372. tBTA_BLE_ADV_TX_POWER tx_power; /* adv tx power */
  373. } tBTA_BLE_ADV_PARAMS;
  374. /* These are the fields returned in each device adv packet. It
  375. ** is returned in the results callback if registered.
  376. */
  377. typedef struct {
  378. UINT8 conn_mode;
  379. tBTA_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */
  380. UINT8 flag;
  381. UINT8 tx_power_level;
  382. UINT8 remote_name_len;
  383. UINT8 *p_remote_name;
  384. tBTA_BLE_SERVICE service;
  385. } tBTA_BLE_INQ_DATA;
  386. enum {
  387. BTA_BLE_BATCH_SCAN_MODE_PASS = 1,
  388. BTA_BLE_BATCH_SCAN_MODE_ACTI = 2,
  389. BTA_BLE_BATCH_SCAN_MODE_PASS_ACTI = 3
  390. };
  391. typedef UINT8 tBTA_BLE_BATCH_SCAN_MODE;
  392. enum {
  393. BTA_BLE_DISCARD_OLD_ITEMS = 0,
  394. BTA_BLE_DISCARD_LOWER_RSSI_ITEMS = 1
  395. };
  396. typedef UINT8 tBTA_BLE_DISCARD_RULE;
  397. enum {
  398. BTA_BLE_ADV_SEEN_FIRST_TIME = 0,
  399. BTA_BLE_ADV_TRACKING_TIMEOUT = 1
  400. };
  401. typedef UINT8 tBTA_BLE_ADV_CHANGE_REASON;
  402. enum {
  403. BTA_BLE_BATCH_SCAN_ENB_EVT = 1,
  404. BTA_BLE_BATCH_SCAN_CFG_STRG_EVT = 2,
  405. BTA_BLE_BATCH_SCAN_DATA_EVT = 3,
  406. BTA_BLE_BATCH_SCAN_THRES_EVT = 4,
  407. BTA_BLE_BATCH_SCAN_PARAM_EVT = 5,
  408. BTA_BLE_BATCH_SCAN_DIS_EVT = 6
  409. };
  410. typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT;
  411. typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION;
  412. #endif
  413. /* BLE customer specific feature function type definitions */
  414. /* data type used on customer specific feature for RSSI monitoring */
  415. #define BTA_BLE_RSSI_ALERT_HI 0
  416. #define BTA_BLE_RSSI_ALERT_RANGE 1
  417. #define BTA_BLE_RSSI_ALERT_LO 2
  418. typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_TYPE;
  419. #define BTA_BLE_RSSI_ALERT_NONE BTM_BLE_RSSI_ALERT_NONE /* (0) */
  420. #define BTA_BLE_RSSI_ALERT_HI_BIT BTM_BLE_RSSI_ALERT_HI_BIT /* (1) */
  421. #define BTA_BLE_RSSI_ALERT_RANGE_BIT BTM_BLE_RSSI_ALERT_RANGE_BIT /* (1 << 1) */
  422. #define BTA_BLE_RSSI_ALERT_LO_BIT BTM_BLE_RSSI_ALERT_LO_BIT /* (1 << 2) */
  423. typedef UINT8 tBTA_DM_BLE_RSSI_ALERT_MASK;
  424. typedef void (tBTA_DM_BLE_RSSI_CBACK) (BD_ADDR bd_addr, tBTA_DM_BLE_RSSI_ALERT_TYPE alert_type, INT8 rssi);
  425. /* max number of filter spot for different filter type */
  426. #define BTA_DM_BLE_MAX_UUID_FILTER BTM_BLE_MAX_UUID_FILTER /* 8 */
  427. #define BTA_DM_BLE_MAX_ADDR_FILTER BTM_BLE_MAX_ADDR_FILTER /* 8 */
  428. #define BTA_DM_BLE_PF_STR_COND_MAX BTM_BLE_PF_STR_COND_MAX /* 4 apply to manu data , or local name */
  429. #define BTA_DM_BLE_PF_STR_LEN_MAX BTM_BLE_PF_STR_LEN_MAX /* match for first 20 bytes */
  430. #define BTA_DM_BLE_PF_LOGIC_OR 0
  431. #define BTA_DM_BLE_PF_LOGIC_AND 1
  432. typedef UINT8 tBTA_DM_BLE_PF_LOGIC_TYPE;
  433. enum {
  434. BTA_DM_BLE_SCAN_COND_ADD,
  435. BTA_DM_BLE_SCAN_COND_DELETE,
  436. BTA_DM_BLE_SCAN_COND_CLEAR = 2
  437. };
  438. typedef UINT8 tBTA_DM_BLE_SCAN_COND_OP;
  439. /* ADV payload filtering vendor specific call event */
  440. enum {
  441. BTA_BLE_SCAN_PF_ENABLE_EVT = 7,
  442. BTA_BLE_SCAN_PF_COND_EVT
  443. };
  444. /* filter selection bit index */
  445. #define BTA_DM_BLE_PF_ADDR_FILTER BTM_BLE_PF_ADDR_FILTER
  446. #define BTA_DM_BLE_PF_SRVC_DATA BTM_BLE_PF_SRVC_DATA
  447. #define BTA_DM_BLE_PF_SRVC_UUID BTM_BLE_PF_SRVC_UUID
  448. #define BTA_DM_BLE_PF_SRVC_SOL_UUID BTM_BLE_PF_SRVC_SOL_UUID
  449. #define BTA_DM_BLE_PF_LOCAL_NAME BTM_BLE_PF_LOCAL_NAME
  450. #define BTA_DM_BLE_PF_MANU_DATA BTM_BLE_PF_MANU_DATA
  451. #define BTA_DM_BLE_PF_SRVC_DATA_PATTERN BTM_BLE_PF_SRVC_DATA_PATTERN
  452. #define BTA_DM_BLE_PF_TYPE_ALL BTM_BLE_PF_TYPE_ALL
  453. #define BTA_DM_BLE_PF_TYPE_MAX BTM_BLE_PF_TYPE_MAX
  454. typedef UINT8 tBTA_DM_BLE_PF_COND_TYPE;
  455. typedef union {
  456. UINT16 uuid16_mask;
  457. UINT32 uuid32_mask;
  458. UINT8 uuid128_mask[LEN_UUID_128];
  459. } tBTA_DM_BLE_PF_COND_MASK;
  460. typedef struct {
  461. tBLE_BD_ADDR *p_target_addr; /* target address, if NULL, generic UUID filter */
  462. tBT_UUID uuid; /* UUID condition */
  463. tBTA_DM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */
  464. tBTA_DM_BLE_PF_COND_MASK *p_uuid_mask; /* UUID condition mask, if NULL, match exact as UUID condition */
  465. } tBTA_DM_BLE_PF_UUID_COND;
  466. typedef struct {
  467. UINT8 data_len; /* <= 20 bytes */
  468. UINT8 *p_data;
  469. } tBTA_DM_BLE_PF_LOCAL_NAME_COND;
  470. typedef struct {
  471. UINT16 company_id; /* company ID */
  472. UINT8 data_len; /* <= 20 bytes */
  473. UINT8 *p_pattern;
  474. UINT16 company_id_mask; /* UUID value mask */
  475. UINT8 *p_pattern_mask; /* Manufacturer data matching mask, same length
  476. as data pattern, set to all 0xff, match exact data */
  477. } tBTA_DM_BLE_PF_MANU_COND;
  478. typedef struct {
  479. UINT16 uuid; /* service ID */
  480. UINT8 data_len; /* <= 20 bytes */
  481. UINT8 *p_pattern;
  482. UINT8 *p_pattern_mask; /* Service data matching mask, same length
  483. as data pattern, set to all 0xff, match exact data */
  484. } tBTA_DM_BLE_PF_SRVC_PATTERN_COND;
  485. typedef union {
  486. tBLE_BD_ADDR target_addr;
  487. tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
  488. tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
  489. tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
  490. tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
  491. tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
  492. } tBTA_DM_BLE_PF_COND_PARAM;
  493. typedef UINT8 tBTA_DM_BLE_PF_FILT_INDEX;
  494. typedef UINT8 tBTA_DM_BLE_PF_AVBL_SPACE;
  495. typedef INT8 tBTA_DM_RSSI_VALUE;
  496. typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE;
  497. typedef UINT8 tBTA_SIG_STRENGTH_MASK;
  498. /* Security Callback Events */
  499. #define BTA_DM_ENABLE_EVT 0 /* Enable Event */
  500. #define BTA_DM_DISABLE_EVT 1 /* Disable Event */
  501. #define BTA_DM_PIN_REQ_EVT 2 /* PIN request. */
  502. #define BTA_DM_AUTH_CMPL_EVT 3 /* Authentication complete indication. */
  503. #define BTA_DM_AUTHORIZE_EVT 4 /* Authorization request. */
  504. #define BTA_DM_LINK_UP_EVT 5 /* Connection UP event */
  505. #define BTA_DM_LINK_DOWN_EVT 6 /* Connection DOWN event */
  506. #define BTA_DM_SIG_STRENGTH_EVT 7 /* Signal strength for bluetooth connection */
  507. #define BTA_DM_BUSY_LEVEL_EVT 8 /* System busy level */
  508. #define BTA_DM_BOND_CANCEL_CMPL_EVT 9 /* Bond cancel complete indication */
  509. #define BTA_DM_SP_CFM_REQ_EVT 10 /* Simple Pairing User Confirmation request. */
  510. #define BTA_DM_SP_KEY_NOTIF_EVT 11 /* Simple Pairing Passkey Notification */
  511. #define BTA_DM_SP_RMT_OOB_EVT 12 /* Simple Pairing Remote OOB Data request. */
  512. #define BTA_DM_SP_KEYPRESS_EVT 13 /* Key press notification event. */
  513. #define BTA_DM_ROLE_CHG_EVT 14 /* Role Change event. */
  514. #define BTA_DM_BLE_KEY_EVT 15 /* BLE SMP key event for peer device keys */
  515. #define BTA_DM_BLE_SEC_REQ_EVT 16 /* BLE SMP security request */
  516. #define BTA_DM_BLE_PASSKEY_NOTIF_EVT 17 /* SMP passkey notification event */
  517. #define BTA_DM_BLE_PASSKEY_REQ_EVT 18 /* SMP passkey request event */
  518. #define BTA_DM_BLE_OOB_REQ_EVT 19 /* SMP OOB request event */
  519. #define BTA_DM_BLE_LOCAL_IR_EVT 20 /* BLE local IR event */
  520. #define BTA_DM_BLE_LOCAL_ER_EVT 21 /* BLE local ER event */
  521. #define BTA_DM_BLE_NC_REQ_EVT 22 /* SMP Numeric Comparison request event */
  522. // btla-specific ++
  523. #define BTA_DM_SP_RMT_OOB_EXT_EVT 23 /* Simple Pairing Remote OOB Extended Data request. */
  524. #define BTA_DM_BLE_AUTH_CMPL_EVT 24 /* BLE Auth complete */
  525. // btla-specific --
  526. #define BTA_DM_DEV_UNPAIRED_EVT 25
  527. #define BTA_DM_HW_ERROR_EVT 26 /* BT Chip H/W error */
  528. #define BTA_DM_LE_FEATURES_READ 27 /* Cotroller specific LE features are read */
  529. #define BTA_DM_ENER_INFO_READ 28 /* Energy info read */
  530. typedef UINT8 tBTA_DM_SEC_EVT;
  531. /* Structure associated with BTA_DM_ENABLE_EVT */
  532. typedef struct {
  533. tBTA_STATUS status;
  534. } tBTA_DM_ENABLE;
  535. /* Structure associated with BTA_DM_PIN_REQ_EVT */
  536. typedef struct {
  537. /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
  538. BD_ADDR bd_addr; /* BD address peer device. */
  539. DEV_CLASS dev_class; /* Class of Device */
  540. BD_NAME bd_name; /* Name of peer device. */
  541. BOOLEAN min_16_digit; /* TRUE if the pin returned must be at least 16 digits */
  542. } tBTA_DM_PIN_REQ;
  543. /* BLE related definition */
  544. #define BTA_DM_AUTH_FAIL_BASE (HCI_ERR_MAX_ERR + 10)
  545. #define BTA_DM_AUTH_CONVERT_SMP_CODE(x) (BTA_DM_AUTH_FAIL_BASE + (x))
  546. #define BTA_DM_AUTH_SMP_PASSKEY_FAIL BTA_DM_AUTH_CONVERT_SMP_CODE (SMP_PASSKEY_ENTRY_FAIL)
  547. #define BTA_DM_AUTH_SMP_OOB_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_OOB_FAIL)
  548. #define BTA_DM_AUTH_SMP_PAIR_AUTH_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_AUTH_FAIL)
  549. #define BTA_DM_AUTH_SMP_CONFIRM_VALUE_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_VALUE_ERR)
  550. #define BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_NOT_SUPPORT)
  551. #define BTA_DM_AUTH_SMP_ENC_KEY_SIZE (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_KEY_SIZE)
  552. #define BTA_DM_AUTH_SMP_INVALID_CMD (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_CMD)
  553. #define BTA_DM_AUTH_SMP_UNKNOWN_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_FAIL_UNKNOWN)
  554. #define BTA_DM_AUTH_SMP_REPEATED_ATTEMPT (BTA_DM_AUTH_FAIL_BASE + SMP_REPEATED_ATTEMPTS)
  555. #define BTA_DM_AUTH_SMP_INVALID_PARAMETERS (BTA_DM_AUTH_FAIL_BASE + SMP_INVALID_PARAMETERS)
  556. #define BTA_DM_AUTH_SMP_INTERNAL_ERR (BTA_DM_AUTH_FAIL_BASE + SMP_PAIR_INTERNAL_ERR)
  557. #define BTA_DM_AUTH_SMP_UNKNOWN_IO (BTA_DM_AUTH_FAIL_BASE + SMP_UNKNOWN_IO_CAP)
  558. #define BTA_DM_AUTH_SMP_INIT_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_INIT_FAIL)
  559. #define BTA_DM_AUTH_SMP_CONFIRM_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_CONFIRM_FAIL)
  560. #define BTA_DM_AUTH_SMP_BUSY (BTA_DM_AUTH_FAIL_BASE + SMP_BUSY)
  561. #define BTA_DM_AUTH_SMP_ENC_FAIL (BTA_DM_AUTH_FAIL_BASE + SMP_ENC_FAIL)
  562. #define BTA_DM_AUTH_SMP_RSP_TIMEOUT (BTA_DM_AUTH_FAIL_BASE + SMP_RSP_TIMEOUT)
  563. /* connection parameter boundary value and dummy value */
  564. #define BTA_DM_BLE_SCAN_INT_MIN BTM_BLE_SCAN_INT_MIN
  565. #define BTA_DM_BLE_SCAN_INT_MAX BTM_BLE_SCAN_INT_MAX
  566. #define BTA_DM_BLE_SCAN_WIN_MIN BTM_BLE_SCAN_WIN_MIN
  567. #define BTA_DM_BLE_SCAN_WIN_MAX BTM_BLE_SCAN_WIN_MAX
  568. #define BTA_DM_BLE_CONN_INT_MIN BTM_BLE_CONN_INT_MIN
  569. #define BTA_DM_BLE_CONN_INT_MAX BTM_BLE_CONN_INT_MAX
  570. #define BTA_DM_BLE_CONN_LATENCY_MAX BTM_BLE_CONN_LATENCY_MAX
  571. #define BTA_DM_BLE_CONN_SUP_TOUT_MIN BTM_BLE_CONN_SUP_TOUT_MIN
  572. #define BTA_DM_BLE_CONN_SUP_TOUT_MAX BTM_BLE_CONN_SUP_TOUT_MAX
  573. #define BTA_DM_BLE_CONN_PARAM_UNDEF BTM_BLE_CONN_PARAM_UNDEF /* use this value when a specific value not to be overwritten */
  574. #define BTA_LE_KEY_PENC BTM_LE_KEY_PENC /* encryption information of peer device */
  575. #define BTA_LE_KEY_PID BTM_LE_KEY_PID /* identity key of the peer device */
  576. #define BTA_LE_KEY_PCSRK BTM_LE_KEY_PCSRK /* peer SRK */
  577. #define BTA_LE_KEY_LENC BTM_LE_KEY_LENC /* master role security information:div */
  578. #define BTA_LE_KEY_LID BTM_LE_KEY_LID /* master device ID key */
  579. #define BTA_LE_KEY_LCSRK BTM_LE_KEY_LCSRK /* local CSRK has been deliver to peer */
  580. typedef UINT8 tBTA_LE_KEY_TYPE; /* can be used as a bit mask */
  581. typedef tBTM_LE_PENC_KEYS tBTA_LE_PENC_KEYS ;
  582. typedef tBTM_LE_PCSRK_KEYS tBTA_LE_PCSRK_KEYS;
  583. typedef tBTM_LE_LENC_KEYS tBTA_LE_LENC_KEYS ;
  584. typedef tBTM_LE_LCSRK_KEYS tBTA_LE_LCSRK_KEYS ;
  585. typedef tBTM_LE_PID_KEYS tBTA_LE_PID_KEYS ;
  586. typedef union {
  587. tBTA_LE_PENC_KEYS penc_key; /* received peer encryption key */
  588. tBTA_LE_PCSRK_KEYS psrk_key; /* received peer device SRK */
  589. tBTA_LE_PID_KEYS pid_key; /* peer device ID key */
  590. tBTA_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
  591. tBTA_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
  592. tBTA_LE_PID_KEYS lid_key; /* local device ID key for the particular remote */
  593. } tBTA_LE_KEY_VALUE;
  594. #define BTA_BLE_LOCAL_KEY_TYPE_ID 1
  595. #define BTA_BLE_LOCAL_KEY_TYPE_ER 2
  596. typedef UINT8 tBTA_DM_BLE_LOCAL_KEY_MASK;
  597. typedef struct {
  598. BT_OCTET16 ir;
  599. BT_OCTET16 irk;
  600. BT_OCTET16 dhk;
  601. } tBTA_BLE_LOCAL_ID_KEYS;
  602. #define BTA_DM_SEC_GRANTED BTA_SUCCESS
  603. #define BTA_DM_SEC_PAIR_NOT_SPT BTA_DM_AUTH_SMP_PAIR_NOT_SUPPORT
  604. #define BTA_DM_SEC_REP_ATTEMPTS BTA_DM_AUTH_SMP_REPEATED_ATTEMPT
  605. typedef UINT8 tBTA_DM_BLE_SEC_GRANT;
  606. #define BTA_DM_BLE_ONN_NONE BTM_BLE_CONN_NONE
  607. #define BTA_DM_BLE_CONN_AUTO BTM_BLE_CONN_AUTO
  608. #define BTA_DM_BLE_CONN_SELECTIVE BTM_BLE_CONN_SELECTIVE
  609. typedef UINT8 tBTA_DM_BLE_CONN_TYPE;
  610. typedef BOOLEAN (tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name);
  611. /* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */
  612. typedef struct {
  613. BD_ADDR bd_addr; /* peer address */
  614. BD_NAME bd_name; /* peer device name */
  615. } tBTA_DM_BLE_SEC_REQ;
  616. typedef struct {
  617. BD_ADDR bd_addr; /* peer address */
  618. tBTM_LE_KEY_TYPE key_type;
  619. tBTM_LE_KEY_VALUE *p_key_value;
  620. } tBTA_DM_BLE_KEY;
  621. /* Structure associated with BTA_DM_AUTH_CMPL_EVT */
  622. typedef struct {
  623. BD_ADDR bd_addr; /* BD address peer device. */
  624. BD_NAME bd_name; /* Name of peer device. */
  625. BOOLEAN key_present; /* Valid link key value in key element */
  626. LINK_KEY key; /* Link key associated with peer device. */
  627. UINT8 key_type; /* The type of Link Key */
  628. BOOLEAN success; /* TRUE of authentication succeeded, FALSE if failed. */
  629. UINT8 fail_reason; /* The HCI reason/error code for when success=FALSE */
  630. tBLE_ADDR_TYPE addr_type; /* Peer device address type */
  631. tBT_DEVICE_TYPE dev_type;
  632. } tBTA_DM_AUTH_CMPL;
  633. /* Structure associated with BTA_DM_AUTHORIZE_EVT */
  634. typedef struct {
  635. BD_ADDR bd_addr; /* BD address peer device. */
  636. BD_NAME bd_name; /* Name of peer device. */
  637. tBTA_SERVICE_ID service; /* Service ID to authorize. */
  638. // btla-specific ++
  639. DEV_CLASS dev_class;
  640. // btla-specific --
  641. } tBTA_DM_AUTHORIZE;
  642. /* Structure associated with BTA_DM_LINK_UP_EVT */
  643. typedef struct {
  644. BD_ADDR bd_addr; /* BD address peer device. */
  645. #if BLE_INCLUDED == TRUE
  646. tBTA_TRANSPORT link_type;
  647. #endif
  648. } tBTA_DM_LINK_UP;
  649. /* Structure associated with BTA_DM_LINK_DOWN_EVT */
  650. typedef struct {
  651. BD_ADDR bd_addr; /* BD address peer device. */
  652. UINT8 status; /* connection open/closed */
  653. BOOLEAN is_removed; /* TRUE if device is removed when link is down */
  654. #if BLE_INCLUDED == TRUE
  655. tBTA_TRANSPORT link_type;
  656. #endif
  657. } tBTA_DM_LINK_DOWN;
  658. /* Structure associated with BTA_DM_ROLE_CHG_EVT */
  659. typedef struct {
  660. BD_ADDR bd_addr; /* BD address peer device. */
  661. UINT8 new_role; /* the new connection role */
  662. } tBTA_DM_ROLE_CHG;
  663. /* Structure associated with BTA_DM_BUSY_LEVEL_EVT */
  664. typedef struct {
  665. UINT8 level; /* when paging or inquiring, level is 10.
  666. Otherwise, the number of ACL links */
  667. UINT8 level_flags; /* indicates individual flags */
  668. } tBTA_DM_BUSY_LEVEL;
  669. #define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* 0 DisplayOnly */
  670. #define BTA_IO_CAP_IO BTM_IO_CAP_IO /* 1 DisplayYesNo */
  671. #define BTA_IO_CAP_IN BTM_IO_CAP_IN /* 2 KeyboardOnly */
  672. #define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* 3 NoInputNoOutput */
  673. #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
  674. #define BTA_IO_CAP_KBDISP BTM_IO_CAP_KBDISP /* 4 Keyboard display */
  675. #endif
  676. typedef tBTM_IO_CAP tBTA_IO_CAP;
  677. #define BTA_AUTH_SP_NO BTM_AUTH_SP_NO /* 0 MITM Protection Not Required - Single Profile/non-bonding
  678. Numeric comparison with automatic accept allowed */
  679. #define BTA_AUTH_SP_YES BTM_AUTH_SP_YES /* 1 MITM Protection Required - Single Profile/non-bonding
  680. Use IO Capabilities to determine authentication procedure */
  681. #define BTA_AUTH_AP_NO BTM_AUTH_AP_NO /* 2 MITM Protection Not Required - All Profiles/dedicated bonding
  682. Numeric comparison with automatic accept allowed */
  683. #define BTA_AUTH_AP_YES BTM_AUTH_AP_YES /* 3 MITM Protection Required - All Profiles/dedicated bonding
  684. Use IO Capabilities to determine authentication procedure */
  685. #define BTA_AUTH_SPGB_NO BTM_AUTH_SPGB_NO /* 4 MITM Protection Not Required - Single Profiles/general bonding
  686. Numeric comparison with automatic accept allowed */
  687. #define BTA_AUTH_SPGB_YES BTM_AUTH_SPGB_YES /* 5 MITM Protection Required - Single Profiles/general bonding
  688. Use IO Capabilities to determine authentication procedure */
  689. typedef tBTM_AUTH_REQ tBTA_AUTH_REQ;
  690. #define BTA_AUTH_DD_BOND BTM_AUTH_DD_BOND /* 2 this bit is set for dedicated bonding */
  691. #define BTA_AUTH_GEN_BOND BTM_AUTH_SPGB_NO /* 4 this bit is set for general bonding */
  692. #define BTA_AUTH_BONDS BTM_AUTH_BONDS /* 6 the general/dedicated bonding bits */
  693. #define BTA_LE_AUTH_NO_BOND BTM_LE_AUTH_REQ_NO_BOND /* 0*/
  694. #define BTA_LE_AUTH_BOND BTM_LE_AUTH_REQ_BOND /* 1 << 0 */
  695. #define BTA_LE_AUTH_REQ_MITM BTM_LE_AUTH_REQ_MITM /* 1 << 2 */
  696. #define BTA_LE_AUTH_REQ_SC_ONLY BTM_LE_AUTH_REQ_SC_ONLY /* 1 << 3 */
  697. #define BTA_LE_AUTH_REQ_SC_BOND BTM_LE_AUTH_REQ_SC_BOND /* 1001 */
  698. #define BTA_LE_AUTH_REQ_SC_MITM BTM_LE_AUTH_REQ_SC_MITM /* 1100 */
  699. #define BTA_LE_AUTH_REQ_SC_MITM_BOND BTM_LE_AUTH_REQ_SC_MITM_BOND /* 1101 */
  700. typedef tBTM_LE_AUTH_REQ tBTA_LE_AUTH_REQ; /* combination of the above bit pattern */
  701. #define BTA_OOB_NONE BTM_OOB_NONE
  702. #define BTA_OOB_PRESENT BTM_OOB_PRESENT
  703. #if BTM_OOB_INCLUDED == TRUE
  704. #define BTA_OOB_UNKNOWN BTM_OOB_UNKNOWN
  705. #endif
  706. typedef tBTM_OOB_DATA tBTA_OOB_DATA;
  707. /* Structure associated with BTA_DM_SP_CFM_REQ_EVT */
  708. typedef struct {
  709. /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
  710. BD_ADDR bd_addr; /* peer address */
  711. DEV_CLASS dev_class; /* peer CoD */
  712. BD_NAME bd_name; /* peer device name */
  713. UINT32 num_val; /* the numeric value for comparison. If just_works, do not show this number to UI */
  714. BOOLEAN just_works; /* TRUE, if "Just Works" association model */
  715. tBTA_AUTH_REQ loc_auth_req; /* Authentication required for local device */
  716. tBTA_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
  717. tBTA_IO_CAP loc_io_caps; /* IO Capabilities of local device */
  718. tBTA_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */
  719. } tBTA_DM_SP_CFM_REQ;
  720. enum {
  721. BTA_SP_KEY_STARTED, /* passkey entry started */
  722. BTA_SP_KEY_ENTERED, /* passkey digit entered */
  723. BTA_SP_KEY_ERASED, /* passkey digit erased */
  724. BTA_SP_KEY_CLEARED, /* passkey cleared */
  725. BTA_SP_KEY_COMPLT /* passkey entry completed */
  726. };
  727. typedef UINT8 tBTA_SP_KEY_TYPE;
  728. /* Structure associated with BTA_DM_SP_KEYPRESS_EVT */
  729. typedef struct {
  730. BD_ADDR bd_addr; /* peer address */
  731. tBTA_SP_KEY_TYPE notif_type;
  732. } tBTA_DM_SP_KEY_PRESS;
  733. /* Structure associated with BTA_DM_SP_KEY_NOTIF_EVT */
  734. typedef struct {
  735. /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
  736. BD_ADDR bd_addr; /* peer address */
  737. DEV_CLASS dev_class; /* peer CoD */
  738. BD_NAME bd_name; /* peer device name */
  739. UINT32 passkey; /* the numeric value for comparison. If just_works, do not show this number to UI */
  740. } tBTA_DM_SP_KEY_NOTIF;
  741. /* Structure associated with BTA_DM_SP_RMT_OOB_EVT */
  742. typedef struct {
  743. /* Note: First 3 data members must be, bd_addr, dev_class, and bd_name in order */
  744. BD_ADDR bd_addr; /* peer address */
  745. DEV_CLASS dev_class; /* peer CoD */
  746. BD_NAME bd_name; /* peer device name */
  747. } tBTA_DM_SP_RMT_OOB;
  748. /* Structure associated with BTA_DM_BOND_CANCEL_CMPL_EVT */
  749. typedef struct {
  750. tBTA_STATUS result; /* TRUE of bond cancel succeeded, FALSE if failed. */
  751. } tBTA_DM_BOND_CANCEL_CMPL;
  752. /* Union of all security callback structures */
  753. typedef union {
  754. tBTA_DM_ENABLE enable; /* BTA enabled */
  755. tBTA_DM_PIN_REQ pin_req; /* PIN request. */
  756. tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */
  757. tBTA_DM_AUTHORIZE authorize; /* Authorization request. */
  758. tBTA_DM_LINK_UP link_up; /* ACL connection down event */
  759. tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */
  760. tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */
  761. tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */
  762. tBTA_DM_SP_KEY_NOTIF key_notif; /* passkey notification */
  763. tBTA_DM_SP_RMT_OOB rmt_oob; /* remote oob */
  764. tBTA_DM_BOND_CANCEL_CMPL bond_cancel_cmpl; /* Bond Cancel Complete indication */
  765. tBTA_DM_SP_KEY_PRESS key_press; /* key press notification event */
  766. tBTA_DM_ROLE_CHG role_chg; /* role change event */
  767. tBTA_DM_BLE_SEC_REQ ble_req; /* BLE SMP related request */
  768. tBTA_DM_BLE_KEY ble_key; /* BLE SMP keys used when pairing */
  769. tBTA_BLE_LOCAL_ID_KEYS ble_id_keys; /* IR event */
  770. BT_OCTET16 ble_er; /* ER event data */
  771. } tBTA_DM_SEC;
  772. /* Security callback */
  773. typedef void (tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
  774. #define BTA_BLE_MULTI_ADV_ILLEGAL 0
  775. /* multi adv callback event */
  776. #define BTA_BLE_MULTI_ADV_ENB_EVT 1
  777. #define BTA_BLE_MULTI_ADV_DISABLE_EVT 2
  778. #define BTA_BLE_MULTI_ADV_PARAM_EVT 3
  779. #define BTA_BLE_MULTI_ADV_DATA_EVT 4
  780. typedef UINT8 tBTA_BLE_MULTI_ADV_EVT;
  781. /* multi adv callback */
  782. typedef void (tBTA_BLE_MULTI_ADV_CBACK)(tBTA_BLE_MULTI_ADV_EVT event,
  783. UINT8 inst_id, void *p_ref, tBTA_STATUS status);
  784. typedef UINT32 tBTA_DM_BLE_REF_VALUE;
  785. #define BTA_DM_BLE_PF_ENABLE_EVT BTM_BLE_PF_ENABLE
  786. #define BTA_DM_BLE_PF_CONFIG_EVT BTM_BLE_PF_CONFIG
  787. typedef UINT8 tBTA_DM_BLE_PF_EVT;
  788. #define BTA_DM_BLE_PF_ENABLE 1
  789. #define BTA_DM_BLE_PF_CONFIG 2
  790. typedef UINT8 tBTA_DM_BLE_PF_ACTION;
  791. /* Config callback */
  792. typedef void (tBTA_DM_BLE_PF_CFG_CBACK) (tBTA_DM_BLE_PF_ACTION action,
  793. tBTA_DM_BLE_PF_COND_TYPE cfg_cond,
  794. tBTA_DM_BLE_PF_AVBL_SPACE avbl_space, tBTA_STATUS status,
  795. tBTA_DM_BLE_REF_VALUE ref_value);
  796. /* Param callback */
  797. typedef void (tBTA_DM_BLE_PF_PARAM_CBACK) (UINT8 action_type, tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
  798. tBTA_DM_BLE_REF_VALUE ref_value, tBTA_STATUS status);
  799. /* Status callback */
  800. typedef void (tBTA_DM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTA_STATUS status,
  801. tBTA_DM_BLE_REF_VALUE ref_value);
  802. #define BTA_DM_BLE_PF_BRDCAST_ADDR_FILT 1
  803. #define BTA_DM_BLE_PF_SERV_DATA_CHG_FILT 2
  804. #define BTA_DM_BLE_PF_SERV_UUID 4
  805. #define BTA_DM_BLE_PF_SERV_SOLC_UUID 8
  806. #define BTA_DM_BLE_PF_LOC_NAME_CHECK 16
  807. #define BTA_DM_BLE_PF_MANUF_NAME_CHECK 32
  808. #define BTA_DM_BLE_PF_SERV_DATA_CHECK 64
  809. typedef UINT16 tBTA_DM_BLE_PF_FEAT_SEL;
  810. #define BTA_DM_BLE_PF_LIST_LOGIC_OR 1
  811. #define BTA_DM_BLE_PF_LIST_LOGIC_AND 2
  812. typedef UINT16 tBTA_DM_BLE_PF_LIST_LOGIC_TYPE;
  813. #define BTA_DM_BLE_PF_FILT_LOGIC_OR 0
  814. #define BTA_DM_BLE_PF_FILT_LOGIC_AND 1
  815. typedef UINT16 tBTA_DM_BLE_PF_FILT_LOGIC_TYPE;
  816. typedef UINT8 tBTA_DM_BLE_PF_RSSI_THRESHOLD;
  817. typedef UINT8 tBTA_DM_BLE_PF_DELIVERY_MODE;
  818. typedef UINT16 tBTA_DM_BLE_PF_TIMEOUT;
  819. typedef UINT8 tBTA_DM_BLE_PF_TIMEOUT_CNT;
  820. typedef UINT16 tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES;
  821. typedef struct {
  822. tBTA_DM_BLE_PF_FEAT_SEL feat_seln;
  823. tBTA_DM_BLE_PF_LIST_LOGIC_TYPE list_logic_type;
  824. tBTA_DM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type;
  825. tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_high_thres;
  826. tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_low_thres;
  827. tBTA_DM_BLE_PF_DELIVERY_MODE dely_mode;
  828. tBTA_DM_BLE_PF_TIMEOUT found_timeout;
  829. tBTA_DM_BLE_PF_TIMEOUT lost_timeout;
  830. tBTA_DM_BLE_PF_TIMEOUT_CNT found_timeout_cnt;
  831. tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES num_of_tracking_entries;
  832. } tBTA_DM_BLE_PF_FILT_PARAMS;
  833. /* Search callback events */
  834. #define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */
  835. #define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */
  836. #define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */
  837. #define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based servoce on a peer device. */
  838. #define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
  839. #define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
  840. #define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
  841. typedef UINT8 tBTA_DM_SEARCH_EVT;
  842. #define BTA_DM_INQ_RES_IGNORE_RSSI BTM_INQ_RES_IGNORE_RSSI /* 0x7f RSSI value not supplied (ignore it) */
  843. /* Structure associated with BTA_DM_INQ_RES_EVT */
  844. typedef struct {
  845. BD_ADDR bd_addr; /* BD address peer device. */
  846. DEV_CLASS dev_class; /* Device class of peer device. */
  847. BOOLEAN remt_name_not_required; /* Application sets this flag if it already knows the name of the device */
  848. /* If the device name is known to application BTA skips the remote name request */
  849. BOOLEAN is_limited; /* TRUE, if the limited inquiry bit is set in the CoD */
  850. INT8 rssi; /* The rssi value */
  851. UINT8 *p_eir; /* received EIR */
  852. #if (BLE_INCLUDED == TRUE)
  853. UINT8 inq_result_type;
  854. UINT8 ble_addr_type;
  855. tBTM_BLE_EVT_TYPE ble_evt_type;
  856. tBT_DEVICE_TYPE device_type;
  857. UINT8 flag;
  858. UINT8 adv_data_len;
  859. UINT8 scan_rsp_len;
  860. #endif
  861. } tBTA_DM_INQ_RES;
  862. /* Structure associated with BTA_DM_INQ_CMPL_EVT */
  863. typedef struct {
  864. UINT8 num_resps; /* Number of inquiry responses. */
  865. } tBTA_DM_INQ_CMPL;
  866. /* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
  867. typedef struct {
  868. BD_ADDR bd_addr; /* BD address peer device. */
  869. UINT8 num_record; /* Number of DI record */
  870. tBTA_STATUS result;
  871. } tBTA_DM_DI_DISC_CMPL;
  872. /* Structure associated with BTA_DM_DISC_RES_EVT */
  873. typedef struct {
  874. BD_ADDR bd_addr; /* BD address peer device. */
  875. BD_NAME bd_name; /* Name of peer device. */
  876. tBTA_SERVICE_MASK services; /* Services found on peer device. */
  877. // btla-specific ++
  878. UINT8 *p_raw_data; /* Raw data for discovery DB */
  879. UINT32 raw_data_size; /* size of raw data */
  880. tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */
  881. UINT32 num_uuids;
  882. UINT8 *p_uuid_list;
  883. // btla-specific --
  884. tBTA_STATUS result;
  885. } tBTA_DM_DISC_RES;
  886. /* Structure associated with tBTA_DM_DISC_BLE_RES */
  887. typedef struct {
  888. BD_ADDR bd_addr; /* BD address peer device. */
  889. BD_NAME bd_name; /* Name of peer device. */
  890. tBT_UUID service; /* GATT based Services UUID found on peer device. */
  891. } tBTA_DM_DISC_BLE_RES;
  892. /* Union of all search callback structures */
  893. typedef union {
  894. tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */
  895. tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */
  896. tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
  897. tBTA_DM_DISC_BLE_RES disc_ble_res; /* discovery result for GATT based service */
  898. tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
  899. } tBTA_DM_SEARCH;
  900. /* Search callback */
  901. typedef void (tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
  902. /* Execute call back */
  903. typedef void (tBTA_DM_EXEC_CBACK) (void *p_param);
  904. /* Encryption callback*/
  905. typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS result);
  906. #if BLE_INCLUDED == TRUE
  907. #define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE
  908. #define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT
  909. #define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM
  910. #define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM
  911. typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT;
  912. typedef tBTM_BLE_TX_TIME_MS tBTA_DM_BLE_TX_TIME_MS;
  913. typedef tBTM_BLE_RX_TIME_MS tBTA_DM_BLE_RX_TIME_MS;
  914. typedef tBTM_BLE_IDLE_TIME_MS tBTA_DM_BLE_IDLE_TIME_MS;
  915. typedef tBTM_BLE_ENERGY_USED tBTA_DM_BLE_ENERGY_USED;
  916. #define BTA_DM_CONTRL_UNKNOWN 0 /* Unknown state */
  917. #define BTA_DM_CONTRL_ACTIVE 1 /* ACL link on, SCO link ongoing, sniff mode */
  918. #define BTA_DM_CONTRL_SCAN 2 /* Scan state - paging/inquiry/trying to connect*/
  919. #define BTA_DM_CONTRL_IDLE 3 /* Idle state - page scan, LE advt, inquiry scan */
  920. typedef UINT8 tBTA_DM_CONTRL_STATE;
  921. typedef UINT8 tBTA_DM_BLE_ADV_STATE;
  922. typedef UINT8 tBTA_DM_BLE_ADV_INFO_PRESENT;
  923. typedef UINT8 tBTA_DM_BLE_RSSI_VALUE;
  924. typedef UINT16 tBTA_DM_BLE_ADV_INFO_TIMESTAMP;
  925. typedef tBTM_BLE_TRACK_ADV_DATA tBTA_DM_BLE_TRACK_ADV_DATA;
  926. typedef void (tBTA_BLE_SCAN_THRESHOLD_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value);
  927. typedef void (tBTA_BLE_SCAN_REP_CBACK) (tBTA_DM_BLE_REF_VALUE ref_value, UINT8 report_format,
  928. UINT8 num_records, UINT16 data_len,
  929. UINT8 *p_rep_data, tBTA_STATUS status);
  930. typedef void (tBTA_BLE_SCAN_SETUP_CBACK) (tBTA_BLE_BATCH_SCAN_EVT evt,
  931. tBTA_DM_BLE_REF_VALUE ref_value,
  932. tBTA_STATUS status);
  933. typedef void (tBTA_START_STOP_SCAN_CMPL_CBACK) (tBTA_STATUS status);
  934. typedef void (tBTA_START_STOP_ADV_CMPL_CBACK) (tBTA_STATUS status);
  935. typedef void (tBTA_BLE_TRACK_ADV_CMPL_CBACK)(int action, tBTA_STATUS status,
  936. tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
  937. tBTA_DM_BLE_REF_VALUE ref_value);
  938. typedef void (tBTA_BLE_TRACK_ADV_CBACK)(tBTA_DM_BLE_TRACK_ADV_DATA *p_adv_data);
  939. typedef void (tBTA_BLE_ENERGY_INFO_CBACK)(tBTA_DM_BLE_TX_TIME_MS tx_time,
  940. tBTA_DM_BLE_RX_TIME_MS rx_time,
  941. tBTA_DM_BLE_IDLE_TIME_MS idle_time,
  942. tBTA_DM_BLE_ENERGY_USED energy_used,
  943. tBTA_DM_CONTRL_STATE ctrl_state,
  944. tBTA_STATUS status);
  945. #else
  946. typedef UINT8 tBTA_DM_BLE_SEC_ACT;
  947. #endif
  948. /* Maximum service name length */
  949. #define BTA_SERVICE_NAME_LEN 35
  950. #define BTA_SERVICE_DESP_LEN BTA_SERVICE_NAME_LEN
  951. #define BTA_PROVIDER_NAME_LEN BTA_SERVICE_NAME_LEN
  952. /* link policy masks */
  953. #define BTA_DM_LP_SWITCH HCI_ENABLE_MASTER_SLAVE_SWITCH
  954. #define BTA_DM_LP_HOLD HCI_ENABLE_HOLD_MODE
  955. #define BTA_DM_LP_SNIFF HCI_ENABLE_SNIFF_MODE
  956. #define BTA_DM_LP_PARK HCI_ENABLE_PARK_MODE
  957. typedef UINT16 tBTA_DM_LP_MASK;
  958. /* power mode actions */
  959. #define BTA_DM_PM_NO_ACTION 0x00 /* no change to the current pm setting */
  960. #define BTA_DM_PM_PARK 0x10 /* prefers park mode */
  961. #define BTA_DM_PM_SNIFF 0x20 /* prefers sniff mode */
  962. #define BTA_DM_PM_SNIFF1 0x21 /* prefers sniff1 mode */
  963. #define BTA_DM_PM_SNIFF2 0x22 /* prefers sniff2 mode */
  964. #define BTA_DM_PM_SNIFF3 0x23 /* prefers sniff3 mode */
  965. #define BTA_DM_PM_SNIFF4 0x24 /* prefers sniff4 mode */
  966. #define BTA_DM_PM_SNIFF5 0x25 /* prefers sniff5 mode */
  967. #define BTA_DM_PM_SNIFF6 0x26 /* prefers sniff6 mode */
  968. #define BTA_DM_PM_SNIFF7 0x27 /* prefers sniff7 mode */
  969. #define BTA_DM_PM_SNIFF_USER0 0x28 /* prefers user-defined sniff0 mode (testtool only) */
  970. #define BTA_DM_PM_SNIFF_USER1 0x29 /* prefers user-defined sniff1 mode (testtool only) */
  971. #define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */
  972. #define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */
  973. #define BTA_DM_PM_SUSPEND 0x04 /* prefers suspend mode */
  974. #define BTA_DM_PM_NO_PREF 0x01 /* service has no prefernce on power mode setting. eg. connection to service got closed */
  975. typedef UINT8 tBTA_DM_PM_ACTION;
  976. /* index to bta_dm_ssr_spec */
  977. #define BTA_DM_PM_SSR0 0
  978. #define BTA_DM_PM_SSR1 1 /* BTA_DM_PM_SSR1 will be dedicated for
  979. HH SSR setting entry, no other profile can use it */
  980. #define BTA_DM_PM_SSR2 2
  981. #define BTA_DM_PM_SSR3 3
  982. #define BTA_DM_PM_SSR4 4
  983. #define BTA_DM_PM_SSR5 5
  984. #define BTA_DM_PM_SSR6 6
  985. #define BTA_DM_PM_NUM_EVTS 9
  986. #ifndef BTA_DM_PM_PARK_IDX
  987. #define BTA_DM_PM_PARK_IDX 5 /* the actual index to bta_dm_pm_md[] for PARK mode */
  988. #endif
  989. #ifndef BTA_DM_PM_SNIFF_A2DP_IDX
  990. #define BTA_DM_PM_SNIFF_A2DP_IDX BTA_DM_PM_SNIFF
  991. #endif
  992. #ifndef BTA_DM_PM_SNIFF_HD_IDLE_IDX
  993. #define BTA_DM_PM_SNIFF_HD_IDLE_IDX BTA_DM_PM_SNIFF2
  994. #endif
  995. #ifndef BTA_DM_PM_SNIFF_SCO_OPEN_IDX
  996. #define BTA_DM_PM_SNIFF_SCO_OPEN_IDX BTA_DM_PM_SNIFF3
  997. #endif
  998. #ifndef BTA_DM_PM_SNIFF_HD_ACTIVE_IDX
  999. #define BTA_DM_PM_SNIFF_HD_ACTIVE_IDX BTA_DM_PM_SNIFF4
  1000. #endif
  1001. #ifndef BTA_DM_PM_SNIFF_HH_OPEN_IDX
  1002. #define BTA_DM_PM_SNIFF_HH_OPEN_IDX BTA_DM_PM_SNIFF2
  1003. #endif
  1004. #ifndef BTA_DM_PM_SNIFF_HH_ACTIVE_IDX
  1005. #define BTA_DM_PM_SNIFF_HH_ACTIVE_IDX BTA_DM_PM_SNIFF2
  1006. #endif
  1007. #ifndef BTA_DM_PM_SNIFF_HH_IDLE_IDX
  1008. #define BTA_DM_PM_SNIFF_HH_IDLE_IDX BTA_DM_PM_SNIFF2
  1009. #endif
  1010. #ifndef BTA_DM_PM_HH_OPEN_DELAY
  1011. #define BTA_DM_PM_HH_OPEN_DELAY 30000
  1012. #endif
  1013. #ifndef BTA_DM_PM_HH_ACTIVE_DELAY
  1014. #define BTA_DM_PM_HH_ACTIVE_DELAY 30000
  1015. #endif
  1016. #ifndef BTA_DM_PM_HH_IDLE_DELAY
  1017. #define BTA_DM_PM_HH_IDLE_DELAY 30000
  1018. #endif
  1019. /* The Sniff Parameters defined below must be ordered from highest
  1020. * latency (biggest interval) to lowest latency. If there is a conflict
  1021. * among the connected services the setting with the lowest latency will
  1022. * be selected. If a device should override a sniff parameter then it
  1023. * must insure that order is maintained.
  1024. */
  1025. #ifndef BTA_DM_PM_SNIFF_MAX
  1026. #define BTA_DM_PM_SNIFF_MAX 800
  1027. #define BTA_DM_PM_SNIFF_MIN 400
  1028. #define BTA_DM_PM_SNIFF_ATTEMPT 4
  1029. #define BTA_DM_PM_SNIFF_TIMEOUT 1
  1030. #endif
  1031. #ifndef BTA_DM_PM_SNIFF1_MAX
  1032. #define BTA_DM_PM_SNIFF1_MAX 400
  1033. #define BTA_DM_PM_SNIFF1_MIN 200
  1034. #define BTA_DM_PM_SNIFF1_ATTEMPT 4
  1035. #define BTA_DM_PM_SNIFF1_TIMEOUT 1
  1036. #endif
  1037. #ifndef BTA_DM_PM_SNIFF2_MAX
  1038. #define BTA_DM_PM_SNIFF2_MAX 180
  1039. #define BTA_DM_PM_SNIFF2_MIN 150
  1040. #define BTA_DM_PM_SNIFF2_ATTEMPT 4
  1041. #define BTA_DM_PM_SNIFF2_TIMEOUT 1
  1042. #endif
  1043. #ifndef BTA_DM_PM_SNIFF3_MAX
  1044. #define BTA_DM_PM_SNIFF3_MAX 150
  1045. #define BTA_DM_PM_SNIFF3_MIN 50
  1046. #define BTA_DM_PM_SNIFF3_ATTEMPT 4
  1047. #define BTA_DM_PM_SNIFF3_TIMEOUT 1
  1048. #endif
  1049. #ifndef BTA_DM_PM_SNIFF4_MAX
  1050. #define BTA_DM_PM_SNIFF4_MAX 54
  1051. #define BTA_DM_PM_SNIFF4_MIN 30
  1052. #define BTA_DM_PM_SNIFF4_ATTEMPT 4
  1053. #define BTA_DM_PM_SNIFF4_TIMEOUT 1
  1054. #endif
  1055. #ifndef BTA_DM_PM_SNIFF5_MAX
  1056. #define BTA_DM_PM_SNIFF5_MAX 36
  1057. #define BTA_DM_PM_SNIFF5_MIN 30
  1058. #define BTA_DM_PM_SNIFF5_ATTEMPT 2
  1059. #define BTA_DM_PM_SNIFF5_TIMEOUT 0
  1060. #endif
  1061. #ifndef BTA_DM_PM_PARK_MAX
  1062. #define BTA_DM_PM_PARK_MAX 800
  1063. #define BTA_DM_PM_PARK_MIN 400
  1064. #define BTA_DM_PM_PARK_ATTEMPT 0
  1065. #define BTA_DM_PM_PARK_TIMEOUT 0
  1066. #endif
  1067. /* Switch callback events */
  1068. #define BTA_DM_SWITCH_CMPL_EVT 0 /* Completion of the Switch API */
  1069. typedef UINT8 tBTA_DM_SWITCH_EVT;
  1070. typedef void (tBTA_DM_SWITCH_CBACK)(tBTA_DM_SWITCH_EVT event, tBTA_STATUS status);
  1071. /* Audio routing out configuration */
  1072. #define BTA_DM_ROUTE_NONE 0x00 /* No Audio output */
  1073. #define BTA_DM_ROUTE_DAC 0x01 /* routing over analog output */
  1074. #define BTA_DM_ROUTE_I2S 0x02 /* routing over digital (I2S) output */
  1075. #define BTA_DM_ROUTE_BT_MONO 0x04 /* routing over SCO */
  1076. #define BTA_DM_ROUTE_BT_STEREO 0x08 /* routing over BT Stereo */
  1077. #define BTA_DM_ROUTE_HOST 0x10 /* routing over Host */
  1078. #define BTA_DM_ROUTE_FMTX 0x20 /* routing over FMTX */
  1079. #define BTA_DM_ROUTE_FMRX 0x40 /* routing over FMRX */
  1080. #define BTA_DM_ROUTE_BTSNK 0x80 /* routing over BT SNK */
  1081. typedef UINT8 tBTA_DM_ROUTE_PATH;
  1082. /* Device Identification (DI) data structure
  1083. */
  1084. /* Used to set the DI record */
  1085. typedef tSDP_DI_RECORD tBTA_DI_RECORD;
  1086. /* Used to get the DI record */
  1087. typedef tSDP_DI_GET_RECORD tBTA_DI_GET_RECORD;
  1088. /* SDP discovery database */
  1089. typedef tSDP_DISCOVERY_DB tBTA_DISCOVERY_DB;
  1090. #ifndef BTA_DI_NUM_MAX
  1091. #define BTA_DI_NUM_MAX 3
  1092. #endif
  1093. /* Device features mask definitions */
  1094. #define BTA_FEATURE_BYTES_PER_PAGE BTM_FEATURE_BYTES_PER_PAGE
  1095. #define BTA_EXT_FEATURES_PAGE_MAX BTM_EXT_FEATURES_PAGE_MAX
  1096. /* ACL type
  1097. */
  1098. #define BTA_DM_LINK_TYPE_BR_EDR 0x01
  1099. #define BTA_DM_LINK_TYPE_LE 0x02
  1100. #define BTA_DM_LINK_TYPE_ALL 0xFF
  1101. typedef UINT8 tBTA_DM_LINK_TYPE;
  1102. #define IMMEDIATE_DELY_MODE 0x00
  1103. #define ONFOUND_DELY_MODE 0x01
  1104. #define BATCH_DELY_MODE 0x02
  1105. #define ALLOW_ALL_FILTER 0x00
  1106. #define LOWEST_RSSI_VALUE 129
  1107. /*****************************************************************************
  1108. ** External Function Declarations
  1109. *****************************************************************************/
  1110. #ifdef __cplusplus
  1111. extern "C"
  1112. {
  1113. #endif
  1114. /*******************************************************************************
  1115. **
  1116. ** Function BTA_EnableBluetooth
  1117. **
  1118. ** Description This function initializes BTA and prepares BTA and the
  1119. ** Bluetooth protocol stack for use. This function is
  1120. ** typically called at startup or when Bluetooth services
  1121. ** are required by the phone. This function must be called
  1122. ** before calling any other API function.
  1123. **
  1124. **
  1125. ** Returns BTA_SUCCESS if successful.
  1126. ** BTA_FAIL if internal failure.
  1127. **
  1128. *******************************************************************************/
  1129. extern tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback);
  1130. /*******************************************************************************
  1131. **
  1132. ** Function BTA_DisableBluetooth
  1133. **
  1134. ** Description This function disables BTA and the Bluetooth protocol
  1135. ** stack. It is called when BTA is no longer being used
  1136. ** by any application in the system.
  1137. **
  1138. **
  1139. ** Returns void
  1140. **
  1141. *******************************************************************************/
  1142. extern tBTA_STATUS BTA_DisableBluetooth(void);
  1143. /*******************************************************************************
  1144. **
  1145. ** Function BTA_EnableTestMode
  1146. **
  1147. ** Description Enables bluetooth device under test mode
  1148. **
  1149. **
  1150. ** Returns tBTA_STATUS
  1151. **
  1152. *******************************************************************************/
  1153. extern tBTA_STATUS BTA_EnableTestMode(void);
  1154. /*******************************************************************************
  1155. **
  1156. ** Function BTA_DisableTestMode
  1157. **
  1158. ** Description Disable bluetooth device under test mode
  1159. **
  1160. **
  1161. ** Returns None
  1162. **
  1163. *******************************************************************************/
  1164. extern void BTA_DisableTestMode(void);
  1165. /*******************************************************************************
  1166. **
  1167. ** Function BTA_DmSetDeviceName
  1168. **
  1169. ** Description This function sets the Bluetooth name of the local device.
  1170. **
  1171. **
  1172. ** Returns void
  1173. **
  1174. *******************************************************************************/
  1175. extern void BTA_DmSetDeviceName(char *p_name);
  1176. /*******************************************************************************
  1177. **
  1178. ** Function BTA_DmSetVisibility
  1179. **
  1180. ** Description This function sets the Bluetooth connectable,discoverable,
  1181. ** pairable and conn paired only modesmodes of the local device.
  1182. ** This controls whether other Bluetooth devices can find and connect to
  1183. ** the local device.
  1184. **
  1185. **
  1186. ** Returns void
  1187. **
  1188. *******************************************************************************/
  1189. extern void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode, UINT8 pairable_mode, UINT8 conn_filter);
  1190. /*******************************************************************************
  1191. **
  1192. ** Function BTA_DmSearch
  1193. **
  1194. ** Description This function searches for peer Bluetooth devices. It
  1195. ** first performs an inquiry; for each device found from the
  1196. ** inquiry it gets the remote name of the device. If
  1197. ** parameter services is nonzero, service discovery will be
  1198. ** performed on each device for the services specified.
  1199. **
  1200. **
  1201. ** Returns void
  1202. **
  1203. *******************************************************************************/
  1204. extern void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services,
  1205. tBTA_DM_SEARCH_CBACK *p_cback);
  1206. /*******************************************************************************
  1207. **
  1208. ** Function BTA_DmSearchCancel
  1209. **
  1210. ** Description This function cancels a search that has been initiated
  1211. ** by calling BTA_DmSearch().
  1212. **
  1213. **
  1214. ** Returns void
  1215. **
  1216. *******************************************************************************/
  1217. extern void BTA_DmSearchCancel(void);
  1218. /*******************************************************************************
  1219. **
  1220. ** Function BTA_DmDiscover
  1221. **
  1222. ** Description This function performs service discovery for the services
  1223. ** of a particular peer device.
  1224. **
  1225. **
  1226. ** Returns void
  1227. **
  1228. *******************************************************************************/
  1229. extern void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services,
  1230. tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
  1231. // btla-specific ++
  1232. /*******************************************************************************
  1233. **
  1234. ** Function BTA_DmDiscoverUUID
  1235. **
  1236. ** Description This function performs service discovery for the services
  1237. ** of a particular peer device.
  1238. **
  1239. **
  1240. ** Returns void
  1241. **
  1242. *******************************************************************************/
  1243. extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
  1244. tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
  1245. /*******************************************************************************
  1246. **
  1247. ** Function BTA_DmGetCachedRemoteName
  1248. **
  1249. ** Description Retieve cached remote name if available
  1250. **
  1251. ** Returns BTA_SUCCESS if cached name was retrieved
  1252. ** BTA_FAILURE if cached name is not available
  1253. **
  1254. *******************************************************************************/
  1255. tBTA_STATUS BTA_DmGetCachedRemoteName(BD_ADDR remote_device, UINT8 **pp_cached_name);
  1256. // btla-specific --
  1257. /*******************************************************************************
  1258. **
  1259. ** Function BTA_DmBond
  1260. **
  1261. ** Description This function initiates a bonding procedure with a peer
  1262. ** device. The bonding procedure enables authentication
  1263. ** and optionally encryption on the Bluetooth link.
  1264. **
  1265. **
  1266. ** Returns void
  1267. **
  1268. *******************************************************************************/
  1269. extern void BTA_DmBond(BD_ADDR bd_addr);
  1270. /*******************************************************************************
  1271. **
  1272. ** Function BTA_DmBondByTransport
  1273. **
  1274. ** Description This function initiates a bonding procedure with a peer
  1275. ** device by designated transport. The bonding procedure enables
  1276. ** authentication and optionally encryption on the Bluetooth link.
  1277. **
  1278. **
  1279. ** Returns void
  1280. **
  1281. *******************************************************************************/
  1282. extern void BTA_DmBondByTransport(BD_ADDR bd_addr, tBTA_TRANSPORT transport);
  1283. /*******************************************************************************
  1284. **
  1285. ** Function BTA_DmBondCancel
  1286. **
  1287. ** Description This function cancels a bonding procedure with a peer
  1288. ** device.
  1289. **
  1290. **
  1291. ** Returns void
  1292. **
  1293. *******************************************************************************/
  1294. extern void BTA_DmBondCancel(BD_ADDR bd_addr);
  1295. /*******************************************************************************
  1296. **
  1297. ** Function BTA_DmPinReply
  1298. **
  1299. ** Description This function provides a PIN when one is requested by DM
  1300. ** during a bonding procedure. The application should call
  1301. ** this function after the security callback is called with
  1302. ** a BTA_DM_PIN_REQ_EVT.
  1303. **
  1304. **
  1305. ** Returns void
  1306. **
  1307. *******************************************************************************/
  1308. extern void BTA_DmPinReply(BD_ADDR bd_addr, BOOLEAN accept, UINT8 pin_len,
  1309. UINT8 *p_pin);
  1310. #if (BTM_OOB_INCLUDED == TRUE)
  1311. /*******************************************************************************
  1312. **
  1313. ** Function BTA_DmLocalOob
  1314. **
  1315. ** Description This function retrieves the OOB data from local controller.
  1316. ** The result is reported by bta_dm_co_loc_oob().
  1317. **
  1318. ** Returns void
  1319. **
  1320. *******************************************************************************/
  1321. extern void BTA_DmLocalOob(void);
  1322. #endif /* BTM_OOB_INCLUDED */
  1323. /*******************************************************************************
  1324. **
  1325. ** Function BTA_DmConfirm
  1326. **
  1327. ** Description This function accepts or rejects the numerical value of the
  1328. ** Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT
  1329. **
  1330. ** Returns void
  1331. **
  1332. *******************************************************************************/
  1333. extern void BTA_DmConfirm(BD_ADDR bd_addr, BOOLEAN accept);
  1334. /*******************************************************************************
  1335. **
  1336. ** Function BTA_DmAddDevice
  1337. **
  1338. ** Description This function adds a device to the security database list
  1339. ** of peer devices. This function would typically be called
  1340. ** at system startup to initialize the security database with
  1341. ** known peer devices. This is a direct execution function
  1342. ** that may lock task scheduling on some platforms.
  1343. **
  1344. ** Returns void
  1345. **
  1346. *******************************************************************************/
  1347. extern void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class,
  1348. LINK_KEY link_key, tBTA_SERVICE_MASK trusted_mask,
  1349. BOOLEAN is_trusted, UINT8 key_type,
  1350. tBTA_IO_CAP io_cap, UINT8 pin_length);
  1351. /*******************************************************************************
  1352. **
  1353. ** Function BTA_DmRemoveDevice
  1354. **
  1355. ** Description This function removes a device from the security database.
  1356. ** This is a direct execution function that may lock task
  1357. ** scheduling on some platforms.
  1358. **
  1359. **
  1360. ** Returns BTA_SUCCESS if successful.
  1361. ** BTA_FAIL if operation failed.
  1362. **
  1363. *******************************************************************************/
  1364. extern tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr);
  1365. /*******************************************************************************
  1366. **
  1367. ** Function BTA_GetEirService
  1368. **
  1369. ** Description This function is called to get BTA service mask from EIR.
  1370. **
  1371. ** Parameters p_eir - pointer of EIR significant part
  1372. ** p_services - return the BTA service mask
  1373. **
  1374. ** Returns None
  1375. **
  1376. *******************************************************************************/
  1377. extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_services );
  1378. /*******************************************************************************
  1379. **
  1380. ** Function BTA_DmGetConnectionState
  1381. **
  1382. ** Description Returns whether the remote device is currently connected.
  1383. **
  1384. ** Returns 0 if the device is NOT connected.
  1385. **
  1386. *******************************************************************************/
  1387. extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
  1388. /*******************************************************************************
  1389. **
  1390. ** Function BTA_DmSetLocalDiRecord
  1391. **
  1392. ** Description This function adds a DI record to the local SDP database.
  1393. **
  1394. ** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
  1395. **
  1396. *******************************************************************************/
  1397. extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
  1398. UINT32 *p_handle );
  1399. /*******************************************************************************
  1400. **
  1401. **
  1402. ** Function BTA_DmCloseACL
  1403. **
  1404. ** Description This function force to close an ACL connection and remove the
  1405. ** device from the security database list of known devices.
  1406. **
  1407. ** Parameters: bd_addr - Address of the peer device
  1408. ** remove_dev - remove device or not after link down
  1409. ** transport - which transport to close
  1410. **
  1411. ** Returns void.
  1412. **
  1413. *******************************************************************************/
  1414. extern void BTA_DmCloseACL(BD_ADDR bd_addr, BOOLEAN remove_dev, tBTA_TRANSPORT transport);
  1415. /*******************************************************************************
  1416. **
  1417. ** Function bta_dmexecutecallback
  1418. **
  1419. ** Description This function will request BTA to execute a call back in the context of BTU task
  1420. ** This API was named in lower case because it is only intended
  1421. ** for the internal customers(like BTIF).
  1422. **
  1423. ** Returns void
  1424. **
  1425. *******************************************************************************/
  1426. extern void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK *p_callback, void *p_param);
  1427. #if (BTM_SCO_HCI_INCLUDED == TRUE)
  1428. /*******************************************************************************
  1429. **
  1430. ** Function BTA_DmPcmInitSamples
  1431. **
  1432. ** Description initialize the down sample converter.
  1433. **
  1434. ** src_sps: original samples per second (source audio data)
  1435. ** (ex. 44100, 48000)
  1436. ** bits: number of bits per pcm sample (16)
  1437. ** n_channels: number of channels (i.e. mono(1), stereo(2)...)
  1438. **
  1439. ** Returns none
  1440. **
  1441. *******************************************************************************/
  1442. extern void BTA_DmPcmInitSamples (UINT32 src_sps, UINT32 bits, UINT32 n_channels);
  1443. /**************************************************************************************
  1444. ** Function BTA_DmPcmResample
  1445. **
  1446. ** Description Down sampling utility to convert higher sampling rate into 8K/16bits
  1447. ** PCM samples.
  1448. **
  1449. ** Parameters p_src: pointer to the buffer where the original sampling PCM
  1450. ** are stored.
  1451. ** in_bytes: Length of the input PCM sample buffer in byte.
  1452. ** p_dst: pointer to the buffer which is to be used to store
  1453. ** the converted PCM samples.
  1454. **
  1455. **
  1456. ** Returns INT32: number of samples converted.
  1457. **
  1458. **************************************************************************************/
  1459. extern INT32 BTA_DmPcmResample (void *p_src, UINT32 in_bytes, void *p_dst);
  1460. #endif
  1461. #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
  1462. /* BLE related API functions */
  1463. /*******************************************************************************
  1464. **
  1465. ** Function BTA_DmBleSecurityGrant
  1466. **
  1467. ** Description Grant security request access.
  1468. **
  1469. ** Parameters: bd_addr - BD address of the peer
  1470. ** res - security grant status.
  1471. **
  1472. ** Returns void
  1473. **
  1474. *******************************************************************************/
  1475. extern void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res);
  1476. /*******************************************************************************
  1477. **
  1478. ** Function BTA_DmBleSetBgConnType
  1479. **
  1480. ** Description This function is called to set BLE connectable mode for a
  1481. ** peripheral device.
  1482. **
  1483. ** Parameters bg_conn_type: it can be auto connection, or selective connection.
  1484. ** p_select_cback: callback function when selective connection procedure
  1485. ** is being used.
  1486. **
  1487. ** Returns void
  1488. **
  1489. *******************************************************************************/
  1490. extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_BLE_SEL_CBACK *p_select_cback);
  1491. /*******************************************************************************
  1492. **
  1493. ** Function BTA_DmBlePasskeyReply
  1494. **
  1495. ** Description Send BLE SMP passkey reply.
  1496. **
  1497. ** Parameters: bd_addr - BD address of the peer
  1498. ** accept - passkey entry sucessful or declined.
  1499. ** passkey - passkey value, must be a 6 digit number,
  1500. ** can be lead by 0.
  1501. **
  1502. ** Returns void
  1503. **
  1504. *******************************************************************************/
  1505. extern void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, BOOLEAN accept, UINT32 passkey);
  1506. /*******************************************************************************
  1507. **
  1508. ** Function BTA_DmBleConfirmReply
  1509. **
  1510. ** Description Send BLE SMP SC user confirmation reply.
  1511. **
  1512. ** Parameters: bd_addr - BD address of the peer
  1513. ** accept - numbers to compare are the same or different.
  1514. **
  1515. ** Returns void
  1516. **
  1517. *******************************************************************************/
  1518. extern void BTA_DmBleConfirmReply(BD_ADDR bd_addr, BOOLEAN accept);
  1519. /*******************************************************************************
  1520. **
  1521. ** Function BTA_DmAddBleDevice
  1522. **
  1523. ** Description Add a BLE device. This function will be normally called
  1524. ** during host startup to restore all required information
  1525. ** for a LE device stored in the NVRAM.
  1526. **
  1527. ** Parameters: bd_addr - BD address of the peer
  1528. ** dev_type - Remote device's device type.
  1529. ** addr_type - LE device address type.
  1530. **
  1531. ** Returns void
  1532. **
  1533. *******************************************************************************/
  1534. extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type,
  1535. tBT_DEVICE_TYPE dev_type);
  1536. /*******************************************************************************
  1537. **
  1538. ** Function BTA_DmAddBleKey
  1539. **
  1540. ** Description Add/modify LE device information. This function will be
  1541. ** normally called during host startup to restore all required
  1542. ** information stored in the NVRAM.
  1543. **
  1544. ** Parameters: bd_addr - BD address of the peer
  1545. ** p_le_key - LE key values.
  1546. ** key_type - LE SMP key type.
  1547. **
  1548. ** Returns void
  1549. **
  1550. *******************************************************************************/
  1551. extern void BTA_DmAddBleKey (BD_ADDR bd_addr,
  1552. tBTA_LE_KEY_VALUE *p_le_key,
  1553. tBTA_LE_KEY_TYPE key_type);
  1554. /*******************************************************************************
  1555. **
  1556. ** Function BTA_DmSetBlePrefConnParams
  1557. **
  1558. ** Description This function is called to set the preferred connection
  1559. ** parameters when default connection parameter is not desired.
  1560. **
  1561. ** Parameters: bd_addr - BD address of the peripheral
  1562. ** min_conn_int - minimum preferred connection interval
  1563. ** max_conn_int - maximum preferred connection interval
  1564. ** slave_latency - preferred slave latency
  1565. ** supervision_tout - preferred supervision timeout
  1566. **
  1567. **
  1568. ** Returns void
  1569. **
  1570. *******************************************************************************/
  1571. extern void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
  1572. UINT16 min_conn_int, UINT16 max_conn_int,
  1573. UINT16 slave_latency, UINT16 supervision_tout );
  1574. /*******************************************************************************
  1575. **
  1576. ** Function BTA_DmSetBleConnScanParams
  1577. **
  1578. ** Description This function is called to set scan parameters used in
  1579. ** BLE connection request
  1580. **
  1581. ** Parameters: scan_interval - scan interval
  1582. ** scan_window - scan window
  1583. **
  1584. ** Returns void
  1585. **
  1586. *******************************************************************************/
  1587. extern void BTA_DmSetBleConnScanParams(UINT32 scan_interval,
  1588. UINT32 scan_window);
  1589. /*******************************************************************************
  1590. **
  1591. ** Function BTA_DmSetBleScanParams
  1592. **
  1593. ** Description This function is called to set scan parameters
  1594. **
  1595. ** Parameters: client_if - Client IF
  1596. ** scan_interval - scan interval
  1597. ** scan_window - scan window
  1598. ** scan_mode - scan mode
  1599. ** scan_param_setup_status_cback - Set scan param status callback
  1600. **
  1601. ** Returns void
  1602. **
  1603. *******************************************************************************/
  1604. extern void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval,
  1605. UINT32 scan_window, tBLE_SCAN_MODE scan_mode,
  1606. tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_status_cback);
  1607. /*******************************************************************************
  1608. **
  1609. ** Function BTA_DmSetBleScanFilterParams
  1610. **
  1611. ** Description This function is called to set scan parameters
  1612. **
  1613. ** Parameters: client_if - Client IF
  1614. ** scan_interval - scan interval
  1615. ** scan_window - scan window
  1616. ** scan_mode - scan mode
  1617. ** scan_param_setup_status_cback - Set scan param status callback
  1618. **
  1619. ** Returns void
  1620. **
  1621. *******************************************************************************/
  1622. extern void BTA_DmSetBleScanFilterParams(tGATT_IF client_if, UINT32 scan_interval,
  1623. UINT32 scan_window, tBLE_SCAN_MODE scan_mode, UINT8 scan_fil_poilcy,
  1624. UINT8 addr_type_own, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback);
  1625. /*******************************************************************************
  1626. **
  1627. ** Function BTA_DmSetBleAdvParams
  1628. **
  1629. ** Description This function sets the advertising parameters BLE functionality.
  1630. ** It is to be called when device act in peripheral or broadcaster
  1631. ** role.
  1632. **
  1633. ** Parameters: adv_int_min - adv interval minimum
  1634. ** adv_int_max - adv interval max
  1635. ** p_dir_bda - directed adv initator address
  1636. **
  1637. ** Returns void
  1638. **
  1639. *******************************************************************************/
  1640. extern void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max,
  1641. tBLE_BD_ADDR *p_dir_bda);
  1642. extern void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max,
  1643. UINT8 adv_type, tBLE_ADDR_TYPE addr_type_own,
  1644. tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP adv_fil_pol,
  1645. tBLE_BD_ADDR *p_dir_bda, tBTA_START_ADV_CMPL_CBACK p_start_adv_cb);
  1646. /*******************************************************************************
  1647. **
  1648. ** Function BTA_DmSearchExt
  1649. **
  1650. ** Description This function searches for peer Bluetooth devices. It performs
  1651. ** an inquiry and gets the remote name for devices. Service
  1652. ** discovery is done if services is non zero
  1653. **
  1654. ** Parameters p_dm_inq: inquiry conditions
  1655. ** services: if service is not empty, service discovery will be done.
  1656. ** for all GATT based service condition, put num_uuid, and
  1657. ** p_uuid is the pointer to the list of UUID values.
  1658. ** p_cback: callback functino when search is completed.
  1659. **
  1660. **
  1661. **
  1662. ** Returns void
  1663. **
  1664. *******************************************************************************/
  1665. extern void BTA_DmSearchExt(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK_EXT *p_services,
  1666. tBTA_DM_SEARCH_CBACK *p_cback);
  1667. /*******************************************************************************
  1668. **
  1669. ** Function BTA_DmDiscoverExt
  1670. **
  1671. ** Description This function does service discovery for services of a
  1672. ** peer device. When services.num_uuid is 0, it indicates all
  1673. ** GATT based services are to be searched; other wise a list of
  1674. ** UUID of interested services should be provided through
  1675. ** services.p_uuid.
  1676. **
  1677. **
  1678. **
  1679. ** Returns void
  1680. **
  1681. *******************************************************************************/
  1682. extern void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
  1683. tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search);
  1684. /*******************************************************************************
  1685. **
  1686. ** Function BTA_DmDiscoverByTransport
  1687. **
  1688. ** Description This function does service discovery on particular transport
  1689. ** for services of a
  1690. ** peer device. When services.num_uuid is 0, it indicates all
  1691. ** GATT based services are to be searched; other wise a list of
  1692. ** UUID of interested services should be provided through
  1693. ** p_services->p_uuid.
  1694. **
  1695. **
  1696. **
  1697. ** Returns void
  1698. **
  1699. *******************************************************************************/
  1700. extern void BTA_DmDiscoverByTransport(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
  1701. tBTA_DM_SEARCH_CBACK *p_cback, BOOLEAN sdp_search,
  1702. tBTA_TRANSPORT transport);
  1703. /*******************************************************************************
  1704. **
  1705. ** Function BTA_DmSetEncryption
  1706. **
  1707. ** Description This function is called to ensure that connection is
  1708. ** encrypted. Should be called only on an open connection.
  1709. ** Typically only needed for connections that first want to
  1710. ** bring up unencrypted links, then later encrypt them.
  1711. **
  1712. ** Parameters: bd_addr - Address of the peer device
  1713. ** transport - transport of the link to be encruypted
  1714. ** p_callback - Pointer to callback function to indicat the
  1715. ** link encryption status
  1716. ** sec_act - This is the security action to indicate
  1717. ** what knid of BLE security level is required for
  1718. ** the BLE link if the BLE is supported
  1719. ** Note: This parameter is ignored for the BR/EDR link
  1720. ** or the BLE is not supported
  1721. **
  1722. ** Returns void
  1723. **
  1724. **
  1725. *******************************************************************************/
  1726. extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport,
  1727. tBTA_DM_ENCRYPT_CBACK *p_callback,
  1728. tBTA_DM_BLE_SEC_ACT sec_act);
  1729. /*******************************************************************************
  1730. **
  1731. ** Function BTA_DmBleObserve
  1732. **
  1733. ** Description This procedure keep the device listening for advertising
  1734. ** events from a broadcast device.
  1735. **
  1736. ** Parameters start: start or stop observe.
  1737. ** duration : Duration of the scan. Continuous scan if 0 is passed
  1738. ** p_results_cb: Callback to be called with scan results
  1739. **
  1740. ** Returns void
  1741. **
  1742. *******************************************************************************/
  1743. extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration,
  1744. tBTA_DM_SEARCH_CBACK *p_results_cb,
  1745. tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb);
  1746. extern void BTA_DmBleStopAdvertising(void);
  1747. extern void BTA_DmSetRandAddress(BD_ADDR rand_addr);
  1748. #endif
  1749. #if BLE_INCLUDED == TRUE
  1750. // btla-specific --
  1751. /*******************************************************************************
  1752. **
  1753. ** Function BTA_DmBleConfigLocalPrivacy
  1754. **
  1755. ** Description Enable/disable privacy on the local device
  1756. **
  1757. ** Parameters: privacy_enable - enable/disabe privacy on remote device.
  1758. **
  1759. ** Returns void
  1760. **
  1761. *******************************************************************************/
  1762. extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable);
  1763. /*******************************************************************************
  1764. **
  1765. ** Function BTA_DmBleEnableRemotePrivacy
  1766. **
  1767. ** Description Enable/disable privacy on a remote device
  1768. **
  1769. ** Parameters: bd_addr - BD address of the peer
  1770. ** privacy_enable - enable/disabe privacy on remote device.
  1771. **
  1772. ** Returns void
  1773. **
  1774. *******************************************************************************/
  1775. extern void BTA_DmBleEnableRemotePrivacy(BD_ADDR bd_addr, BOOLEAN privacy_enable);
  1776. /*******************************************************************************
  1777. **
  1778. ** Function BTA_DmBleSetAdvConfig
  1779. **
  1780. ** Description This function is called to override the BTA default ADV parameters.
  1781. **
  1782. ** Parameters Pointer to User defined ADV data structure
  1783. **
  1784. ** Returns None
  1785. **
  1786. *******************************************************************************/
  1787. extern void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask,
  1788. tBTA_BLE_ADV_DATA *p_adv_cfg,
  1789. tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
  1790. /*******************************************************************************
  1791. **
  1792. ** Function BTA_DmBleSetAdvConfigRaw
  1793. **
  1794. ** Description This function is called to set raw Advertising data
  1795. **
  1796. ** Parameters p_raw_adv : raw advertising data.
  1797. ** raw_adv_len : raw advertising data length.
  1798. ** p_adv_data_cback : set adv data complete callback.
  1799. **
  1800. ** Returns None
  1801. **
  1802. *******************************************************************************/
  1803. extern void BTA_DmBleSetAdvConfigRaw (UINT8 *p_raw_adv, UINT32 raw_adv_len,
  1804. tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
  1805. /*******************************************************************************
  1806. **
  1807. ** Function BTA_DmBleSetScanRsp
  1808. **
  1809. ** Description This function is called to override the BTA scan response.
  1810. **
  1811. ** Parameters Pointer to User defined ADV data structure
  1812. **
  1813. ** Returns None
  1814. **
  1815. *******************************************************************************/
  1816. extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask,
  1817. tBTA_BLE_ADV_DATA *p_adv_cfg,
  1818. tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
  1819. /*******************************************************************************
  1820. **
  1821. ** Function BTA_DmBleSetScanRspRaw
  1822. **
  1823. ** Description This function is called to set raw scan response data
  1824. **
  1825. ** Parameters p_raw_scan_rsp : raw scan_rspertising data.
  1826. ** raw_scan_rsp_len : raw scan_rspertising data length.
  1827. ** p_scan_rsp_data_cback : set scan_rsp data complete callback.
  1828. **
  1829. ** Returns None
  1830. **
  1831. *******************************************************************************/
  1832. extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
  1833. tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback);
  1834. /*******************************************************************************
  1835. **
  1836. ** Function BTA_DmBleBroadcast
  1837. **
  1838. ** Description This function starts or stops LE broadcasting.
  1839. **
  1840. ** Parameters start: start or stop broadcast.
  1841. ** p_start_stop_adv_cb: stop broadcast completed event
  1842. **
  1843. ** Returns None
  1844. **
  1845. *******************************************************************************/
  1846. extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p_start_stop_adv_cb);
  1847. /*******************************************************************************
  1848. **
  1849. ** Function BTA_BleEnableAdvInstance
  1850. **
  1851. ** Description This function enables the Multi ADV instance feature
  1852. **
  1853. ** Parameters p_params Pointer to ADV param user defined structure
  1854. ** p_cback Pointer to Multi ADV callback structure
  1855. ** p_ref - Reference pointer
  1856. **
  1857. ** Returns None
  1858. **
  1859. *******************************************************************************/
  1860. extern void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
  1861. tBTA_BLE_MULTI_ADV_CBACK *p_cback, void *p_ref);
  1862. /*******************************************************************************
  1863. **
  1864. ** Function BTA_BleUpdateAdvInstParam
  1865. **
  1866. ** Description This function updates the Multi ADV instance params
  1867. **
  1868. ** Parameters inst_id Instance ID
  1869. ** p_params Pointer to ADV param user defined structure
  1870. **
  1871. ** Returns None
  1872. **
  1873. *******************************************************************************/
  1874. extern void BTA_BleUpdateAdvInstParam (UINT8 inst_id,
  1875. tBTA_BLE_ADV_PARAMS *p_params);
  1876. /*******************************************************************************
  1877. **
  1878. ** Function BTA_BleCfgAdvInstData
  1879. **
  1880. ** Description This function is called to configure the ADV instance data
  1881. **
  1882. ** Parameters inst_id - Instance ID
  1883. ** is_scan_rsp - Boolean value Scan response
  1884. ** Pointer to User defined ADV data structure
  1885. ** Returns None
  1886. **
  1887. *******************************************************************************/
  1888. extern void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
  1889. tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_data);
  1890. /*******************************************************************************
  1891. **
  1892. ** Function BTA_BleDisableAdvInstance
  1893. **
  1894. ** Description This function is called to disable the ADV instance
  1895. **
  1896. ** Parameters inst_id - Instance ID to be disabled
  1897. **
  1898. ** Returns None
  1899. **
  1900. *******************************************************************************/
  1901. extern void BTA_BleDisableAdvInstance(UINT8 inst_id);
  1902. /*******************************************************************************
  1903. **
  1904. ** Function BTA_DmBleUpdateConnectionParams
  1905. **
  1906. ** Description Update connection parameters, can only be used when connection is up.
  1907. **
  1908. ** Parameters: bd_addr - BD address of the peer
  1909. ** min_int - minimum connection interval, [0x0004~ 0x4000]
  1910. ** max_int - maximum connection interval, [0x0004~ 0x4000]
  1911. ** latency - slave latency [0 ~ 500]
  1912. ** timeout - supervision timeout [0x000a ~ 0xc80]
  1913. **
  1914. ** Returns void
  1915. **
  1916. *******************************************************************************/
  1917. extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
  1918. UINT16 max_int, UINT16 latency, UINT16 timeout);
  1919. /*******************************************************************************
  1920. **
  1921. ** Function BTA_DmBleSetDataLength
  1922. **
  1923. ** Description This function is to set maximum LE data packet size
  1924. **
  1925. ** Returns void
  1926. **
  1927. *******************************************************************************/
  1928. extern void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length);
  1929. /*******************************************************************************
  1930. **
  1931. ** Function BTA_DmBleSetStorageParams
  1932. **
  1933. ** Description This function is called to set the storage parameters
  1934. **
  1935. ** Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning
  1936. ** batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning
  1937. ** batch_scan_notify_threshold - Setup notification level based on total space
  1938. ** consumed by both pools. Setting it to 0 will disable threshold notification
  1939. ** p_setup_cback - Setup callback
  1940. ** p_thres_cback - Threshold callback
  1941. ** p_rep_cback - Reports callback
  1942. ** ref_value - Reference value
  1943. **
  1944. ** Returns None
  1945. **
  1946. *******************************************************************************/
  1947. extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max,
  1948. UINT8 batch_scan_trunc_max,
  1949. UINT8 batch_scan_notify_threshold,
  1950. tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback,
  1951. tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback,
  1952. tBTA_BLE_SCAN_REP_CBACK *p_rep_cback,
  1953. tBTA_DM_BLE_REF_VALUE ref_value);
  1954. /*******************************************************************************
  1955. **
  1956. ** Function BTA_DmBleEnableBatchScan
  1957. **
  1958. ** Description This function is called to enable the batch scan
  1959. **
  1960. ** Parameters scan_mode -Batch scan mode
  1961. ** scan_interval - Scan interval
  1962. ** scan_window - Scan window
  1963. ** discard_rule -Discard rules
  1964. ** addr_type - Address type
  1965. ** ref_value - Reference value
  1966. **
  1967. ** Returns None
  1968. **
  1969. *******************************************************************************/
  1970. extern void BTA_DmBleEnableBatchScan(tBTA_BLE_BATCH_SCAN_MODE scan_mode,
  1971. UINT32 scan_interval, UINT32 scan_window,
  1972. tBTA_BLE_DISCARD_RULE discard_rule,
  1973. tBLE_ADDR_TYPE addr_type,
  1974. tBTA_DM_BLE_REF_VALUE ref_value);
  1975. /*******************************************************************************
  1976. **
  1977. ** Function BTA_DmBleReadScanReports
  1978. **
  1979. ** Description This function is called to read the batch scan reports
  1980. **
  1981. ** Parameters scan_mode -Batch scan mode
  1982. ** ref_value - Reference value
  1983. **
  1984. ** Returns None
  1985. **
  1986. *******************************************************************************/
  1987. extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type,
  1988. tBTA_DM_BLE_REF_VALUE ref_value);
  1989. /*******************************************************************************
  1990. **
  1991. ** Function BTA_DmBleDisableBatchScan
  1992. **
  1993. ** Description This function is called to disable the batch scanning
  1994. **
  1995. ** Parameters ref_value - Reference value
  1996. **
  1997. ** Returns None
  1998. **
  1999. *******************************************************************************/
  2000. extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value);
  2001. /*******************************************************************************
  2002. **
  2003. ** Function BTA_DmEnableScanFilter
  2004. **
  2005. ** Description This function is called to enable the adv data payload filter
  2006. **
  2007. ** Parameters action - enable or disable the APCF feature
  2008. ** p_cmpl_cback - Command completed callback
  2009. ** ref_value - Reference value
  2010. **
  2011. ** Returns void
  2012. **
  2013. *******************************************************************************/
  2014. extern void BTA_DmEnableScanFilter(UINT8 action,
  2015. tBTA_DM_BLE_PF_STATUS_CBACK *p_cmpl_cback,
  2016. tBTA_DM_BLE_REF_VALUE ref_value);
  2017. /*******************************************************************************
  2018. **
  2019. ** Function BTA_DmBleScanFilterSetup
  2020. **
  2021. ** Description This function is called to setup the filter params
  2022. **
  2023. ** Parameters p_target: enable the filter condition on a target device; if NULL
  2024. ** filt_index - Filter index
  2025. ** p_filt_params -Filter parameters
  2026. ** ref_value - Reference value
  2027. ** action - Add, delete or clear
  2028. ** p_cmpl_back - Command completed callback
  2029. **
  2030. ** Returns void
  2031. **
  2032. *******************************************************************************/
  2033. extern void BTA_DmBleScanFilterSetup(UINT8 action,
  2034. tBTA_DM_BLE_PF_FILT_INDEX filt_index,
  2035. tBTA_DM_BLE_PF_FILT_PARAMS *p_filt_params,
  2036. tBLE_BD_ADDR *p_target,
  2037. tBTA_DM_BLE_PF_PARAM_CBACK *p_cmpl_cback,
  2038. tBTA_DM_BLE_REF_VALUE ref_value);
  2039. /*******************************************************************************
  2040. **
  2041. ** Function BTA_DmBleCfgFilterCondition
  2042. **
  2043. ** Description This function is called to configure the adv data payload filter
  2044. ** condition.
  2045. **
  2046. ** Parameters action: to read/write/clear
  2047. ** cond_type: filter condition type
  2048. ** filt_index - Filter index
  2049. ** p_cond: filter condition parameter
  2050. ** p_cmpl_back - Command completed callback
  2051. ** ref_value - Reference value
  2052. **
  2053. ** Returns void
  2054. **
  2055. *******************************************************************************/
  2056. extern void BTA_DmBleCfgFilterCondition(tBTA_DM_BLE_SCAN_COND_OP action,
  2057. tBTA_DM_BLE_PF_COND_TYPE cond_type,
  2058. tBTA_DM_BLE_PF_FILT_INDEX filt_index,
  2059. tBTA_DM_BLE_PF_COND_PARAM *p_cond,
  2060. tBTA_DM_BLE_PF_CFG_CBACK *p_cmpl_cback,
  2061. tBTA_DM_BLE_REF_VALUE ref_value);
  2062. /*******************************************************************************
  2063. **
  2064. ** Function BTA_DmBleTrackAdvertiser
  2065. **
  2066. ** Description This function is called to track the advertiser
  2067. **
  2068. ** Parameters ref_value - Reference value
  2069. ** p_track_adv_cback - ADV callback
  2070. **
  2071. ** Returns None
  2072. **
  2073. *******************************************************************************/
  2074. extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value,
  2075. tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback);
  2076. /*******************************************************************************
  2077. **
  2078. ** Function BTA_DmBleGetEnergyInfo
  2079. **
  2080. ** Description This function is called to obtain the energy info
  2081. **
  2082. ** Parameters p_cmpl_cback - Command complete callback
  2083. **
  2084. ** Returns void
  2085. **
  2086. *******************************************************************************/
  2087. extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK *p_cmpl_cback);
  2088. /*******************************************************************************
  2089. **
  2090. ** Function BTA_BrcmInit
  2091. **
  2092. ** Description This function initializes Broadcom specific VS handler in BTA
  2093. **
  2094. ** Returns void
  2095. **
  2096. *******************************************************************************/
  2097. extern void BTA_VendorInit (void);
  2098. /*******************************************************************************
  2099. **
  2100. ** Function BTA_BrcmCleanup
  2101. **
  2102. ** Description This function frees up Broadcom specific VS specific dynamic memory
  2103. **
  2104. ** Returns void
  2105. **
  2106. *******************************************************************************/
  2107. extern void BTA_VendorCleanup (void);
  2108. #endif
  2109. #ifdef __cplusplus
  2110. }
  2111. #endif
  2112. #endif /* BTA_API_H */