Loading system/gd/shim/l2cap.cc +30 −8 Original line number Diff line number Diff line Loading @@ -211,7 +211,8 @@ struct L2cap::impl { void RegistrationComplete(l2cap::classic::DynamicChannelManager::RegistrationResult result, std::unique_ptr<l2cap::classic::DynamicChannelService> service); void ConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel); void LocalConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel); void RemoteConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel); void ConnectionFailure(l2cap::classic::DynamicChannelManager::ConnectionResult result); bool Write(ChannelInterfaceId cid, std::unique_ptr<packet::RawBuilder> packet); Loading Loading @@ -246,8 +247,9 @@ void L2cap::impl::RegistrationComplete(l2cap::classic::DynamicChannelManager::Re completed.set_value(); } void L2cap::impl::ConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) { LOG_DEBUG("Connection is open"); void L2cap::impl::LocalConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) { LOG_DEBUG("Local initiated connection is open to connect_queue_size:%zd device:%s", connect_completed_queue_.size(), channel->GetDevice().ToString().c_str()); auto completed = std::move(connect_completed_queue_.front()); connect_completed_queue_.pop(); if (!channel_interface_manager_.HasResources()) { Loading @@ -256,11 +258,31 @@ void L2cap::impl::ConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> completed.set_value(channel_interface_manager_.AddChannel(std::move(channel))); } void L2cap::impl::RemoteConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) { LOG_DEBUG("Remote initiated connection is open to connect_queue_size:%zd device:%s", connect_completed_queue_.size(), channel->GetDevice().ToString().c_str()); // TODO(cmanton) plumb back to legacy somehow } void L2cap::impl::ConnectionFailure(l2cap::classic::DynamicChannelManager::ConnectionResult result) { LOG_DEBUG("Connection failed"); auto& completed = connect_completed_queue_.front(); switch (result.connection_result_code) { case l2cap::classic::DynamicChannelManager::ConnectionResultCode::SUCCESS: LOG_WARN("Connection failed result:success hci:%s", hci::ErrorCodeText(result.hci_error).c_str()); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_NO_SERVICE_REGISTERED: LOG_DEBUG("Connection failed result:no service registered hci:%s", hci::ErrorCodeText(result.hci_error).c_str()); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_HCI_ERROR: LOG_DEBUG("Connection failed result:hci error hci:%s", hci::ErrorCodeText(result.hci_error).c_str()); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR: LOG_DEBUG("Connection failed result:l2cap error hci:%s l2cap:%s", hci::ErrorCodeText(result.hci_error).c_str(), l2cap::ConnectionResponseResultText(result.l2cap_connection_response_result).c_str()); break; } auto completed = std::move(connect_completed_queue_.front()); connect_completed_queue_.pop(); completed.set_value(0); completed.set_value(kInvalidChannelInterfaceId); } void L2cap::impl::RegisterService(l2cap::Psm psm, std::promise<void> register_completed) { Loading @@ -268,14 +290,14 @@ void L2cap::impl::RegisterService(l2cap::Psm psm, std::promise<void> register_co register_completed_queue_.push(std::move(register_completed)); bool rc = dynamic_channel_manager_->RegisterService( psm, security_policy, common::BindOnce(&L2cap::impl::RegistrationComplete, common::Unretained(this)), common::Bind(&L2cap::impl::ConnectionOpen, common::Unretained(this)), handler_); common::Bind(&L2cap::impl::RemoteConnectionOpen, common::Unretained(this)), handler_); ASSERT_LOG(rc == true, "Failed to request register classic service"); } void L2cap::impl::Connect(l2cap::Psm psm, hci::Address address, std::promise<uint16_t> connect_completed) { connect_completed_queue_.push(std::move(connect_completed)); bool rc = dynamic_channel_manager_->ConnectChannel( address, psm, common::Bind(&L2cap::impl::ConnectionOpen, common::Unretained(this)), address, psm, common::Bind(&L2cap::impl::LocalConnectionOpen, common::Unretained(this)), common::Bind(&L2cap::impl::ConnectionFailure, common::Unretained(this)), handler_); ASSERT_LOG(rc == true, "Failed to request connect classic channel"); } Loading system/main/shim/l2c_api.cc +14 −16 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ uint16_t bluetooth::shim::L2CA_Register(uint16_t client_psm, tL2CAP_APPL_INFO* callbacks, bool enable_snoop) { if (L2C_INVALID_PSM(client_psm)) { LOG_ERROR(LOG_TAG, "%s Invalid classic psm:0x%04x", __func__, client_psm); LOG_ERROR(LOG_TAG, "%s Invalid classic psm:%hd", __func__, client_psm); return 0; } Loading @@ -38,7 +38,7 @@ uint16_t bluetooth::shim::L2CA_Register(uint16_t client_psm, (callbacks->pL2CA_ConfigInd_Cb == nullptr) || (callbacks->pL2CA_DataInd_Cb == nullptr) || (callbacks->pL2CA_DisconnectInd_Cb == nullptr)) { LOG_ERROR(LOG_TAG, "%s Invalid classic callbacks psm:0x%04x", __func__, LOG_ERROR(LOG_TAG, "%s Invalid classic callbacks psm:%hd", __func__, client_psm); return 0; } Loading @@ -51,37 +51,36 @@ uint16_t bluetooth::shim::L2CA_Register(uint16_t client_psm, is_outgoing_connection_only); if (shim_l2cap.Classic().IsPsmRegistered(psm)) { LOG_ERROR(LOG_TAG, "%s Already registered classic client_psm:0x%04x psm:0x%04x", LOG_ERROR(LOG_TAG, "%s Already registered classic client_psm:%hd psm:%hd", __func__, client_psm, psm); return 0; } shim_l2cap.Classic().RegisterPsm(psm, callbacks); LOG_INFO(LOG_TAG, "%s classic client_psm:0x%04x psm:0x%04x", __func__, client_psm, psm); LOG_INFO(LOG_TAG, "%s classic client_psm:%hd psm:%hd", __func__, client_psm, psm); shim_l2cap.Register(psm, callbacks, enable_snoop); return psm; return client_psm; } void bluetooth::shim::L2CA_Deregister(uint16_t client_psm) { if (L2C_INVALID_PSM(client_psm)) { LOG_ERROR(LOG_TAG, "%s Invalid classic psm:0x%04x", __func__, client_psm); LOG_ERROR(LOG_TAG, "%s Invalid classic client_psm:%hd", __func__, client_psm); return; } uint16_t psm = shim_l2cap.ConvertClientToRealPsm(client_psm); if (!shim_l2cap.Classic().IsPsmRegistered(psm)) { LOG_ERROR( LOG_TAG, "%s Not previously registered classic client_psm:0x%04x psm:0x%04x", LOG_ERROR(LOG_TAG, "%s Not previously registered classic client_psm:%hd psm:%hd", __func__, client_psm, psm); return; } shim_l2cap.Classic().UnregisterPsm(psm); shim_l2cap.RemoveClientPsm(client_psm); shim_l2cap.RemoveClientPsm(psm); } uint16_t bluetooth::shim::L2CA_AllocatePSM(void) { Loading @@ -98,12 +97,11 @@ uint16_t bluetooth::shim::L2CA_AllocateLePSM(void) { void bluetooth::shim::L2CA_FreeLePSM(uint16_t psm) { if (!shim_l2cap.Le().IsPsmAllocated(psm)) { LOG_ERROR(LOG_TAG, "%s Not previously allocated le psm:0x%04x", __func__, psm); LOG_ERROR(LOG_TAG, "%s Not previously allocated le psm:%hd", __func__, psm); return; } if (!shim_l2cap.Le().IsPsmRegistered(psm)) { LOG_ERROR(LOG_TAG, "%s Must deregister psm before deallocation psm:0x%04x", LOG_ERROR(LOG_TAG, "%s Must deregister psm before deallocation psm:%hd", __func__, psm); return; } Loading system/main/shim/l2cap.cc +18 −20 Original line number Diff line number Diff line Loading @@ -125,19 +125,14 @@ uint16_t bluetooth::shim::L2cap::GetNextDynamicClassicPsm() { void bluetooth::shim::L2cap::Register(uint16_t psm, tL2CAP_APPL_INFO* p_cb_info, bool enable_snoop) { LOG_DEBUG(LOG_TAG, "Registering service psm:%hd", psm); std::chrono::system_clock::time_point two_seconds = std::chrono::system_clock::now() + std::chrono::seconds(2); LOG_DEBUG(LOG_TAG, "Registering service on psm:%hd", psm); std::promise<void> register_completed; auto completed = register_completed.get_future(); bluetooth::shim::GetL2cap()->RegisterService(psm, enable_snoop, std::move(register_completed)); completed.wait(); if (std::future_status::ready != completed.wait_until(two_seconds)) { LOG_WARN(LOG_TAG, "Timed out registering service to psm:%hd", psm); } LOG_DEBUG(LOG_TAG, "Successfully registered service on psm:%hd", psm); } uint16_t bluetooth::shim::L2cap::Connect(uint16_t psm, Loading @@ -145,19 +140,16 @@ uint16_t bluetooth::shim::L2cap::Connect(uint16_t psm, LOG_DEBUG(LOG_TAG, "Requesting connection to psm:%hd address:%s", psm, raw_address.ToString().c_str()); std::chrono::system_clock::time_point two_seconds = std::chrono::system_clock::now() + std::chrono::seconds(2); std::promise<uint16_t> connect_completed; auto completed = connect_completed.get_future(); bluetooth::shim::GetL2cap()->Connect(psm, raw_address.ToString(), std::move(connect_completed)); if (std::future_status::ready == completed.wait_until(two_seconds)) { return completed.get(); } LOG_WARN(LOG_TAG, "Timed out connecting to psm:%hd address:%s", psm, raw_address.ToString().c_str()); return 0; uint16_t cid = completed.get(); LOG_INFO(LOG_TAG, "Successfully connected using connection_interface_descriptor:%hd " "psm:%hd address:%s", cid, psm, raw_address.ToString().c_str()); return cid; } bool bluetooth::shim::L2cap::IsCongested(uint16_t cid) const { Loading Loading @@ -186,11 +178,15 @@ bool bluetooth::shim::L2cap::WriteNonFlushable(uint16_t cid, BT_HDR* bt_hdr) { bool bluetooth::shim::L2cap::SetCallbacks(uint16_t cid, const tL2CAP_APPL_INFO* callbacks) { LOG_ASSERT(cid_to_callback_map_.find(cid) != cid_to_callback_map_.end()) << "Registering multiple channel callbacks cid:" << cid; << "Registering multiple channel callbacks " "connection_interface_descriptor:" << cid; cid_to_callback_map_[cid] = callbacks; bluetooth::shim::GetL2cap()->SetOnReadDataReady( cid, [this](uint16_t cid, std::vector<const uint8_t> data) { LOG_INFO(LOG_TAG, "Got data on cid:%hd len:%zd", cid, data.size()); LOG_INFO(LOG_TAG, "Got data on connection_interface_descriptor:%hd len:%zd", cid, data.size()); BT_HDR* bt_hdr = static_cast<BT_HDR*>(osi_calloc(data.size() + kBtHdrSize)); Loading @@ -200,7 +196,8 @@ bool bluetooth::shim::L2cap::SetCallbacks(uint16_t cid, cid_to_callback_map_[cid]->pL2CA_DataInd_Cb(cid, bt_hdr); }); bluetooth::shim::GetL2cap()->SetOnClose(cid, [this, &cid](int error_code) { LOG_DEBUG(LOG_TAG, "Channel closed cid:%hd", cid); LOG_DEBUG(LOG_TAG, "Channel closed connection_interface_descriptor:%hd", cid); cid_to_callback_map_[cid]->pL2CA_DisconnectInd_Cb(cid, true); }); return true; Loading @@ -208,6 +205,7 @@ bool bluetooth::shim::L2cap::SetCallbacks(uint16_t cid, void bluetooth::shim::L2cap::ClearCallbacks(uint16_t cid) { LOG_ASSERT(cid_to_callback_map_.find(cid) == cid_to_callback_map_.end()) << "Clearing callbacks that do not exist cid:" << cid; << "Clearing callbacks that do not exist connection_interface_descriptor:" << cid; cid_to_callback_map_.erase(cid); } Loading
system/gd/shim/l2cap.cc +30 −8 Original line number Diff line number Diff line Loading @@ -211,7 +211,8 @@ struct L2cap::impl { void RegistrationComplete(l2cap::classic::DynamicChannelManager::RegistrationResult result, std::unique_ptr<l2cap::classic::DynamicChannelService> service); void ConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel); void LocalConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel); void RemoteConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel); void ConnectionFailure(l2cap::classic::DynamicChannelManager::ConnectionResult result); bool Write(ChannelInterfaceId cid, std::unique_ptr<packet::RawBuilder> packet); Loading Loading @@ -246,8 +247,9 @@ void L2cap::impl::RegistrationComplete(l2cap::classic::DynamicChannelManager::Re completed.set_value(); } void L2cap::impl::ConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) { LOG_DEBUG("Connection is open"); void L2cap::impl::LocalConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) { LOG_DEBUG("Local initiated connection is open to connect_queue_size:%zd device:%s", connect_completed_queue_.size(), channel->GetDevice().ToString().c_str()); auto completed = std::move(connect_completed_queue_.front()); connect_completed_queue_.pop(); if (!channel_interface_manager_.HasResources()) { Loading @@ -256,11 +258,31 @@ void L2cap::impl::ConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> completed.set_value(channel_interface_manager_.AddChannel(std::move(channel))); } void L2cap::impl::RemoteConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) { LOG_DEBUG("Remote initiated connection is open to connect_queue_size:%zd device:%s", connect_completed_queue_.size(), channel->GetDevice().ToString().c_str()); // TODO(cmanton) plumb back to legacy somehow } void L2cap::impl::ConnectionFailure(l2cap::classic::DynamicChannelManager::ConnectionResult result) { LOG_DEBUG("Connection failed"); auto& completed = connect_completed_queue_.front(); switch (result.connection_result_code) { case l2cap::classic::DynamicChannelManager::ConnectionResultCode::SUCCESS: LOG_WARN("Connection failed result:success hci:%s", hci::ErrorCodeText(result.hci_error).c_str()); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_NO_SERVICE_REGISTERED: LOG_DEBUG("Connection failed result:no service registered hci:%s", hci::ErrorCodeText(result.hci_error).c_str()); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_HCI_ERROR: LOG_DEBUG("Connection failed result:hci error hci:%s", hci::ErrorCodeText(result.hci_error).c_str()); break; case l2cap::classic::DynamicChannelManager::ConnectionResultCode::FAIL_L2CAP_ERROR: LOG_DEBUG("Connection failed result:l2cap error hci:%s l2cap:%s", hci::ErrorCodeText(result.hci_error).c_str(), l2cap::ConnectionResponseResultText(result.l2cap_connection_response_result).c_str()); break; } auto completed = std::move(connect_completed_queue_.front()); connect_completed_queue_.pop(); completed.set_value(0); completed.set_value(kInvalidChannelInterfaceId); } void L2cap::impl::RegisterService(l2cap::Psm psm, std::promise<void> register_completed) { Loading @@ -268,14 +290,14 @@ void L2cap::impl::RegisterService(l2cap::Psm psm, std::promise<void> register_co register_completed_queue_.push(std::move(register_completed)); bool rc = dynamic_channel_manager_->RegisterService( psm, security_policy, common::BindOnce(&L2cap::impl::RegistrationComplete, common::Unretained(this)), common::Bind(&L2cap::impl::ConnectionOpen, common::Unretained(this)), handler_); common::Bind(&L2cap::impl::RemoteConnectionOpen, common::Unretained(this)), handler_); ASSERT_LOG(rc == true, "Failed to request register classic service"); } void L2cap::impl::Connect(l2cap::Psm psm, hci::Address address, std::promise<uint16_t> connect_completed) { connect_completed_queue_.push(std::move(connect_completed)); bool rc = dynamic_channel_manager_->ConnectChannel( address, psm, common::Bind(&L2cap::impl::ConnectionOpen, common::Unretained(this)), address, psm, common::Bind(&L2cap::impl::LocalConnectionOpen, common::Unretained(this)), common::Bind(&L2cap::impl::ConnectionFailure, common::Unretained(this)), handler_); ASSERT_LOG(rc == true, "Failed to request connect classic channel"); } Loading
system/main/shim/l2c_api.cc +14 −16 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ uint16_t bluetooth::shim::L2CA_Register(uint16_t client_psm, tL2CAP_APPL_INFO* callbacks, bool enable_snoop) { if (L2C_INVALID_PSM(client_psm)) { LOG_ERROR(LOG_TAG, "%s Invalid classic psm:0x%04x", __func__, client_psm); LOG_ERROR(LOG_TAG, "%s Invalid classic psm:%hd", __func__, client_psm); return 0; } Loading @@ -38,7 +38,7 @@ uint16_t bluetooth::shim::L2CA_Register(uint16_t client_psm, (callbacks->pL2CA_ConfigInd_Cb == nullptr) || (callbacks->pL2CA_DataInd_Cb == nullptr) || (callbacks->pL2CA_DisconnectInd_Cb == nullptr)) { LOG_ERROR(LOG_TAG, "%s Invalid classic callbacks psm:0x%04x", __func__, LOG_ERROR(LOG_TAG, "%s Invalid classic callbacks psm:%hd", __func__, client_psm); return 0; } Loading @@ -51,37 +51,36 @@ uint16_t bluetooth::shim::L2CA_Register(uint16_t client_psm, is_outgoing_connection_only); if (shim_l2cap.Classic().IsPsmRegistered(psm)) { LOG_ERROR(LOG_TAG, "%s Already registered classic client_psm:0x%04x psm:0x%04x", LOG_ERROR(LOG_TAG, "%s Already registered classic client_psm:%hd psm:%hd", __func__, client_psm, psm); return 0; } shim_l2cap.Classic().RegisterPsm(psm, callbacks); LOG_INFO(LOG_TAG, "%s classic client_psm:0x%04x psm:0x%04x", __func__, client_psm, psm); LOG_INFO(LOG_TAG, "%s classic client_psm:%hd psm:%hd", __func__, client_psm, psm); shim_l2cap.Register(psm, callbacks, enable_snoop); return psm; return client_psm; } void bluetooth::shim::L2CA_Deregister(uint16_t client_psm) { if (L2C_INVALID_PSM(client_psm)) { LOG_ERROR(LOG_TAG, "%s Invalid classic psm:0x%04x", __func__, client_psm); LOG_ERROR(LOG_TAG, "%s Invalid classic client_psm:%hd", __func__, client_psm); return; } uint16_t psm = shim_l2cap.ConvertClientToRealPsm(client_psm); if (!shim_l2cap.Classic().IsPsmRegistered(psm)) { LOG_ERROR( LOG_TAG, "%s Not previously registered classic client_psm:0x%04x psm:0x%04x", LOG_ERROR(LOG_TAG, "%s Not previously registered classic client_psm:%hd psm:%hd", __func__, client_psm, psm); return; } shim_l2cap.Classic().UnregisterPsm(psm); shim_l2cap.RemoveClientPsm(client_psm); shim_l2cap.RemoveClientPsm(psm); } uint16_t bluetooth::shim::L2CA_AllocatePSM(void) { Loading @@ -98,12 +97,11 @@ uint16_t bluetooth::shim::L2CA_AllocateLePSM(void) { void bluetooth::shim::L2CA_FreeLePSM(uint16_t psm) { if (!shim_l2cap.Le().IsPsmAllocated(psm)) { LOG_ERROR(LOG_TAG, "%s Not previously allocated le psm:0x%04x", __func__, psm); LOG_ERROR(LOG_TAG, "%s Not previously allocated le psm:%hd", __func__, psm); return; } if (!shim_l2cap.Le().IsPsmRegistered(psm)) { LOG_ERROR(LOG_TAG, "%s Must deregister psm before deallocation psm:0x%04x", LOG_ERROR(LOG_TAG, "%s Must deregister psm before deallocation psm:%hd", __func__, psm); return; } Loading
system/main/shim/l2cap.cc +18 −20 Original line number Diff line number Diff line Loading @@ -125,19 +125,14 @@ uint16_t bluetooth::shim::L2cap::GetNextDynamicClassicPsm() { void bluetooth::shim::L2cap::Register(uint16_t psm, tL2CAP_APPL_INFO* p_cb_info, bool enable_snoop) { LOG_DEBUG(LOG_TAG, "Registering service psm:%hd", psm); std::chrono::system_clock::time_point two_seconds = std::chrono::system_clock::now() + std::chrono::seconds(2); LOG_DEBUG(LOG_TAG, "Registering service on psm:%hd", psm); std::promise<void> register_completed; auto completed = register_completed.get_future(); bluetooth::shim::GetL2cap()->RegisterService(psm, enable_snoop, std::move(register_completed)); completed.wait(); if (std::future_status::ready != completed.wait_until(two_seconds)) { LOG_WARN(LOG_TAG, "Timed out registering service to psm:%hd", psm); } LOG_DEBUG(LOG_TAG, "Successfully registered service on psm:%hd", psm); } uint16_t bluetooth::shim::L2cap::Connect(uint16_t psm, Loading @@ -145,19 +140,16 @@ uint16_t bluetooth::shim::L2cap::Connect(uint16_t psm, LOG_DEBUG(LOG_TAG, "Requesting connection to psm:%hd address:%s", psm, raw_address.ToString().c_str()); std::chrono::system_clock::time_point two_seconds = std::chrono::system_clock::now() + std::chrono::seconds(2); std::promise<uint16_t> connect_completed; auto completed = connect_completed.get_future(); bluetooth::shim::GetL2cap()->Connect(psm, raw_address.ToString(), std::move(connect_completed)); if (std::future_status::ready == completed.wait_until(two_seconds)) { return completed.get(); } LOG_WARN(LOG_TAG, "Timed out connecting to psm:%hd address:%s", psm, raw_address.ToString().c_str()); return 0; uint16_t cid = completed.get(); LOG_INFO(LOG_TAG, "Successfully connected using connection_interface_descriptor:%hd " "psm:%hd address:%s", cid, psm, raw_address.ToString().c_str()); return cid; } bool bluetooth::shim::L2cap::IsCongested(uint16_t cid) const { Loading Loading @@ -186,11 +178,15 @@ bool bluetooth::shim::L2cap::WriteNonFlushable(uint16_t cid, BT_HDR* bt_hdr) { bool bluetooth::shim::L2cap::SetCallbacks(uint16_t cid, const tL2CAP_APPL_INFO* callbacks) { LOG_ASSERT(cid_to_callback_map_.find(cid) != cid_to_callback_map_.end()) << "Registering multiple channel callbacks cid:" << cid; << "Registering multiple channel callbacks " "connection_interface_descriptor:" << cid; cid_to_callback_map_[cid] = callbacks; bluetooth::shim::GetL2cap()->SetOnReadDataReady( cid, [this](uint16_t cid, std::vector<const uint8_t> data) { LOG_INFO(LOG_TAG, "Got data on cid:%hd len:%zd", cid, data.size()); LOG_INFO(LOG_TAG, "Got data on connection_interface_descriptor:%hd len:%zd", cid, data.size()); BT_HDR* bt_hdr = static_cast<BT_HDR*>(osi_calloc(data.size() + kBtHdrSize)); Loading @@ -200,7 +196,8 @@ bool bluetooth::shim::L2cap::SetCallbacks(uint16_t cid, cid_to_callback_map_[cid]->pL2CA_DataInd_Cb(cid, bt_hdr); }); bluetooth::shim::GetL2cap()->SetOnClose(cid, [this, &cid](int error_code) { LOG_DEBUG(LOG_TAG, "Channel closed cid:%hd", cid); LOG_DEBUG(LOG_TAG, "Channel closed connection_interface_descriptor:%hd", cid); cid_to_callback_map_[cid]->pL2CA_DisconnectInd_Cb(cid, true); }); return true; Loading @@ -208,6 +205,7 @@ bool bluetooth::shim::L2cap::SetCallbacks(uint16_t cid, void bluetooth::shim::L2cap::ClearCallbacks(uint16_t cid) { LOG_ASSERT(cid_to_callback_map_.find(cid) == cid_to_callback_map_.end()) << "Clearing callbacks that do not exist cid:" << cid; << "Clearing callbacks that do not exist connection_interface_descriptor:" << cid; cid_to_callback_map_.erase(cid); }