• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2005-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 advanced
22  *  audio/video
23  *
24  ******************************************************************************/
25 
26 #include "bt_target.h"
27 #include "gki.h"
28 #include "bta_api.h"
29 #include "bta_av_int.h"
30 
31 #ifndef BTA_AV_RC_PASS_RSP_CODE
32 #define BTA_AV_RC_PASS_RSP_CODE     BTA_AV_RSP_NOT_IMPL
33 #endif
34 
35 const UINT32  bta_av_meta_caps_co_ids[] = {
36     AVRC_CO_METADATA,
37     AVRC_CO_BROADCOM
38 };
39 
40 /* AVRCP cupported categories */
41 #define BTA_AV_RC_SUPF_CT       (AVRC_SUPF_CT_CAT2)
42 
43 /* Added to modify
44 **	1. flush timeout
45 **	2. Remove Group navigation support in SupportedFeatures
46 **	3. GetCapabilities supported event_ids list
47 **	4. GetCapabilities supported event_ids count
48 */
49 #ifdef ANDROID_APP_INCLUDED
50 /* Flushing partial avdtp packets can cause some headsets to disconnect the link
51    if receiving partial a2dp frames */
52 const UINT16  bta_av_audio_flush_to[] = {
53      0, /* 1 stream */
54      0, /* 2 streams */
55      0, /* 3 streams */
56      0, /* 4 streams */
57      0  /* 5 streams */
58 };     /* AVDTP audio transport channel flush timeout */
59 
60 /* Note: Android doesnt support AVRC_SUPF_TG_GROUP_NAVI  */
61 /* Note: if AVRC_SUPF_TG_GROUP_NAVI is set, bta_av_cfg.avrc_group should be TRUE */
62 #if AVRC_METADATA_INCLUDED == TRUE
63 #define BTA_AV_RC_SUPF_TG       (AVRC_SUPF_TG_CAT1) /* TODO: | AVRC_SUPF_TG_APP_SETTINGS) */
64 #else
65 #define BTA_AV_RC_SUPF_TG       (AVRC_SUPF_TG_CAT1)
66 #endif
67 
68 /*
69  * If the number of event IDs is changed in this array, BTA_AV_ NUM_RC_EVT_IDS   also needs to be changed.
70  */
71 const UINT8  bta_av_meta_caps_evt_ids[] = {
72     AVRC_EVT_PLAY_STATUS_CHANGE,
73     AVRC_EVT_TRACK_CHANGE,
74     AVRC_EVT_PLAY_POS_CHANGED,
75     /* TODO: Add support for these events
76     AVRC_EVT_APP_SETTING_CHANGE,
77     */
78 };
79 #ifndef BTA_AV_NUM_RC_EVT_IDS
80 #define BTA_AV_NUM_RC_EVT_IDS   (sizeof(bta_av_meta_caps_evt_ids) / sizeof(bta_av_meta_caps_evt_ids[0]))
81 #endif /* BTA_AV_NUM_RC_EVT_IDS */
82 
83 #endif /* ANDROID_APP_INCLUDED */
84 
85 /* the MTU for the AVRCP browsing channel */
86 #ifndef BTA_AV_MAX_RC_BR_MTU
87 #define BTA_AV_MAX_RC_BR_MTU      1008
88 #endif
89 
90 const tBTA_AV_CFG bta_av_cfg =
91 {
92     AVRC_CO_BROADCOM,       /* AVRCP Company ID */
93 #if AVRC_METADATA_INCLUDED == TRUE
94     512,                    /* AVRCP MTU at L2CAP for control channel */
95 #else
96     48,                     /* AVRCP MTU at L2CAP for control channel */
97 #endif
98     BTA_AV_MAX_RC_BR_MTU,   /* AVRCP MTU at L2CAP for browsing channel */
99     BTA_AV_RC_SUPF_CT,      /* AVRCP controller categories */
100     BTA_AV_RC_SUPF_TG,      /* AVRCP target categories */
101     672,                    /* AVDTP signaling channel MTU at L2CAP */
102     BTA_AV_MAX_A2DP_MTU,    /* AVDTP audio transport channel MTU at L2CAP */
103     bta_av_audio_flush_to,  /* AVDTP audio transport channel flush timeout */
104     6,                      /* AVDTP audio channel max data queue size */
105     BTA_AV_MAX_VDP_MTU,     /* AVDTP video transport channel MTU at L2CAP */
106     600,                    /* AVDTP video transport channel flush timeout */
107     TRUE,                   /* TRUE, to accept AVRC 1.3 group nevigation command */
108     2,                      /* company id count in p_meta_co_ids */
109     BTA_AV_NUM_RC_EVT_IDS, /* event id count in p_meta_evt_ids */
110     BTA_AV_RC_PASS_RSP_CODE,/* the default response code for pass through commands */
111     bta_av_meta_caps_co_ids,/* the metadata Get Capabilities response for company id */
112     bta_av_meta_caps_evt_ids,/* the the metadata Get Capabilities response for event id */
113     NULL,                   /* the action function table for VDP stream */
114     NULL,                   /* action function to register VDP */
115     {0},                    /* Default AVRCP controller name */
116     {0},                    /* Default AVRCP target name */
117 };
118 
119 tBTA_AV_CFG *p_bta_av_cfg = (tBTA_AV_CFG *) &bta_av_cfg;
120 
121 const UINT16 bta_av_rc_id[] =
122 {
123     0x021F, /* bit mask: 0=SELECT, 1=UP, 2=DOWN, 3=LEFT,
124                          4=RIGHT, 5=RIGHT_UP, 6=RIGHT_DOWN, 7=LEFT_UP,
125                          8=LEFT_DOWN, 9=ROOT_MENU, 10=SETUP_MENU, 11=CONT_MENU,
126                          12=FAV_MENU, 13=EXIT */
127 
128     0,      /* not used */
129 
130     0x0000, /* bit mask: 0=0, 1=1, 2=2, 3=3,
131                          4=4, 5=5, 6=6, 7=7,
132                          8=8, 9=9, 10=DOT, 11=ENTER,
133                          12=CLEAR */
134 
135     0x0003, /* bit mask: 0=CHAN_UP, 1=CHAN_DOWN, 2=PREV_CHAN, 3=SOUND_SEL,
136                          4=INPUT_SEL, 5=DISP_INFO, 6=HELP, 7=PAGE_UP,
137                          8=PAGE_DOWN */
138 
139 #if (BTA_AV_RC_PASS_RSP_CODE == BTA_AV_RSP_INTERIM)
140     /* btui_app provides an example of how to leave the decision of rejecting a command or not
141      * based on which media player is currently addressed (this is only applicable for AVRCP 1.4 or later)
142      * If the decision is per player for a particular rc_id, the related bit is clear (not set) */
143     0x0070, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
144                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
145                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
146                          12=BACKWARD */
147 #else
148 #if (defined BTA_AVRCP_FF_RW_SUPPORT) && (BTA_AVRCP_FF_RW_SUPPORT == TRUE)
149     0x1b70, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
150                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
151                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
152                          12=BACKWARD */
153 #else
154     0x1870, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
155                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
156                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
157                          12=BACKWARD */
158 #endif
159 #endif
160 
161     0x0000, /* bit mask: 0=ANGLE, 1=SUBPICT */
162 
163     0,      /* not used */
164 
165     0x0000  /* bit mask: 0=not used, 1=F1, 2=F2, 3=F3,
166                          4=F4, 5=F5 */
167 };
168 
169 #if (BTA_AV_RC_PASS_RSP_CODE == BTA_AV_RSP_INTERIM)
170 const UINT16 bta_av_rc_id_ac[] =
171 {
172     0x0000, /* bit mask: 0=SELECT, 1=UP, 2=DOWN, 3=LEFT,
173                          4=RIGHT, 5=RIGHT_UP, 6=RIGHT_DOWN, 7=LEFT_UP,
174                          8=LEFT_DOWN, 9=ROOT_MENU, 10=SETUP_MENU, 11=CONT_MENU,
175                          12=FAV_MENU, 13=EXIT */
176 
177     0,      /* not used */
178 
179     0x0000, /* bit mask: 0=0, 1=1, 2=2, 3=3,
180                          4=4, 5=5, 6=6, 7=7,
181                          8=8, 9=9, 10=DOT, 11=ENTER,
182                          12=CLEAR */
183 
184     0x0000, /* bit mask: 0=CHAN_UP, 1=CHAN_DOWN, 2=PREV_CHAN, 3=SOUND_SEL,
185                          4=INPUT_SEL, 5=DISP_INFO, 6=HELP, 7=PAGE_UP,
186                          8=PAGE_DOWN */
187 
188     /* btui_app provides an example of how to leave the decision of rejecting a command or not
189      * based on which media player is currently addressed (this is only applicable for AVRCP 1.4 or later)
190      * If the decision is per player for a particular rc_id, the related bit is set */
191     0x1800, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
192                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
193                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
194                          12=BACKWARD */
195 
196     0x0000, /* bit mask: 0=ANGLE, 1=SUBPICT */
197 
198     0,      /* not used */
199 
200     0x0000  /* bit mask: 0=not used, 1=F1, 2=F2, 3=F3,
201                          4=F4, 5=F5 */
202 };
203 UINT16 *p_bta_av_rc_id_ac = (UINT16 *) bta_av_rc_id_ac;
204 #else
205 UINT16 *p_bta_av_rc_id_ac = NULL;
206 #endif
207 
208 UINT16 *p_bta_av_rc_id = (UINT16 *) bta_av_rc_id;
209