btm_ble_api.h 81 KB

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