p_scb->co_started = false;
p_scb->p_cos->stop(p_scb->hndl, p_scb->PeerAddress());
- L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_NO_AUTOMATIC_FLUSH);
}
/* if q_info.a2dp_list is not empty, drop it now */
* to be changed
*/
p_scb->co_started = bta_av_cb.audio_open_cnt;
- } else {
}
- L2CA_SetFlushTimeout(p_scb->PeerAddress(), 0);
/* clear the congestion flag */
p_scb->cong = false;
p_scb->co_started = false;
p_scb->p_cos->stop(p_scb->hndl, p_scb->PeerAddress());
}
- L2CA_SetFlushTimeout(p_scb->PeerAddress(), L2CAP_NO_AUTOMATIC_FLUSH);
}
{
// May need to update the flush timeout of this already started stream
if (p_scbi->co_started != bta_av_cb.audio_open_cnt) {
p_scbi->co_started = bta_av_cb.audio_open_cnt;
- L2CA_SetFlushTimeout(p_scbi->PeerAddress(), 0);
}
}
}
/*******************************************************************************
*
- * Function L2CA_SetFlushTimeout
- *
- * Description This function set the automatic flush time out in Baseband
- * for ACL-U packets.
- * BdAddr : the remote BD address of ACL link. If it is
- * BT_DB_ANY then the flush time out will be applied
- * to all ACL link.
- * FlushTimeout: flush time out in ms
- * 0x0000 : No automatic flush
- * L2CAP_NO_RETRANSMISSION : No retransmission
- * 0x0002 - 0xFFFE : flush time out, if
- * (flush_tout * 8) + 3 / 5) <=
- * HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT
- * (in 625us slot).
- * Otherwise, return false.
- * L2CAP_NO_AUTOMATIC_FLUSH : No automatic flush
- *
- * Returns true if command succeeded, false if failed
- *
- * NOTE This flush timeout applies to all logical channels active on
- * the ACL link.
- ******************************************************************************/
-extern bool L2CA_SetFlushTimeout(const RawAddress& bd_addr,
- uint16_t flush_tout);
-
-/*******************************************************************************
- *
* Function L2CA_SetChnlFlushability
*
* Description Higher layers call this function to set a channels
/*******************************************************************************
*
- * Function L2CA_SetFlushTimeout
- *
- * Description This function set the automatic flush time out in Baseband
- * for ACL-U packets.
- * BdAddr : the remote BD address of ACL link. If it is
- * BT_DB_ANY then the flush time out will be applied to
- * all ACL links.
- * FlushTimeout: flush time out in ms
- * 0x0000 : No automatic flush
- * 0x0001 : No retransmission
- * 0x0002 - 0x0500 : flush time out in ms
- * 0xffff : DEPRECATED No automatic flush (0x0000)
- * >0x0500 : Illegal value
- *
- * Returns true if command succeeded, false if failed
- *
- * NOTE This flush timeout applies to all logical channels active on
- * the ACL link.
- ******************************************************************************/
-constexpr uint32_t ConvertMillisecondsToBasebandSlots(uint32_t milliseconds) {
- return ((milliseconds * 8) + 3) / 5;
-}
-
-bool L2CA_SetFlushTimeout(const RawAddress& bd_addr,
- const uint16_t flush_timeout_in_ms) {
- if (bluetooth::shim::is_gd_shim_enabled()) {
- return bluetooth::shim::L2CA_SetFlushTimeout(bd_addr, flush_timeout_in_ms);
- }
-
- if (flush_timeout_in_ms == L2CAP_NO_AUTOMATIC_FLUSH) {
- LOG_WARN(
- "%s Parameter deprecated for no automatic flush; please use 0x0000",
- __func__);
- } else if (ConvertMillisecondsToBasebandSlots(flush_timeout_in_ms) >
- HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT) {
- LOG_WARN(
- "%s Unable to set flush timeout larger then controller capability:%dms",
- __func__, flush_timeout_in_ms);
- return false;
- }
-
- uint16_t flush_timeout_in_slots = 0;
-
- /* no automatic flush (infinite timeout) */
- if (flush_timeout_in_ms == 0x0000 ||
- flush_timeout_in_ms == L2CAP_NO_AUTOMATIC_FLUSH) {
- flush_timeout_in_slots = 0x0;
- }
-
- if (RawAddress::kAny != bd_addr) {
- tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_BR_EDR);
-
- if ((p_lcb) && (p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTED)) {
- if (p_lcb->LinkFlushTimeout() != flush_timeout_in_ms) {
- p_lcb->SetLinkFlushTimeout(flush_timeout_in_ms);
- acl_write_automatic_flush_timeout(bd_addr, flush_timeout_in_slots);
- }
- } else {
- LOG(WARNING) << __func__ << " No lcb for bd_addr " << bd_addr;
- return false;
- }
- } else {
- tL2C_LCB* p_lcb = &l2cb.lcb_pool[0];
- for (int xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_lcb++) {
- if ((p_lcb->in_use) && (p_lcb->link_state == LST_CONNECTED)) {
- if (p_lcb->LinkFlushTimeout() != flush_timeout_in_ms) {
- p_lcb->SetLinkFlushTimeout(flush_timeout_in_ms);
- acl_write_automatic_flush_timeout(p_lcb->remote_bd_addr,
- flush_timeout_in_slots);
- }
- }
- }
- }
- return true;
-}
-
-/*******************************************************************************
- *
* Function L2CA_GetPeerFeatures
*
* Description Get a peers features and fixed channel map