btm_ble_api.h 75 KB

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