return false;
}
-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;
- }
+bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
if (idle_tout == 0xffff) {
bluetooth::shim::L2CA_ConnectFixedChnl(kLeAttributeCid, rem_bda);
} else {
/*******************************************************************************
*
- * Function L2CA_SetFixedChannelTout
+ * Function L2CA_SetLeGattTimeout
*
* Description Higher layers call this function to set the idle timeout for
* a fixed channel. The "idle timeout" is the amount of time
* Returns true if command succeeded, false if failed
*
******************************************************************************/
-bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda, uint16_t fixed_cid,
- uint16_t idle_tout);
+bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout);
bool L2CA_UpdateBleConnParams(const RawAddress& rem_bda, uint16_t min_int,
uint16_t max_int, uint16_t latency,
tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bd_addr, transport);
if (p_tcb != NULL) {
- status = L2CA_SetFixedChannelTout(bd_addr, L2CAP_ATT_CID, idle_tout);
+ status = L2CA_SetLeGattTimeout(bd_addr, idle_tout);
if (idle_tout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP)
L2CA_SetIdleTimeoutByBdAddr(
/*******************************************************************************
*
- * Function L2CA_SetFixedChannelTout
+ * Function L2CA_SetLeGattTimeout
*
* Description Higher layers call this function to set the idle timeout for
* a fixed channel. The "idle timeout" is the amount of time
* Returns true if command succeeded, false if failed
*
******************************************************************************/
-extern bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda,
- uint16_t fixed_cid, uint16_t idle_tout);
+extern bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda,
+ uint16_t idle_tout);
extern bool L2CA_UpdateBleConnParams(const RawAddress& rem_bda,
uint16_t min_int, uint16_t max_int,
/*******************************************************************************
*
- * Function L2CA_SetFixedChannelTout
+ * Function L2CA_SetLeGattTimeout
*
* Description Higher layers call this function to set the idle timeout for
* a fixed channel. The "idle timeout" is the amount of time
* Returns true if command succeeded, false if failed
*
******************************************************************************/
-bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda, uint16_t fixed_cid,
- uint16_t idle_tout) {
+bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
if (bluetooth::shim::is_gd_l2cap_enabled()) {
- return bluetooth::shim::L2CA_SetFixedChannelTout(rem_bda, fixed_cid,
- idle_tout);
+ return bluetooth::shim::L2CA_SetLeGattTimeout(rem_bda, idle_tout);
}
- tL2C_LCB* p_lcb;
- tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
-
- if (fixed_cid >= L2CAP_ATT_CID && fixed_cid <= L2CAP_SMP_CID)
- transport = BT_TRANSPORT_LE;
+ constexpr uint16_t kAttCid = 4;
/* Is a fixed channel connected to the remote BDA ?*/
- p_lcb = l2cu_find_lcb_by_bd_addr(rem_bda, transport);
+ tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(rem_bda, BT_TRANSPORT_LE);
if (((p_lcb) == NULL) ||
- (!p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL])) {
+ (!p_lcb->p_fixed_ccbs[kAttCid - L2CAP_FIRST_FIXED_CHNL])) {
LOG(WARNING) << __func__ << " BDA: " << rem_bda
- << StringPrintf(" CID: 0x%04x not connected", fixed_cid);
+ << StringPrintf(" CID: 0x%04x not connected", kAttCid);
return (false);
}
- p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]
- ->fixed_chnl_idle_tout = idle_tout;
+ p_lcb->p_fixed_ccbs[kAttCid - L2CAP_FIRST_FIXED_CHNL]->fixed_chnl_idle_tout =
+ idle_tout;
if (p_lcb->in_use && p_lcb->link_state == LST_CONNECTED &&
!p_lcb->ccb_queue.p_first_ccb) {
mock_function_count_map[__func__]++;
return false;
}
-bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda, uint16_t fixed_cid,
- uint16_t idle_tout) {
+bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {
mock_function_count_map[__func__]++;
return false;
}
mock_function_count_map[__func__]++;
return false;
}
-bool bluetooth::shim::L2CA_SetFixedChannelTout(const RawAddress& rem_bda,
- uint16_t fixed_cid,
- uint16_t idle_tout) {
+bool bluetooth::shim::L2CA_SetLeGattTimeout(const RawAddress& rem_bda,
+ uint16_t idle_tout) {
mock_function_count_map[__func__]++;
return false;
}