if (bluetooth::shim::is_gd_shim_enabled()) {
return L2CA_ConnectFixedChnl(L2CAP_ATT_CID, address);
}
- auto it = bgconn_dev.find(address);
- bool in_white_list = false;
+ bool in_white_list = false;
+ auto it = bgconn_dev.find(address);
if (it != bgconn_dev.end()) {
// app already trying to connect to this particular device
if (it->second.doing_direct_conn.count(app_id)) {
// are we already in the white list ?
if (anyone_connecting(it)) {
+ LOG_WARN("Background connection attempt already in progress app_id=%x",
+ app_id);
in_white_list = true;
}
}
if (!in_white_list) {
if (!BTM_WhiteListAdd(address)) {
// if we can't add to white list, turn parameters back to slow.
+ LOG_WARN("Unable to add le device to whitelist");
if (params_changed) BTM_SetLeConnectionModeToSlow();
return false;
}
return true;
}
-bool any_direct_connect_left() {
+static bool any_direct_connect_left() {
for (const auto& tmp : bgconn_dev) {
if (!tmp.second.doing_direct_conn.empty()) return true;
}
}
bool direct_connect_remove(uint8_t app_id, const RawAddress& address) {
- VLOG(2) << __func__ << ": "
- << "app_id: " << +app_id << ", address:" << address;
auto it = bgconn_dev.find(address);
- if (it == bgconn_dev.end()) return false;
+ if (it == bgconn_dev.end()) {
+ LOG_WARN("Unable to find background connection to remove");
+ return false;
+ }
auto app_it = it->second.doing_direct_conn.find(app_id);
- if (app_it == it->second.doing_direct_conn.end()) return false;
+ if (app_it == it->second.doing_direct_conn.end()) {
+ LOG_WARN("Unable to find direct connection to remove");
+ return false;
+ }
// this will free the alarm
it->second.doing_direct_conn.erase(app_it);
BTM_SetLeConnectionModeToSlow();
}
- if (anyone_connecting(it)) return true;
+ if (anyone_connecting(it)) {
+ return true;
+ }
// no more apps interested - remove from whitelist
BTM_WhiteListRemove(address);