bta_dm_cfg.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2003-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 compile-time configurable constants for the device
  21. * manager.
  22. *
  23. ******************************************************************************/
  24. #include <stddef.h>
  25. #include "common/bt_target.h"
  26. #include "bta/bta_sys.h"
  27. #include "bta/bta_api.h"
  28. #include "bta_dm_int.h"
  29. #include "bta/bta_jv_api.h"
  30. #include "bta/bta_gap_bt_co.h"
  31. #ifndef BTA_DM_LINK_POLICY_SETTINGS
  32. #define BTA_DM_LINK_POLICY_SETTINGS (HCI_ENABLE_MASTER_SLAVE_SWITCH | HCI_ENABLE_HOLD_MODE | HCI_ENABLE_SNIFF_MODE | HCI_ENABLE_PARK_MODE)
  33. #endif
  34. /* page timeout in 625uS */
  35. #ifndef BTA_DM_PAGE_TIMEOUT
  36. #define BTA_DM_PAGE_TIMEOUT 8192
  37. #endif
  38. /* link supervision timeout in 625uS (5 secs) */
  39. #ifndef BTA_DM_LINK_TIMEOUT
  40. #define BTA_DM_LINK_TIMEOUT 8000
  41. #endif
  42. /* TRUE to avoid scatternet when av is streaming (be the master) */
  43. #ifndef BTA_DM_AVOID_SCATTER_A2DP
  44. #define BTA_DM_AVOID_SCATTER_A2DP TRUE
  45. #endif
  46. /* For Insight, PM cfg lookup tables are runtime configurable (to allow tweaking of params for power consumption measurements) */
  47. #ifndef BTE_SIM_APP
  48. #define tBTA_DM_PM_TYPE_QUALIFIER const
  49. #else
  50. #define tBTA_DM_PM_TYPE_QUALIFIER
  51. #endif
  52. const tBTA_DM_CFG bta_dm_cfg = {
  53. /* mobile phone COD */
  54. BTA_DM_COD,
  55. /* link policy settings */
  56. BTA_DM_LINK_POLICY_SETTINGS,
  57. /* page timeout in 625uS */
  58. BTA_DM_PAGE_TIMEOUT,
  59. /* link supervision timeout in 625uS*/
  60. BTA_DM_LINK_TIMEOUT,
  61. /* TRUE to avoid scatternet when av is streaming (be the master) */
  62. BTA_DM_AVOID_SCATTER_A2DP
  63. };
  64. #ifndef BTA_DM_SCATTERNET
  65. /* By default, allow partial scatternet */
  66. #define BTA_DM_SCATTERNET BTA_DM_PARTIAL_SCATTERNET
  67. #endif
  68. #ifndef BTA_HH_ROLE
  69. /* By default, do not specify HH role (backward compatibility) */
  70. #define BTA_HH_ROLE BTA_ANY_ROLE
  71. #endif
  72. #ifndef BTA_AV_ROLE
  73. /* By default, AV role (backward BTA_MASTER_ROLE_PREF) */
  74. #define BTA_AV_ROLE BTA_MASTER_ROLE_PREF
  75. #endif
  76. #ifndef BTA_PANU_ROLE
  77. /* By default, AV role (backward BTA_MASTER_ROLE_PREF) */
  78. #define BTA_PANU_ROLE BTA_SLAVE_ROLE_ONLY
  79. #endif
  80. #define BTA_DM_NUM_RM_ENTRY 6
  81. /* appids for PAN used by insight sample application
  82. these have to be same as defined in btui_int.h */
  83. #define BTUI_PAN_ID_PANU 0
  84. #define BTUI_PAN_ID_NAP 1
  85. #define BTUI_PAN_ID_GN 2
  86. /* First element is always for SYS:
  87. app_id = # of entries table, cfg is
  88. device scatternet support */
  89. const tBTA_DM_RM bta_dm_rm_cfg[] = {
  90. {BTA_ID_SYS, BTA_DM_NUM_RM_ENTRY, BTA_DM_SCATTERNET},
  91. {BTA_ID_PAN, BTUI_PAN_ID_NAP, BTA_ANY_ROLE},
  92. {BTA_ID_PAN, BTUI_PAN_ID_GN, BTA_ANY_ROLE},
  93. {BTA_ID_PAN, BTA_APP_ID_PAN_MULTI, BTA_MASTER_ROLE_ONLY},
  94. {BTA_ID_PAN, BTUI_PAN_ID_PANU, BTA_PANU_ROLE},
  95. {BTA_ID_HH, BTA_ALL_APP_ID, BTA_HH_ROLE},
  96. {BTA_ID_AV, BTA_ALL_APP_ID, BTA_AV_ROLE}
  97. };
  98. tBTA_DM_CFG *const p_bta_dm_cfg = (tBTA_DM_CFG *) &bta_dm_cfg;
  99. tBTA_DM_RM *const p_bta_dm_rm_cfg = (tBTA_DM_RM *) &bta_dm_rm_cfg;
  100. #if BLE_INCLUDED == TRUE
  101. # define BTA_DM_NUM_PM_ENTRY 8 /* number of entries in bta_dm_pm_cfg except the first */
  102. # define BTA_DM_NUM_PM_SPEC 8 /* number of entries in bta_dm_pm_spec */
  103. #else
  104. # define BTA_DM_NUM_PM_ENTRY 6 /* number of entries in bta_dm_pm_cfg except the first */
  105. # define BTA_DM_NUM_PM_SPEC 6 /* number of entries in bta_dm_pm_spec */
  106. #endif
  107. #if (BTA_DM_PM_INCLUDED == TRUE)
  108. tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG bta_dm_pm_cfg[BTA_DM_NUM_PM_ENTRY + 1] = {
  109. {BTA_ID_SYS, BTA_DM_NUM_PM_ENTRY, 0}, /* reserved: specifies length of this table. */
  110. {BTA_ID_AG, BTA_ALL_APP_ID, 0}, /* ag uses first spec table for app id 0 */
  111. {BTA_ID_AV, BTA_ALL_APP_ID, 1}, /* av spec table */
  112. {BTA_ID_JV, BTA_APP_ID_1, 2}, /* app BTA_JV_PM_ID_1, reuse ftc spec table */
  113. {BTA_ID_JV, BTA_ALL_APP_ID, 3}, /* reuse fts spec table */
  114. {BTA_ID_HS, BTA_ALL_APP_ID, 4}, /* HS spec table */
  115. {BTA_ID_AVK, BTA_ALL_APP_ID, 5} /* avk spec table */
  116. #if BLE_INCLUDED == TRUE
  117. , {BTA_ID_GATTC, BTA_ALL_APP_ID, 6} /* gattc spec table */
  118. , {BTA_ID_GATTS, BTA_ALL_APP_ID, 7} /* gatts spec table */
  119. #endif
  120. };
  121. #define BTA_DM_PM_SPEC_TO_OFFSET (197) /* timeout offset to avoid conflict with other bluedroid host */
  122. tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
  123. /* AG : 0 */
  124. {
  125. (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
  126. #if (BTM_SSR_INCLUDED == TRUE)
  127. (BTA_DM_PM_SSR2), /* the SSR entry */
  128. #endif
  129. {
  130. {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */
  131. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  132. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  133. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  134. {{BTA_DM_PM_SNIFF_SCO_OPEN_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */
  135. {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */
  136. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  137. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  138. {{BTA_DM_PM_RETRY, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  139. }
  140. },
  141. /* AV : 1 */
  142. {
  143. (BTA_DM_PM_SNIFF), /* allow sniff */
  144. #if (BTM_SSR_INCLUDED == TRUE)
  145. (BTA_DM_PM_SSR2), /* the SSR entry */
  146. #endif
  147. {
  148. {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */
  149. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  150. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  151. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  152. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
  153. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
  154. {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  155. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  156. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  157. }
  158. },
  159. /* FTC, OPC, JV : 2 */
  160. {
  161. (BTA_DM_PM_SNIFF), /* allow sniff */
  162. #if (BTM_SSR_INCLUDED == TRUE)
  163. (BTA_DM_PM_SSR2), /* the SSR entry */
  164. #endif
  165. {
  166. {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */
  167. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  168. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  169. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  170. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
  171. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
  172. {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  173. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  174. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  175. }
  176. },
  177. /* FTS, PBS, OPS, MSE, BTA_JV_PM_ID_1 : 3 */
  178. {
  179. (BTA_DM_PM_SNIFF), /* allow sniff */
  180. #if (BTM_SSR_INCLUDED == TRUE)
  181. (BTA_DM_PM_SSR2), /* the SSR entry */
  182. #endif
  183. {
  184. {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */
  185. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  186. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  187. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  188. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
  189. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
  190. {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  191. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  192. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  193. }
  194. },
  195. /* HS : 4 */
  196. {
  197. (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
  198. #if (BTM_SSR_INCLUDED == TRUE)
  199. (BTA_DM_PM_SSR2), /* the SSR entry */
  200. #endif
  201. {
  202. {{BTA_DM_PM_SNIFF, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */
  203. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  204. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  205. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  206. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */
  207. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */
  208. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  209. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  210. {{BTA_DM_PM_RETRY, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  211. }
  212. },
  213. /* AVK : 5 */
  214. {
  215. (BTA_DM_PM_SNIFF), /* allow sniff */
  216. #if (BTM_SSR_INCLUDED == TRUE)
  217. (BTA_DM_PM_SSR2), /* the SSR entry */
  218. #endif
  219. {
  220. {{BTA_DM_PM_SNIFF, 3000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */
  221. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  222. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  223. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  224. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
  225. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
  226. {{BTA_DM_PM_SNIFF4, 3000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  227. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  228. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  229. }
  230. }
  231. #if BLE_INCLUDED == TRUE
  232. /* GATTC : 6 */
  233. , {
  234. (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
  235. #if (BTM_SSR_INCLUDED == TRUE)
  236. (BTA_DM_PM_SSR2), /* the SSR entry */
  237. #endif
  238. {
  239. {{BTA_DM_PM_SNIFF_A2DP_IDX, 10000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */
  240. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  241. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  242. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  243. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
  244. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
  245. {{BTA_DM_PM_SNIFF_A2DP_IDX, 10000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  246. {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  247. #if defined(AMP_INCLUDED) && (AMP_INCLUDED == TRUE)
  248. {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* amp */
  249. #endif
  250. {{BTA_DM_PM_RETRY, 5000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  251. }
  252. }
  253. /* GATTS : 7 */
  254. , {
  255. (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
  256. #if (BTM_SSR_INCLUDED == TRUE)
  257. (BTA_DM_PM_SSR2), /* the SSR entry */
  258. #endif
  259. {
  260. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */
  261. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
  262. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
  263. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
  264. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
  265. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
  266. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
  267. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
  268. #if defined(AMP_INCLUDED) && (AMP_INCLUDED == TRUE)
  269. {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* amp */
  270. #endif
  271. {{BTA_DM_PM_RETRY, 5000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
  272. }
  273. }
  274. #endif
  275. #ifdef BTE_SIM_APP /* For Insight builds only */
  276. /* Entries at the end of the pm_spec table are user-defined (runtime configurable),
  277. for power consumption experiments.
  278. Insight finds the first user-defined entry by looking for the first BTA_DM_PM_NO_PREF.
  279. The number of user_defined specs is defined by BTA_SWRAP_UD_PM_SPEC_COUNT */
  280. ,
  281. {BTA_DM_PM_NO_PREF}, /* pm_spec USER_DEFINED_0 */
  282. {BTA_DM_PM_NO_PREF} /* pm_spec USER_DEFINED_1 */
  283. #endif /* BTE_SIM_APP */
  284. };
  285. /* Please refer to the SNIFF table definitions in bta/bta_api.h.
  286. *
  287. * Adding to or Modifying the Table
  288. * Additional sniff parameter entries can be added for BTA_DM_PM_SNIFF5 - BTA_DM_PM_SNIFF7.
  289. * Overrides of additional table entries can be specified in bdroid_buildcfg.h. If additional
  290. * sniff parameter entries are added or an override of an existing entry is specified in
  291. * bdroid_buildcfg.h then the BTA_DM_PM_*_IDX defines in bta/bta_api.h will need to be match the new
  292. * ordering.
  293. *
  294. * Table Ordering
  295. * Sniff Table entries must be ordered from highest latency (biggest interval) to lowest latency.
  296. * If there is a conflict among the connected services the setting with the lowest latency will
  297. * be selected.
  298. */
  299. tBTA_DM_PM_TYPE_QUALIFIER tBTM_PM_PWR_MD bta_dm_pm_md[] = {
  300. /*
  301. * More sniff parameter entries can be added for
  302. * BTA_DM_PM_SNIFF3 - BTA_DM_PM_SNIFF7, if needed. When entries are added or
  303. * removed, BTA_DM_PM_PARK_IDX needs to be updated to reflect the actual index
  304. * BTA_DM_PM_PARK_IDX is defined in bta/bta_api.h and can be override by the
  305. * bdroid_buildcfg.h settings.
  306. * The SNIFF table entries must be in the order from highest latency (biggest
  307. * interval) to lowest latency. If there's a conflict among the connected
  308. * services, the setting with lowest latency wins.
  309. */
  310. /* sniff modes: max interval, min interval, attempt, timeout */
  311. {BTA_DM_PM_SNIFF_MAX, BTA_DM_PM_SNIFF_MIN, BTA_DM_PM_SNIFF_ATTEMPT, BTA_DM_PM_SNIFF_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF - A2DP */
  312. {BTA_DM_PM_SNIFF1_MAX, BTA_DM_PM_SNIFF1_MIN, BTA_DM_PM_SNIFF1_ATTEMPT, BTA_DM_PM_SNIFF1_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF1 */
  313. {BTA_DM_PM_SNIFF2_MAX, BTA_DM_PM_SNIFF2_MIN, BTA_DM_PM_SNIFF2_ATTEMPT, BTA_DM_PM_SNIFF2_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF2- HD idle */
  314. {BTA_DM_PM_SNIFF3_MAX, BTA_DM_PM_SNIFF3_MIN, BTA_DM_PM_SNIFF3_ATTEMPT, BTA_DM_PM_SNIFF3_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF3- SCO open */
  315. {BTA_DM_PM_SNIFF4_MAX, BTA_DM_PM_SNIFF4_MIN, BTA_DM_PM_SNIFF4_ATTEMPT, BTA_DM_PM_SNIFF4_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF4- HD active */
  316. {BTA_DM_PM_SNIFF5_MAX, BTA_DM_PM_SNIFF5_MIN, BTA_DM_PM_SNIFF5_ATTEMPT, BTA_DM_PM_SNIFF5_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF5- HD active */
  317. {BTA_DM_PM_PARK_MAX, BTA_DM_PM_PARK_MIN, BTA_DM_PM_PARK_ATTEMPT, BTA_DM_PM_PARK_TIMEOUT, BTM_PM_MD_PARK}
  318. #ifdef BTE_SIM_APP /* For Insight builds only */
  319. /* Entries at the end of the bta_dm_pm_md table are user-defined (runtime configurable),
  320. for power consumption experiments.
  321. Insight finds the first user-defined entry by looking for the first 'max=0'.
  322. The number of user_defined specs is defined by BTA_SWRAP_UD_PM_DM_COUNT */
  323. ,
  324. {0}, /* CONN_OPEN/SCO_CLOSE power mode settings for pm_spec USER_DEFINED_0 */
  325. {0}, /* SCO_OPEN power mode settings for pm_spec USER_DEFINED_0 */
  326. {0}, /* CONN_OPEN/SCO_CLOSE power mode settings for pm_spec USER_DEFINED_1 */
  327. {0} /* SCO_OPEN power mode settings for pm_spec USER_DEFINED_1 */
  328. #endif /* BTE_SIM_APP */
  329. };
  330. /* 0=max_lat -> no SSR */
  331. /* the smaller of the SSR max latency wins.
  332. * the entries in this table must be from highest latency (biggest interval) to lowest latency */
  333. #if (BTM_SSR_INCLUDED == TRUE)
  334. tBTA_DM_SSR_SPEC bta_dm_ssr_spec[] = {
  335. /*max_lat, min_rmt_to, min_loc_to*/
  336. {0, 0, 0}, /* BTA_DM_PM_SSR0 - do not use SSR */
  337. {0, 0, 2}, /* BTA_DM_PM_SSR1 - HH, can NOT share entry with any other profile,
  338. seting default max latency and min remote timeout as 0,
  339. and always read individual device preference from HH module */
  340. {1200, 2, 2}, /* BTA_DM_PM_SSR2 - others (as long as sniff is allowed)*/
  341. {360, 160, 2} /* BTA_DM_PM_SSR3 - HD */
  342. };
  343. tBTA_DM_SSR_SPEC *const p_bta_dm_ssr_spec = (tBTA_DM_SSR_SPEC *) &bta_dm_ssr_spec;
  344. #endif
  345. tBTA_DM_PM_CFG *const p_bta_dm_pm_cfg = (tBTA_DM_PM_CFG *) &bta_dm_pm_cfg;
  346. tBTA_DM_PM_SPEC *const p_bta_dm_pm_spec = (tBTA_DM_PM_SPEC *) &bta_dm_pm_spec;
  347. tBTM_PM_PWR_MD *const p_bta_dm_pm_md = (tBTM_PM_PWR_MD *) &bta_dm_pm_md;
  348. #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
  349. /* The performance impact of EIR packet size
  350. **
  351. ** When BTM_EIR_DEFAULT_FEC_REQUIRED is TRUE,
  352. ** 1 to 17 bytes, DM1 is used and most robust.
  353. ** 18 to 121 bytes, DM3 is used but impacts inquiry scan time with large number
  354. ** of devices.(almost double with 150 users)
  355. ** 122 to 224 bytes, DM5 is used but cause quite big performance loss even with
  356. ** small number of users. so it is not recommended.
  357. ** 225 to 240 bytes, DH5 is used without FEC but it not recommended.
  358. ** (same reason of DM5)
  359. **
  360. ** When BTM_EIR_DEFAULT_FEC_REQUIRED is FALSE,
  361. ** 1 to 27 bytes, DH1 is used but only robust at short range.
  362. ** 28 to 183 bytes, DH3 is used but only robust at short range and impacts inquiry
  363. ** scan time with large number of devices.
  364. ** 184 to 240 bytes, DH5 is used but it not recommended.
  365. */
  366. #if (BTA_EIR_CANNED_UUID_LIST == TRUE)
  367. /* for example */
  368. const UINT8 bta_dm_eir_uuid16_list[] = { 0x08, 0x11, /* Headset */
  369. 0x1E, 0x11, /* Handsfree */
  370. 0x0E, 0x11, /* AV Remote Control */
  371. 0x0B, 0x11, /* Audio Sink */
  372. };
  373. #endif // BTA_EIR_CANNED_UUID_LIST
  374. /* Extended Inquiry Response */
  375. tBTA_DM_EIR_CONF bta_dm_eir_cfg = {
  376. BTM_EIR_DEFAULT_FEC_REQUIRED, /* FEC required */
  377. 50, /* minimum length of local name when it is shortened */
  378. /* if length of local name is longer than this and EIR has not enough */
  379. /* room for all UUID list then local name is shortened to this length */
  380. TRUE, /* Included UUIDs */
  381. #if (BTA_EIR_CANNED_UUID_LIST == TRUE)
  382. 8,
  383. (UINT8 *)bta_dm_eir_uuid16_list,
  384. #else // BTA_EIR_CANNED_UUID_LIST
  385. { /* mask of UUID list in EIR */
  386. 0xFFFFFFFF, /* LSB is the first UUID of the first 32 UUIDs in BTM_EIR_UUID_LKUP_TBL */
  387. 0xFFFFFFFF /* LSB is the first UUID of the next 32 UUIDs in BTM_EIR_UUID_LKUP_TBL */
  388. /* BTM_EIR_UUID_LKUP_TBL can be overrided */
  389. },
  390. #endif // BTA_EIR_CANNED_UUID_LIST
  391. FALSE, /* Not included TX power*/
  392. 3, /* Inquiry TX power */
  393. 0, /* flags for EIR */
  394. 0, /* length of manufacturer specific in bytes */
  395. NULL, /* manufacturer specific */
  396. 0, /* length of URL in bytes */
  397. NULL, /* URL */
  398. #if (BTC_GAP_BT_INCLUDED == TRUE)
  399. (tBTA_DM_CONFIG_EIR_CBACK *)btc_gap_bt_config_eir_cmpl_callback /* callback */
  400. #else
  401. NULL
  402. #endif /* #if (BTC_GAP_BT_INCLUDED == TRUE) */
  403. };
  404. tBTA_DM_EIR_CONF *p_bta_dm_eir_cfg = (tBTA_DM_EIR_CONF *) &bta_dm_eir_cfg;