Change GetAddress() to GetMacAddress() in BluetoothAdapter

PiperOrigin-RevId: 834896610
This commit is contained in:
Crisrael Lucero
2025-11-20 13:49:49 -08:00
committed by Copybara-Service
parent 023db9bd33
commit dd943af8e9
20 changed files with 36 additions and 34 deletions
@@ -51,7 +51,7 @@ class MockBluetoothAdapter : public BluetoothAdapter {
MOCK_METHOD(bool, SetName, (absl::string_view name), (override));
MOCK_METHOD(bool, SetName, (absl::string_view name, bool persist),
(override));
MOCK_METHOD(MacAddress, GetAddress, (), (const, override));
MOCK_METHOD(MacAddress, GetMacAddress, (), (const, override));
};
} // namespace
@@ -821,7 +821,7 @@ BluetoothAdapter::GetGenericBluetoothAdapterInstanceID() const {
}
// Returns BT MAC address assigned to this adapter.
MacAddress BluetoothAdapter::GetAddress() const {
MacAddress BluetoothAdapter::GetMacAddress() const {
if (windows_bluetooth_adapter_ == nullptr) {
LOG(ERROR) << __func__ << ": No Bluetooth adapter on this device.";
return MacAddress();
@@ -83,7 +83,7 @@ class BluetoothAdapter : public api::BluetoothAdapter {
bool SetName(absl::string_view name, bool persist) override;
// Returns BT MAC address assigned to this adapter.
MacAddress GetAddress() const override;
MacAddress GetMacAddress() const override;
// Returns bluetooth device name from registry
std::string GetNameFromRegistry(PHKEY hKey) const;
@@ -144,9 +144,9 @@ TEST(BluetoothAdapter, DISABLED_SetName_Exceeded) {
EXPECT_EQ(bluetooth_adapter.GetName(), original_bluetooth_device_name);
}
TEST(BluetoothAdapter, DISABLED_GetAddress) {
TEST(BluetoothAdapter, DISABLED_GetMacAddress) {
BluetoothAdapter bluetooth_adapter;
EXPECT_TRUE(bluetooth_adapter.GetAddress().IsSet());
EXPECT_TRUE(bluetooth_adapter.GetMacAddress().IsSet());
}
TEST(BluetoothAdapter, DISABLED_SetOnScanModeChanged) {
@@ -72,7 +72,7 @@ BluetoothDevice::BluetoothDevice(
}
// Returns BT MAC address assigned to this device.
MacAddress BluetoothDevice::GetAddress() const { return mac_address_; }
MacAddress BluetoothDevice::GetMacAddress() const { return mac_address_; }
// Checks cache first, will check uncached if no result.
RfcommDeviceService BluetoothDevice::GetRfcommServiceForIdAsync(
@@ -70,7 +70,7 @@ class BluetoothDevice : public api::BluetoothDevice {
std::string GetName() const override { return name_; }
// Returns BT MAC address assigned to this device.
MacAddress GetAddress() const override;
MacAddress GetMacAddress() const override;
std::string GetId() { return id_; }
@@ -173,7 +173,7 @@ std::unique_ptr<api::BluetoothSocket> BluetoothClassicMedium::ConnectToService(
}
BluetoothDevice* remote_device_to_connect_ =
GetRemoteDeviceInternal(remote_device.GetAddress());
GetRemoteDeviceInternal(remote_device.GetMacAddress());
if (remote_device_to_connect_ == nullptr ||
remote_device_to_connect_->GetId().empty()) {
@@ -293,11 +293,11 @@ api::BluetoothDevice* BluetoothClassicMedium::GetRemoteDevice(
std::unique_ptr<api::BluetoothPairing> BluetoothClassicMedium::CreatePairing(
api::BluetoothDevice& remote_device) {
VLOG(1) << __func__ << ": Start to createPairing with device: "
<< remote_device.GetAddress().ToString();
<< remote_device.GetMacAddress().ToString();
try {
winrt::Windows::Devices::Bluetooth::BluetoothDevice bluetooth_device =
winrt::Windows::Devices::Bluetooth::BluetoothDevice::
FromBluetoothAddressAsync(remote_device.GetAddress().address())
FromBluetoothAddressAsync(remote_device.GetMacAddress().address())
.get();
winrt::Windows::Devices::Enumeration::DeviceInformationCustomPairing
custom_pairing =