diff options
| -rw-r--r-- | system/main/shim/l2c_api.cc | 37 | ||||
| -rw-r--r-- | system/main/shim/l2c_api.h | 134 | ||||
| -rw-r--r-- | system/stack/include/l2c_api.h | 172 | ||||
| -rw-r--r-- | system/stack/l2cap/l2c_api.cc | 93 |
4 files changed, 2 insertions, 434 deletions
diff --git a/system/main/shim/l2c_api.cc b/system/main/shim/l2c_api.cc index f9676db58a..07e864fd73 100644 --- a/system/main/shim/l2c_api.cc +++ b/system/main/shim/l2c_api.cc @@ -209,26 +209,9 @@ bool bluetooth::shim::L2CA_SetConnectionCallbacks( return false; } -uint8_t bluetooth::shim::L2CA_DataWriteEx(uint16_t cid, BT_HDR* bt_hdr, - uint16_t flags) { - bool write_success = false; - switch (flags) { - case L2CAP_FLUSHABLE_CH_BASED: - write_success = shim_l2cap.Write(cid, bt_hdr); - break; - case L2CAP_FLUSHABLE_PKT: - write_success = shim_l2cap.WriteFlushable(cid, bt_hdr); - break; - case L2CAP_NON_FLUSHABLE_PKT: - write_success = shim_l2cap.WriteNonFlushable(cid, bt_hdr); - break; - } - return write_success ? L2CAP_DW_SUCCESS : L2CAP_DW_FAILED; -} - uint8_t bluetooth::shim::L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) { - return bluetooth::shim::L2CA_DataWriteEx(cid, p_data, - L2CAP_FLUSHABLE_CH_BASED); + bool write_success = shim_l2cap.Write(cid, p_data); + return write_success ? L2CAP_DW_SUCCESS : L2CAP_DW_FAILED; } /** @@ -365,13 +348,6 @@ bool bluetooth::shim::L2CA_SetTxPriority(uint16_t cid, return false; } -bool bluetooth::shim::L2CA_SetChnlDataRate(uint16_t cid, - tL2CAP_CHNL_DATA_RATE tx, - tL2CAP_CHNL_DATA_RATE rx) { - LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__); - return false; -} - uint8_t bluetooth::shim::L2CA_GetChnlFcrMode(uint16_t lcid) { LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__); return 0; @@ -395,12 +371,3 @@ uint16_t bluetooth::shim::L2CA_FlushChannel(uint16_t lcid, LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__); return 0; } - -/** - * Misc APIs - */ -bool bluetooth::shim::L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb, - const RawAddress& p_bda) { - LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__); - return false; -} diff --git a/system/main/shim/l2c_api.h b/system/main/shim/l2c_api.h index 011a77bb60..f5e5155f80 100644 --- a/system/main/shim/l2c_api.h +++ b/system/main/shim/l2c_api.h @@ -440,32 +440,6 @@ bool L2CA_SendTestSFrame(uint16_t cid, uint8_t sup_type, uint8_t back_track); ******************************************************************************/ bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority); -/******************************************************************************* - * - * Function L2CA_RegForNoCPEvt - * - * Description Register callback for Number of Completed Packets event. - * - * Input Param p_cb - callback for Number of completed packets event - * p_bda - BT address of remote device - * - * Returns - * - ******************************************************************************/ -bool L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb, const RawAddress& p_bda); - -/******************************************************************************* - * - * Function L2CA_SetChnlDataRate - * - * Description Sets the tx/rx data rate for a channel. - * - * Returns true if a valid channel, else false - * - ******************************************************************************/ -bool L2CA_SetChnlDataRate(uint16_t cid, tL2CAP_CHNL_DATA_RATE tx, - tL2CAP_CHNL_DATA_RATE rx); - typedef void(tL2CA_RESERVE_CMPL_CBACK)(void); /******************************************************************************* @@ -496,24 +470,6 @@ bool L2CA_SetFlushTimeout(const RawAddress& bd_addr, uint16_t flush_tout); /******************************************************************************* * - * Function L2CA_DataWriteEx - * - * Description Higher layers call this function to write data with extended - * flags. - * flags : L2CAP_FLUSHABLE_CH_BASED - * L2CAP_FLUSHABLE_PKT - * L2CAP_NON_FLUSHABLE_PKT - * - * Returns L2CAP_DW_SUCCESS, if data accepted, else false - * L2CAP_DW_CONGESTED, if data accepted and the channel is - * congested - * L2CAP_DW_FAILED, if error - * - ******************************************************************************/ -uint8_t L2CA_DataWriteEx(uint16_t cid, BT_HDR* p_data, uint16_t flags); - -/******************************************************************************* - * * Function L2CA_SetChnlFlushability * * Description Higher layers call this function to set a channels @@ -568,96 +524,6 @@ uint8_t L2CA_GetChnlFcrMode(uint16_t lcid); /******************************************************************************* * - * Function L2CA_UcdRegister - * - * Description Register PSM on UCD. - * - * Parameters: tL2CAP_UCD_CB_INFO - * - * Return value: true if successs - * - ******************************************************************************/ -bool L2CA_UcdRegister(uint16_t psm, tL2CAP_UCD_CB_INFO* p_cb_info); - -/******************************************************************************* - * - * Function L2CA_UcdDeregister - * - * Description Deregister PSM on UCD. - * - * Parameters: PSM - * - * Return value: true if successs - * - ******************************************************************************/ -bool L2CA_UcdDeregister(uint16_t psm); - -/******************************************************************************* - * - * Function L2CA_UcdDiscover - * - * Description Discover UCD of remote device. - * - * Parameters: PSM - * BD_ADDR of remote device - * info_type : L2CAP_UCD_INFO_TYPE_RECEPTION - * L2CAP_UCD_INFO_TYPE_MTU - * - * - * Return value: true if successs - * - ******************************************************************************/ -bool L2CA_UcdDiscover(uint16_t psm, const RawAddress& rem_bda, - uint8_t info_type); - -/******************************************************************************* - * - * Function L2CA_UcdDataWrite - * - * Description Send UCD to remote device - * - * Parameters: PSM - * BD Address of remote - * Pointer to buffer of type BT_HDR - * flags : L2CAP_FLUSHABLE_CH_BASED - * L2CAP_FLUSHABLE_PKT - * L2CAP_NON_FLUSHABLE_PKT - * - * Return value L2CAP_DW_SUCCESS, if data accepted - * L2CAP_DW_FAILED, if error - * - ******************************************************************************/ -uint16_t L2CA_UcdDataWrite(uint16_t psm, const RawAddress& rem_bda, - BT_HDR* p_buf, uint16_t flags); - -/******************************************************************************* - * - * Function L2CA_UcdSetIdleTimeout - * - * Description Set UCD Idle timeout. - * - * Parameters: BD Addr - * Timeout in second - * - * Return value: true if successs - * - ******************************************************************************/ -bool L2CA_UcdSetIdleTimeout(const RawAddress& rem_bda, uint16_t timeout); - -/******************************************************************************* - * - * Function L2CA_UCDSetTxPriority - * - * Description Sets the transmission priority for a connectionless channel. - * - * Returns true if a valid channel, else false - * - ******************************************************************************/ -bool L2CA_UCDSetTxPriority(const RawAddress& rem_bda, - tL2CAP_CHNL_PRIORITY priority); - -/******************************************************************************* - * * Function L2CA_RegisterFixedChannel * * Description Register a fixed channel. diff --git a/system/stack/include/l2c_api.h b/system/stack/include/l2c_api.h index 1605c88649..f3bce15f64 100644 --- a/system/stack/include/l2c_api.h +++ b/system/stack/include/l2c_api.h @@ -766,32 +766,6 @@ extern bool L2CA_SendTestSFrame(uint16_t cid, uint8_t sup_type, ******************************************************************************/ extern bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority); -/******************************************************************************* - * - * Function L2CA_RegForNoCPEvt - * - * Description Register callback for Number of Completed Packets event. - * - * Input Param p_cb - callback for Number of completed packets event - * p_bda - BT address of remote device - * - * Returns - * - ******************************************************************************/ -extern bool L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb, const RawAddress& p_bda); - -/******************************************************************************* - * - * Function L2CA_SetChnlDataRate - * - * Description Sets the tx/rx data rate for a channel. - * - * Returns true if a valid channel, else false - * - ******************************************************************************/ -extern bool L2CA_SetChnlDataRate(uint16_t cid, tL2CAP_CHNL_DATA_RATE tx, - tL2CAP_CHNL_DATA_RATE rx); - typedef void(tL2CA_RESERVE_CMPL_CBACK)(void); /******************************************************************************* @@ -823,24 +797,6 @@ extern bool L2CA_SetFlushTimeout(const RawAddress& bd_addr, /******************************************************************************* * - * Function L2CA_DataWriteEx - * - * Description Higher layers call this function to write data with extended - * flags. - * flags : L2CAP_FLUSHABLE_CH_BASED - * L2CAP_FLUSHABLE_PKT - * L2CAP_NON_FLUSHABLE_PKT - * - * Returns L2CAP_DW_SUCCESS, if data accepted, else false - * L2CAP_DW_CONGESTED, if data accepted and the channel is - * congested - * L2CAP_DW_FAILED, if error - * - ******************************************************************************/ -extern uint8_t L2CA_DataWriteEx(uint16_t cid, BT_HDR* p_data, uint16_t flags); - -/******************************************************************************* - * * Function L2CA_SetChnlFlushability * * Description Higher layers call this function to set a channels @@ -895,134 +851,6 @@ extern uint8_t L2CA_GetChnlFcrMode(uint16_t lcid); /******************************************************************************* * - * UCD callback prototypes - * - ******************************************************************************/ - -/* UCD discovery. Parameters are - * BD Address of remote - * Data Type - * Data - */ -#define L2CAP_UCD_INFO_TYPE_RECEPTION 0x01 -#define L2CAP_UCD_INFO_TYPE_MTU 0x02 - -typedef void(tL2CA_UCD_DISCOVER_CB)(const RawAddress&, uint8_t, uint32_t); - -/* UCD data received. Parameters are - * BD Address of remote - * Pointer to buffer with data - */ -typedef void(tL2CA_UCD_DATA_CB)(const RawAddress&, BT_HDR*); - -/* Congestion status callback protype. This callback is optional. If - * an application tries to send data when the transmit queue is full, - * the data will anyways be dropped. The parameter is: - * remote BD_ADDR - * true if congested, false if uncongested - */ -typedef void(tL2CA_UCD_CONGESTION_STATUS_CB)(const RawAddress&, bool); - -/* UCD registration info (the callback addresses and PSM) - */ -typedef struct { - tL2CA_UCD_DISCOVER_CB* pL2CA_UCD_Discover_Cb; - tL2CA_UCD_DATA_CB* pL2CA_UCD_Data_Cb; - tL2CA_UCD_CONGESTION_STATUS_CB* pL2CA_UCD_Congestion_Status_Cb; -} tL2CAP_UCD_CB_INFO; - -/******************************************************************************* - * - * Function L2CA_UcdRegister - * - * Description Register PSM on UCD. - * - * Parameters: tL2CAP_UCD_CB_INFO - * - * Return value: true if successs - * - ******************************************************************************/ -extern bool L2CA_UcdRegister(uint16_t psm, tL2CAP_UCD_CB_INFO* p_cb_info); - -/******************************************************************************* - * - * Function L2CA_UcdDeregister - * - * Description Deregister PSM on UCD. - * - * Parameters: PSM - * - * Return value: true if successs - * - ******************************************************************************/ -extern bool L2CA_UcdDeregister(uint16_t psm); - -/******************************************************************************* - * - * Function L2CA_UcdDiscover - * - * Description Discover UCD of remote device. - * - * Parameters: PSM - * BD_ADDR of remote device - * info_type : L2CAP_UCD_INFO_TYPE_RECEPTION - * L2CAP_UCD_INFO_TYPE_MTU - * - * - * Return value: true if successs - * - ******************************************************************************/ -extern bool L2CA_UcdDiscover(uint16_t psm, const RawAddress& rem_bda, - uint8_t info_type); - -/******************************************************************************* - * - * Function L2CA_UcdDataWrite - * - * Description Send UCD to remote device - * - * Parameters: PSM - * BD Address of remote - * Pointer to buffer of type BT_HDR - * flags : L2CAP_FLUSHABLE_CH_BASED - * L2CAP_FLUSHABLE_PKT - * L2CAP_NON_FLUSHABLE_PKT - * - * Return value L2CAP_DW_SUCCESS, if data accepted - * L2CAP_DW_FAILED, if error - * - ******************************************************************************/ -extern uint16_t L2CA_UcdDataWrite(uint16_t psm, const RawAddress& rem_bda, - BT_HDR* p_buf, uint16_t flags); - -/******************************************************************************* - * - * Function L2CA_UcdSetIdleTimeout - * - * Description Set UCD Idle timeout. - * - * Parameters: BD Addr - * Timeout in second - * - * Return value: true if successs - * - ******************************************************************************/ -extern bool L2CA_UcdSetIdleTimeout(const RawAddress& rem_bda, uint16_t timeout); - -/******************************************************************************* - * - * Function L2CA_UCDSetTxPriority - * - * Description Sets the transmission priority for a connectionless channel. - * - * Returns true if a valid channel, else false - * - ******************************************************************************/ -extern bool L2CA_UCDSetTxPriority(const RawAddress& rem_bda, - tL2CAP_CHNL_PRIORITY priority); - -/******************************************************************************* - * * Fixed Channel callback prototypes * ******************************************************************************/ diff --git a/system/stack/l2cap/l2c_api.cc b/system/stack/l2cap/l2c_api.cc index b8091488ba..90aab52c21 100644 --- a/system/stack/l2cap/l2c_api.cc +++ b/system/stack/l2cap/l2c_api.cc @@ -1411,43 +1411,6 @@ bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) { /******************************************************************************* * - * Function L2CA_SetChnlDataRate - * - * Description Sets the tx/rx data rate for a channel. - * - * Returns true if a valid channel, else false - * - ******************************************************************************/ -bool L2CA_SetChnlDataRate(uint16_t cid, tL2CAP_CHNL_DATA_RATE tx, - tL2CAP_CHNL_DATA_RATE rx) { - if (bluetooth::shim::is_gd_shim_enabled()) { - return bluetooth::shim::L2CA_SetChnlDataRate(cid, tx, rx); - } - - tL2C_CCB* p_ccb; - - L2CAP_TRACE_API("L2CA_SetChnlDataRate() CID: 0x%04x, tx:%d, rx:%d", cid, tx, - rx); - - /* Find the channel control block. We don't know the link it is on. */ - p_ccb = l2cu_find_ccb_by_cid(NULL, cid); - if (p_ccb == NULL) { - L2CAP_TRACE_WARNING("L2CAP - no CCB for L2CA_SetChnlDataRate, CID: %d", - cid); - return (false); - } - - p_ccb->tx_data_rate = tx; - p_ccb->rx_data_rate = rx; - - /* Adjust channel buffer allocation */ - l2c_link_adjust_chnl_allocation(); - - return (true); -} - -/******************************************************************************* - * * Function L2CA_SetFlushTimeout * * Description This function set the automatic flush time out in Baseband @@ -2123,36 +2086,6 @@ bool L2CA_GetConnectionConfig(uint16_t lcid, uint16_t* mtu, uint16_t* rcid, /******************************************************************************* * - * Function L2CA_RegForNoCPEvt - * - * Description Register callback for Number of Completed Packets event. - * - * Input Param p_cb - callback for Number of completed packets event - * p_bda - BT address of remote device - * - * Returns true if registered OK, else false - * - ******************************************************************************/ -bool L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb, const RawAddress& p_bda) { - if (bluetooth::shim::is_gd_shim_enabled()) { - return bluetooth::shim::L2CA_RegForNoCPEvt(p_cb, p_bda); - } - - tL2C_LCB* p_lcb; - - /* Find the link that is associated with this remote bdaddr */ - p_lcb = l2cu_find_lcb_by_bd_addr(p_bda, BT_TRANSPORT_BR_EDR); - - /* If no link for this handle, nothing to do. */ - if (!p_lcb) return false; - - p_lcb->p_nocp_cb = p_cb; - - return true; -} - -/******************************************************************************* - * * Function L2CA_DataWrite * * Description Higher layers call this function to write data. @@ -2210,32 +2143,6 @@ bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) { /******************************************************************************* * - * Function L2CA_DataWriteEx - * - * Description Higher layers call this function to write data with extended - * flags. - * flags : L2CAP_FLUSHABLE_CH_BASED - * L2CAP_FLUSHABLE_PKT - * L2CAP_NON_FLUSHABLE_PKT - * - * Returns L2CAP_DW_SUCCESS, if data accepted, else false - * L2CAP_DW_CONGESTED, if data accepted and the channel is - * congested - * L2CAP_DW_FAILED, if error - * - ******************************************************************************/ -uint8_t L2CA_DataWriteEx(uint16_t cid, BT_HDR* p_data, uint16_t flags) { - if (bluetooth::shim::is_gd_shim_enabled()) { - return bluetooth::shim::L2CA_DataWriteEx(cid, p_data, flags); - } - - L2CAP_TRACE_API("L2CA_DataWriteEx() CID: 0x%04x Len: %d Flags:0x%04X", cid, - p_data->len, flags); - return l2c_data_write(cid, p_data, flags); -} - -/******************************************************************************* - * * Function L2CA_FlushChannel * * Description This function flushes none, some or all buffers queued up |
