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

Commit 52ca2acc authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "avdt: connection role as enum" into main

parents a217daea 9d4701b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1572,7 +1572,7 @@ void bta_av_sig_chg(tBTA_AV_DATA* p_data) {
      /* this entry is not used yet. */
      p_cb->conn_lcb |= mask; /* mark it as used */
      log::verbose("start sig timer {}", p_data->hdr.offset);
      if (p_data->hdr.offset == AVDT_ACP) {
      if (p_data->hdr.offset == static_cast<uint16_t>(tAVDT_ROLE::AVDT_ACP)) {
        log::verbose("Incoming L2CAP acquired, set state as incoming");
        p_scb->OnConnected(p_data->str_msg.bd_addr);
        p_scb->use_rc = true; /* allowing RC for incoming connection */
+7 −7
Original line number Diff line number Diff line
@@ -355,11 +355,10 @@ void avdt_ad_tc_open_ind(AvdtpTransportChannel* p_tbl) {
    }

    p_ccb = avdt_ccb_by_idx(p_tbl->ccb_idx);
    /* use err_param to indicate the role of connection.
     * AVDT_ACP, if ACP */
    evt.err_param = AVDT_INT;
    /* use err_param to indicate the role of connection */
    evt.err_param = static_cast<uint8_t>(tAVDT_ROLE::AVDT_INT);
    if (p_tbl->cfg_flags & AVDT_L2C_CFG_CONN_ACP) {
      evt.err_param = AVDT_ACP;
      evt.err_param = static_cast<uint8_t>(tAVDT_ROLE::AVDT_ACP);
    }
    tAVDT_CCB_EVT avdt_ccb_evt;
    avdt_ccb_evt.msg.hdr = evt;
@@ -503,7 +502,7 @@ tL2CAP_DW_RESULT avdt_ad_write_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_sc
 * Returns          Nothing.
 *
 ******************************************************************************/
void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, uint8_t role) {
void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, tAVDT_ROLE role) {
  AvdtpTransportChannel* p_tbl;
  uint16_t lcid;

@@ -516,7 +515,8 @@ void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, uint8_t ro
  p_tbl->tcid = avdt_ad_type_to_tcid(type, p_scb);
  p_tbl->my_mtu = kAvdtpMtu;
  log::verbose("p_tbl: {} state: {} tcid: {} type: {} role: {} my_mtu: {}", std::format_ptr(p_tbl),
               tc_state_text(p_tbl->state), p_tbl->tcid, tc_type_text(type), role, p_tbl->my_mtu);
               tc_state_text(p_tbl->state), p_tbl->tcid, tc_type_text(type), avdt_role_text(role),
               p_tbl->my_mtu);

  if (type != AVDT_CHAN_SIG) {
    /* also set scb_hdl in rt_tbl */
@@ -525,7 +525,7 @@ void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, uint8_t ro
                 p_tbl->tcid, avdt_scb_to_hdl(p_scb));
  }

  if (role == AVDT_ACP) {
  if (role == tAVDT_ROLE::AVDT_ACP) {
    /* if we're acceptor, we're done; just sit back and listen */
    p_tbl->state = AVDT_AD_ST_ACP;
  } else {
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ static void avdt_ccb_clear_ccb(AvdtpCcb* p_ccb) {
 *
 ******************************************************************************/
void avdt_ccb_chan_open(AvdtpCcb* p_ccb, tAVDT_CCB_EVT* /* p_data */) {
  avdt_ad_open_req(AVDT_CHAN_SIG, p_ccb, NULL, AVDT_INT);
  avdt_ad_open_req(AVDT_CHAN_SIG, p_ccb, NULL, tAVDT_ROLE::AVDT_INT);
}

/*******************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -952,7 +952,7 @@ void avdt_ad_tc_cong_ind(AvdtpTransportChannel* p_tbl, bool is_congested);
void avdt_ad_tc_data_ind(AvdtpTransportChannel* p_tbl, BT_HDR* p_buf);
AvdtpTransportChannel* avdt_ad_tc_tbl_by_type(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb);
tL2CAP_DW_RESULT avdt_ad_write_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, BT_HDR* p_buf);
void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, uint8_t role);
void avdt_ad_open_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb, tAVDT_ROLE role);
void avdt_ad_close_req(uint8_t type, AvdtpCcb* p_ccb, AvdtpScb* p_scb);

void avdt_ccb_idle_ccb_timer_timeout(void* data);
+4 −4
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ void avdt_scb_hdl_open_rej(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) {
void avdt_scb_hdl_open_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* /* p_data */) {
  /* initiate opening of trans channels for this SEID */
  p_scb->role = AVDT_OPEN_INT;
  avdt_ad_open_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, AVDT_INT);
  avdt_ad_open_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, tAVDT_ROLE::AVDT_INT);

  /* start tc connect timer */
  alarm_set_on_mloop(p_scb->transport_channel_timer, AVDT_SCB_TC_CONN_TIMEOUT_MS,
@@ -904,7 +904,7 @@ void avdt_scb_hdl_tc_close_sto(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) {
 ******************************************************************************/
void avdt_scb_hdl_tc_open(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) {
  uint8_t event;
  uint8_t role;
  tAVDT_ROLE role;

  alarm_cancel(p_scb->transport_channel_timer);

@@ -915,7 +915,7 @@ void avdt_scb_hdl_tc_open(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) {
               p_scb->req_cfg.psc_mask, p_scb->curr_cfg.psc_mask);
  if (p_scb->curr_cfg.psc_mask & AVDT_PSC_REPORT) {
    /* open the reporting channel, if both devices support it */
    role = (p_scb->role == AVDT_OPEN_INT) ? AVDT_INT : AVDT_ACP;
    role = (p_scb->role == AVDT_OPEN_INT) ? tAVDT_ROLE::AVDT_INT : tAVDT_ROLE::AVDT_ACP;
    avdt_ad_open_req(AVDT_CHAN_REPORT, p_scb->p_ccb, p_scb, role);
  }

@@ -1155,7 +1155,7 @@ void avdt_scb_snd_open_req(AvdtpScb* p_scb, tAVDT_SCB_EVT* /* p_data */) {
void avdt_scb_snd_open_rsp(AvdtpScb* p_scb, tAVDT_SCB_EVT* p_data) {
  /* notify adaptation that we're waiting for transport channel open */
  p_scb->role = AVDT_OPEN_ACP;
  avdt_ad_open_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, AVDT_ACP);
  avdt_ad_open_req(AVDT_CHAN_MEDIA, p_scb->p_ccb, p_scb, tAVDT_ROLE::AVDT_ACP);

  /* send response */
  avdt_msg_send_rsp(p_scb->p_ccb, AVDT_SIG_OPEN, &p_data->msg);
Loading