Remove unused methods.

PiperOrigin-RevId: 756053350
This commit is contained in:
Francis Tsui
2025-05-07 16:36:04 -07:00
committed by Copybara-Service
parent 4beed5b72a
commit 59e527dbe3
17 changed files with 57 additions and 263 deletions
+1 -1
View File
@@ -1382,7 +1382,7 @@ bool BleV2::StartAsyncScanningLocked(absl::string_view service_id,
[this](api::ble_v2::BlePeripheral& peripheral,
BleAdvertisementData advertisement_data) {
AssumeHeld(mutex_);
BleV2Peripheral proxy(medium_, peripheral);
BleV2Peripheral proxy(medium_, peripheral.GetUniqueId());
RunOnBleThread([this, proxy = std::move(proxy),
advertisement_data]() {
MutexLock lock(&mutex_);
@@ -132,6 +132,7 @@ cc_test(
"//internal/flags:nearby_flags",
"//internal/platform:base",
"//internal/platform:comm",
"//internal/platform:mac_address",
"//internal/platform:test_util",
"//internal/platform:types",
"//internal/platform:uuid",
@@ -143,7 +143,7 @@ void DiscoveredPeripheralTracker::ProcessFoundBleAdvertisement(
return;
}
if (HandleOnLostAdvertisementLocked(peripheral, advertisement_data)) {
if (HandleOnLostAdvertisementLocked(advertisement_data)) {
return;
}
@@ -181,7 +181,6 @@ void DiscoveredPeripheralTracker::ProcessFoundBleAdvertisement(
}
bool DiscoveredPeripheralTracker::HandleOnLostAdvertisementLocked(
BleV2Peripheral peripheral,
const BleAdvertisementData& advertisement_data) {
auto service_data =
advertisement_data.service_data.find(bleutils::kCopresenceServiceUuid);
@@ -268,7 +268,6 @@ class DiscoveredPeripheralTracker {
// 2. Matches a peripheral's advertisement hash that has previously been
// discovered.
bool HandleOnLostAdvertisementLocked(
BleV2Peripheral peripheral,
const ::nearby::api::ble_v2::BleAdvertisementData& advertisement_data)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
@@ -15,6 +15,7 @@
#include "connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h"
#include <atomic>
#include <list>
#include <memory>
#include <string>
#include <vector>
@@ -44,6 +45,7 @@
#include "internal/platform/count_down_latch.h"
#include "internal/platform/feature_flags.h"
#include "internal/platform/implementation/ble_v2.h"
#include "internal/platform/mac_address.h"
#include "internal/platform/medium_environment.h"
#include "internal/platform/mutex.h"
#include "internal/platform/mutex_lock.h"
@@ -186,8 +188,15 @@ class DiscoveredPeripheralTrackerTest : public testing::TestWithParam<bool> {
}
BleV2Peripheral CreateBlePeripheral() {
return ble_central_->GetRemotePeripheral(
adapter_peripheral_->GetMacAddress());
MacAddress mac_address;
MacAddress::FromString(adapter_peripheral_->GetMacAddress(), mac_address);
api::ble_v2::BlePeripheral api_peripheral;
ble_central_->GetImpl()->GetRemotePeripheral(
mac_address.address(),
[&api_peripheral](api::ble_v2::BlePeripheral& peripheral) {
api_peripheral = peripheral;
});
return BleV2Peripheral(*ble_central_, api_peripheral.GetUniqueId());
}
// Simulates to see a fast advertisement.
@@ -113,9 +113,8 @@ TEST_P(BleV2Test, CanConnect) {
bool fast_advertisement) {
discovered_peripheral = peripheral;
NEARBY_LOGS(INFO)
<< "Discovered peripheral="
<< peripheral.GetAddress().value_or("")
<< ", fast advertisement=" << fast_advertisement;
<< "Discovered peripheral, fast advertisement="
<< fast_advertisement;
discovered_latch.CountDown();
},
});
@@ -174,9 +173,8 @@ TEST_P(BleV2Test, CanCancelConnect) {
bool fast_advertisement) {
discovered_peripheral = peripheral;
NEARBY_LOGS(INFO)
<< "Discovered peripheral="
<< peripheral.GetAddress().value_or("")
<< ", fast advertisement=" << fast_advertisement;
<< "Discovered peripheral, fast advertisement="
<< fast_advertisement;
discovered_latch.CountDown();
},
});
+2 -1
View File
@@ -494,11 +494,12 @@ cc_test(
":cancellation_flag",
":comm",
":connection_info",
":mac_address",
":test_util",
":types",
":uuid",
"//connections/implementation/flags:connections_flags",
"//internal/flags:nearby_flags",
"//internal/platform:uuid",
"//internal/platform/implementation:comm",
"//internal/platform/implementation/g3", # build_cleaner: keep
"//proto:connections_enums_cc_proto",
+3 -22
View File
@@ -21,7 +21,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/status/status.h"
#include "absl/types/optional.h"
#include "absl/strings/string_view.h"
#include "internal/platform/cancellation_flag.h"
#include "internal/platform/implementation/ble_v2.h"
#include "internal/platform/logging.h"
@@ -78,7 +78,7 @@ bool BleV2Medium::StartScanning(const Uuid& service_uuid,
peripherals_.insert(&peripheral);
}
BleV2Peripheral proxy(*this, peripheral);
BleV2Peripheral proxy(*this, peripheral.GetUniqueId());
if (!scanning_enabled_) return;
scan_callback_.advertisement_found_cb(std::move(proxy),
advertisement_data);
@@ -119,7 +119,7 @@ bool BleV2Medium::StartMultipleServicesScanning(
peripherals_.insert(&peripheral);
}
BleV2Peripheral proxy(*this, peripheral);
BleV2Peripheral proxy(*this, peripheral.GetUniqueId());
if (!scanning_enabled_) return;
scan_callback_.advertisement_found_cb(std::move(proxy),
advertisement_data);
@@ -302,25 +302,6 @@ bool BleV2Medium::IsExtendedAdvertisementsAvailable() {
return IsValid() && impl_->IsExtendedAdvertisementsAvailable();
}
BleV2Peripheral BleV2Medium::GetRemotePeripheral(
const std::string& mac_address) {
BleV2Peripheral peripheral;
impl_->GetRemotePeripheral(mac_address,
[&](api::ble_v2::BlePeripheral& device) {
peripheral = BleV2Peripheral(*this, device);
});
return peripheral;
}
absl::optional<std::string> BleV2Peripheral::GetAddress() const {
absl::optional<std::string> address;
api::ble_v2::BlePeripheral* device = GetImpl();
if (device != nullptr) {
address = device->GetAddress();
};
return address;
}
bool BleV2Peripheral::IsValid() const {
return GetImpl() != nullptr;
}
+9 -13
View File
@@ -52,16 +52,15 @@ class BleV2Medium;
class BleV2Peripheral final {
public:
BleV2Peripheral() = default;
BleV2Peripheral(BleV2Medium& medium, api::ble_v2::BlePeripheral& impl)
: medium_(&medium), unique_id_(impl.GetUniqueId()) {}
BleV2Peripheral(BleV2Medium& medium,
api::ble_v2::BlePeripheral::UniqueId unique_id)
: medium_(&medium), unique_id_(unique_id) {}
BleV2Peripheral(const BleV2Peripheral&) = default;
BleV2Peripheral& operator=(const BleV2Peripheral&) = default;
BleV2Peripheral(BleV2Peripheral&& other) = default;
BleV2Peripheral& operator=(BleV2Peripheral&& other) = default;
// NOLINTNEXTLINE(google3-legacy-absl-backports)
absl::optional<std::string> GetAddress() const;
ByteArray GetId() const { return id_; }
void SetId(const ByteArray& id) { id_ = id; }
@@ -192,9 +191,11 @@ class BleV2ServerSocket final {
if (socket == nullptr) {
LOG(INFO) << "BleServerSocket Accept() failed on server socket: " << this;
} else {
auto* platform_peripheral = socket->GetRemotePeripheral();
api::ble_v2::BlePeripheral* platform_peripheral =
socket->GetRemotePeripheral();
if (platform_peripheral != nullptr) {
peripheral = BleV2Peripheral(*medium_, *platform_peripheral);
peripheral =
BleV2Peripheral(*medium_, platform_peripheral->GetUniqueId());
}
}
return BleV2Socket(peripheral, std::move(socket));
@@ -219,7 +220,6 @@ class BleV2ServerSocket final {
//
// Note that some of the methods return absl::optional instead
// of std::optional, because iOS platform is still in C++14.
// LINT.IfChange
class GattServer final {
public:
GattServer(BleV2Medium& medium,
@@ -266,7 +266,6 @@ class GattServer final {
BleV2Medium& medium_;
std::unique_ptr<api::ble_v2::GattServer> impl_;
};
// LINT.ThenChange(//depot/google3/third_party/nearby/internal/platform/implementation/ble_v2.h)
// Opaque wrapper for a GattClient.
//
@@ -427,7 +426,8 @@ class BleL2capServerSocket final {
api::ble_v2::BlePeripheral* platform_peripheral =
socket->GetRemotePeripheral();
if (platform_peripheral != nullptr) {
peripheral = BleV2Peripheral(*medium_, *platform_peripheral);
peripheral =
BleV2Peripheral(*medium_, platform_peripheral->GetUniqueId());
}
}
return BleL2capSocket(peripheral, std::move(socket));
@@ -582,10 +582,6 @@ class BleV2Medium final {
bool IsValid() const { return impl_ != nullptr; }
// Returns a `BleV2Peripheral` with given mac address. `mac_address` is in
// canonical format.
BleV2Peripheral GetRemotePeripheral(const std::string& mac_address);
api::ble_v2::BleMedium* GetImpl() const { return impl_.get(); }
BluetoothAdapter& GetAdapter() { return adapter_; }
void AddAlternateUuidForService(uint16_t uuid,
+24 -136
View File
@@ -32,6 +32,7 @@
#include "internal/platform/count_down_latch.h"
#include "internal/platform/feature_flags.h"
#include "internal/platform/implementation/ble_v2.h"
#include "internal/platform/mac_address.h"
#include "internal/platform/medium_environment.h"
#include "internal/platform/single_thread_executor.h"
#include "internal/platform/uuid.h"
@@ -625,11 +626,11 @@ TEST_F(BleV2MediumTest, GattClientConnectToGattServerWorks) {
gatt_server->UpdateCharacteristic(*server_characteristic, server_value));
// Start GattClient
BleV2Peripheral ble_peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
std::unique_ptr<GattClient> gatt_client =
ble_b.ConnectToGattServer(BleV2Peripheral(ble_peripheral), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
MacAddress mac_address;
EXPECT_TRUE(MacAddress::FromString(adapter_a.GetMacAddress(), mac_address));
std::unique_ptr<GattClient> gatt_client = ble_b.ConnectToGattServer(
BleV2Peripheral(ble_b, mac_address.address()), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
ASSERT_NE(gatt_client, nullptr);
@@ -660,13 +661,13 @@ TEST_F(BleV2MediumTest, GattClientConnectToStoppedGattServerFails) {
std::unique_ptr<GattServer> gatt_server =
ble_a.StartGattServer(/*ServerGattConnectionCallback=*/{});
ASSERT_NE(gatt_server, nullptr);
BleV2Peripheral ble_peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
MacAddress mac_address;
EXPECT_TRUE(MacAddress::FromString(adapter_a.GetMacAddress(), mac_address));
gatt_server->Stop();
std::unique_ptr<GattClient> gatt_client =
ble_b.ConnectToGattServer(BleV2Peripheral(ble_peripheral), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
std::unique_ptr<GattClient> gatt_client = ble_b.ConnectToGattServer(
BleV2Peripheral(ble_b, mac_address.address()), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
ASSERT_NE(gatt_client, nullptr);
EXPECT_FALSE(gatt_client->IsValid());
@@ -684,10 +685,10 @@ TEST_F(BleV2MediumTest, GattClientNotifiedWhenServerDisconnects) {
ASSERT_NE(gatt_server, nullptr);
CountDownLatch disconnected_latch(1);
// Start GattClient
BleV2Peripheral ble_peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
MacAddress mac_address;
EXPECT_TRUE(MacAddress::FromString(adapter_a.GetMacAddress(), mac_address));
std::unique_ptr<GattClient> gatt_client = ble_b.ConnectToGattServer(
BleV2Peripheral(ble_peripheral), kTxPowerLevel,
BleV2Peripheral(ble_b, mac_address.address()), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{.disconnected_cb = [&]() {
disconnected_latch.CountDown();
}});
@@ -723,12 +724,11 @@ TEST_F(BleV2MediumTest, GattClientOperatiosOnCharacteristic) {
ASSERT_NE(gatt_server, nullptr);
// Start GattClient.
BleV2Peripheral ble_peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
ASSERT_TRUE(ble_peripheral.IsValid());
std::unique_ptr<GattClient> gatt_client =
ble_b.ConnectToGattServer(BleV2Peripheral(ble_peripheral), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
MacAddress mac_address;
EXPECT_TRUE(MacAddress::FromString(adapter_a.GetMacAddress(), mac_address));
std::unique_ptr<GattClient> gatt_client = ble_b.ConnectToGattServer(
BleV2Peripheral(ble_b, mac_address.address()), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
ASSERT_NE(gatt_client, nullptr);
// Can't not discover service and characteristic.
@@ -806,12 +806,11 @@ TEST_F(BleV2MediumTest, GattClientSubscribeNotificationGattServerCanNotify) {
ByteArray("any")));
// Start GattClient
BleV2Peripheral ble_peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
ASSERT_TRUE(ble_peripheral.IsValid());
std::unique_ptr<GattClient> gatt_client =
ble_b.ConnectToGattServer(BleV2Peripheral(ble_peripheral), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
MacAddress mac_address;
EXPECT_TRUE(MacAddress::FromString(adapter_a.GetMacAddress(), mac_address));
std::unique_ptr<GattClient> gatt_client = ble_b.ConnectToGattServer(
BleV2Peripheral(ble_b, mac_address.address()), kTxPowerLevel,
/*ClientGattConnectionCallback=*/{});
ASSERT_NE(gatt_client, nullptr);
EXPECT_TRUE(gatt_client->DiscoverServiceAndCharacteristics(
@@ -858,116 +857,5 @@ TEST_F(BleV2MediumTest, GattClientSubscribeNotificationGattServerCanNotify) {
env_.Stop();
}
TEST(BleV2PeripheralTest, ConstructionWorks) {
MediumEnvironment::Instance().Start();
BluetoothAdapter adapter_a;
BluetoothAdapter adapter_b;
BleV2Medium ble_a(adapter_a);
BleV2Medium ble_b(adapter_b);
BleV2Peripheral peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
ASSERT_TRUE(peripheral.IsValid());
EXPECT_EQ(peripheral.GetAddress(), adapter_a.GetMacAddress());
MediumEnvironment::Instance().Stop();
}
TEST(BleV2PeripheralTest, SetIdAndPsmWorks) {
MediumEnvironment::Instance().Start();
BluetoothAdapter adapter_a;
BluetoothAdapter adapter_b;
BleV2Medium ble_a(adapter_a);
BleV2Medium ble_b(adapter_b);
ByteArray id((std::string(kId)));
int psm = 2;
BleV2Peripheral peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
peripheral.SetId(id);
peripheral.SetPsm(psm);
ASSERT_TRUE(peripheral.IsValid());
EXPECT_EQ(peripheral.GetId(), id);
EXPECT_EQ(peripheral.GetPsm(), 2);
MediumEnvironment::Instance().Stop();
}
TEST(BleV2PeripheralTest, CopyConstructorAndAssignmentSuccess) {
MediumEnvironment::Instance().Start();
BluetoothAdapter adapter_a;
BluetoothAdapter adapter_b;
BleV2Medium ble_a(adapter_a);
BleV2Medium ble_b(adapter_b);
ByteArray id((std::string(kId)));
int psm = 2;
BleV2Peripheral peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
peripheral.SetId(id);
peripheral.SetPsm(psm);
BleV2Peripheral copy_peripheral_1(peripheral);
ASSERT_TRUE(copy_peripheral_1.IsValid());
EXPECT_EQ(copy_peripheral_1.GetAddress(), adapter_a.GetMacAddress());
EXPECT_EQ(copy_peripheral_1.GetId(), id);
EXPECT_EQ(copy_peripheral_1.GetPsm(), 2);
BleV2Peripheral copy_periphera1_2 = peripheral;
ASSERT_TRUE(copy_periphera1_2.IsValid());
EXPECT_EQ(copy_periphera1_2.GetAddress(), adapter_a.GetMacAddress());
EXPECT_EQ(copy_periphera1_2.GetId(), id);
EXPECT_EQ(copy_periphera1_2.GetPsm(), 2);
MediumEnvironment::Instance().Stop();
}
TEST(BleV2PeripheralTest, MoveConstructorSuccess) {
MediumEnvironment::Instance().Start();
BluetoothAdapter adapter_a;
BluetoothAdapter adapter_b;
BleV2Medium ble_a(adapter_a);
BleV2Medium ble_b(adapter_b);
ByteArray id((std::string(kId)));
int psm = 2;
BleV2Peripheral peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
peripheral.SetId(id);
peripheral.SetPsm(psm);
BleV2Peripheral move_peripheral(std::move(peripheral));
ASSERT_TRUE(move_peripheral.IsValid());
EXPECT_EQ(move_peripheral.GetAddress(), adapter_a.GetMacAddress());
EXPECT_EQ(move_peripheral.GetId(), id);
EXPECT_EQ(move_peripheral.GetPsm(), 2);
MediumEnvironment::Instance().Stop();
}
TEST(BleV2PeripheralTest, MoveAssignmentSuccess) {
MediumEnvironment::Instance().Start();
BluetoothAdapter adapter_a;
BluetoothAdapter adapter_b;
BleV2Medium ble_a(adapter_a);
BleV2Medium ble_b(adapter_b);
ByteArray id((std::string(kId)));
int psm = 2;
BleV2Peripheral peripheral =
ble_b.GetRemotePeripheral(adapter_a.GetMacAddress());
peripheral.SetId(id);
peripheral.SetPsm(psm);
BleV2Peripheral move_peripheral = std::move(peripheral);
ASSERT_TRUE(move_peripheral.IsValid());
EXPECT_EQ(move_peripheral.GetAddress(), adapter_a.GetMacAddress());
EXPECT_EQ(move_peripheral.GetId(), id);
EXPECT_EQ(move_peripheral.GetPsm(), 2);
MediumEnvironment::Instance().Stop();
}
} // namespace
} // namespace nearby
@@ -164,12 +164,6 @@ class BleMedium : public api::ble_v2::BleMedium {
// This is currently always false for all Apple hardware.
bool IsExtendedAdvertisementsAvailable() override;
// A peripheral cannot be retreived via MAC address on Apple platforms.
//
// This always returns false and does not call the callback.
bool GetRemotePeripheral(const std::string &mac_address,
api::ble_v2::BleMedium::GetRemotePeripheralCallback callback) override;
// Returns true if `id` refers to a known BLE peripheral and calls `callback` with a reference to
// said peripheral that is only guaranteed to be available for the duration of the callback.
// Otherwise, does not call the callback and returns false.
@@ -536,13 +536,6 @@ bool BleMedium::IsExtendedAdvertisementsAvailable() {
return [medium_ supportsExtendedAdvertisements];
}
bool BleMedium::GetRemotePeripheral(const std::string &mac_address,
api::ble_v2::BleMedium::GetRemotePeripheralCallback callback) {
// Apple does not expose MAC address information, so we cannot retreive a peripheral via MAC
// address.
return false;
}
bool BleMedium::GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId unique_id,
api::ble_v2::BleMedium::GetRemotePeripheralCallback callback) {
// If the unique_id is 0, that means it's the local/empty peripheral. We must return "true"
+1 -9
View File
@@ -117,7 +117,7 @@ class BlePeripheral {
void* GetPlatformData() const { return platform_data_; }
bool IsSet() const { return unique_id_ != 0 || address_.IsSet(); }
bool IsSet() const { return GetUniqueId() != 0 || !GetAddress().empty(); }
private:
UniqueId unique_id_ = 0;
@@ -623,14 +623,6 @@ class BleMedium {
// Requests if support extended advertisement.
virtual bool IsExtendedAdvertisementsAvailable() = 0;
// Calls `callback` and returns true if `mac_address` is a valid BLE address.
// Otherwise, does not call the callback and returns false.
//
// This method is not available on Apple platforms and will always return
// false, ignoring the callback.
virtual bool GetRemotePeripheral(const std::string& mac_address,
GetRemotePeripheralCallback callback) = 0;
// Calls `callback` and returns true if `id` refers to a known BLE peripheral.
// Otherwise, does not call the callback and returns false.
virtual bool GetRemotePeripheral(BlePeripheral::UniqueId id,
@@ -349,36 +349,6 @@ bool BleV2Medium::IsExtendedAdvertisementsAvailable() {
return is_extended_advertisements_available_;
}
bool BleV2Medium::GetRemotePeripheral(const std::string& mac_address,
GetRemotePeripheralCallback callback) {
NEARBY_LOGS(INFO) << "GetRemotePeripheral, address= " << mac_address;
absl::MutexLock lock(&mutex_);
for (auto& item : remote_peripherals_) {
auto* peripheral = item.second.get();
if (peripheral->GetAddress() == mac_address) {
callback(*peripheral);
return true;
}
}
BleV2Medium* remote_medium = dynamic_cast<BleV2Medium*>(
MediumEnvironment::Instance().FindBleV2Medium(mac_address));
if (remote_medium == nullptr) {
return false;
}
api::ble_v2::BlePeripheral::UniqueId id =
remote_medium->GetPeripheral().GetUniqueId();
BluetoothAdapter& adapter = remote_medium->GetAdapter();
MacAddress address;
if (!MacAddress::FromString(adapter.GetMacAddress(), address)) {
return false;
}
remote_peripherals_[id] =
std::make_unique<api::ble_v2::BlePeripheral>(id, address);
remote_peripherals_[id]->SetPlatformData(&adapter);
callback(*remote_peripherals_[id]);
return true;
}
bool BleV2Medium::GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id,
GetRemotePeripheralCallback callback) {
absl::MutexLock lock(&mutex_);
@@ -194,9 +194,6 @@ class BleV2Medium : public api::ble_v2::BleMedium {
api::ble_v2::BlePeripheral& GetPeripheral() { return peripheral_; }
bool GetRemotePeripheral(const std::string& mac_address,
GetRemotePeripheralCallback callback) override;
bool GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id,
GetRemotePeripheralCallback callback) override;
@@ -1299,26 +1299,6 @@ void BleV2Medium::AdvertisementFoundHandler(
}
}
bool BleV2Medium::GetRemotePeripheral(const std::string& mac_address,
GetRemotePeripheralCallback callback) {
MacAddress bluetooth_address;
if (!MacAddress::FromString(mac_address, bluetooth_address)) {
LOG(WARNING) << __func__ << ": Invalid MAC address: " << mac_address;
return false;
}
api::ble_v2::BlePeripheral* peripheral = nullptr;
{
absl::MutexLock lock(&mutex_);
peripheral = GetOrCreatePeripheral(bluetooth_address);
}
if (peripheral != nullptr && peripheral->IsSet()) {
callback(*peripheral);
return true;
}
return false;
}
bool BleV2Medium::GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id,
GetRemotePeripheralCallback callback) {
MacAddress bluetooth_address;
@@ -80,10 +80,6 @@ class BleV2Medium : public api::ble_v2::BleMedium {
CancellationFlag* cancellation_flag) override ABSL_LOCKS_EXCLUDED(mutex_);
bool IsExtendedAdvertisementsAvailable() override;
bool GetRemotePeripheral(const std::string& mac_address,
GetRemotePeripheralCallback callback) override
ABSL_LOCKS_EXCLUDED(mutex_);
bool GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id,
GetRemotePeripheralCallback callback) override
ABSL_LOCKS_EXCLUDED(mutex_);