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