mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Convert absl::string_view to const std::string&
PiperOrigin-RevId: 531634295
This commit is contained in:
committed by
Copybara-Service
parent
b9a4d98e25
commit
01c8e1ed05
@@ -48,7 +48,8 @@ std::unique_ptr<GattClient> BleV2::ConnectToGattServer(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BleV2Peripheral v2_peripheral = medium_.GetRemotePeripheral(ble_address);
|
||||
BleV2Peripheral v2_peripheral =
|
||||
medium_.GetRemotePeripheral(std::string(ble_address));
|
||||
return medium_.ConnectToGattServer(v2_peripheral,
|
||||
api::ble_v2::TxPowerLevel::kUnknown, {});
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ bool BleV2Medium::IsExtendedAdvertisementsAvailable() {
|
||||
}
|
||||
|
||||
BleV2Peripheral BleV2Medium::GetRemotePeripheral(
|
||||
absl::string_view mac_address) {
|
||||
const std::string& mac_address) {
|
||||
BleV2Peripheral peripheral;
|
||||
impl_->GetRemotePeripheral(mac_address,
|
||||
[&](api::ble_v2::BlePeripheral& device) {
|
||||
|
||||
@@ -444,7 +444,7 @@ class BleV2Medium final {
|
||||
|
||||
// Returns a `BleV2Peripheral` with given mac address. `mac_address` is in
|
||||
// canonical format.
|
||||
BleV2Peripheral GetRemotePeripheral(absl::string_view mac_address);
|
||||
BleV2Peripheral GetRemotePeripheral(const std::string& mac_address);
|
||||
|
||||
api::ble_v2::BleMedium* GetImpl() const { return impl_.get(); }
|
||||
BluetoothAdapter& GetAdapter() { return adapter_; }
|
||||
|
||||
@@ -145,7 +145,7 @@ class BleMedium : public api::ble_v2::BleMedium {
|
||||
CancellationFlag *cancellation_flag) override;
|
||||
bool IsExtendedAdvertisementsAvailable() override;
|
||||
|
||||
bool GetRemotePeripheral(absl::string_view mac_address,
|
||||
bool GetRemotePeripheral(const std::string& mac_address,
|
||||
GetRemotePeripheralCallback callback) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ class BleMedium {
|
||||
|
||||
// Calls `callback` and returns true if `mac_address` is a valid BLE address.
|
||||
// Otherwise, does not call the callback and returns false.
|
||||
virtual bool GetRemotePeripheral(absl::string_view mac_address,
|
||||
virtual bool GetRemotePeripheral(const std::string& mac_address,
|
||||
GetRemotePeripheralCallback callback) = 0;
|
||||
|
||||
// Calls `callback` and returns true if `id` refers to a known BLE peripheral.
|
||||
|
||||
@@ -378,7 +378,7 @@ bool BleV2Medium::IsExtendedAdvertisementsAvailable() {
|
||||
return is_support_extended_advertisement_;
|
||||
}
|
||||
|
||||
bool BleV2Medium::GetRemotePeripheral(absl::string_view mac_address,
|
||||
bool BleV2Medium::GetRemotePeripheral(const std::string& mac_address,
|
||||
GetRemotePeripheralCallback callback) {
|
||||
NEARBY_LOGS(INFO) << "GetRemotePeripheral, address= " << mac_address;
|
||||
absl::MutexLock lock(&mutex_);
|
||||
|
||||
@@ -221,7 +221,7 @@ class BleV2Medium : public api::ble_v2::BleMedium {
|
||||
|
||||
BleV2Peripheral& GetPeripheral() { return peripheral_; }
|
||||
|
||||
bool GetRemotePeripheral(absl::string_view mac_address,
|
||||
bool GetRemotePeripheral(const std::string& mac_address,
|
||||
GetRemotePeripheralCallback callback) override;
|
||||
|
||||
bool GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id,
|
||||
|
||||
@@ -843,7 +843,7 @@ void BleV2Medium::AdvertisementReceivedHandler(
|
||||
}
|
||||
}
|
||||
|
||||
bool BleV2Medium::GetRemotePeripheral(absl::string_view mac_address,
|
||||
bool BleV2Medium::GetRemotePeripheral(const std::string& mac_address,
|
||||
GetRemotePeripheralCallback callback) {
|
||||
for (auto& item : peripherals_) {
|
||||
if (item.second->GetAddress() == mac_address) {
|
||||
|
||||
@@ -71,7 +71,7 @@ class BleV2Medium : public api::ble_v2::BleMedium {
|
||||
CancellationFlag* cancellation_flag) override;
|
||||
bool IsExtendedAdvertisementsAvailable() override;
|
||||
|
||||
bool GetRemotePeripheral(absl::string_view mac_address,
|
||||
bool GetRemotePeripheral(const std::string& mac_address,
|
||||
GetRemotePeripheralCallback callback) override;
|
||||
|
||||
bool GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id,
|
||||
|
||||
Reference in New Issue
Block a user