Enhance on Bluetooth discovery check

PiperOrigin-RevId: 691947459
This commit is contained in:
Guogang Li
2024-10-31 15:05:16 -07:00
committed by Copybara-Service
parent 7f7dee54c0
commit f391af8e47
7 changed files with 45 additions and 19 deletions
@@ -191,6 +191,7 @@ bool BluetoothClassicMedium::StopDiscovery() {
if (IsWatcherStarted()) {
result = StopScanning();
discovery_callback_ = {};
}
return result;
@@ -659,8 +660,10 @@ winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Updated(
LOG(INFO) << "Updated device name:"
<< mac_address_to_bluetooth_device_map_[mac_address]->GetName();
discovery_callback_.device_name_changed_cb(
*mac_address_to_bluetooth_device_map_[mac_address]);
if (discovery_callback_.device_name_changed_cb != nullptr) {
discovery_callback_.device_name_changed_cb(
*mac_address_to_bluetooth_device_map_[mac_address]);
}
}
}