Home | History | Annotate | Download | only in av
      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 };
    114 
    115 tBTA_AV_CFG *p_bta_av_cfg = (tBTA_AV_CFG *) &bta_av_cfg;
    116 
    117 const UINT16 bta_av_rc_id[] =
    118 {
    119     0x021F, /* bit mask: 0=SELECT, 1=UP, 2=DOWN, 3=LEFT,
    120                          4=RIGHT, 5=RIGHT_UP, 6=RIGHT_DOWN, 7=LEFT_UP,
    121                          8=LEFT_DOWN, 9=ROOT_MENU, 10=SETUP_MENU, 11=CONT_MENU,
    122                          12=FAV_MENU, 13=EXIT */
    123 
    124     0,      /* not used */
    125 
    126     0x0000, /* bit mask: 0=0, 1=1, 2=2, 3=3,
    127                          4=4, 5=5, 6=6, 7=7,
    128                          8=8, 9=9, 10=DOT, 11=ENTER,
    129                          12=CLEAR */
    130 
    131     0x0003, /* bit mask: 0=CHAN_UP, 1=CHAN_DOWN, 2=PREV_CHAN, 3=SOUND_SEL,
    132                          4=INPUT_SEL, 5=DISP_INFO, 6=HELP, 7=PAGE_UP,
    133                          8=PAGE_DOWN */
    134 
    135 #if (BTA_AV_RC_PASS_RSP_CODE == BTA_AV_RSP_INTERIM)
    136     /* btui_app provides an example of how to leave the decision of rejecting a command or not
    137      * based on which media player is currently addressed (this is only applicable for AVRCP 1.4 or later)
    138      * If the decision is per player for a particular rc_id, the related bit is clear (not set) */
    139     0x0070, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
    140                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
    141                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
    142                          12=BACKWARD */
    143 #else
    144 #if (defined BTA_AVRCP_FF_RW_SUPPORT) && (BTA_AVRCP_FF_RW_SUPPORT == TRUE)
    145     0x1b70, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
    146                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
    147                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
    148                          12=BACKWARD */
    149 #else
    150     0x1870, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
    151                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
    152                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
    153                          12=BACKWARD */
    154 #endif
    155 #endif
    156 
    157     0x0000, /* bit mask: 0=ANGLE, 1=SUBPICT */
    158 
    159     0,      /* not used */
    160 
    161     0x0000  /* bit mask: 0=not used, 1=F1, 2=F2, 3=F3,
    162                          4=F4, 5=F5 */
    163 };
    164 
    165 #if (BTA_AV_RC_PASS_RSP_CODE == BTA_AV_RSP_INTERIM)
    166 const UINT16 bta_av_rc_id_ac[] =
    167 {
    168     0x0000, /* bit mask: 0=SELECT, 1=UP, 2=DOWN, 3=LEFT,
    169                          4=RIGHT, 5=RIGHT_UP, 6=RIGHT_DOWN, 7=LEFT_UP,
    170                          8=LEFT_DOWN, 9=ROOT_MENU, 10=SETUP_MENU, 11=CONT_MENU,
    171                          12=FAV_MENU, 13=EXIT */
    172 
    173     0,      /* not used */
    174 
    175     0x0000, /* bit mask: 0=0, 1=1, 2=2, 3=3,
    176                          4=4, 5=5, 6=6, 7=7,
    177                          8=8, 9=9, 10=DOT, 11=ENTER,
    178                          12=CLEAR */
    179 
    180     0x0000, /* bit mask: 0=CHAN_UP, 1=CHAN_DOWN, 2=PREV_CHAN, 3=SOUND_SEL,
    181                          4=INPUT_SEL, 5=DISP_INFO, 6=HELP, 7=PAGE_UP,
    182                          8=PAGE_DOWN */
    183 
    184     /* btui_app provides an example of how to leave the decision of rejecting a command or not
    185      * based on which media player is currently addressed (this is only applicable for AVRCP 1.4 or later)
    186      * If the decision is per player for a particular rc_id, the related bit is set */
    187     0x1800, /* bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE,
    188                          4=PLAY, 5=STOP, 6=PAUSE, 7=RECORD,
    189                          8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
    190                          12=BACKWARD */
    191 
    192     0x0000, /* bit mask: 0=ANGLE, 1=SUBPICT */
    193 
    194     0,      /* not used */
    195 
    196     0x0000  /* bit mask: 0=not used, 1=F1, 2=F2, 3=F3,
    197                          4=F4, 5=F5 */
    198 };
    199 UINT16 *p_bta_av_rc_id_ac = (UINT16 *) bta_av_rc_id_ac;
    200 #else
    201 UINT16 *p_bta_av_rc_id_ac = NULL;
    202 #endif
    203 
    204 UINT16 *p_bta_av_rc_id = (UINT16 *) bta_av_rc_id;
    205