return shim_l2cap.ConnectResponse(p_bd_addr, id, lcid, result, status);
}
-bool bluetooth::shim::L2CA_ConfigReq(uint16_t cid, tL2CAP_CFG_INFO* cfg_info) {
- return shim_l2cap.ConfigRequest(cid, cfg_info);
-}
-
-bool bluetooth::shim::L2CA_ConfigRsp(uint16_t cid, tL2CAP_CFG_INFO* cfg_info) {
- return shim_l2cap.ConfigResponse(cid, cfg_info);
-}
-
bool bluetooth::shim::L2CA_DisconnectReq(uint16_t cid) {
return shim_l2cap.DisconnectRequest(cid);
}
-bool bluetooth::shim::L2CA_DisconnectRsp(uint16_t cid) {
- return shim_l2cap.DisconnectResponse(cid);
-}
-
/**
* Le Connection Oriented Channel APIs
*/
/*******************************************************************************
*
- * Function L2CA_ConfigReq
- *
- * Description Higher layers call this function to send configuration.
- *
- * Returns true if configuration sent, else false
- *
- ******************************************************************************/
-bool L2CA_ConfigReq(uint16_t cid, tL2CAP_CFG_INFO* p_cfg);
-
-/*******************************************************************************
- *
- * Function L2CA_ConfigRsp
- *
- * Description Higher layers call this function to send a configuration
- * response.
- *
- * Returns true if configuration response sent, else false
- *
- ******************************************************************************/
-bool L2CA_ConfigRsp(uint16_t cid, tL2CAP_CFG_INFO* p_cfg);
-
-/*******************************************************************************
- *
* Function L2CA_DisconnectReq
*
* Description Higher layers call this function to disconnect a channel.
/*******************************************************************************
*
- * Function L2CA_DisconnectRsp
- *
- * Description Higher layers call this function to acknowledge the
- * disconnection of a channel.
- *
- * Returns void
- *
- ******************************************************************************/
-bool L2CA_DisconnectRsp(uint16_t cid);
-
-/*******************************************************************************
- *
* Function L2CA_DataWrite
*
* Description Higher layers call this function to write data.
FROM_HERE,
base::Bind(classic_.Callbacks(psm).pL2CA_ConnectCfm_Cb, cid,
connected ? (kConnectionSuccess) : (kConnectionFail)));
+ tL2CAP_CFG_INFO cfg_info{};
+ do_in_main_thread(
+ FROM_HERE,
+ base::Bind(classic_.Callbacks(CidToPsm(cid)).pL2CA_ConfigInd_Cb, cid,
+ base::Unretained(&cfg_info)));
+ do_in_main_thread(
+ FROM_HERE,
+ base::Bind(classic_.Callbacks(CidToPsm(cid)).pL2CA_ConfigCfm_Cb, cid,
+ L2CAP_CFG_OK));
} else {
LOG_DEBUG("Connection Closed before presentation to upper layer");
FROM_HERE,
base::Bind(classic_.Callbacks(CidToPsm(cid)).pL2CA_ConnectInd_Cb,
raw_address, cid, psm, kUnusedId));
+ tL2CAP_CFG_INFO cfg_info{};
+ do_in_main_thread(
+ FROM_HERE,
+ base::Bind(classic_.Callbacks(CidToPsm(cid)).pL2CA_ConfigInd_Cb, cid,
+ base::Unretained(&cfg_info)));
+ do_in_main_thread(
+ FROM_HERE,
+ base::Bind(classic_.Callbacks(CidToPsm(cid)).pL2CA_ConfigCfm_Cb, cid,
+ L2CAP_CFG_OK));
}
bool bluetooth::shim::legacy::L2cap::Write(uint16_t cid, BT_HDR* bt_hdr) {
return true;
}
-bool bluetooth::shim::legacy::L2cap::ConfigRequest(
- uint16_t cid, const tL2CAP_CFG_INFO* config_info) {
- LOG_INFO("Received config request from upper layer cid:%hd", cid);
- CHECK(ConnectionExists(cid));
-
- bluetooth::shim::GetL2cap()->SendLoopbackResponse([this, cid]() {
- CHECK(ConnectionExists(cid));
- tL2CAP_CFG_INFO cfg_info{
- .result = L2CAP_CFG_OK,
- .mtu_present = false,
- .qos_present = false,
- .flush_to_present = false,
- .fcr_present = false,
- .fcs_present = false,
- .ext_flow_spec_present = false,
- .flags = 0,
- };
- LOG(INFO) << __func__ << "Rcvd config request";
- do_in_main_thread(
- FROM_HERE,
- base::Bind(classic_.Callbacks(CidToPsm(cid)).pL2CA_ConfigInd_Cb, cid,
- base::Unretained(&cfg_info)));
- do_in_main_thread(
- FROM_HERE,
- base::Bind(classic_.Callbacks(CidToPsm(cid)).pL2CA_ConfigCfm_Cb, cid,
- L2CAP_CFG_OK));
- });
- return true;
-}
-
-bool bluetooth::shim::legacy::L2cap::ConfigResponse(
- uint16_t cid, const tL2CAP_CFG_INFO* config_info) {
- CHECK(ConnectionExists(cid));
- LOG_DEBUG(
-
- "%s Silently dropping client config response as channel is already open",
- __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()) {
return true;
}
-bool bluetooth::shim::legacy::L2cap::DisconnectResponse(uint16_t cid) {
- LOG_DEBUG(
- "%s Silently dropping client disconnect response as channel is "
- "already disconnected",
- __func__);
- return true;
-}
-
void bluetooth::shim::legacy::L2cap::Dump(int fd) {
if (cid_to_psm_map_.empty()) {
dprintf(fd, "%s No active l2cap channels\n", kModuleName);
// Legacy API entry points
bool ConnectResponse(const RawAddress& raw_address, uint8_t signal_id,
uint16_t cid, uint16_t result, uint16_t status);
- bool ConfigRequest(uint16_t cid, const tL2CAP_CFG_INFO* config_info);
- bool ConfigResponse(uint16_t cid, const tL2CAP_CFG_INFO* config_info);
+
bool DisconnectRequest(uint16_t cid);
- bool DisconnectResponse(uint16_t cid);
bool GetRemoteCid(uint16_t cid, uint16_t* remote_cid);