btm_ble_api.h 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 1999-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This file contains the Bluetooth Manager (BTM) API function external
  21. * definitions.
  22. *
  23. ******************************************************************************/
  24. #ifndef BTM_BLE_API_H
  25. #define BTM_BLE_API_H
  26. #include "common/bt_defs.h"
  27. #include "stack/btm_api.h"
  28. #include "common/bt_common_types.h"
  29. #define CHANNEL_MAP_LEN 5
  30. typedef UINT8 tBTM_BLE_CHNL_MAP[CHANNEL_MAP_LEN];
  31. /* 0x00-0x04 only used for set advertising parameter command */
  32. #define BTM_BLE_CONNECT_EVT 0x00 /* 0x00-0x04 only used for set advertising
  33. parameter command */
  34. #define BTM_BLE_CONNECT_DIR_EVT 0x01 /* Connectable directed advertising */
  35. #define BTM_BLE_DISCOVER_EVT 0x02 /* Scannable undirected advertising */
  36. #define BTM_BLE_NON_CONNECT_EVT 0x03 /* Non connectable undirected advertising */
  37. #define BTM_BLE_CONNECT_LO_DUTY_DIR_EVT 0x04 /* Connectable low duty
  38. cycle directed advertising */
  39. /* 0x00 - 0x05 can be received on adv event type */
  40. #define BTM_BLE_SCAN_RSP_EVT 0x04
  41. #define BTM_BLE_SCAN_REQ_EVT 0x05
  42. #define BTM_BLE_UNKNOWN_EVT 0xff
  43. #define BTM_BLE_UNKNOWN_EVT 0xff
  44. typedef UINT8 tBTM_BLE_EVT;
  45. typedef UINT8 tBTM_BLE_CONN_MODE;
  46. typedef UINT32 tBTM_BLE_REF_VALUE;
  47. #define BTM_BLE_SCAN_MODE_PASS 0
  48. #define BTM_BLE_SCAN_MODE_ACTI 1
  49. #define BTM_BLE_SCAN_MODE_NONE 0xff
  50. typedef UINT8 tBLE_SCAN_MODE;
  51. #define BTM_BLE_BATCH_SCAN_MODE_DISABLE 0
  52. #define BTM_BLE_BATCH_SCAN_MODE_PASS 1
  53. #define BTM_BLE_BATCH_SCAN_MODE_ACTI 2
  54. #define BTM_BLE_BATCH_SCAN_MODE_PASS_ACTI 3
  55. typedef UINT8 tBTM_BLE_BATCH_SCAN_MODE;
  56. /* advertising channel map */
  57. #define BTM_BLE_ADV_CHNL_37 (0x01 << 0)
  58. #define BTM_BLE_ADV_CHNL_38 (0x01 << 1)
  59. #define BTM_BLE_ADV_CHNL_39 (0x01 << 2)
  60. typedef UINT8 tBTM_BLE_ADV_CHNL_MAP;
  61. /*d efault advertising channel map */
  62. #ifndef BTM_BLE_DEFAULT_ADV_CHNL_MAP
  63. #define BTM_BLE_DEFAULT_ADV_CHNL_MAP (BTM_BLE_ADV_CHNL_37| BTM_BLE_ADV_CHNL_38| BTM_BLE_ADV_CHNL_39)
  64. #endif
  65. /* advertising filter policy */
  66. #define AP_SCAN_CONN_ALL 0x00 /* default */
  67. #define AP_SCAN_WL_CONN_ALL 0x01
  68. #define AP_SCAN_ALL_CONN_WL 0x02
  69. #define AP_SCAN_CONN_WL 0x03
  70. #define AP_SCAN_CONN_POLICY_MAX 0x04
  71. typedef UINT8 tBTM_BLE_AFP;
  72. /* default advertising filter policy */
  73. #ifndef BTM_BLE_DEFAULT_AFP
  74. #define BTM_BLE_DEFAULT_AFP AP_SCAN_CONN_ALL
  75. #endif
  76. /* scanning filter policy */
  77. #define SP_ADV_ALL 0x00 /* 0: accept adv packet from all, directed adv pkt not directed */
  78. /* to local device is ignored */
  79. #define SP_ADV_WL 0x01 /* 1: accept adv packet from device in white list, directed adv */
  80. /* packet not directed to local device is ignored */
  81. #define SP_ADV_ALL_RPA_DIR_ADV 0x02 /* 2: accept adv packet from all, directed adv pkt */
  82. /* not directed to me is ignored except direct adv with RPA */
  83. #define SP_ADV_WL_RPA_DIR_ADV 0x03 /* 3: accept adv packet from device in white list, directed */
  84. /* adv pkt not directed to me is ignored except direct adv */
  85. /* with RPA */
  86. typedef UINT8 tBTM_BLE_SFP;
  87. #ifndef BTM_BLE_DEFAULT_SFP
  88. #define BTM_BLE_DEFAULT_SFP SP_ADV_ALL
  89. #endif
  90. /* adv parameter boundary values */
  91. #define BTM_BLE_ADV_INT_MIN 0x0020
  92. #define BTM_BLE_ADV_INT_MAX 0x4000
  93. /* Full scan boundary values */
  94. #define BTM_BLE_ADV_SCAN_FULL_MIN 0x00
  95. #define BTM_BLE_ADV_SCAN_FULL_MAX 0x64
  96. /* Partial scan boundary values */
  97. #define BTM_BLE_ADV_SCAN_TRUNC_MIN BTM_BLE_ADV_SCAN_FULL_MIN
  98. #define BTM_BLE_ADV_SCAN_TRUNC_MAX BTM_BLE_ADV_SCAN_FULL_MAX
  99. /* Threshold values */
  100. #define BTM_BLE_ADV_SCAN_THR_MIN BTM_BLE_ADV_SCAN_FULL_MIN
  101. #define BTM_BLE_ADV_SCAN_THR_MAX BTM_BLE_ADV_SCAN_FULL_MAX
  102. /* connection parameter boundary values */
  103. #define BTM_BLE_SCAN_INT_MIN 0x0004
  104. #define BTM_BLE_SCAN_INT_MAX 0x4000
  105. #define BTM_BLE_SCAN_WIN_MIN 0x0004
  106. #define BTM_BLE_SCAN_WIN_MAX 0x4000
  107. #define BTM_BLE_EXT_SCAN_INT_MAX 0x00FFFFFF
  108. #define BTM_BLE_EXT_SCAN_WIN_MAX 0xFFFF
  109. #define BTM_BLE_CONN_INT_MIN 0x0006
  110. #define BTM_BLE_CONN_INT_MAX 0x0C80
  111. #define BTM_BLE_CONN_LATENCY_MAX 500
  112. #define BTM_BLE_CONN_SUP_TOUT_MIN 0x000A
  113. #define BTM_BLE_CONN_SUP_TOUT_MAX 0x0C80
  114. #define BTM_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */
  115. #define BTM_BLE_SCAN_PARAM_UNDEF 0xffffffff
  116. /* default connection parameters if not configured, use GAP recommend value for auto/selective connection */
  117. /* default scan interval */
  118. #ifndef BTM_BLE_SCAN_FAST_INT
  119. #define BTM_BLE_SCAN_FAST_INT 96 /* 30 ~ 60 ms (use 60) = 96 *0.625 */
  120. #endif
  121. /* default scan window for background connection, applicable for auto connection or selective conenction */
  122. #ifndef BTM_BLE_SCAN_FAST_WIN
  123. #define BTM_BLE_SCAN_FAST_WIN 48 /* 30 ms = 48 *0.625 */
  124. #endif
  125. /* default scan paramter used in reduced power cycle (background scanning) */
  126. #ifndef BTM_BLE_SCAN_SLOW_INT_1
  127. #define BTM_BLE_SCAN_SLOW_INT_1 2048 /* 1.28 s = 2048 *0.625 */
  128. #endif
  129. #ifndef BTM_BLE_SCAN_SLOW_WIN_1
  130. #define BTM_BLE_SCAN_SLOW_WIN_1 48 /* 30 ms = 48 *0.625 */
  131. #endif
  132. /* default scan paramter used in reduced power cycle (background scanning) */
  133. #ifndef BTM_BLE_SCAN_SLOW_INT_2
  134. #define BTM_BLE_SCAN_SLOW_INT_2 4096 /* 2.56 s = 4096 *0.625 */
  135. #endif
  136. #ifndef BTM_BLE_SCAN_SLOW_WIN_2
  137. #define BTM_BLE_SCAN_SLOW_WIN_2 36 /* 22.5 ms = 36 *0.625 */
  138. #endif
  139. /* default connection interval min */
  140. #ifndef BTM_BLE_CONN_INT_MIN_DEF
  141. #define BTM_BLE_CONN_INT_MIN_DEF 10 /* recommended min: 12.5 ms = 10 * 1.25 */
  142. #endif
  143. /* default connection interval max */
  144. #ifndef BTM_BLE_CONN_INT_MAX_DEF
  145. #define BTM_BLE_CONN_INT_MAX_DEF 12 /* recommended max: 15 ms = 12 * 1.25 */
  146. #endif
  147. /* default slave latency */
  148. #ifndef BTM_BLE_CONN_SLAVE_LATENCY_DEF
  149. #define BTM_BLE_CONN_SLAVE_LATENCY_DEF 0 /* 0 */
  150. #endif
  151. /* default supervision timeout */
  152. #ifndef BTM_BLE_CONN_TIMEOUT_DEF
  153. #define BTM_BLE_CONN_TIMEOUT_DEF 600
  154. #endif
  155. /* minimum acceptable connection interval */
  156. #ifndef BTM_BLE_CONN_INT_MIN_LIMIT
  157. #define BTM_BLE_CONN_INT_MIN_LIMIT 0x0009
  158. #endif
  159. #define BTM_BLE_DIR_CONN_FALLBACK_UNDIR 1
  160. #define BTM_BLE_DIR_CONN_FALLBACK_NO_ADV 2
  161. #ifndef BTM_BLE_DIR_CONN_FALLBACK
  162. #define BTM_BLE_DIR_CONN_FALLBACK BTM_BLE_DIR_CONN_FALLBACK_UNDIR
  163. #endif
  164. #define BTM_CMAC_TLEN_SIZE 8 /* 64 bits */
  165. #define BTM_BLE_AUTH_SIGN_LEN 12 /* BLE data signature length 8 Bytes + 4 bytes counter*/
  166. typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN]; /* Device address */
  167. #ifndef BTM_BLE_HOST_SUPPORT
  168. #define BTM_BLE_HOST_SUPPORT 0x01
  169. #endif
  170. #ifndef BTM_BLE_SIMULTANEOUS_HOST
  171. #define BTM_BLE_SIMULTANEOUS_HOST 0x01
  172. #endif
  173. /* Appearance Values Reported with BTM_BLE_AD_TYPE_APPEARANCE */
  174. #define BTM_BLE_APPEARANCE_UNKNOWN 0x0000
  175. #define BTM_BLE_APPEARANCE_GENERIC_PHONE 0x0040
  176. #define BTM_BLE_APPEARANCE_GENERIC_COMPUTER 0x0080
  177. #define BTM_BLE_APPEARANCE_GENERIC_WATCH 0x00C0
  178. #define BTM_BLE_APPEARANCE_SPORTS_WATCH 0x00C1
  179. #define BTM_BLE_APPEARANCE_GENERIC_CLOCK 0x0100
  180. #define BTM_BLE_APPEARANCE_GENERIC_DISPLAY 0x0140
  181. #define BTM_BLE_APPEARANCE_GENERIC_REMOTE 0x0180
  182. #define BTM_BLE_APPEARANCE_GENERIC_EYEGLASSES 0x01C0
  183. #define BTM_BLE_APPEARANCE_GENERIC_TAG 0x0200
  184. #define BTM_BLE_APPEARANCE_GENERIC_KEYRING 0x0240
  185. #define BTM_BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280
  186. #define BTM_BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0
  187. #define BTM_BLE_APPEARANCE_GENERIC_THERMOMETER 0x0300
  188. #define BTM_BLE_APPEARANCE_THERMOMETER_EAR 0x0301
  189. #define BTM_BLE_APPEARANCE_GENERIC_HEART_RATE 0x0340
  190. #define BTM_BLE_APPEARANCE_HEART_RATE_BELT 0x0341
  191. #define BTM_BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380
  192. #define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381
  193. #define BTM_BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382
  194. #define BTM_BLE_APPEARANCE_GENERIC_HID 0x03C0
  195. #define BTM_BLE_APPEARANCE_HID_KEYBOARD 0x03C1
  196. #define BTM_BLE_APPEARANCE_HID_MOUSE 0x03C2
  197. #define BTM_BLE_APPEARANCE_HID_JOYSTICK 0x03C3
  198. #define BTM_BLE_APPEARANCE_HID_GAMEPAD 0x03C4
  199. #define BTM_BLE_APPEARANCE_HID_DIGITIZER_TABLET 0x03C5
  200. #define BTM_BLE_APPEARANCE_HID_CARD_READER 0x03C6
  201. #define BTM_BLE_APPEARANCE_HID_DIGITAL_PEN 0x03C7
  202. #define BTM_BLE_APPEARANCE_HID_BARCODE_SCANNER 0x03C8
  203. #define BTM_BLE_APPEARANCE_GENERIC_GLUCOSE 0x0400
  204. #define BTM_BLE_APPEARANCE_GENERIC_WALKING 0x0440
  205. #define BTM_BLE_APPEARANCE_WALKING_IN_SHOE 0x0441
  206. #define BTM_BLE_APPEARANCE_WALKING_ON_SHOE 0x0442
  207. #define BTM_BLE_APPEARANCE_WALKING_ON_HIP 0x0443
  208. #define BTM_BLE_APPEARANCE_GENERIC_CYCLING 0x0480
  209. #define BTM_BLE_APPEARANCE_CYCLING_COMPUTER 0x0481
  210. #define BTM_BLE_APPEARANCE_CYCLING_SPEED 0x0482
  211. #define BTM_BLE_APPEARANCE_CYCLING_CADENCE 0x0483
  212. #define BTM_BLE_APPEARANCE_CYCLING_POWER 0x0484
  213. #define BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485
  214. #define BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40
  215. #define BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41
  216. #define BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42
  217. #define BTM_BLE_APPEARANCE_GENERIC_WEIGHT 0x0C80
  218. #define BTM_BLE_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE 0x0CC0
  219. #define BTM_BLE_APPEARANCE_POWERED_WHEELCHAIR 0x0CC1
  220. #define BTM_BLE_APPEARANCE_MOBILITY_SCOOTER 0x0CC2
  221. #define BTM_BLE_APPEARANCE_GENERIC_CONTINUOUS_GLUCOSE_MONITOR 0x0D00
  222. #define BTM_BLE_APPEARANCE_GENERIC_INSULIN_PUMP 0x0D40
  223. #define BTM_BLE_APPEARANCE_INSULIN_PUMP_DURABLE_PUMP 0x0D41
  224. #define BTM_BLE_APPEARANCE_INSULIN_PUMP_PATCH_PUMP 0x0D44
  225. #define BTM_BLE_APPEARANCE_INSULIN_PEN 0x0D48
  226. #define BTM_BLE_APPEARANCE_GENERIC_MEDICATION_DELIVERY 0x0D80
  227. #define BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS 0x1440
  228. #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION 0x1441
  229. #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV 0x1442
  230. #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD 0x1443
  231. #define BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV 0x1444
  232. /* Structure returned with Rand/Encrypt complete callback */
  233. typedef struct {
  234. UINT8 status;
  235. UINT8 param_len;
  236. UINT16 opcode;
  237. UINT8 param_buf[BT_OCTET16_LEN];
  238. } tBTM_RAND_ENC;
  239. /* General callback function for notifying an application that a synchronous
  240. ** BTM function is complete. The pointer contains the address of any returned data.
  241. */
  242. typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1);
  243. #define BTM_BLE_FILTER_TARGET_SCANNER 0x01
  244. #define BTM_BLE_FILTER_TARGET_ADVR 0x00
  245. #define BTM_BLE_POLICY_BLACK_ALL 0x00 /* relevant to both */
  246. #define BTM_BLE_POLICY_ALLOW_SCAN 0x01 /* relevant to advertiser */
  247. #define BTM_BLE_POLICY_ALLOW_CONN 0x02 /* relevant to advertiser */
  248. #define BTM_BLE_POLICY_WHITE_ALL 0x03 /* relevant to both */
  249. /* ADV data flag bit definition used for BTM_BLE_AD_TYPE_FLAG */
  250. #define BTM_BLE_LIMIT_DISC_FLAG (0x01 << 0)
  251. #define BTM_BLE_GEN_DISC_FLAG (0x01 << 1)
  252. #define BTM_BLE_BREDR_NOT_SPT (0x01 << 2)
  253. /* 4.1 spec adv flag for simultaneous BR/EDR+LE connection support */
  254. #define BTM_BLE_DMT_CONTROLLER_SPT (0x01 << 3)
  255. #define BTM_BLE_DMT_HOST_SPT (0x01 << 4)
  256. #define BTM_BLE_NON_LIMIT_DISC_FLAG (0x00 ) /* lowest bit unset */
  257. #define BTM_BLE_ADV_FLAG_MASK (BTM_BLE_LIMIT_DISC_FLAG | BTM_BLE_BREDR_NOT_SPT | BTM_BLE_GEN_DISC_FLAG)
  258. #define BTM_BLE_LIMIT_DISC_MASK (BTM_BLE_LIMIT_DISC_FLAG )
  259. #define BTM_BLE_AD_BIT_DEV_NAME (0x00000001 << 0)
  260. #define BTM_BLE_AD_BIT_FLAGS (0x00000001 << 1)
  261. #define BTM_BLE_AD_BIT_MANU (0x00000001 << 2)
  262. #define BTM_BLE_AD_BIT_TX_PWR (0x00000001 << 3)
  263. #define BTM_BLE_AD_BIT_INT_RANGE (0x00000001 << 5)
  264. #define BTM_BLE_AD_BIT_SERVICE (0x00000001 << 6)
  265. #define BTM_BLE_AD_BIT_SERVICE_SOL (0x00000001 << 7)
  266. #define BTM_BLE_AD_BIT_SERVICE_DATA (0x00000001 << 8)
  267. #define BTM_BLE_AD_BIT_SIGN_DATA (0x00000001 << 9)
  268. #define BTM_BLE_AD_BIT_SERVICE_128SOL (0x00000001 << 10)
  269. #define BTM_BLE_AD_BIT_APPEARANCE (0x00000001 << 11)
  270. #define BTM_BLE_AD_BIT_PUBLIC_ADDR (0x00000001 << 12)
  271. #define BTM_BLE_AD_BIT_RANDOM_ADDR (0x00000001 << 13)
  272. #define BTM_BLE_AD_BIT_SERVICE_32 (0x00000001 << 4)
  273. #define BTM_BLE_AD_BIT_SERVICE_32SOL (0x00000001 << 14)
  274. #define BTM_BLE_AD_BIT_PROPRIETARY (0x00000001 << 15)
  275. #define BTM_BLE_AD_BIT_SERVICE_128 (0x00000001 << 16) /*128-bit Service UUIDs*/
  276. typedef UINT32 tBTM_BLE_AD_MASK;
  277. /* relate to ESP_BLE_AD_TYPE_xxx in esp_gap_ble_api.h */
  278. #define BTM_BLE_AD_TYPE_FLAG HCI_EIR_FLAGS_TYPE /* 0x01 */
  279. #define BTM_BLE_AD_TYPE_16SRV_PART HCI_EIR_MORE_16BITS_UUID_TYPE /* 0x02 */
  280. #define BTM_BLE_AD_TYPE_16SRV_CMPL HCI_EIR_COMPLETE_16BITS_UUID_TYPE /* 0x03 */
  281. #define BTM_BLE_AD_TYPE_32SRV_PART HCI_EIR_MORE_32BITS_UUID_TYPE /* 0x04 */
  282. #define BTM_BLE_AD_TYPE_32SRV_CMPL HCI_EIR_COMPLETE_32BITS_UUID_TYPE /* 0x05 */
  283. #define BTM_BLE_AD_TYPE_128SRV_PART HCI_EIR_MORE_128BITS_UUID_TYPE /* 0x06 */
  284. #define BTM_BLE_AD_TYPE_128SRV_CMPL HCI_EIR_COMPLETE_128BITS_UUID_TYPE /* 0x07 */
  285. #define BTM_BLE_AD_TYPE_NAME_SHORT HCI_EIR_SHORTENED_LOCAL_NAME_TYPE /* 0x08 */
  286. #define BTM_BLE_AD_TYPE_NAME_CMPL HCI_EIR_COMPLETE_LOCAL_NAME_TYPE /* 0x09 */
  287. #define BTM_BLE_AD_TYPE_TX_PWR HCI_EIR_TX_POWER_LEVEL_TYPE /* 0x0A */
  288. #define BTM_BLE_AD_TYPE_DEV_CLASS 0x0D
  289. #define BTM_BLE_AD_TYPE_SM_TK 0x10
  290. #define BTM_BLE_AD_TYPE_SM_OOB_FLAG 0x11
  291. #define BTM_BLE_AD_TYPE_INT_RANGE 0x12
  292. #define BTM_BLE_AD_TYPE_SOL_SRV_UUID 0x14
  293. #define BTM_BLE_AD_TYPE_128SOL_SRV_UUID 0x15
  294. #define BTM_BLE_AD_TYPE_SERVICE_DATA 0x16
  295. #define BTM_BLE_AD_TYPE_PUBLIC_TARGET 0x17
  296. #define BTM_BLE_AD_TYPE_RANDOM_TARGET 0x18
  297. #define BTM_BLE_AD_TYPE_APPEARANCE 0x19
  298. #define BTM_BLE_AD_TYPE_ADV_INT 0x1a
  299. #define BTM_BLE_AD_TYPE_LE_DEV_ADDR 0x1b
  300. #define BTM_BLE_AD_TYPE_LE_ROLE 0x1c
  301. #define BTM_BLE_AD_TYPE_SPAIR_C256 0x1d
  302. #define BTM_BLE_AD_TYPE_SPAIR_R256 0x1e
  303. #define BTM_BLE_AD_TYPE_32SOL_SRV_UUID 0x1f
  304. #define BTM_BLE_AD_TYPE_32SERVICE_DATA 0x20
  305. #define BTM_BLE_AD_TYPE_128SERVICE_DATA 0x21
  306. #define BTM_BLE_AD_TYPE_LE_SECURE_CONFIRM 0x22
  307. #define BTM_BLE_AD_TYPE_LE_SECURE_RANDOM 0x23
  308. #define BTM_BLE_AD_TYPE_URI 0x24
  309. #define BTM_BLE_AD_TYPE_INDOOR_POSITION 0x25
  310. #define BTM_BLE_AD_TYPE_TRANS_DISC_DATA 0x26
  311. #define BTM_BLE_AD_TYPE_LE_SUPPORT_FEATURE 0x27
  312. #define BTM_BLE_AD_TYPE_CHAN_MAP_UPDATE 0x28
  313. #define BTM_BLE_AD_TYPE_MANU HCI_EIR_MANUFACTURER_SPECIFIC_TYPE /* 0xff */
  314. typedef UINT8 tBTM_BLE_AD_TYPE;
  315. /* Security settings used with L2CAP LE COC */
  316. #define BTM_SEC_LE_LINK_ENCRYPTED 0x01
  317. #define BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM 0x02
  318. #define BTM_SEC_LE_LINK_PAIRED_WITH_MITM 0x04
  319. /* Min/max Preferred number of payload octets that the local Controller
  320. should include in a single Link Layer Data Channel PDU. */
  321. #define BTM_BLE_DATA_SIZE_MAX 0x00fb
  322. #define BTM_BLE_DATA_SIZE_MIN 0x001b
  323. /* Preferred maximum number of microseconds that the local Controller
  324. should use to transmit a single Link Layer Data Channel PDU. */
  325. #define BTM_BLE_DATA_TX_TIME_MIN 0x0148
  326. #define BTM_BLE_DATA_TX_TIME_MAX 0x0848
  327. /* adv tx power level */
  328. #define BTM_BLE_ADV_TX_POWER_MIN 0 /* minimum tx power */
  329. #define BTM_BLE_ADV_TX_POWER_MAX 7 /* maximum tx power */
  330. typedef UINT8 tBTM_BLE_ADV_TX_POWER;
  331. /* adv tx power in dBm */
  332. typedef struct {
  333. UINT8 adv_inst_max; /* max adv instance supported in controller */
  334. UINT8 rpa_offloading;
  335. UINT16 tot_scan_results_strg;
  336. UINT8 max_irk_list_sz;
  337. UINT8 filter_support;
  338. UINT8 max_filter;
  339. UINT8 energy_support;
  340. BOOLEAN values_read;
  341. UINT16 version_supported;
  342. UINT16 total_trackable_advertisers;
  343. UINT8 extended_scan_support;
  344. UINT8 debug_logging_supported;
  345. } tBTM_BLE_VSC_CB;
  346. /* slave preferred connection interval range */
  347. typedef struct {
  348. UINT16 low;
  349. UINT16 hi;
  350. } tBTM_BLE_INT_RANGE;
  351. /* Service tag supported in the device */
  352. typedef struct {
  353. UINT8 num_service;
  354. BOOLEAN list_cmpl;
  355. UINT16 *p_uuid;
  356. } tBTM_BLE_SERVICE;
  357. /* 32 bits Service supported in the device */
  358. typedef struct {
  359. UINT8 num_service;
  360. BOOLEAN list_cmpl;
  361. UINT32 *p_uuid;
  362. } tBTM_BLE_32SERVICE;
  363. /* 128 bits Service supported in the device */
  364. typedef struct {
  365. BOOLEAN list_cmpl;
  366. UINT8 uuid128[MAX_UUID_SIZE];
  367. } tBTM_BLE_128SERVICE;
  368. typedef struct {
  369. UINT8 len;
  370. UINT8 *p_val;
  371. } tBTM_BLE_MANU;
  372. typedef struct {
  373. tBT_UUID service_uuid;
  374. UINT8 len;
  375. UINT8 *p_val;
  376. } tBTM_BLE_SERVICE_DATA;
  377. typedef struct {
  378. UINT8 adv_type;
  379. UINT8 len;
  380. UINT8 *p_val; /* number of len byte */
  381. } tBTM_BLE_PROP_ELEM;
  382. typedef struct {
  383. UINT8 num_elem;
  384. tBTM_BLE_PROP_ELEM *p_elem;
  385. } tBTM_BLE_PROPRIETARY;
  386. typedef struct {
  387. tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
  388. tBTM_BLE_MANU *p_manu; /* manufactuer data */
  389. tBTM_BLE_SERVICE *p_services; /* services */
  390. tBTM_BLE_128SERVICE *p_services_128b; /* 128 bits service */
  391. tBTM_BLE_32SERVICE *p_service_32b; /* 32 bits Service UUID */
  392. tBTM_BLE_SERVICE *p_sol_services; /* 16 bits services Solicitation UUIDs */
  393. tBTM_BLE_32SERVICE *p_sol_service_32b; /* List of 32 bit Service Solicitation UUIDs */
  394. tBTM_BLE_128SERVICE *p_sol_service_128b; /* List of 128 bit Service Solicitation UUIDs */
  395. tBTM_BLE_PROPRIETARY *p_proprietary;
  396. tBTM_BLE_SERVICE_DATA *p_service_data; /* service data */
  397. UINT16 appearance;
  398. UINT8 flag;
  399. UINT8 tx_power;
  400. } tBTM_BLE_ADV_DATA;
  401. #ifndef BTM_BLE_MULTI_ADV_MAX
  402. #define BTM_BLE_MULTI_ADV_MAX 16 /* controller returned adv_inst_max should be less
  403. than this number */
  404. #endif
  405. #define BTM_BLE_MULTI_ADV_INVALID 0
  406. #define BTM_BLE_MULTI_ADV_ENB_EVT 1
  407. #define BTM_BLE_MULTI_ADV_DISABLE_EVT 2
  408. #define BTM_BLE_MULTI_ADV_PARAM_EVT 3
  409. #define BTM_BLE_MULTI_ADV_DATA_EVT 4
  410. typedef UINT8 tBTM_BLE_MULTI_ADV_EVT;
  411. #define BTM_BLE_MULTI_ADV_DEFAULT_STD 0
  412. typedef struct {
  413. UINT16 adv_int_min;
  414. UINT16 adv_int_max;
  415. UINT8 adv_type;
  416. tBTM_BLE_ADV_CHNL_MAP channel_map;
  417. tBTM_BLE_AFP adv_filter_policy;
  418. tBTM_BLE_ADV_TX_POWER tx_power;
  419. } tBTM_BLE_ADV_PARAMS;
  420. typedef struct {
  421. UINT8 *p_sub_code; /* dynamic array to store sub code */
  422. UINT8 *p_inst_id; /* dynamic array to store instance id */
  423. UINT8 pending_idx;
  424. UINT8 next_idx;
  425. } tBTM_BLE_MULTI_ADV_OPQ;
  426. typedef void (tBTM_BLE_MULTI_ADV_CBACK)(tBTM_BLE_MULTI_ADV_EVT evt, UINT8 inst_id,
  427. void *p_ref, tBTM_STATUS status);
  428. typedef struct {
  429. UINT8 inst_id;
  430. BOOLEAN in_use;
  431. UINT8 adv_evt;
  432. BD_ADDR rpa;
  433. TIMER_LIST_ENT raddr_timer_ent;
  434. tBTM_BLE_MULTI_ADV_CBACK *p_cback;
  435. void *p_ref;
  436. UINT8 index;
  437. } tBTM_BLE_MULTI_ADV_INST;
  438. typedef struct {
  439. UINT8 inst_index_queue[BTM_BLE_MULTI_ADV_MAX];
  440. int front;
  441. int rear;
  442. } tBTM_BLE_MULTI_ADV_INST_IDX_Q;
  443. typedef struct {
  444. tBTM_BLE_MULTI_ADV_INST *p_adv_inst; /* dynamic array to store adv instance */
  445. tBTM_BLE_MULTI_ADV_OPQ op_q;
  446. } tBTM_BLE_MULTI_ADV_CB;
  447. typedef UINT8 tGATT_IF;
  448. typedef void (tBTM_BLE_SCAN_THRESHOLD_CBACK)(tBTM_BLE_REF_VALUE ref_value);
  449. typedef void (tBTM_BLE_SCAN_REP_CBACK)(tBTM_BLE_REF_VALUE ref_value, UINT8 report_format,
  450. UINT8 num_records, UINT16 total_len,
  451. UINT8 *p_rep_data, UINT8 status);
  452. typedef void (tBTM_BLE_SCAN_SETUP_CBACK)(UINT8 evt, tBTM_BLE_REF_VALUE ref_value, UINT8 status);
  453. #ifndef BTM_BLE_BATCH_SCAN_MAX
  454. #define BTM_BLE_BATCH_SCAN_MAX 5
  455. #endif
  456. #ifndef BTM_BLE_BATCH_REP_MAIN_Q_SIZE
  457. #define BTM_BLE_BATCH_REP_MAIN_Q_SIZE 2
  458. #endif
  459. typedef enum {
  460. BTM_BLE_SCAN_INVALID_STATE = 0,
  461. BTM_BLE_SCAN_ENABLE_CALLED = 1,
  462. BTM_BLE_SCAN_ENABLED_STATE = 2,
  463. BTM_BLE_SCAN_DISABLE_CALLED = 3,
  464. BTM_BLE_SCAN_DISABLED_STATE = 4
  465. } tBTM_BLE_BATCH_SCAN_STATE;
  466. enum {
  467. BTM_BLE_DISCARD_OLD_ITEMS,
  468. BTM_BLE_DISCARD_LOWER_RSSI_ITEMS
  469. };
  470. typedef UINT8 tBTM_BLE_DISCARD_RULE;
  471. typedef struct {
  472. UINT8 sub_code[BTM_BLE_BATCH_SCAN_MAX];
  473. tBTM_BLE_BATCH_SCAN_STATE cur_state[BTM_BLE_BATCH_SCAN_MAX];
  474. tBTM_BLE_REF_VALUE ref_value[BTM_BLE_BATCH_SCAN_MAX];
  475. UINT8 pending_idx;
  476. UINT8 next_idx;
  477. } tBTM_BLE_BATCH_SCAN_OPQ;
  478. typedef struct {
  479. UINT8 rep_mode[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
  480. tBTM_BLE_REF_VALUE ref_value[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
  481. UINT8 num_records[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
  482. UINT16 data_len[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
  483. UINT8 *p_data[BTM_BLE_BATCH_REP_MAIN_Q_SIZE];
  484. UINT8 pending_idx;
  485. UINT8 next_idx;
  486. } tBTM_BLE_BATCH_SCAN_REP_Q;
  487. typedef struct {
  488. tBTM_BLE_BATCH_SCAN_STATE cur_state;
  489. tBTM_BLE_BATCH_SCAN_MODE scan_mode;
  490. UINT32 scan_interval;
  491. UINT32 scan_window;
  492. tBLE_ADDR_TYPE addr_type;
  493. tBTM_BLE_DISCARD_RULE discard_rule;
  494. tBTM_BLE_BATCH_SCAN_OPQ op_q;
  495. tBTM_BLE_BATCH_SCAN_REP_Q main_rep_q;
  496. tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback;
  497. tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback;
  498. tBTM_BLE_SCAN_REP_CBACK *p_scan_rep_cback;
  499. tBTM_BLE_REF_VALUE ref_value;
  500. } tBTM_BLE_BATCH_SCAN_CB;
  501. /// Ble scan duplicate type
  502. enum {
  503. BTM_BLE_SCAN_DUPLICATE_DISABLE = 0x0, /*!< the Link Layer should generate advertising reports to the host for each packet received */
  504. BTM_BLE_SCAN_DUPLICATE_ENABLE = 0x1, /*!< the Link Layer should filter out duplicate advertising reports to the Host */
  505. BTM_BLE_SCAN_DUPLICATE_MAX = 0x2, /*!< 0x02 – 0xFF, Reserved for future use */
  506. };
  507. /* filter selection bit index */
  508. #define BTM_BLE_PF_ADDR_FILTER 0
  509. #define BTM_BLE_PF_SRVC_DATA 1
  510. #define BTM_BLE_PF_SRVC_UUID 2
  511. #define BTM_BLE_PF_SRVC_SOL_UUID 3
  512. #define BTM_BLE_PF_LOCAL_NAME 4
  513. #define BTM_BLE_PF_MANU_DATA 5
  514. #define BTM_BLE_PF_SRVC_DATA_PATTERN 6
  515. #define BTM_BLE_PF_TYPE_ALL 7 /* when passed in payload filter type all, only clear action is applicable */
  516. #define BTM_BLE_PF_TYPE_MAX 8
  517. /* max number of filter spot for different filter type */
  518. #ifndef BTM_BLE_MAX_UUID_FILTER
  519. #define BTM_BLE_MAX_UUID_FILTER 8
  520. #endif
  521. #ifndef BTM_BLE_MAX_ADDR_FILTER
  522. #define BTM_BLE_MAX_ADDR_FILTER 8
  523. #endif
  524. #ifndef BTM_BLE_PF_STR_COND_MAX
  525. #define BTM_BLE_PF_STR_COND_MAX 4 /* apply to manu data , or local name */
  526. #endif
  527. #ifndef BTM_BLE_PF_STR_LEN_MAX
  528. #define BTM_BLE_PF_STR_LEN_MAX 29 /* match for first 29 bytes */
  529. #endif
  530. typedef UINT8 tBTM_BLE_PF_COND_TYPE;
  531. #define BTM_BLE_PF_LOGIC_OR 0
  532. #define BTM_BLE_PF_LOGIC_AND 1
  533. typedef UINT8 tBTM_BLE_PF_LOGIC_TYPE;
  534. #define BTM_BLE_PF_ENABLE 1
  535. #define BTM_BLE_PF_CONFIG 2
  536. typedef UINT8 tBTM_BLE_PF_ACTION;
  537. typedef UINT8 tBTM_BLE_PF_FILT_INDEX;
  538. typedef UINT8 tBTM_BLE_PF_AVBL_SPACE;
  539. #define BTM_BLE_PF_BRDCAST_ADDR_FILT 1
  540. #define BTM_BLE_PF_SERV_DATA_CHG_FILT 2
  541. #define BTM_BLE_PF_SERV_UUID 4
  542. #define BTM_BLE_PF_SERV_SOLC_UUID 8
  543. #define BTM_BLE_PF_LOC_NAME_CHECK 16
  544. #define BTM_BLE_PF_MANUF_NAME_CHECK 32
  545. #define BTM_BLE_PF_SERV_DATA_CHECK 64
  546. typedef UINT16 tBTM_BLE_PF_FEAT_SEL;
  547. #define BTM_BLE_PF_LIST_LOGIC_OR 1
  548. #define BTM_BLE_PF_LIST_LOGIC_AND 2
  549. typedef UINT16 tBTM_BLE_PF_LIST_LOGIC_TYPE;
  550. #define BTM_BLE_PF_FILT_LOGIC_OR 0
  551. #define BTM_BLE_PF_FILT_LOGIC_AND 1
  552. typedef UINT16 tBTM_BLE_PF_FILT_LOGIC_TYPE;
  553. typedef UINT8 tBTM_BLE_PF_RSSI_THRESHOLD;
  554. typedef UINT8 tBTM_BLE_PF_DELIVERY_MODE;
  555. typedef UINT16 tBTM_BLE_PF_TIMEOUT;
  556. typedef UINT8 tBTM_BLE_PF_TIMEOUT_CNT;
  557. typedef UINT16 tBTM_BLE_PF_ADV_TRACK_ENTRIES;
  558. typedef struct {
  559. tBTM_BLE_PF_FEAT_SEL feat_seln;
  560. tBTM_BLE_PF_LIST_LOGIC_TYPE logic_type;
  561. tBTM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type;
  562. tBTM_BLE_PF_RSSI_THRESHOLD rssi_high_thres;
  563. tBTM_BLE_PF_RSSI_THRESHOLD rssi_low_thres;
  564. tBTM_BLE_PF_DELIVERY_MODE dely_mode;
  565. tBTM_BLE_PF_TIMEOUT found_timeout;
  566. tBTM_BLE_PF_TIMEOUT lost_timeout;
  567. tBTM_BLE_PF_TIMEOUT_CNT found_timeout_cnt;
  568. tBTM_BLE_PF_ADV_TRACK_ENTRIES num_of_tracking_entries;
  569. } tBTM_BLE_PF_FILT_PARAMS;
  570. enum {
  571. BTM_BLE_SCAN_COND_ADD,
  572. BTM_BLE_SCAN_COND_DELETE,
  573. BTM_BLE_SCAN_COND_CLEAR = 2
  574. };
  575. typedef UINT8 tBTM_BLE_SCAN_COND_OP;
  576. enum {
  577. BTM_BLE_FILT_ENABLE_DISABLE = 1,
  578. BTM_BLE_FILT_CFG = 2,
  579. BTM_BLE_FILT_ADV_PARAM = 3
  580. };
  581. typedef UINT8 tBTM_BLE_FILT_CB_EVT;
  582. /* BLE adv payload filtering config complete callback */
  583. typedef void (tBTM_BLE_PF_CFG_CBACK)(tBTM_BLE_PF_ACTION action, tBTM_BLE_SCAN_COND_OP cfg_op,
  584. tBTM_BLE_PF_AVBL_SPACE avbl_space, tBTM_STATUS status,
  585. tBTM_BLE_REF_VALUE ref_value);
  586. typedef void (tBTM_BLE_PF_CMPL_CBACK) (tBTM_BLE_PF_CFG_CBACK);
  587. /* BLE adv payload filtering status setup complete callback */
  588. typedef void (tBTM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTM_STATUS status,
  589. tBTM_BLE_REF_VALUE ref_value);
  590. /* BLE adv payload filtering param setup complete callback */
  591. typedef void (tBTM_BLE_PF_PARAM_CBACK) (tBTM_BLE_PF_ACTION action_type,
  592. tBTM_BLE_PF_AVBL_SPACE avbl_space,
  593. tBTM_BLE_REF_VALUE ref_value, tBTM_STATUS status);
  594. typedef union {
  595. UINT16 uuid16_mask;
  596. UINT32 uuid32_mask;
  597. UINT8 uuid128_mask[LEN_UUID_128];
  598. } tBTM_BLE_PF_COND_MASK;
  599. typedef struct {
  600. tBLE_BD_ADDR *p_target_addr; /* target address, if NULL, generic UUID filter */
  601. tBT_UUID uuid; /* UUID condition */
  602. tBTM_BLE_PF_LOGIC_TYPE cond_logic; /* AND/OR */
  603. tBTM_BLE_PF_COND_MASK *p_uuid_mask; /* UUID mask */
  604. } tBTM_BLE_PF_UUID_COND;
  605. typedef struct {
  606. UINT8 data_len; /* <= 20 bytes */
  607. UINT8 *p_data;
  608. } tBTM_BLE_PF_LOCAL_NAME_COND;
  609. typedef struct {
  610. UINT16 company_id; /* company ID */
  611. UINT8 data_len; /* <= 20 bytes */
  612. UINT8 *p_pattern;
  613. UINT16 company_id_mask; /* UUID value mask */
  614. UINT8 *p_pattern_mask; /* Manufacturer data matching mask,
  615. same length as data pattern,
  616. set to all 0xff, match exact data */
  617. } tBTM_BLE_PF_MANU_COND;
  618. typedef struct {
  619. UINT16 uuid; /* service ID */
  620. UINT8 data_len; /* <= 20 bytes */
  621. UINT8 *p_pattern;
  622. UINT8 *p_pattern_mask; /* Service data matching mask, same length as data pattern,
  623. set to all 0xff, match exact data */
  624. } tBTM_BLE_PF_SRVC_PATTERN_COND;
  625. typedef union {
  626. tBLE_BD_ADDR target_addr;
  627. tBTM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
  628. tBTM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
  629. tBTM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
  630. tBTM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
  631. tBTM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
  632. } tBTM_BLE_PF_COND_PARAM;
  633. typedef struct {
  634. UINT8 action_ocf[BTM_BLE_PF_TYPE_MAX];
  635. tBTM_BLE_REF_VALUE ref_value[BTM_BLE_PF_TYPE_MAX];
  636. tBTM_BLE_PF_PARAM_CBACK *p_filt_param_cback[BTM_BLE_PF_TYPE_MAX];
  637. tBTM_BLE_PF_CFG_CBACK *p_scan_cfg_cback[BTM_BLE_PF_TYPE_MAX];
  638. UINT8 cb_evt[BTM_BLE_PF_TYPE_MAX];
  639. UINT8 pending_idx;
  640. UINT8 next_idx;
  641. } tBTM_BLE_ADV_FILTER_ADV_OPQ;
  642. #define BTM_BLE_MAX_FILTER_COUNTER (BTM_BLE_MAX_ADDR_FILTER + 1) /* per device filter + one generic filter indexed by 0 */
  643. #ifndef BTM_CS_IRK_LIST_MAX
  644. #define BTM_CS_IRK_LIST_MAX 0x20
  645. #endif
  646. typedef struct {
  647. BOOLEAN in_use;
  648. BD_ADDR bd_addr;
  649. UINT8 pf_counter[BTM_BLE_PF_TYPE_MAX]; /* number of filter indexed by tBTM_BLE_PF_COND_TYPE */
  650. } tBTM_BLE_PF_COUNT;
  651. typedef struct {
  652. BOOLEAN enable;
  653. UINT8 op_type;
  654. tBTM_BLE_PF_COUNT *p_addr_filter_count; /* per BDA filter array */
  655. tBLE_BD_ADDR cur_filter_target;
  656. tBTM_BLE_PF_STATUS_CBACK *p_filt_stat_cback;
  657. tBTM_BLE_ADV_FILTER_ADV_OPQ op_q;
  658. } tBTM_BLE_ADV_FILTER_CB;
  659. /* Sub codes */
  660. #define BTM_BLE_META_PF_ENABLE 0x00
  661. #define BTM_BLE_META_PF_FEAT_SEL 0x01
  662. #define BTM_BLE_META_PF_ADDR 0x02
  663. #define BTM_BLE_META_PF_UUID 0x03
  664. #define BTM_BLE_META_PF_SOL_UUID 0x04
  665. #define BTM_BLE_META_PF_LOCAL_NAME 0x05
  666. #define BTM_BLE_META_PF_MANU_DATA 0x06
  667. #define BTM_BLE_META_PF_SRVC_DATA 0x07
  668. #define BTM_BLE_META_PF_ALL 0x08
  669. typedef UINT8 BTM_BLE_ADV_STATE;
  670. typedef UINT8 BTM_BLE_ADV_INFO_PRESENT;
  671. typedef UINT8 BTM_BLE_RSSI_VALUE;
  672. typedef UINT16 BTM_BLE_ADV_INFO_TIMESTAMP;
  673. /* These are the fields returned in each device adv packet. It
  674. ** is returned in the results callback if registered.
  675. */
  676. typedef struct {
  677. UINT8 conn_mode;
  678. tBTM_BLE_AD_MASK ad_mask; /* mask of the valid adv data field */
  679. UINT8 flag;
  680. UINT8 tx_power_level;
  681. UINT8 remote_name_len;
  682. UINT8 *p_remote_name;
  683. tBTM_BLE_SERVICE service;
  684. } tBTM_BLE_INQ_DATA;
  685. enum {
  686. BTM_BLE_CONN_NONE,
  687. BTM_BLE_CONN_AUTO,
  688. BTM_BLE_CONN_SELECTIVE
  689. };
  690. typedef UINT8 tBTM_BLE_CONN_TYPE;
  691. #define ADV_INFO_PRESENT 0x00
  692. #define NO_ADV_INFO_PRESENT 0x01
  693. typedef btgatt_track_adv_info_t tBTM_BLE_TRACK_ADV_DATA;
  694. typedef void (tBTM_BLE_TRACK_ADV_CBACK)(tBTM_BLE_TRACK_ADV_DATA *p_track_adv_data);
  695. typedef UINT8 tBTM_BLE_TRACK_ADV_EVT;
  696. typedef struct {
  697. tBTM_BLE_REF_VALUE ref_value;
  698. tBTM_BLE_TRACK_ADV_CBACK *p_track_cback;
  699. } tBTM_BLE_ADV_TRACK_CB;
  700. enum {
  701. BTM_BLE_TRACK_ADV_ADD,
  702. BTM_BLE_TRACK_ADV_REMOVE
  703. };
  704. typedef UINT8 tBTM_BLE_TRACK_ADV_ACTION;
  705. #define BTM_BLE_MULTI_ADV_INVALID 0
  706. #define BTM_BLE_BATCH_SCAN_ENABLE_EVT 1
  707. #define BTM_BLE_BATCH_SCAN_CFG_STRG_EVT 2
  708. #define BTM_BLE_BATCH_SCAN_READ_REPTS_EVT 3
  709. #define BTM_BLE_BATCH_SCAN_THR_EVT 4
  710. #define BTM_BLE_BATCH_SCAN_PARAM_EVT 5
  711. #define BTM_BLE_BATCH_SCAN_DISABLE_EVT 6
  712. typedef UINT8 tBTM_BLE_BATCH_SCAN_EVT;
  713. typedef UINT32 tBTM_BLE_TX_TIME_MS;
  714. typedef UINT32 tBTM_BLE_RX_TIME_MS;
  715. typedef UINT32 tBTM_BLE_IDLE_TIME_MS;
  716. typedef UINT32 tBTM_BLE_ENERGY_USED;
  717. typedef void (tBTM_BLE_ENERGY_INFO_CBACK)(tBTM_BLE_TX_TIME_MS tx_time, tBTM_BLE_RX_TIME_MS rx_time,
  718. tBTM_BLE_IDLE_TIME_MS idle_time,
  719. tBTM_BLE_ENERGY_USED energy_used,
  720. tBTM_STATUS status);
  721. typedef struct {
  722. tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback;
  723. } tBTM_BLE_ENERGY_INFO_CB;
  724. typedef BOOLEAN (tBTM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name);
  725. typedef void (tBTM_BLE_CTRL_FEATURES_CBACK)(tBTM_STATUS status);
  726. /* callback function for SMP signing algorithm, signed data in little endian order with tlen bits long */
  727. typedef void (tBTM_BLE_SIGN_CBACK)(void *p_ref_data, UINT8 *p_signing_data);
  728. typedef void (tBTM_BLE_VERIFY_CBACK)(void *p_ref_data, BOOLEAN match);
  729. /* random address set complete callback */
  730. typedef void (tBTM_BLE_RANDOM_SET_CBACK) (BD_ADDR random_bda);
  731. typedef void (tBTM_BLE_SCAN_REQ_CBACK)(BD_ADDR remote_bda, tBLE_ADDR_TYPE addr_type, UINT8 adv_evt);
  732. typedef void (*tBLE_SCAN_PARAM_SETUP_CBACK)(tGATT_IF client_if, tBTM_STATUS status);
  733. tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb;
  734. typedef void (tBTM_START_ADV_CMPL_CBACK) (UINT8 status);
  735. typedef void (tBTM_START_STOP_ADV_CMPL_CBACK) (UINT8 status);
  736. /*****************************************************************************
  737. ** EXTERNAL FUNCTION DECLARATIONS
  738. *****************************************************************************/
  739. /*
  740. #ifdef __cplusplus
  741. extern "C" {
  742. #endif
  743. */
  744. /*******************************************************************************
  745. **
  746. ** Function BTM_BleRegiseterConnParamCallback
  747. **
  748. ** Description register connection parameters update callback func
  749. **
  750. ** Parameters: update_conn_param_cb
  751. **
  752. ** Returns void
  753. **
  754. *******************************************************************************/
  755. void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
  756. /*******************************************************************************
  757. **
  758. ** Function BTM_SecAddBleDevice
  759. **
  760. ** Description Add/modify device. This function will be normally called
  761. ** during host startup to restore all required information
  762. ** for a LE device stored in the NVRAM.
  763. **
  764. ** Parameters: bd_addr - BD address of the peer
  765. ** bd_name - Name of the peer device. NULL if unknown.
  766. ** dev_type - Remote device's device type.
  767. ** addr_type - LE device address type.
  768. **
  769. ** Returns TRUE if added OK, else FALSE
  770. **
  771. *******************************************************************************/
  772. //extern
  773. BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name,
  774. tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type);
  775. /*******************************************************************************
  776. **
  777. ** Function BTM_SecAddBleKey
  778. **
  779. ** Description Add/modify LE device information. This function will be
  780. ** normally called during host startup to restore all required
  781. ** information stored in the NVRAM.
  782. **
  783. ** Parameters: bd_addr - BD address of the peer
  784. ** p_le_key - LE key values.
  785. ** key_type - LE SMP key type.
  786. *
  787. ** Returns TRUE if added OK, else FALSE
  788. **
  789. *******************************************************************************/
  790. //extern
  791. BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key,
  792. tBTM_LE_KEY_TYPE key_type);
  793. /*******************************************************************************
  794. **
  795. ** Function BTM_BleSetAdvParams
  796. **
  797. ** Description This function is called to set advertising parameters.
  798. **
  799. ** Parameters: None.
  800. **
  801. ** Returns void
  802. **
  803. *******************************************************************************/
  804. //extern
  805. tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
  806. tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP chnl_map);
  807. /*******************************************************************************
  808. **
  809. ** Function BTM_BleSetAdvParamsStartAdv
  810. **
  811. ** Description This function is called to set all of the advertising parameters.
  812. **
  813. ** Parameters: None.
  814. **
  815. ** Returns void
  816. **
  817. *******************************************************************************/
  818. tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max, UINT8 adv_type,
  819. tBLE_ADDR_TYPE own_bda_type, tBLE_BD_ADDR *p_dir_bda,
  820. tBTM_BLE_ADV_CHNL_MAP chnl_map, tBTM_BLE_AFP afp, tBTM_START_ADV_CMPL_CBACK *adv_cb);
  821. /*******************************************************************************
  822. **
  823. ** Function BTM_BleWriteAdvData
  824. **
  825. ** Description This function is called to write advertising data.
  826. **
  827. ** Parameters: None.
  828. **
  829. ** Returns void
  830. **
  831. *******************************************************************************/
  832. //extern
  833. tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask,
  834. tBTM_BLE_ADV_DATA *p_data);
  835. /*******************************************************************************
  836. **
  837. ** Function BTM_BleWriteAdvDataRaw
  838. **
  839. ** Description This function is called to write raw advertising data.
  840. **
  841. ** Parameters: p_raw_adv : point to raw advertising data
  842. ** raw_adv_len : raw advertising data
  843. **
  844. ** Returns BTM_SUCCESS means success.
  845. **
  846. *******************************************************************************/
  847. //extern
  848. tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len);
  849. tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr);
  850. void BTM_BleClearRandAddress(void);
  851. /*******************************************************************************
  852. **
  853. ** Function BTM_BleSetAdvParams
  854. **
  855. ** Description This function is called to set advertising parameters.
  856. **
  857. ** Parameters adv_int_min: minimum advertising interval
  858. ** adv_int_max: maximum advertising interval
  859. ** p_dir_bda: connectable direct initiator's LE device address
  860. ** chnl_map: advertising channel map.
  861. **
  862. ** Returns void
  863. **
  864. *******************************************************************************/
  865. //extern
  866. void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
  867. tBLE_BD_ADDR *p_dir_bda, tBTM_BLE_ADV_CHNL_MAP *p_chnl_map);
  868. /*******************************************************************************
  869. **
  870. ** Function BTM_BleObtainVendorCapabilities
  871. **
  872. ** Description This function is called to obatin vendor capabilties
  873. **
  874. ** Parameters p_cmn_vsc_cb - Returns the vednor capabilities
  875. **
  876. ** Returns void
  877. **
  878. *******************************************************************************/
  879. //extern
  880. void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb);
  881. /*******************************************************************************
  882. **
  883. ** Function BTM_BleSetScanParams
  884. **
  885. ** Description This function is called to set Scan parameters.
  886. **
  887. ** Parameters client_if - Client IF value
  888. ** scan_interval - Scan interval
  889. ** scan_window - Scan window
  890. ** scan_type - Scan type
  891. ** scan_setup_status_cback - Scan setup status callback
  892. **
  893. ** Returns void
  894. **
  895. *******************************************************************************/
  896. //extern
  897. void BTM_BleSetScanParams(tGATT_IF client_if, UINT32 scan_interval,
  898. UINT32 scan_window, tBLE_SCAN_MODE scan_type,
  899. tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback);
  900. /*******************************************************************************
  901. **
  902. ** Function BTM_BleSetScanFilterParams
  903. **
  904. ** Description This function is called to set Scan Filter & parameters.
  905. **
  906. ** Parameters client_if - Client IF value
  907. ** scan_interval - Scan interval
  908. ** scan_window - Scan window
  909. ** scan_type - Scan type
  910. ** addr_type_own - owner address type
  911. ** scan_duplicate_filter - scan duplicate filter
  912. ** scan_filter_policy - scan filter policy
  913. ** scan_setup_status_cback - Scan setup status callback
  914. **
  915. ** Returns void
  916. **
  917. *******************************************************************************/
  918. void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32 scan_window,
  919. tBLE_SCAN_MODE scan_mode, UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBTM_BLE_SFP scan_filter_policy,
  920. tBLE_SCAN_PARAM_SETUP_CBACK scan_setup_status_cback);
  921. /*******************************************************************************
  922. **
  923. ** Function BTM_BleGetVendorCapabilities
  924. **
  925. ** Description This function reads local LE features
  926. **
  927. ** Parameters p_cmn_vsc_cb : Locala LE capability structure
  928. **
  929. ** Returns void
  930. **
  931. *******************************************************************************/
  932. //extern
  933. void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB *p_cmn_vsc_cb);
  934. /*******************************************************************************
  935. **
  936. ** Function BTM_BleSetStorageConfig
  937. **
  938. ** Description This function is called to setup storage configuration and setup callbacks.
  939. **
  940. ** Parameters UINT8 batch_scan_full_max -Batch scan full maximum
  941. UINT8 batch_scan_trunc_max - Batch scan truncated value maximum
  942. UINT8 batch_scan_notify_threshold - Threshold value
  943. tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback - Setup callback
  944. tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold callback
  945. void *p_ref - Reference value
  946. **
  947. ** Returns tBTM_STATUS
  948. **
  949. *******************************************************************************/
  950. //extern
  951. tBTM_STATUS BTM_BleSetStorageConfig(UINT8 batch_scan_full_max,
  952. UINT8 batch_scan_trunc_max,
  953. UINT8 batch_scan_notify_threshold,
  954. tBTM_BLE_SCAN_SETUP_CBACK *p_setup_cback,
  955. tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback,
  956. tBTM_BLE_SCAN_REP_CBACK *p_cback,
  957. tBTM_BLE_REF_VALUE ref_value);
  958. /*******************************************************************************
  959. **
  960. ** Function BTM_BleEnableBatchScan
  961. **
  962. ** Description This function is called to enable batch scan
  963. **
  964. ** Parameters tBTM_BLE_BATCH_SCAN_MODE scan_mode - Batch scan mode
  965. UINT32 scan_interval -Scan interval
  966. UINT32 scan_window - Scan window value
  967. tBLE_ADDR_TYPE addr_type - Address type
  968. tBTM_BLE_DISCARD_RULE discard_rule - Data discard rules
  969. **
  970. ** Returns tBTM_STATUS
  971. **
  972. *******************************************************************************/
  973. //extern
  974. tBTM_STATUS BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
  975. UINT32 scan_interval, UINT32 scan_window,
  976. tBTM_BLE_DISCARD_RULE discard_rule,
  977. tBLE_ADDR_TYPE addr_type,
  978. tBTM_BLE_REF_VALUE ref_value);
  979. /*******************************************************************************
  980. **
  981. ** Function BTM_BleDisableBatchScan
  982. **
  983. ** Description This function is called to disable batch scanning
  984. **
  985. ** Parameters void
  986. **
  987. ** Returns void
  988. **
  989. *******************************************************************************/
  990. //extern
  991. tBTM_STATUS BTM_BleDisableBatchScan(tBTM_BLE_REF_VALUE ref_value);
  992. /*******************************************************************************
  993. **
  994. ** Function BTM_BleReadScanReports
  995. **
  996. ** Description This function is called to read batch scan reports
  997. **
  998. ** Parameters tBLE_SCAN_MODE scan_mode - Scan mode report to be read out
  999. tBTM_BLE_SCAN_REP_CBACK* p_cback - Reports callback
  1000. **
  1001. ** Returns tBTM_STATUS
  1002. **
  1003. *******************************************************************************/
  1004. //extern
  1005. tBTM_STATUS BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode,
  1006. tBTM_BLE_REF_VALUE ref_value);
  1007. /*******************************************************************************
  1008. **
  1009. ** Function BTM_BleTrackAdvertiser
  1010. **
  1011. ** Description This function is called to read batch scan reports
  1012. **
  1013. ** Parameters p_track_cback - Tracking callback
  1014. ** ref_value - Reference value
  1015. **
  1016. ** Returns tBTM_STATUS
  1017. **
  1018. *******************************************************************************/
  1019. //extern
  1020. tBTM_STATUS BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK *p_track_cback,
  1021. tBTM_BLE_REF_VALUE ref_value);
  1022. /*******************************************************************************
  1023. **
  1024. ** Function BTM_BleWriteScanRsp
  1025. **
  1026. ** Description This function is called to write LE scan response.
  1027. **
  1028. ** Parameters: p_scan_rsp: scan response.
  1029. **
  1030. ** Returns status
  1031. **
  1032. *******************************************************************************/
  1033. //extern
  1034. tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask,
  1035. tBTM_BLE_ADV_DATA *p_data);
  1036. /*******************************************************************************
  1037. **
  1038. ** Function BTM_BleWriteScanRspRaw
  1039. **
  1040. ** Description This function is called to write raw scan response data
  1041. **
  1042. ** Parameters: None.
  1043. **
  1044. ** Returns void
  1045. **
  1046. *******************************************************************************/
  1047. //extern
  1048. tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len);
  1049. /*******************************************************************************
  1050. **
  1051. ** Function BTM_BleObserve
  1052. **
  1053. ** Description This procedure keep the device listening for advertising
  1054. ** events from a broadcast device.
  1055. **
  1056. ** Parameters start: start or stop observe.
  1057. **
  1058. ** Returns void
  1059. **
  1060. *******************************************************************************/
  1061. //extern
  1062. tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration,
  1063. tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb);
  1064. /*******************************************************************************
  1065. **
  1066. ** Function BTM_BleScan
  1067. **
  1068. ** Description This procedure keep the device listening for advertising
  1069. ** events from a broadcast device.
  1070. **
  1071. ** Parameters start: start or stop scan.
  1072. **
  1073. ** Returns void
  1074. **
  1075. *******************************************************************************/
  1076. //extern
  1077. tBTM_STATUS BTM_BleScan(BOOLEAN start, UINT32 duration,
  1078. tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb);
  1079. /*******************************************************************************
  1080. **
  1081. ** Function BTM_GetDeviceIDRoot
  1082. **
  1083. ** Description This function is called to read the local device identity
  1084. ** root.
  1085. **
  1086. ** Returns void
  1087. ** the local device ER is copied into er
  1088. **
  1089. *******************************************************************************/
  1090. //extern
  1091. void BTM_GetDeviceIDRoot (BT_OCTET16 ir);
  1092. /*******************************************************************************
  1093. **
  1094. ** Function BTM_GetDeviceEncRoot
  1095. **
  1096. ** Description This function is called to read the local device encryption
  1097. ** root.
  1098. **
  1099. ** Returns void
  1100. ** the local device ER is copied into er
  1101. **
  1102. *******************************************************************************/
  1103. //extern
  1104. void BTM_GetDeviceEncRoot (BT_OCTET16 er);
  1105. /*******************************************************************************
  1106. **
  1107. ** Function BTM_GetDeviceDHK
  1108. **
  1109. ** Description This function is called to read the local device DHK.
  1110. **
  1111. ** Returns void
  1112. ** the local device DHK is copied into dhk
  1113. **
  1114. *******************************************************************************/
  1115. //extern
  1116. void BTM_GetDeviceDHK (BT_OCTET16 dhk);
  1117. /*******************************************************************************
  1118. **
  1119. ** Function BTM_SecurityGrant
  1120. **
  1121. ** Description This function is called to grant security process.
  1122. **
  1123. ** Parameters bd_addr - peer device bd address.
  1124. ** res - result of the operation BTM_SUCCESS if success.
  1125. ** Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts.
  1126. **
  1127. ** Returns None
  1128. **
  1129. *******************************************************************************/
  1130. //extern
  1131. void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res);
  1132. /*******************************************************************************
  1133. **
  1134. ** Function BTM_BlePasskeyReply
  1135. **
  1136. ** Description This function is called after Security Manager submitted
  1137. ** passkey request to the application.
  1138. **
  1139. ** Parameters: bd_addr - Address of the device for which passkey was requested
  1140. ** res - result of the operation SMP_SUCCESS if success
  1141. ** passkey - numeric value in the range of
  1142. ** BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
  1143. **
  1144. *******************************************************************************/
  1145. //extern
  1146. void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey);
  1147. /*******************************************************************************
  1148. **
  1149. ** Function BTM_BleSetStaticPasskey
  1150. **
  1151. ** Description This function is called to set static passkey
  1152. **
  1153. **
  1154. ** Parameters: add - set static passkey when add is TRUE
  1155. ** clear static passkey when add is FALSE
  1156. ** passkey - static passkey
  1157. **
  1158. **
  1159. *******************************************************************************/
  1160. void BTM_BleSetStaticPasskey(BOOLEAN add, UINT32 passkey);
  1161. /*******************************************************************************
  1162. **
  1163. ** Function BTM_BleConfirmReply
  1164. **
  1165. ** Description This function is called after Security Manager submitted
  1166. ** numeric comparison request to the application.
  1167. **
  1168. ** Parameters: bd_addr - Address of the device with which numeric
  1169. ** comparison was requested
  1170. ** res - comparison result BTM_SUCCESS if success
  1171. **
  1172. *******************************************************************************/
  1173. //extern
  1174. void BTM_BleConfirmReply (BD_ADDR bd_addr, UINT8 res);
  1175. /*******************************************************************************
  1176. **
  1177. ** Function BTM_LeOobDataReply
  1178. **
  1179. ** Description This function is called to provide the OOB data for
  1180. ** SMP in response to BTM_LE_OOB_REQ_EVT
  1181. **
  1182. ** Parameters: bd_addr - Address of the peer device
  1183. ** res - result of the operation SMP_SUCCESS if success
  1184. ** p_data - simple pairing Randomizer C.
  1185. **
  1186. *******************************************************************************/
  1187. //extern
  1188. void BTM_BleOobDataReply(BD_ADDR bd_addr, UINT8 res, UINT8 len, UINT8 *p_data);
  1189. /*******************************************************************************
  1190. **
  1191. ** Function BTM_BleDataSignature
  1192. **
  1193. ** Description This function is called to sign the data using AES128 CMAC
  1194. ** algorith.
  1195. **
  1196. ** Parameter bd_addr: target device the data to be signed for.
  1197. ** p_text: singing data
  1198. ** len: length of the signing data
  1199. ** signature: output parameter where data signature is going to
  1200. ** be stored.
  1201. **
  1202. ** Returns TRUE if signing sucessul, otherwise FALSE.
  1203. **
  1204. *******************************************************************************/
  1205. //extern
  1206. BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
  1207. BLE_SIGNATURE signature);
  1208. /*******************************************************************************
  1209. **
  1210. ** Function BTM_BleVerifySignature
  1211. **
  1212. ** Description This function is called to verify the data signature
  1213. **
  1214. ** Parameter bd_addr: target device the data to be signed for.
  1215. ** p_orig: original data before signature.
  1216. ** len: length of the signing data
  1217. ** counter: counter used when doing data signing
  1218. ** p_comp: signature to be compared against.
  1219. ** Returns TRUE if signature verified correctly; otherwise FALSE.
  1220. **
  1221. *******************************************************************************/
  1222. //extern
  1223. BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig,
  1224. UINT16 len, UINT32 counter,
  1225. UINT8 *p_comp);
  1226. /*******************************************************************************
  1227. **
  1228. ** Function BTM_ReadConnectionAddr
  1229. **
  1230. ** Description This function is called to set the local device random address
  1231. ** .
  1232. **
  1233. ** Returns void
  1234. **
  1235. *******************************************************************************/
  1236. //extern
  1237. void BTM_ReadConnectionAddr (BD_ADDR remote_bda, BD_ADDR local_conn_addr,
  1238. tBLE_ADDR_TYPE *p_addr_type);
  1239. /*******************************************************************************
  1240. **
  1241. ** Function BTM_ReadRemoteConnectionAddr
  1242. **
  1243. ** Description This function is read the remote device address currently used
  1244. ** .
  1245. **
  1246. ** Returns void
  1247. **
  1248. *******************************************************************************/
  1249. //extern
  1250. BOOLEAN BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr,
  1251. BD_ADDR conn_addr,
  1252. tBLE_ADDR_TYPE *p_addr_type);
  1253. /*******************************************************************************
  1254. **
  1255. ** Function BTM_BleLoadLocalKeys
  1256. **
  1257. ** Description Local local identity key, encryption root or sign counter.
  1258. **
  1259. ** Parameters: key_type: type of key, can be BTM_BLE_KEY_TYPE_ID, BTM_BLE_KEY_TYPE_ER
  1260. ** or BTM_BLE_KEY_TYPE_COUNTER.
  1261. ** p_key: pointer to the key.
  1262. *
  1263. ** Returns non2.
  1264. **
  1265. *******************************************************************************/
  1266. //extern
  1267. void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key);
  1268. /*******************************************************************************
  1269. **
  1270. ** Function BTM_BleSetBgConnType
  1271. **
  1272. ** Description This function is called to set BLE background connection
  1273. ** procedure type. It can be auto connection, or selective connection.
  1274. **
  1275. ** Parameters conn_type: it can be auto connection, or selective connection.
  1276. ** p_select_cback: callback function when selective connection procedure
  1277. ** is being used.
  1278. **
  1279. ** Returns void
  1280. **
  1281. *******************************************************************************/
  1282. //extern
  1283. BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE conn_type,
  1284. tBTM_BLE_SEL_CBACK *p_select_cback);
  1285. /*******************************************************************************
  1286. **
  1287. ** Function BTM_BleUpdateBgConnDev
  1288. **
  1289. ** Description This function is called to add or remove a device into/from
  1290. ** background connection procedure. The background connection
  1291. * procedure is decided by the background connection type, it can be
  1292. * auto connection, or selective connection.
  1293. **
  1294. ** Parameters add_remove: TRUE to add; FALSE to remove.
  1295. ** remote_bda: device address to add/remove.
  1296. **
  1297. ** Returns void
  1298. **
  1299. *******************************************************************************/
  1300. //extern
  1301. BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda);
  1302. /*******************************************************************************
  1303. **
  1304. ** Function BTM_BleClearBgConnDev
  1305. **
  1306. ** Description This function is called to clear the whitelist,
  1307. ** end any pending whitelist connections,
  1308. * and reset the local bg device list.
  1309. **
  1310. ** Parameters void
  1311. **
  1312. ** Returns void
  1313. **
  1314. *******************************************************************************/
  1315. //extern
  1316. void BTM_BleClearBgConnDev(void);
  1317. /********************************************************
  1318. **
  1319. ** Function BTM_BleSetPrefConnParams
  1320. **
  1321. ** Description Set a peripheral's preferred connection parameters. When
  1322. ** any of the value does not want to be updated while others
  1323. ** do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to
  1324. ** leave untouched.
  1325. **
  1326. ** Parameters: bd_addr - BD address of the peripheral
  1327. ** min_conn_int - minimum preferred connection interval
  1328. ** max_conn_int - maximum preferred connection interval
  1329. ** slave_latency - preferred slave latency
  1330. ** supervision_tout - preferred supervision timeout
  1331. **
  1332. ** Returns void
  1333. **
  1334. *******************************************************************************/
  1335. //extern
  1336. void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
  1337. UINT16 min_conn_int, UINT16 max_conn_int,
  1338. UINT16 slave_latency, UINT16 supervision_tout);
  1339. /******************************************************************************
  1340. **
  1341. ** Function BTM_BleSetConnScanParams
  1342. **
  1343. ** Description Set scan parameters used in BLE connection request
  1344. **
  1345. ** Parameters: scan_interval - scan interval
  1346. ** scan_window - scan window
  1347. **
  1348. ** Returns void
  1349. **
  1350. *******************************************************************************/
  1351. //extern
  1352. void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window);
  1353. /******************************************************************************
  1354. **
  1355. ** Function BTM_BleReadControllerFeatures
  1356. **
  1357. ** Description Reads BLE specific controller features
  1358. **
  1359. ** Parameters: tBTM_BLE_CTRL_FEATURES_CBACK : Callback to notify when features are read
  1360. **
  1361. ** Returns void
  1362. **
  1363. *******************************************************************************/
  1364. //extern
  1365. void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK *p_vsc_cback);
  1366. /*******************************************************************************
  1367. **
  1368. ** Function BTM_CheckAdvData
  1369. **
  1370. ** Description This function is called to get ADV data for a specific type.
  1371. **
  1372. ** Parameters p_adv - pointer of ADV data
  1373. ** type - finding ADV data type
  1374. ** p_length - return the length of ADV data not including type
  1375. **
  1376. ** Returns pointer of ADV data
  1377. **
  1378. *******************************************************************************/
  1379. //extern
  1380. UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length);
  1381. /*******************************************************************************
  1382. **
  1383. ** Function BTM_BleGetCurrentAddress
  1384. **
  1385. ** Description This function is called to get local used BLE address.
  1386. **
  1387. ** Parameters: None.
  1388. **
  1389. ** Returns success or fail
  1390. **
  1391. *******************************************************************************/
  1392. BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type);
  1393. /*******************************************************************************
  1394. **
  1395. ** Function BTM__BLEReadDiscoverability
  1396. **
  1397. ** Description This function is called to read the current LE discoverability
  1398. ** mode of the device.
  1399. **
  1400. ** Returns BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or
  1401. ** BTM_BLE_GENRAL_DISCOVERABLE
  1402. **
  1403. *******************************************************************************/
  1404. UINT16 BTM_BleReadDiscoverability();
  1405. /*******************************************************************************
  1406. **
  1407. ** Function BTM__BLEReadConnectability
  1408. **
  1409. ** Description This function is called to read the current LE connectibility
  1410. ** mode of the device.
  1411. **
  1412. ** Returns BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
  1413. **
  1414. *******************************************************************************/
  1415. //extern
  1416. UINT16 BTM_BleReadConnectability ();
  1417. void BTM_Recovery_Pre_State(void);
  1418. /*******************************************************************************
  1419. **
  1420. ** Function BTM_ReadDevInfo
  1421. **
  1422. ** Description This function is called to read the device/address type
  1423. ** of BD address.
  1424. **
  1425. ** Parameter remote_bda: remote device address
  1426. ** p_dev_type: output parameter to read the device type.
  1427. ** p_addr_type: output parameter to read the address type.
  1428. **
  1429. *******************************************************************************/
  1430. //extern
  1431. void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type,
  1432. tBLE_ADDR_TYPE *p_addr_type);
  1433. /*******************************************************************************
  1434. **
  1435. ** Function BTM_ReadConnectedTransportAddress
  1436. **
  1437. ** Description This function is called to read the paired device/address type of other device paired
  1438. ** corresponding to the BD_address
  1439. **
  1440. ** Parameter remote_bda: remote device address, carry out the transport address
  1441. ** transport: active transport
  1442. **
  1443. ** Return TRUE if an active link is identified; FALSE otherwise
  1444. **
  1445. *******************************************************************************/
  1446. //extern
  1447. BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda,
  1448. tBT_TRANSPORT transport);
  1449. /*******************************************************************************
  1450. **
  1451. ** Function BTM_BleBroadcast
  1452. **
  1453. ** Description This function is to start or stop broadcasting.
  1454. **
  1455. ** Parameters start: start or stop broadcasting.
  1456. **
  1457. ** Returns status.
  1458. **
  1459. *******************************************************************************/
  1460. //extern
  1461. tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cback);
  1462. /*******************************************************************************
  1463. **
  1464. ** Function BTM_BleConfigPrivacy
  1465. **
  1466. ** Description This function is called to enable or disable the privacy in
  1467. ** the local device.
  1468. **
  1469. ** Parameters enable: TRUE to enable it; FALSE to disable it.
  1470. **
  1471. ** Returns BOOLEAN privacy mode set success; otherwise failed.
  1472. **
  1473. *******************************************************************************/
  1474. //extern
  1475. BOOLEAN BTM_BleConfigPrivacy(BOOLEAN enable, tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cabck);
  1476. /*******************************************************************************
  1477. **
  1478. ** Function BTM_BleConfigLocalIcon
  1479. **
  1480. ** Description This function is called to set local icon
  1481. **
  1482. ** Parameters icon: appearance value.
  1483. **
  1484. **
  1485. *******************************************************************************/
  1486. void BTM_BleConfigLocalIcon(uint16_t icon);
  1487. /*******************************************************************************
  1488. **
  1489. ** Function BTM_BleLocalPrivacyEnabled
  1490. **
  1491. ** Description Checks if local device supports private address
  1492. **
  1493. ** Returns Return TRUE if local privacy is enabled else FALSE
  1494. **
  1495. *******************************************************************************/
  1496. //extern
  1497. BOOLEAN BTM_BleLocalPrivacyEnabled(void);
  1498. /*******************************************************************************
  1499. **
  1500. ** Function BTM_BleEnableMixedPrivacyMode
  1501. **
  1502. ** Description This function is called to enabled Mixed mode if privacy 1.2
  1503. ** is applicable in controller.
  1504. **
  1505. ** Parameters mixed_on: mixed mode to be used or not.
  1506. **
  1507. ** Returns void
  1508. **
  1509. *******************************************************************************/
  1510. //extern
  1511. void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on);
  1512. /*******************************************************************************
  1513. **
  1514. ** Function BTM_BleMaxMultiAdvInstanceCount
  1515. **
  1516. ** Description Returns max number of multi adv instances supported by controller
  1517. **
  1518. ** Returns Max multi adv instance count
  1519. **
  1520. *******************************************************************************/
  1521. //extern
  1522. UINT8 BTM_BleMaxMultiAdvInstanceCount();
  1523. /*******************************************************************************
  1524. **
  1525. ** Function BTM_BleSetConnectableMode
  1526. **
  1527. ** Description This function is called to set BLE connectable mode for a
  1528. ** peripheral device.
  1529. **
  1530. ** Parameters connectable_mode: directed connectable mode, or non-directed.It can
  1531. ** be BTM_BLE_CONNECT_EVT, BTM_BLE_CONNECT_DIR_EVT or
  1532. ** BTM_BLE_CONNECT_LO_DUTY_DIR_EVT
  1533. **
  1534. ** Returns BTM_ILLEGAL_VALUE if controller does not support BLE.
  1535. ** BTM_SUCCESS is status set successfully; otherwise failure.
  1536. **
  1537. *******************************************************************************/
  1538. //extern
  1539. tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode);
  1540. /*******************************************************************************
  1541. **
  1542. ** Function BTM_BleTurnOnPrivacyOnRemote
  1543. **
  1544. ** Description This function is called to enable or disable the privacy on the
  1545. ** remote device.
  1546. **
  1547. ** Parameters bd_addr: remote device address.
  1548. ** privacy_on: TRUE to enable it; FALSE to disable it.
  1549. **
  1550. ** Returns void
  1551. **
  1552. *******************************************************************************/
  1553. //extern
  1554. void BTM_BleTurnOnPrivacyOnRemote(BD_ADDR bd_addr,
  1555. BOOLEAN privacy_on);
  1556. /*******************************************************************************
  1557. **
  1558. ** Function BTM_BleUpdateAdvWhitelist
  1559. **
  1560. ** Description Add or remove device from advertising white list
  1561. **
  1562. ** Returns void
  1563. **
  1564. *******************************************************************************/
  1565. //extern
  1566. BOOLEAN BTM_BleUpdateAdvWhitelist(BOOLEAN add_remove, BD_ADDR emote_bda, tBTM_ADD_WHITELIST_CBACK *add_wl_cb);
  1567. /*******************************************************************************
  1568. **
  1569. ** Function BTM_BleUpdateAdvFilterPolicy
  1570. **
  1571. ** Description This function update the filter policy of advertiser.
  1572. **
  1573. ** Parameter adv_policy: advertising filter policy
  1574. **
  1575. ** Return void
  1576. *******************************************************************************/
  1577. //extern
  1578. void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy);
  1579. /*******************************************************************************
  1580. **
  1581. ** Function BTM_BleReceiverTest
  1582. **
  1583. ** Description This function is called to start the LE Receiver test
  1584. **
  1585. ** Parameter rx_freq - Frequency Range
  1586. ** p_cmd_cmpl_cback - Command Complete callback
  1587. **
  1588. *******************************************************************************/
  1589. void BTM_BleReceiverTest(UINT8 rx_freq, tBTM_CMPL_CB *p_cmd_cmpl_cback);
  1590. /*******************************************************************************
  1591. **
  1592. ** Function BTM_BleTransmitterTest
  1593. **
  1594. ** Description This function is called to start the LE Transmitter test
  1595. **
  1596. ** Parameter tx_freq - Frequency Range
  1597. ** test_data_len - Length in bytes of payload data in each packet
  1598. ** packet_payload - Pattern to use in the payload
  1599. ** p_cmd_cmpl_cback - Command Complete callback
  1600. **
  1601. *******************************************************************************/
  1602. void BTM_BleTransmitterTest(UINT8 tx_freq, UINT8 test_data_len,
  1603. UINT8 packet_payload, tBTM_CMPL_CB *p_cmd_cmpl_cback);
  1604. /*******************************************************************************
  1605. **
  1606. ** Function BTM_BleTestEnd
  1607. **
  1608. ** Description This function is called to stop the in-progress TX or RX test
  1609. **
  1610. ** Parameter p_cmd_cmpl_cback - Command complete callback
  1611. **
  1612. *******************************************************************************/
  1613. void BTM_BleTestEnd(tBTM_CMPL_CB *p_cmd_cmpl_cback);
  1614. /*******************************************************************************
  1615. **
  1616. ** Function BTM_UseLeLink
  1617. **
  1618. ** Description This function is to select the underneath physical link to use.
  1619. **
  1620. ** Returns TRUE to use LE, FALSE use BR/EDR.
  1621. **
  1622. *******************************************************************************/
  1623. //extern
  1624. BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr);
  1625. /*******************************************************************************
  1626. **
  1627. ** Function BTM_BleStackEnable
  1628. **
  1629. ** Description Enable/Disable BLE functionality on stack regarless controller
  1630. ** capability.
  1631. **
  1632. ** Parameters: enable: TRUE to enable, FALSE to disable.
  1633. **
  1634. ** Returns TRUE if added OK, else FALSE
  1635. **
  1636. *******************************************************************************/
  1637. //extern
  1638. tBTM_STATUS BTM_BleStackEnable (BOOLEAN enable);
  1639. /*******************************************************************************
  1640. **
  1641. ** Function BTM_GetLeSecurityState
  1642. **
  1643. ** Description This function is called to get security mode 1 flags and
  1644. ** encryption key size for LE peer.
  1645. **
  1646. ** Returns BOOLEAN TRUE if LE device is found, FALSE otherwise.
  1647. **
  1648. *******************************************************************************/
  1649. //extern
  1650. BOOLEAN BTM_GetLeSecurityState (BD_ADDR bd_addr,
  1651. UINT8 *p_le_dev_sec_flags,
  1652. UINT8 *p_le_key_size);
  1653. /*******************************************************************************
  1654. **
  1655. ** Function BTM_BleSecurityProcedureIsRunning
  1656. **
  1657. ** Description This function indicates if LE security procedure is
  1658. ** currently running with the peer.
  1659. **
  1660. ** Returns BOOLEAN TRUE if security procedure is running, FALSE otherwise.
  1661. **
  1662. *******************************************************************************/
  1663. //extern
  1664. BOOLEAN BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr);
  1665. /*******************************************************************************
  1666. **
  1667. ** Function BTM_BleGetSupportedKeySize
  1668. **
  1669. ** Description This function gets the maximum encryption key size in bytes
  1670. ** the local device can suport.
  1671. ** record.
  1672. **
  1673. ** Returns the key size or 0 if the size can't be retrieved.
  1674. **
  1675. *******************************************************************************/
  1676. //extern
  1677. UINT8 BTM_BleGetSupportedKeySize (BD_ADDR bd_addr);
  1678. /*******************************************************************************/
  1679. /* Multi ADV API */
  1680. /*******************************************************************************
  1681. **
  1682. ** Function BTM_BleEnableAdvInstance
  1683. **
  1684. ** Description This function enable a Multi-ADV instance with the specified
  1685. ** adv parameters
  1686. **
  1687. ** Parameters p_params: pointer to the adv parameter structure, set as default
  1688. ** adv parameter when the instance is enabled.
  1689. ** p_cback: callback function for the adv instance.
  1690. ** p_ref: reference data attach to the adv instance to be enabled.
  1691. **
  1692. ** Returns status
  1693. **
  1694. *******************************************************************************/
  1695. //extern
  1696. tBTM_STATUS BTM_BleEnableAdvInstance (tBTM_BLE_ADV_PARAMS *p_params,
  1697. tBTM_BLE_MULTI_ADV_CBACK *p_cback,
  1698. void *p_ref);
  1699. /*******************************************************************************
  1700. **
  1701. ** Function BTM_BleUpdateAdvInstParam
  1702. **
  1703. ** Description This function update a Multi-ADV instance with the specififed
  1704. ** adv parameters.
  1705. **
  1706. ** Parameters inst_id: adv instance ID
  1707. ** p_params: pointer to the adv parameter structure.
  1708. **
  1709. ** Returns status
  1710. **
  1711. *******************************************************************************/
  1712. //extern
  1713. tBTM_STATUS BTM_BleUpdateAdvInstParam (UINT8 inst_id, tBTM_BLE_ADV_PARAMS *p_params);
  1714. /*******************************************************************************
  1715. **
  1716. ** Function BTM_BleCfgAdvInstData
  1717. **
  1718. ** Description This function configure a Multi-ADV instance with the specified
  1719. ** adv data or scan response data.
  1720. **
  1721. ** Parameters inst_id: adv instance ID
  1722. ** is_scan_rsp: is this scacn response, if no set as adv data.
  1723. ** data_mask: adv data mask.
  1724. ** p_data: pointer to the adv data structure.
  1725. **
  1726. ** Returns status
  1727. **
  1728. *******************************************************************************/
  1729. //extern
  1730. tBTM_STATUS BTM_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
  1731. tBTM_BLE_AD_MASK data_mask,
  1732. tBTM_BLE_ADV_DATA *p_data);
  1733. /*******************************************************************************
  1734. **
  1735. ** Function BTM_BleDisableAdvInstance
  1736. **
  1737. ** Description This function disable a Multi-ADV instance.
  1738. **
  1739. ** Parameters inst_id: adv instance ID
  1740. **
  1741. ** Returns status
  1742. **
  1743. *******************************************************************************/
  1744. //extern
  1745. tBTM_STATUS BTM_BleDisableAdvInstance (UINT8 inst_id);
  1746. /*******************************************************************************
  1747. **
  1748. ** Function BTM_BleAdvFilterParamSetup
  1749. **
  1750. ** Description This function is called to setup the adv data payload filter
  1751. ** condition.
  1752. **
  1753. ** Parameters p_target: enabble the filter condition on a target device; if NULL
  1754. ** enable the generic scan condition.
  1755. ** enable: enable or disable the filter condition
  1756. **
  1757. ** Returns void
  1758. **
  1759. *******************************************************************************/
  1760. //extern
  1761. tBTM_STATUS BTM_BleAdvFilterParamSetup(int action,
  1762. tBTM_BLE_PF_FILT_INDEX filt_index,
  1763. tBTM_BLE_PF_FILT_PARAMS *p_filt_params,
  1764. tBLE_BD_ADDR *p_target, tBTM_BLE_PF_PARAM_CBACK *p_cmpl_cback,
  1765. tBTM_BLE_REF_VALUE ref_value);
  1766. /*******************************************************************************
  1767. **
  1768. ** Function BTM_BleCfgFilterCondition
  1769. **
  1770. ** Description This function is called to configure the adv data payload filter
  1771. ** condition.
  1772. **
  1773. ** Parameters action: to read/write/clear
  1774. ** cond_type: filter condition type.
  1775. ** p_cond: filter condition paramter
  1776. **
  1777. ** Returns tBTM_STATUS
  1778. **
  1779. *******************************************************************************/
  1780. //extern
  1781. tBTM_STATUS BTM_BleCfgFilterCondition(tBTM_BLE_SCAN_COND_OP action,
  1782. tBTM_BLE_PF_COND_TYPE cond_type,
  1783. tBTM_BLE_PF_FILT_INDEX filt_index,
  1784. tBTM_BLE_PF_COND_PARAM *p_cond,
  1785. tBTM_BLE_PF_CFG_CBACK *p_cmpl_cback,
  1786. tBTM_BLE_REF_VALUE ref_value);
  1787. /*******************************************************************************
  1788. **
  1789. ** Function BTM_BleEnableDisableFilterFeature
  1790. **
  1791. ** Description This function is called to enable or disable the APCF feature
  1792. **
  1793. ** Parameters enable - TRUE - enables the APCF, FALSE - disables the APCF
  1794. ** ref_value - Ref value
  1795. **
  1796. ** Returns tBTM_STATUS
  1797. **
  1798. *******************************************************************************/
  1799. //extern
  1800. tBTM_STATUS BTM_BleEnableDisableFilterFeature(UINT8 enable,
  1801. tBTM_BLE_PF_STATUS_CBACK *p_stat_cback,
  1802. tBTM_BLE_REF_VALUE ref_value);
  1803. /*******************************************************************************
  1804. **
  1805. ** Function BTM_BleGetEnergyInfo
  1806. **
  1807. ** Description This function obtains the energy info
  1808. **
  1809. ** Parameters p_ener_cback - Callback pointer
  1810. **
  1811. ** Returns status
  1812. **
  1813. *******************************************************************************/
  1814. //extern
  1815. tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback);
  1816. /*******************************************************************************
  1817. **
  1818. ** Function BTM_SetBleDataLength
  1819. **
  1820. ** Description This function is called to set maximum BLE transmission packet size
  1821. **
  1822. ** Returns BTM_SUCCESS if success; otherwise failed.
  1823. **
  1824. *******************************************************************************/
  1825. //extern
  1826. tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length);
  1827. /*
  1828. #ifdef __cplusplus
  1829. }
  1830. #endif
  1831. */
  1832. #endif