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