Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a210014 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Remove unnecessery re-defininitions of BTA_AV constants

* Remove unused BTA_AV_* re-defenitions
* Replace remaining BTA_AV_* constants with the corresponding
  AVRC_* sonstant

Test: Code compilation
Change-Id: I4c7a04738bf41e661da15f3a86ea36974c391adf
parent 1c68b341
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -366,12 +366,12 @@ uint8_t bta_av_rc_create(tBTA_AV_CB* p_cb, uint8_t role, uint8_t shdl,
 *
 * Description      Check if it is Group Navigation Msg for Metadata
 *
 * Returns          BTA_AV_RSP_ACCEPT or BTA_AV_RSP_NOT_IMPL.
 * Returns          AVRC_RSP_ACCEPT or AVRC_RSP_NOT_IMPL
 *
 ******************************************************************************/
static tBTA_AV_CODE bta_av_group_navi_supported(uint8_t len, uint8_t* p_data,
                                                bool is_inquiry) {
  tBTA_AV_CODE ret = BTA_AV_RSP_NOT_IMPL;
  tBTA_AV_CODE ret = AVRC_RSP_NOT_IMPL;
  uint8_t* p_ptr = p_data;
  uint16_t u16;
  uint32_t u32;
@@ -382,12 +382,12 @@ static tBTA_AV_CODE bta_av_group_navi_supported(uint8_t len, uint8_t* p_data,

    if (u32 == AVRC_CO_METADATA) {
      if (is_inquiry) {
        if (u16 <= AVRC_PDU_PREV_GROUP) ret = BTA_AV_RSP_IMPL_STBL;
        if (u16 <= AVRC_PDU_PREV_GROUP) ret = AVRC_RSP_IMPL_STBL;
      } else {
        if (u16 <= AVRC_PDU_PREV_GROUP)
          ret = BTA_AV_RSP_ACCEPT;
          ret = AVRC_RSP_ACCEPT;
        else
          ret = BTA_AV_RSP_REJ;
          ret = AVRC_RSP_REJ;
      }
    }
  }
@@ -401,24 +401,24 @@ static tBTA_AV_CODE bta_av_group_navi_supported(uint8_t len, uint8_t* p_data,
 *
 * Description      Check if remote control operation is supported.
 *
 * Returns          BTA_AV_RSP_ACCEPT of supported, BTA_AV_RSP_NOT_IMPL if not.
 * Returns          AVRC_RSP_ACCEPT of supported, AVRC_RSP_NOT_IMPL if not.
 *
 ******************************************************************************/
static tBTA_AV_CODE bta_av_op_supported(tBTA_AV_RC rc_id, bool is_inquiry) {
  tBTA_AV_CODE ret_code = BTA_AV_RSP_NOT_IMPL;
  tBTA_AV_CODE ret_code = AVRC_RSP_NOT_IMPL;

  if (p_bta_av_rc_id) {
    if (is_inquiry) {
      if (p_bta_av_rc_id[rc_id >> 4] & (1 << (rc_id & 0x0F))) {
        ret_code = BTA_AV_RSP_IMPL_STBL;
        ret_code = AVRC_RSP_IMPL_STBL;
      }
    } else {
      if (p_bta_av_rc_id[rc_id >> 4] & (1 << (rc_id & 0x0F))) {
        ret_code = BTA_AV_RSP_ACCEPT;
      } else if ((p_bta_av_cfg->rc_pass_rsp == BTA_AV_RSP_INTERIM) &&
        ret_code = AVRC_RSP_ACCEPT;
      } else if ((p_bta_av_cfg->rc_pass_rsp == AVRC_RSP_INTERIM) &&
                 p_bta_av_rc_id_ac) {
        if (p_bta_av_rc_id_ac[rc_id >> 4] & (1 << (rc_id & 0x0F))) {
          ret_code = BTA_AV_RSP_INTERIM;
          ret_code = AVRC_RSP_INTERIM;
        }
      }
    }
@@ -762,7 +762,7 @@ tBTA_AV_EVT bta_av_proc_meta_cmd(tAVRC_RESPONSE* p_rc_rsp,
    APPL_TRACE_DEBUG("SUBUNIT must be PANEL");
    /* reject it */
    evt = 0;
    p_vendor->hdr.ctype = BTA_AV_RSP_NOT_IMPL;
    p_vendor->hdr.ctype = AVRC_RSP_NOT_IMPL;
    p_vendor->vendor_len = 0;
    p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM;
  } else if (!AVRC_IsValidAvcType(pdu, p_vendor->hdr.ctype)) {
@@ -860,7 +860,7 @@ void bta_av_rc_msg(tBTA_AV_CB* p_cb, tBTA_AV_DATA* p_data) {
      osi_property_get("bluetooth.pts.avrcp_ct.support", avrcp_ct_support,
                       "false");
      if (p_data->rc_msg.msg.pass.op_id == AVRC_ID_VENDOR) {
        p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_NOT_IMPL;
        p_data->rc_msg.msg.hdr.ctype = AVRC_RSP_NOT_IMPL;
#if (AVRC_METADATA_INCLUDED == TRUE)
        if (p_cb->features & BTA_AV_FEAT_METADATA)
          p_data->rc_msg.msg.hdr.ctype = bta_av_group_navi_supported(
@@ -870,7 +870,7 @@ void bta_av_rc_msg(tBTA_AV_CB* p_cb, tBTA_AV_DATA* p_data) {
      } else if (((p_data->rc_msg.msg.pass.op_id == AVRC_ID_VOL_UP) ||
                  (p_data->rc_msg.msg.pass.op_id == AVRC_ID_VOL_DOWN)) &&
                 !strcmp(avrcp_ct_support, "true")) {
        p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_ACCEPT;
        p_data->rc_msg.msg.hdr.ctype = AVRC_RSP_ACCEPT;
      } else {
        p_data->rc_msg.msg.hdr.ctype =
            bta_av_op_supported(p_data->rc_msg.msg.pass.op_id, is_inquiry);
@@ -879,13 +879,13 @@ void bta_av_rc_msg(tBTA_AV_CB* p_cb, tBTA_AV_DATA* p_data) {
      APPL_TRACE_DEBUG("ctype %d", p_data->rc_msg.msg.hdr.ctype)

      /* send response */
      if (p_data->rc_msg.msg.hdr.ctype != BTA_AV_RSP_INTERIM)
      if (p_data->rc_msg.msg.hdr.ctype != AVRC_RSP_INTERIM)
        AVRC_PassRsp(p_data->rc_msg.handle, p_data->rc_msg.label,
                     &p_data->rc_msg.msg.pass);

      /* set up for callback if supported */
      if (p_data->rc_msg.msg.hdr.ctype == BTA_AV_RSP_ACCEPT ||
          p_data->rc_msg.msg.hdr.ctype == BTA_AV_RSP_INTERIM) {
      if (p_data->rc_msg.msg.hdr.ctype == AVRC_RSP_ACCEPT ||
          p_data->rc_msg.msg.hdr.ctype == AVRC_RSP_INTERIM) {
        evt = BTA_AV_REMOTE_CMD_EVT;
        av.remote_cmd.rc_id = p_data->rc_msg.msg.pass.op_id;
        av.remote_cmd.key_state = p_data->rc_msg.msg.pass.state;
@@ -918,7 +918,7 @@ void bta_av_rc_msg(tBTA_AV_CB* p_cb, tBTA_AV_DATA* p_data) {
    }
    /* must be a bad ctype -> reject*/
    else {
      p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_REJ;
      p_data->rc_msg.msg.hdr.ctype = AVRC_RSP_REJ;
      AVRC_PassRsp(p_data->rc_msg.handle, p_data->rc_msg.label,
                   &p_data->rc_msg.msg.pass);
    }
@@ -963,10 +963,10 @@ void bta_av_rc_msg(tBTA_AV_CB* p_cb, tBTA_AV_DATA* p_data) {
             p_data->rc_msg.msg.hdr.ctype <= AVRC_CMD_GEN_INQ) {
      if (p_data->rc_msg.msg.vendor.p_vendor_data[0] == AVRC_PDU_INVALID) {
        /* reject it */
        p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_REJ;
        p_data->rc_msg.msg.hdr.ctype = AVRC_RSP_REJ;
        p_data->rc_msg.msg.vendor.p_vendor_data[4] = AVRC_STS_BAD_CMD;
      } else
        p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_NOT_IMPL;
        p_data->rc_msg.msg.hdr.ctype = AVRC_RSP_NOT_IMPL;
      AVRC_VendorRsp(p_data->rc_msg.handle, p_data->rc_msg.label,
                     &p_data->rc_msg.msg.vendor);
    }
+4 −4
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
#endif

#ifndef BTA_AV_RC_PASS_RSP_CODE
#define BTA_AV_RC_PASS_RSP_CODE BTA_AV_RSP_NOT_IMPL
#define BTA_AV_RC_PASS_RSP_CODE AVRC_RSP_NOT_IMPL
#endif

const uint32_t bta_av_meta_caps_co_ids[] = {AVRC_CO_METADATA, AVRC_CO_BROADCOM};
@@ -264,9 +264,9 @@ const uint16_t bta_av_rc_id[] = {
 * bit mask: 0=POWER, 1=VOL_UP, 2=VOL_DOWN, 3=MUTE, 4=PLAY, 5=STOP,
             6=PAUSE, 7=RECORD, 8=REWIND, 9=FAST_FOR, 10=EJECT, 11=FORWARD,
             12=BACKWARD */
#if (BTA_AV_RC_PASS_RSP_CODE == BTA_AV_RSP_INTERIM)
#if (BTA_AV_RC_PASS_RSP_CODE == AVRC_RSP_INTERIM)
    0x0070, /* PLAY | STOP | PAUSE */
#else       /* BTA_AV_RC_PASS_RSP_CODE != BTA_AV_RSP_INTERIM */
#else       /* BTA_AV_RC_PASS_RSP_CODE != AVRC_RSP_INTERIM */
#if (BTA_AVRCP_FF_RW_SUPPORT == TRUE)
    0x1b7E, /* PLAY | STOP | PAUSE | FF | RW | VOL_UP | VOL_DOWN | MUTE | FW |
               BACK */
@@ -283,7 +283,7 @@ const uint16_t bta_av_rc_id[] = {
                        4=F4, 5=F5 */
};

#if (BTA_AV_RC_PASS_RSP_CODE == BTA_AV_RSP_INTERIM)
#if (BTA_AV_RC_PASS_RSP_CODE == AVRC_RSP_INTERIM)
const uint16_t bta_av_rc_id_ac[] = {
    0x0000, /* bit mask: 0=SELECT, 1=UP, 2=DOWN, 3=LEFT,
                         4=RIGHT, 5=RIGHT_UP, 6=RIGHT_DOWN,
+0 −86
Original line number Diff line number Diff line
@@ -106,104 +106,18 @@ typedef uint8_t tBTA_AV_HNDL;
#endif

/* operation id list for BTA_AvRemoteCmd */
#define BTA_AV_RC_SELECT AVRC_ID_SELECT         /* select */
#define BTA_AV_RC_UP AVRC_ID_UP                 /* up */
#define BTA_AV_RC_DOWN AVRC_ID_DOWN             /* down */
#define BTA_AV_RC_LEFT AVRC_ID_LEFT             /* left */
#define BTA_AV_RC_RIGHT AVRC_ID_RIGHT           /* right */
#define BTA_AV_RC_RIGHT_UP AVRC_ID_RIGHT_UP     /* right-up */
#define BTA_AV_RC_RIGHT_DOWN AVRC_ID_RIGHT_DOWN /* right-down */
#define BTA_AV_RC_LEFT_UP AVRC_ID_LEFT_UP       /* left-up */
#define BTA_AV_RC_LEFT_DOWN AVRC_ID_LEFT_DOWN   /* left-down */
#define BTA_AV_RC_ROOT_MENU AVRC_ID_ROOT_MENU   /* root menu */
#define BTA_AV_RC_SETUP_MENU AVRC_ID_SETUP_MENU /* setup menu */
#define BTA_AV_RC_CONT_MENU AVRC_ID_CONT_MENU   /* contents menu */
#define BTA_AV_RC_FAV_MENU AVRC_ID_FAV_MENU     /* favorite menu */
#define BTA_AV_RC_EXIT AVRC_ID_EXIT             /* exit */
#define BTA_AV_RC_0 AVRC_ID_0                   /* 0 */
#define BTA_AV_RC_1 AVRC_ID_1                   /* 1 */
#define BTA_AV_RC_2 AVRC_ID_2                   /* 2 */
#define BTA_AV_RC_3 AVRC_ID_3                   /* 3 */
#define BTA_AV_RC_4 AVRC_ID_4                   /* 4 */
#define BTA_AV_RC_5 AVRC_ID_5                   /* 5 */
#define BTA_AV_RC_6 AVRC_ID_6                   /* 6 */
#define BTA_AV_RC_7 AVRC_ID_7                   /* 7 */
#define BTA_AV_RC_8 AVRC_ID_8                   /* 8 */
#define BTA_AV_RC_9 AVRC_ID_9                   /* 9 */
#define BTA_AV_RC_DOT AVRC_ID_DOT               /* dot */
#define BTA_AV_RC_ENTER AVRC_ID_ENTER           /* enter */
#define BTA_AV_RC_CLEAR AVRC_ID_CLEAR           /* clear */
#define BTA_AV_RC_CHAN_UP AVRC_ID_CHAN_UP       /* channel up */
#define BTA_AV_RC_CHAN_DOWN AVRC_ID_CHAN_DOWN   /* channel down */
#define BTA_AV_RC_PREV_CHAN AVRC_ID_PREV_CHAN   /* previous channel */
#define BTA_AV_RC_SOUND_SEL AVRC_ID_SOUND_SEL   /* sound select */
#define BTA_AV_RC_INPUT_SEL AVRC_ID_INPUT_SEL   /* input select */
#define BTA_AV_RC_DISP_INFO AVRC_ID_DISP_INFO   /* display information */
#define BTA_AV_RC_HELP AVRC_ID_HELP             /* help */
#define BTA_AV_RC_PAGE_UP AVRC_ID_PAGE_UP       /* page up */
#define BTA_AV_RC_PAGE_DOWN AVRC_ID_PAGE_DOWN   /* page down */
#define BTA_AV_RC_POWER AVRC_ID_POWER           /* power */
#define BTA_AV_RC_VOL_UP AVRC_ID_VOL_UP         /* volume up */
#define BTA_AV_RC_VOL_DOWN AVRC_ID_VOL_DOWN     /* volume down */
#define BTA_AV_RC_MUTE AVRC_ID_MUTE             /* mute */
#define BTA_AV_RC_PLAY AVRC_ID_PLAY             /* play */
#define BTA_AV_RC_STOP AVRC_ID_STOP             /* stop */
#define BTA_AV_RC_PAUSE AVRC_ID_PAUSE           /* pause */
#define BTA_AV_RC_RECORD AVRC_ID_RECORD         /* record */
#define BTA_AV_RC_REWIND AVRC_ID_REWIND         /* rewind */
#define BTA_AV_RC_FAST_FOR AVRC_ID_FAST_FOR     /* fast forward */
#define BTA_AV_RC_EJECT AVRC_ID_EJECT           /* eject */
#define BTA_AV_RC_FORWARD AVRC_ID_FORWARD       /* forward */
#define BTA_AV_RC_BACKWARD AVRC_ID_BACKWARD     /* backward */
#define BTA_AV_RC_ANGLE AVRC_ID_ANGLE           /* angle */
#define BTA_AV_RC_SUBPICT AVRC_ID_SUBPICT       /* subpicture */
#define BTA_AV_RC_F1 AVRC_ID_F1                 /* F1 */
#define BTA_AV_RC_F2 AVRC_ID_F2                 /* F2 */
#define BTA_AV_RC_F3 AVRC_ID_F3                 /* F3 */
#define BTA_AV_RC_F4 AVRC_ID_F4                 /* F4 */
#define BTA_AV_RC_F5 AVRC_ID_F5                 /* F5 */
#define BTA_AV_VENDOR AVRC_ID_VENDOR            /* vendor unique */

typedef uint8_t tBTA_AV_RC;

/* state flag for pass through command */
#define BTA_AV_STATE_PRESS AVRC_STATE_PRESS     /* key pressed */
#define BTA_AV_STATE_RELEASE AVRC_STATE_RELEASE /* key released */

typedef uint8_t tBTA_AV_STATE;

/* command codes for BTA_AvVendorCmd */
#define BTA_AV_CMD_CTRL AVRC_CMD_CTRL
#define BTA_AV_CMD_STATUS AVRC_CMD_STATUS
#define BTA_AV_CMD_SPEC_INQ AVRC_CMD_SPEC_INQ
#define BTA_AV_CMD_NOTIF AVRC_CMD_NOTIF
#define BTA_AV_CMD_GEN_INQ AVRC_CMD_GEN_INQ

typedef uint8_t tBTA_AV_CMD;

/* response codes for BTA_AvVendorRsp */
#define BTA_AV_RSP_NOT_IMPL AVRC_RSP_NOT_IMPL
#define BTA_AV_RSP_ACCEPT AVRC_RSP_ACCEPT
#define BTA_AV_RSP_REJ AVRC_RSP_REJ
#define BTA_AV_RSP_IN_TRANS AVRC_RSP_IN_TRANS
#define BTA_AV_RSP_IMPL_STBL AVRC_RSP_IMPL_STBL
#define BTA_AV_RSP_CHANGED AVRC_RSP_CHANGED
#define BTA_AV_RSP_INTERIM AVRC_RSP_INTERIM

typedef uint8_t tBTA_AV_CODE;

/* error codes for BTA_AvProtectRsp */
#define BTA_AV_ERR_NONE A2DP_SUCCESS /* Success, no error */
#define BTA_AV_ERR_BAD_STATE \
  AVDT_ERR_BAD_STATE /* Message cannot be processed in this state */
#define BTA_AV_ERR_RESOURCE AVDT_ERR_RESOURCE /* Insufficient resources */
#define BTA_AV_ERR_BAD_CP_TYPE                                               \
  A2DP_BAD_CP_TYPE /* The requested Content Protection Type is not supported \
                      */
#define BTA_AV_ERR_BAD_CP_FORMAT                                             \
  A2DP_BAD_CP_FORMAT /* The format of Content Protection Data is not correct \
                        */

typedef uint8_t tBTA_AV_ERR;

/* AV callback events */
+1 −1
Original line number Diff line number Diff line
@@ -784,7 +784,7 @@ static bool btif_av_state_opened_handler(btif_sm_event_t event, void* p_data) {

  if ((event == BTA_AV_REMOTE_CMD_EVT) &&
      (btif_av_cb.flags & BTIF_AV_FLAG_REMOTE_SUSPEND) &&
      (p_av->remote_cmd.rc_id == BTA_AV_RC_PLAY)) {
      (p_av->remote_cmd.rc_id == AVRC_ID_PLAY)) {
    BTIF_TRACE_EVENT("%s: Resetting remote suspend flag on RC PLAY", __func__);
    btif_av_cb.flags &= ~BTIF_AV_FLAG_REMOTE_SUSPEND;
  }
+4 −4
Original line number Diff line number Diff line
@@ -730,7 +730,7 @@ void handle_rc_passthrough_cmd(tBTA_AV_REMOTE_CMD* p_remote_cmd) {

  /* If AVRC is open and peer sends PLAY but there is no AVDT, then we queue-up
   * this PLAY */
  if ((p_remote_cmd->rc_id == BTA_AV_RC_PLAY) && (!btif_av_is_connected())) {
  if ((p_remote_cmd->rc_id == AVRC_ID_PLAY) && (!btif_av_is_connected())) {
    if (p_remote_cmd->key_state == AVRC_STATE_PRESS) {
      APPL_TRACE_WARNING("%s: AVDT not open, queuing the PLAY command",
                         __func__);
@@ -740,14 +740,14 @@ void handle_rc_passthrough_cmd(tBTA_AV_REMOTE_CMD* p_remote_cmd) {
  }

  /* If we previously queued a play and we get a PAUSE, clear it. */
  if ((p_remote_cmd->rc_id == BTA_AV_RC_PAUSE) && (p_dev->rc_pending_play)) {
  if ((p_remote_cmd->rc_id == AVRC_ID_PAUSE) && (p_dev->rc_pending_play)) {
    APPL_TRACE_WARNING("%s: Clear the pending PLAY on PAUSE received",
                       __func__);
    p_dev->rc_pending_play = false;
    return;
  }

  if ((p_remote_cmd->rc_id == BTA_AV_RC_STOP) &&
  if ((p_remote_cmd->rc_id == AVRC_ID_STOP) &&
      (!btif_av_stream_started_ready())) {
    APPL_TRACE_WARNING("%s: Stream suspended, ignore STOP cmd", __func__);
    return;
@@ -4982,7 +4982,7 @@ static bt_status_t set_volume_rsp(RawAddress* bd_addr, uint8_t abs_vol,
    BTIF_TRACE_DEBUG("%s: msgreq being sent out with label: %d", __func__,
                     p_dev->rc_vol_label);
    if (p_msg != NULL) {
      BTA_AvVendorRsp(p_dev->rc_handle, label, BTA_AV_RSP_ACCEPT, data_start,
      BTA_AvVendorRsp(p_dev->rc_handle, label, AVRC_RSP_ACCEPT, data_start,
                      p_msg->len, 0);
      status = BT_STATUS_SUCCESS;
    }