return shim_l2cap.CreateConnection(psm, raw_address);
}
-bool bluetooth::shim::L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id,
- uint16_t lcid, uint16_t result,
- uint16_t status) {
- return shim_l2cap.ConnectResponse(p_bd_addr, id, lcid, result, status);
-}
-
bool bluetooth::shim::L2CA_DisconnectReq(uint16_t cid) {
return shim_l2cap.DisconnectRequest(cid);
}
/*******************************************************************************
*
- * Function L2CA_ConnectRsp
- *
- * Description Higher layers call this function to accept an incoming
- * L2CAP connection, for which they had gotten an connect
- * indication callback.
- *
- * Returns true for success, false for failure
- *
- ******************************************************************************/
-bool L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid,
- uint16_t result, uint16_t status);
-
-/*******************************************************************************
- *
* Function L2CA_RegisterLECoc
*
* Description Other layers call this function to register for L2CAP
});
}
-bool bluetooth::shim::legacy::L2cap::ConnectResponse(
- const RawAddress& raw_address, uint8_t signal_id, uint16_t cid,
- uint16_t result, uint16_t status) {
- CHECK(ConnectionExists(cid));
- LOG_DEBUG(
- "%s Silently dropping client connect response as channel is "
- "already connected",
- __func__);
- return true;
-}
-
bool bluetooth::shim::legacy::L2cap::DisconnectRequest(uint16_t cid) {
CHECK(ConnectionExists(cid));
if (cid_closing_set_.find(cid) != cid_closing_set_.end()) {
uint16_t ConvertClientToRealPsm(uint16_t psm);
void RemoveClientPsm(uint16_t client_psm);
- // Legacy API entry points
- bool ConnectResponse(const RawAddress& raw_address, uint8_t signal_id,
- uint16_t cid, uint16_t result, uint16_t status);
-
bool DisconnectRequest(uint16_t cid);
bool GetRemoteCid(uint16_t cid, uint16_t* remote_cid);
/*******************************************************************************
*
- * Function L2CA_ConnectRsp
- *
- * Description Higher layers call this function to accept an incoming
- * L2CAP connection, for which they had gotten an connect
- * indication callback.
- *
- * Returns true for success, false for failure
- *
- ******************************************************************************/
-extern bool L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id,
- uint16_t lcid, uint16_t result, uint16_t status);
-
-/*******************************************************************************
- *
* Function L2CA_RegisterLECoc
*
* Description Other layers call this function to register for L2CAP
/*******************************************************************************
*
- * Function L2CA_ConnectRsp
- *
- * Description Higher layers call this function to accept an incoming
- * L2CAP connection, for which they had gotten an connect
- * indication callback.
- *
- * Returns true for success, false for failure
- *
- ******************************************************************************/
-bool L2CA_ConnectRsp(const RawAddress& p_bd_addr, uint8_t id, uint16_t lcid,
- uint16_t result, uint16_t status) {
- if (bluetooth::shim::is_gd_shim_enabled()) {
- return bluetooth::shim::L2CA_ConnectRsp(p_bd_addr, id, lcid, result,
- status);
- }
-
- tL2C_LCB* p_lcb;
- tL2C_CCB* p_ccb;
-
- VLOG(1) << __func__ << " BDA: " << p_bd_addr
- << StringPrintf(" CID:0x%04x Result:%d Status:%d", lcid, result,
- status);
-
- /* First, find the link control block */
- p_lcb = l2cu_find_lcb_by_bd_addr(p_bd_addr, BT_TRANSPORT_BR_EDR);
- if (p_lcb == NULL) {
- /* No link. Get an LCB and start link establishment */
- L2CAP_TRACE_WARNING("L2CAP - no LCB for L2CA_conn_rsp");
- return (false);
- }
-
- /* Now, find the channel control block */
- p_ccb = l2cu_find_ccb_by_cid(p_lcb, lcid);
- if (p_ccb == NULL) {
- L2CAP_TRACE_WARNING("L2CAP - no CCB for L2CA_conn_rsp");
- return (false);
- }
-
- /* The IDs must match */
- if (p_ccb->remote_id != id) {
- L2CAP_TRACE_WARNING("L2CAP - bad id in L2CA_conn_rsp. Exp: %d Got: %d",
- p_ccb->remote_id, id);
- return (false);
- }
-
- if (result == L2CAP_CONN_OK) {
- l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_RSP, NULL);
- } else {
- tL2C_CONN_INFO conn_info;
-
- conn_info.l2cap_result = result;
- conn_info.l2cap_status = status;
-
- if (result == L2CAP_CONN_PENDING)
- l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_RSP, &conn_info);
- else
- l2c_csm_execute(p_ccb, L2CEVT_L2CA_CONNECT_RSP_NEG, &conn_info);
- }
-
- return (true);
-}
-
-/*******************************************************************************
- *
* Function L2CA_DisconnectReq
*
* Description Higher layers call this function to disconnect a channel.