#include "stack/include/btm_api.h"
#include "stack/include/btu.h"
+namespace bluetooth {
+namespace shim {
+
using bluetooth::hci::AddressWithType;
using namespace bluetooth::l2cap;
// Classic Dynamic Channel Shim Helper
+namespace {
uint16_t classic_cid_token_counter_ = 0x41;
std::unordered_map<uint16_t /* token */, uint16_t /* cid */>
classic::SecurityPolicy policy_;
void Register() {
- bluetooth::shim::GetL2capClassicModule()
- ->GetDynamicChannelManager()
- ->RegisterService(
- psm_, config_, policy_,
- bluetooth::shim::GetGdShimHandler()->BindOnceOn(
- this, &ClassicDynamicChannelHelper::on_registration_complete),
- bluetooth::shim::GetGdShimHandler()->BindOn(
- this, &ClassicDynamicChannelHelper::on_channel_open, 0));
+ GetL2capClassicModule()->GetDynamicChannelManager()->RegisterService(
+ psm_, config_, policy_,
+ GetGdShimHandler()->BindOnceOn(
+ this, &ClassicDynamicChannelHelper::on_registration_complete),
+ GetGdShimHandler()->BindOn(
+ this, &ClassicDynamicChannelHelper::on_channel_open, 0));
}
void on_registration_complete(
return;
}
initiated_by_us_[cid_token] = true;
- bluetooth::shim::GetL2capClassicModule()
- ->GetDynamicChannelManager()
- ->ConnectChannel(
- device.GetAddress(), config_, psm_,
- bluetooth::shim::GetGdShimHandler()->BindOn(
- this, &ClassicDynamicChannelHelper::on_channel_open, cid_token),
- bluetooth::shim::GetGdShimHandler()->BindOnceOn(
- this,
- &ClassicDynamicChannelHelper::on_outgoing_connection_fail));
+ GetL2capClassicModule()->GetDynamicChannelManager()->ConnectChannel(
+ device.GetAddress(), config_, psm_,
+ GetGdShimHandler()->BindOn(
+ this, &ClassicDynamicChannelHelper::on_channel_open, cid_token),
+ GetGdShimHandler()->BindOnceOn(
+ this, &ClassicDynamicChannelHelper::on_outgoing_connection_fail));
}
void Disconnect(uint16_t cid_token) {
void Unregister() {
if (channel_service_ != nullptr) {
- channel_service_->Unregister(
- bluetooth::shim::GetGdShimHandler()->BindOnceOn(
- this, &ClassicDynamicChannelHelper::on_unregistered));
+ channel_service_->Unregister(GetGdShimHandler()->BindOnceOn(
+ this, &ClassicDynamicChannelHelper::on_unregistered));
channel_service_ = nullptr;
}
}
if (channel_service_ == nullptr && channels_.empty()) {
// Try again
- bluetooth::shim::L2CA_Deregister(psm_);
+ L2CA_Deregister(psm_);
}
}
cid_token = add_classic_cid_token_entry(psm_);
}
- channel->RegisterOnCloseCallback(
- bluetooth::shim::GetGdShimHandler()->BindOnceOn(
- this, &ClassicDynamicChannelHelper::on_channel_close, cid_token));
+ channel->RegisterOnCloseCallback(GetGdShimHandler()->BindOnceOn(
+ this, &ClassicDynamicChannelHelper::on_channel_close, cid_token));
channel->GetQueueUpEnd()->RegisterDequeue(
- bluetooth::shim::GetGdShimHandler(),
+ GetGdShimHandler(),
bluetooth::common::Bind(&ClassicDynamicChannelHelper::on_incoming_data,
bluetooth::common::Unretained(this),
cid_token));
LOG(ERROR) << "Channel is not open";
return false;
}
- buffer->second->Enqueue(std::move(packet),
- bluetooth::shim::GetGdShimHandler());
+ buffer->second->Enqueue(std::move(packet), GetGdShimHandler());
return true;
}
intptr_t security_enforce_callback_counter_ = 100;
} le_security_enforcement_shim_;
+} // namespace
-bool bluetooth::shim::L2CA_ReadRemoteVersion(const RawAddress& addr,
- uint8_t* lmp_version,
- uint16_t* manufacturer,
- uint16_t* lmp_sub_version) {
+bool L2CA_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
+ uint16_t* manufacturer, uint16_t* lmp_sub_version) {
auto& entry = remote_feature_map_[addr];
if (!entry.version_info_received) {
return false;
return true;
}
-void bluetooth::shim::L2CA_UseLegacySecurityModule() {
+void L2CA_UseLegacySecurityModule() {
LOG_INFO("GD L2cap is using legacy security module");
- bluetooth::shim::GetL2capClassicModule()->InjectSecurityEnforcementInterface(
+ GetL2capClassicModule()->InjectSecurityEnforcementInterface(
&security_enforcement_shim_);
- security_interface_ =
- bluetooth::shim::GetL2capClassicModule()->GetSecurityInterface(
- bluetooth::shim::GetGdShimHandler(), &security_listener_shim_);
+ security_interface_ = GetL2capClassicModule()->GetSecurityInterface(
+ GetGdShimHandler(), &security_listener_shim_);
- bluetooth::shim::GetL2capLeModule()->InjectSecurityEnforcementInterface(
+ GetL2capLeModule()->InjectSecurityEnforcementInterface(
&le_security_enforcement_shim_);
// TODO(b/161543441): read the privacy policy from device-specific
/**
* Classic Service Registration APIs
*/
-uint16_t bluetooth::shim::L2CA_Register(
- uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks, bool enable_snoop,
- tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu,
- uint16_t required_remote_mtu, uint16_t sec_level) {
+uint16_t L2CA_Register(uint16_t client_psm, const tL2CAP_APPL_INFO& callbacks,
+ bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
+ uint16_t my_mtu, uint16_t required_remote_mtu,
+ uint16_t sec_level) {
if (classic_dynamic_channel_helper_map_.count(client_psm) != 0) {
LOG(ERROR) << __func__ << "Already registered psm: " << client_psm;
return 0;
return client_psm;
}
-void bluetooth::shim::L2CA_Deregister(uint16_t psm) {
+void L2CA_Deregister(uint16_t psm) {
if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return;
/**
* Classic Connection Oriented Channel APIS
*/
-uint16_t bluetooth::shim::L2CA_ConnectReq(uint16_t psm,
- const RawAddress& raw_address) {
+uint16_t L2CA_ConnectReq(uint16_t psm, const RawAddress& raw_address) {
if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return 0;
return cid_token;
}
-bool bluetooth::shim::L2CA_DisconnectReq(uint16_t cid) {
+bool L2CA_DisconnectReq(uint16_t cid) {
auto psm = classic_cid_token_to_channel_map_[cid];
if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return true;
}
-uint8_t bluetooth::shim::L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
+uint8_t L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
if (classic_cid_token_to_channel_map_.count(cid) == 0) {
LOG(ERROR) << __func__ << "Invalid cid: " << cid;
return 0;
len;
}
-bool bluetooth::shim::L2CA_ReconfigCreditBasedConnsReq(
- const RawAddress& bd_addr, std::vector<uint16_t>& lcids,
- tL2CAP_LE_CFG_INFO* p_cfg) {
+bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bd_addr,
+ std::vector<uint16_t>& lcids,
+ tL2CAP_LE_CFG_INFO* p_cfg) {
LOG_INFO("UNIMPLEMENTED %s addr: %s cfg:%p", __func__,
bd_addr.ToString().c_str(), p_cfg);
return false;
}
-std::vector<uint16_t> bluetooth::shim::L2CA_ConnectCreditBasedReq(
- uint16_t psm, const RawAddress& p_bd_addr, tL2CAP_LE_CFG_INFO* p_cfg) {
+std::vector<uint16_t> L2CA_ConnectCreditBasedReq(uint16_t psm,
+ const RawAddress& p_bd_addr,
+ tL2CAP_LE_CFG_INFO* p_cfg) {
LOG_INFO("UNIMPLEMENTED %s addr:%s", __func__, p_bd_addr.ToString().c_str());
std::vector<uint16_t> result;
return result;
}
-bool bluetooth::shim::L2CA_ConnectCreditBasedRsp(
- const RawAddress& bd_addr, uint8_t id,
- std::vector<uint16_t>& accepted_lcids, uint16_t result,
- tL2CAP_LE_CFG_INFO* p_cfg) {
+bool L2CA_ConnectCreditBasedRsp(const RawAddress& bd_addr, uint8_t id,
+ std::vector<uint16_t>& accepted_lcids,
+ uint16_t result, tL2CAP_LE_CFG_INFO* p_cfg) {
LOG_INFO("UNIMPLEMENTED %s addr:%s", __func__, bd_addr.ToString().c_str());
return false;
}
/**
* Link APIs
*/
-bool bluetooth::shim::L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr,
- uint16_t timeout,
- tBT_TRANSPORT transport) {
+bool L2CA_SetIdleTimeoutByBdAddr(const RawAddress& bd_addr, uint16_t timeout,
+ tBT_TRANSPORT transport) {
LOG_INFO("UNIMPLEMENTED %s", __func__);
return false;
}
-bool bluetooth::shim::L2CA_SetAclPriority(const RawAddress& bd_addr,
- tL2CAP_PRIORITY priority) {
+bool L2CA_SetAclPriority(const RawAddress& bd_addr, tL2CAP_PRIORITY priority) {
LOG_INFO("UNIMPLEMENTED %s", __func__);
return false;
}
-bool bluetooth::shim::L2CA_GetPeerFeatures(const RawAddress& bd_addr,
- uint32_t* p_ext_feat,
- uint8_t* p_chnl_mask) {
+bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat,
+ uint8_t* p_chnl_mask) {
LOG_INFO("UNIMPLEMENTED %s", __func__);
return false;
}
void on_channel_open(std::unique_ptr<le::FixedChannel> channel) {
auto device = channel->GetDevice();
channel->RegisterOnCloseCallback(
- bluetooth::shim::GetGdShimHandler(),
- bluetooth::common::BindOnce(&LeFixedChannelHelper::on_channel_close,
- bluetooth::common::Unretained(this),
- device));
+ GetGdShimHandler(), bluetooth::common::BindOnce(
+ &LeFixedChannelHelper::on_channel_close,
+ bluetooth::common::Unretained(this), device));
channel->Acquire();
channel_enqueue_buffer_[device] = std::make_unique<
bluetooth::os::EnqueueBuffer<bluetooth::packet::BasePacketBuilder>>(
channel->GetQueueUpEnd());
channel->GetQueueUpEnd()->RegisterDequeue(
- bluetooth::shim::GetGdShimHandler(),
+ GetGdShimHandler(),
bluetooth::common::Bind(&LeFixedChannelHelper::on_incoming_data,
bluetooth::common::Unretained(this), device));
channels_[device] = std::move(channel);
auto address = bluetooth::ToRawAddress(device.GetAddress());
(freg_.pL2CA_FixedConn_Cb)(cid_, address, true, 0, BT_TRANSPORT_LE);
- bluetooth::shim::Btm::StoreAddressType(
- address, static_cast<tBLE_ADDR_TYPE>(device.GetAddressType()));
+ Btm::StoreAddressType(address,
+ static_cast<tBLE_ADDR_TYPE>(device.GetAddressType()));
}
void on_incoming_data(bluetooth::hci::AddressWithType remote) {
LOG(ERROR) << "Channel is not open";
return false;
}
- buffer->second->Enqueue(std::move(packet),
- bluetooth::shim::GetGdShimHandler());
+ buffer->second->Enqueue(std::move(packet), GetGdShimHandler());
return true;
}
* Fixed Channel APIs. Note: Classic fixed channel (connectionless and BR SMP)
* is not supported
*/
-bool bluetooth::shim::L2CA_RegisterFixedChannel(uint16_t cid,
- tL2CAP_FIXED_CHNL_REG* p_freg) {
+bool L2CA_RegisterFixedChannel(uint16_t cid, tL2CAP_FIXED_CHNL_REG* p_freg) {
if (cid != kAttCid && cid != kSmpCid) {
LOG(ERROR) << "Invalid cid: " << cid;
return false;
LOG(ERROR) << "Can't register cid " << cid;
return false;
}
- bluetooth::shim::GetL2capLeModule()
- ->GetFixedChannelManager()
- ->RegisterService(
- cid,
- common::BindOnce(&LeFixedChannelHelper::on_registration_complete,
- common::Unretained(helper)),
- common::Bind(&LeFixedChannelHelper::on_channel_open,
+ GetL2capLeModule()->GetFixedChannelManager()->RegisterService(
+ cid,
+ common::BindOnce(&LeFixedChannelHelper::on_registration_complete,
common::Unretained(helper)),
- GetGdShimHandler());
+ common::Bind(&LeFixedChannelHelper::on_channel_open,
+ common::Unretained(helper)),
+ GetGdShimHandler());
helper->freg_ = *p_freg;
return true;
}
-bool bluetooth::shim::L2CA_ConnectFixedChnl(uint16_t cid,
- const RawAddress& rem_bda) {
+bool L2CA_ConnectFixedChnl(uint16_t cid, const RawAddress& rem_bda) {
if (cid != kAttCid && cid != kSmpCid) {
LOG(ERROR) << "Invalid cid " << cid;
return false;
auto* helper = &le_fixed_channel_helper_.find(cid)->second;
auto remote = ToAddressWithType(rem_bda, Btm::GetAddressType(rem_bda));
- auto manager = bluetooth::shim::GetL2capLeModule()->GetFixedChannelManager();
+ auto manager = GetL2capLeModule()->GetFixedChannelManager();
manager->ConnectServices(
remote,
common::BindOnce(&LeFixedChannelHelper::on_outgoing_connection_fail,
return true;
}
-bool bluetooth::shim::L2CA_ConnectFixedChnl(uint16_t cid,
- const RawAddress& rem_bda,
- uint8_t initiating_phys) {
- return bluetooth::shim::L2CA_ConnectFixedChnl(cid, rem_bda);
-}
-
-uint16_t bluetooth::shim::L2CA_SendFixedChnlData(uint16_t cid,
- const RawAddress& rem_bda,
- BT_HDR* p_buf) {
+uint16_t L2CA_SendFixedChnlData(uint16_t cid, const RawAddress& rem_bda,
+ BT_HDR* p_buf) {
if (cid != kAttCid && cid != kSmpCid) {
LOG(ERROR) << "Invalid cid " << cid;
return false;
return sent ? len : 0;
}
-bool bluetooth::shim::L2CA_RemoveFixedChnl(uint16_t cid,
- const RawAddress& rem_bda) {
+bool L2CA_RemoveFixedChnl(uint16_t cid, const RawAddress& rem_bda) {
if (cid != kAttCid && cid != kSmpCid) {
LOG(ERROR) << "Invalid cid " << cid;
return false;
/**
* Channel hygiene APIs
*/
-bool bluetooth::shim::L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
+bool L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
auto psm = classic_cid_token_to_channel_map_[lcid];
if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return *rcid != 0;
}
-bool bluetooth::shim::L2CA_SetTxPriority(uint16_t cid,
- tL2CAP_CHNL_PRIORITY priority) {
+bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
LOG_INFO("UNIMPLEMENTED %s", __func__);
return false;
}
-bool bluetooth::shim::L2CA_SetFixedChannelTout(const RawAddress& rem_bda,
- uint16_t fixed_cid,
- uint16_t idle_tout) {
+bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda, uint16_t fixed_cid,
+ uint16_t idle_tout) {
LOG_INFO("UNIMPLEMENTED %s", __func__);
return false;
}
-bool bluetooth::shim::L2CA_SetChnlFlushability(uint16_t cid,
- bool is_flushable) {
+bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
LOG_INFO("UNIMPLEMENTED %s", __func__);
return false;
}
-uint16_t bluetooth::shim::L2CA_FlushChannel(uint16_t lcid,
- uint16_t num_to_flush) {
+uint16_t L2CA_FlushChannel(uint16_t lcid, uint16_t num_to_flush) {
LOG_INFO("UNIMPLEMENTED %s", __func__);
return 0;
}
-bool bluetooth::shim::L2CA_IsLinkEstablished(const RawAddress& bd_addr,
- tBT_TRANSPORT transport) {
+bool L2CA_IsLinkEstablished(const RawAddress& bd_addr,
+ tBT_TRANSPORT transport) {
return security_listener_shim_.IsLinkUp(bd_addr);
}
-void bluetooth::shim::L2CA_ConnectForSecurity(const RawAddress& bd_addr) {
+void L2CA_ConnectForSecurity(const RawAddress& bd_addr) {
security_interface_->InitiateConnectionForSecurity(
bluetooth::ToGdAddress(bd_addr));
}
-void bluetooth::shim::L2CA_SetBondingState(const RawAddress& bd_addr,
- bool is_bonding) {
+void L2CA_SetBondingState(const RawAddress& bd_addr, bool is_bonding) {
security_listener_shim_.UpdateLinkHoldForSecurity(bd_addr, is_bonding);
}
-void bluetooth::shim::L2CA_DisconnectLink(const RawAddress& remote) {
+void L2CA_DisconnectLink(const RawAddress& remote) {
security_listener_shim_.Disconnect(remote);
}
-uint16_t bluetooth::shim::L2CA_GetNumLinks() {
- return security_listener_shim_.GetNumAclLinks();
-}
+uint16_t L2CA_GetNumLinks() { return security_listener_shim_.GetNumAclLinks(); }
// LE COC Shim Helper
+namespace {
uint16_t le_cid_token_counter_ = 1;
struct LeCocChannelInfo {
tL2CAP_APPL_INFO appl_info_;
void Register() {
- bluetooth::shim::GetL2capLeModule()
- ->GetDynamicChannelManager()
- ->RegisterService(
- psm_, {}, {},
- bluetooth::common::BindOnce(
- &LeDynamicChannelHelper::on_registration_complete,
- bluetooth::common::Unretained(this)),
- bluetooth::common::Bind(&LeDynamicChannelHelper::on_channel_open,
- bluetooth::common::Unretained(this)),
- bluetooth::shim::GetGdShimHandler());
+ GetL2capLeModule()->GetDynamicChannelManager()->RegisterService(
+ psm_, {}, {},
+ bluetooth::common::BindOnce(
+ &LeDynamicChannelHelper::on_registration_complete,
+ bluetooth::common::Unretained(this)),
+ bluetooth::common::Bind(&LeDynamicChannelHelper::on_channel_open,
+ bluetooth::common::Unretained(this)),
+ GetGdShimHandler());
}
void on_registration_complete(
return;
}
initiated_by_us_[device] = true;
- bluetooth::shim::GetL2capLeModule()
- ->GetDynamicChannelManager()
- ->ConnectChannel(
- device, {}, psm_,
- bluetooth::common::Bind(&LeDynamicChannelHelper::on_channel_open,
- bluetooth::common::Unretained(this)),
- bluetooth::common::Bind(
- &LeDynamicChannelHelper::on_outgoing_connection_fail,
- bluetooth::common::Unretained(this)),
- bluetooth::shim::GetGdShimHandler());
+ GetL2capLeModule()->GetDynamicChannelManager()->ConnectChannel(
+ device, {}, psm_,
+ bluetooth::common::Bind(&LeDynamicChannelHelper::on_channel_open,
+ bluetooth::common::Unretained(this)),
+ bluetooth::common::Bind(
+ &LeDynamicChannelHelper::on_outgoing_connection_fail,
+ bluetooth::common::Unretained(this)),
+ GetGdShimHandler());
}
void Disconnect(bluetooth::hci::AddressWithType device) {
channel_service_->Unregister(
bluetooth::common::BindOnce(&LeDynamicChannelHelper::on_unregistered,
bluetooth::common::Unretained(this)),
- bluetooth::shim::GetGdShimHandler());
+ GetGdShimHandler());
channel_service_ = nullptr;
}
}
if (channel_service_ == nullptr && channels_.empty()) {
// Try again
- bluetooth::shim::L2CA_DeregisterLECoc(psm_);
+ L2CA_DeregisterLECoc(psm_);
}
}
void on_channel_open(std::unique_ptr<le::DynamicChannel> channel) {
auto device = channel->GetDevice();
- channel->RegisterOnCloseCallback(
- bluetooth::shim::GetGdShimHandler()->BindOnceOn(
- this, &LeDynamicChannelHelper::on_channel_close, device));
+ channel->RegisterOnCloseCallback(GetGdShimHandler()->BindOnceOn(
+ this, &LeDynamicChannelHelper::on_channel_close, device));
channel_enqueue_buffer_[device] = std::make_unique<
bluetooth::os::EnqueueBuffer<bluetooth::packet::BasePacketBuilder>>(
channel->GetQueueUpEnd());
channel->GetQueueUpEnd()->RegisterDequeue(
- bluetooth::shim::GetGdShimHandler(),
+ GetGdShimHandler(),
bluetooth::common::Bind(&LeDynamicChannelHelper::on_incoming_data,
bluetooth::common::Unretained(this), device));
channels_[device] = std::move(channel);
LOG(ERROR) << "Channel is not open";
return false;
}
- buffer->second->Enqueue(std::move(packet),
- bluetooth::shim::GetGdShimHandler());
+ buffer->second->Enqueue(std::move(packet), GetGdShimHandler());
return true;
}
std::unordered_map<uint16_t, std::unique_ptr<LeDynamicChannelHelper>>
le_dynamic_channel_helper_map_;
+std::unordered_set<uint16_t> assigned_dynamic_le_psm_;
+uint16_t next_assigned_dynamic_le_psm_ = 0x80;
+} // namespace
+
/**
* Le Connection Oriented Channel APIs
*/
-static std::unordered_set<uint16_t> assigned_dynamic_le_psm_;
-static uint16_t next_assigned_dynamic_le_psm_ = 0x80;
-
-uint16_t bluetooth::shim::L2CA_AllocateLePSM() {
+uint16_t L2CA_AllocateLePSM() {
if (le_dynamic_channel_helper_map_.size() > 100) {
LOG_ERROR("Why do we need more than 100 dynamic channel PSMs?");
return 0;
return next_assigned_dynamic_le_psm_;
}
-void bluetooth::shim::L2CA_FreeLePSM(uint16_t psm) {
- assigned_dynamic_le_psm_.erase(psm);
-}
+void L2CA_FreeLePSM(uint16_t psm) { assigned_dynamic_le_psm_.erase(psm); }
-uint16_t bluetooth::shim::L2CA_RegisterLECoc(uint16_t psm,
- const tL2CAP_APPL_INFO& callbacks,
- uint16_t sec_level) {
+uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& callbacks,
+ uint16_t sec_level) {
if (le_dynamic_channel_helper_map_.count(psm) != 0) {
LOG(ERROR) << __func__ << "Already registered psm: " << psm;
return 0;
return psm;
}
-void bluetooth::shim::L2CA_DeregisterLECoc(uint16_t psm) {
+void L2CA_DeregisterLECoc(uint16_t psm) {
if (le_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return;
}
}
-uint16_t bluetooth::shim::L2CA_ConnectLECocReq(uint16_t psm,
- const RawAddress& p_bd_addr,
- tL2CAP_LE_CFG_INFO* p_cfg) {
+uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
+ tL2CAP_LE_CFG_INFO* p_cfg) {
if (le_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return 0;
return add_le_cid_token_entry(psm, p_bd_addr);
}
-bool bluetooth::shim::L2CA_GetPeerLECocConfig(uint16_t cid,
- tL2CAP_LE_CFG_INFO* peer_cfg) {
+bool L2CA_GetPeerLECocConfig(uint16_t cid, tL2CAP_LE_CFG_INFO* peer_cfg) {
if (le_cid_token_to_channel_map_.count(cid) == 0) {
LOG(ERROR) << __func__ << "Invalid cid: " << cid;
return false;
return mtu;
}
-bool bluetooth::shim::L2CA_DisconnectLECocReq(uint16_t cid) {
+bool L2CA_DisconnectLECocReq(uint16_t cid) {
if (le_cid_token_to_channel_map_.count(cid) == 0) {
LOG(ERROR) << __func__ << "Invalid cid: " << cid;
return false;
return true;
}
-uint8_t bluetooth::shim::L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
+uint8_t L2CA_LECocDataWrite(uint16_t cid, BT_HDR* p_data) {
if (le_cid_token_to_channel_map_.count(cid) == 0) {
LOG(ERROR) << __func__ << "Invalid cid: " << cid;
return 0;
len;
}
-void bluetooth::shim::L2CA_SwitchRoleToCentral(const RawAddress& addr) {
- bluetooth::shim::GetAclManager()->SwitchRole(ToGdAddress(addr),
- bluetooth::hci::Role::CENTRAL);
+void L2CA_SwitchRoleToCentral(const RawAddress& addr) {
+ GetAclManager()->SwitchRole(ToGdAddress(addr), bluetooth::hci::Role::CENTRAL);
}
+
+} // namespace shim
+} // namespace bluetooth