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

Commit a6835939 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

LE L2cap shim: Implement fixed channel timeout

Implement timeout settings with Fixed channel acquire/release.  So far
we only have two timeout options: no timeout, and disconnect
immediately, which we can use existing methods to implement.

Test: CtsVerifier
Tag: #gd-refactor
Bug: 141555841
Change-Id: If262e2773575b5c3c99a7286d66ca5f6a7fe7e58
parent ec5800d2
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -637,9 +637,19 @@ bool L2CA_ConnectCreditBasedRsp(const RawAddress& bd_addr, uint8_t id,
 */
bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
                                 tBT_TRANSPORT transport) {
  if (transport == BT_TRANSPORT_BR_EDR) {
    LOG_INFO("UNIMPLEMENTED %s", __func__);
    return false;
  }
  constexpr int GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP = 1;
  if (timeout == 0 || timeout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP) {
    bluetooth::shim::L2CA_RemoveFixedChnl(kLeAttributeCid, bd_addr);
    return true;
  } else {
    LOG_INFO("UNIMPLEMENTED %s", __func__);
    return false;
  }
}

bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
  LOG_INFO("UNIMPLEMENTED %s", __func__);
@@ -845,9 +855,17 @@ bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {

bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda, uint16_t fixed_cid,
                              uint16_t idle_tout) {
  if (fixed_cid != kLeAttributeCid) {
    LOG_INFO("UNIMPLEMENTED %s", __func__);
    return false;
  }
  if (idle_tout == 0xffff) {
    bluetooth::shim::L2CA_ConnectFixedChnl(kLeAttributeCid, rem_bda);
  } else {
    bluetooth::shim::L2CA_RemoveFixedChnl(kLeAttributeCid, rem_bda);
  }
  return true;
}

bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
  LOG_INFO("UNIMPLEMENTED %s", __func__);