/**
* Invoked when an ACL link is connected.
*/
- virtual void OnLinkConnected(hci::AddressWithType remote, uint16_t handle) {}
+ virtual void OnLinkConnected(hci::AddressWithType remote, uint16_t handle, hci::Role my_role) {}
/**
* Invoked when an ACL link is disconnected.
struct LeLinkPropertyListenerShim
: public bluetooth::l2cap::le::LinkPropertyListener {
std::unordered_map<hci::AddressWithType, uint16_t> address_to_handle_;
+ std::unordered_map<hci::AddressWithType, hci::Role> address_to_role_;
- void OnLinkConnected(hci::AddressWithType remote, uint16_t handle) override {
+ void OnLinkConnected(hci::AddressWithType remote, uint16_t handle,
+ hci::Role role) override {
address_to_handle_[remote] = handle;
+ address_to_role_[remote] = role;
}
void OnLinkDisconnected(hci::AddressWithType remote) override {
return false;
}
+hci_role_t L2CA_GetBleConnRole(const RawAddress& bd_addr) {
+ auto remote = ToAddressWithType(bd_addr, Btm::GetAddressType(bd_addr));
+ if (le_link_property_listener_shim_.address_to_role_.count(remote) == 0) {
+ return HCI_ROLE_UNKNOWN;
+ }
+ return static_cast<hci_role_t>(
+ le_link_property_listener_shim_.address_to_role_[remote]);
+}
+
void L2CA_ConnectForSecurity(const RawAddress& bd_addr) {
security_interface_->InitiateConnectionForSecurity(
bluetooth::ToGdAddress(bd_addr));
bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda);
uint16_t L2CA_GetLeHandle(uint16_t cid, const RawAddress& rem_bda);
+hci_role_t L2CA_GetBleConnRole(const RawAddress& bd_addr);
void L2CA_LeConnectionUpdate(const RawAddress& rem_bda, uint16_t min_int,
uint16_t max_int, uint16_t latency,
}
hci_role_t L2CA_GetBleConnRole(const RawAddress& bd_addr) {
+ if (bluetooth::shim::is_gd_l2cap_enabled()) {
+ return bluetooth::shim::L2CA_GetBleConnRole(bd_addr);
+ }
+
tL2C_LCB* p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_LE);
if (p_lcb == nullptr) {
return HCI_ROLE_UNKNOWN;