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