Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: device/bluetooth/bluetooth_device.cc

Issue 2205693003: bluetooth: Replace old advertised uuids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Fix mac Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_device.cc
diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc
index bac4b638a4839a3697f52ab2df3d9ecd7c1b2065..9c55a577214b21ca61bbe5aec47cd0d127f1213d 100644
--- a/device/bluetooth/bluetooth_device.cc
+++ b/device/bluetooth/bluetooth_device.cc
@@ -243,6 +243,23 @@ bool BluetoothDevice::IsTrustable() const {
return false;
}
+BluetoothDevice::UUIDList BluetoothDevice::GetUUIDs() const {
+ if (!IsGattConnected()) {
+ return BluetoothDevice::UUIDList(advertised_uuids_.begin(),
+ advertised_uuids_.end());
+ }
+
+ if (IsGattServicesDiscoveryComplete()) {
+ std::unordered_set<BluetoothUUID, BluetoothUUIDHash> local_uuids;
+ for (const auto& gatt_service_pair : gatt_services_) {
+ local_uuids.insert(gatt_service_pair.second->GetUUID());
+ }
+ return BluetoothDevice::UUIDList(local_uuids.begin(), local_uuids.end());
+ }
+
+ return BluetoothDevice::UUIDList();
+}
+
void BluetoothDevice::CreateGattConnection(
const GattConnectionCallback& callback,
const ConnectErrorCallback& error_callback) {
@@ -333,6 +350,7 @@ BluetoothDevice::UUIDList BluetoothDevice::GetServiceDataUUIDs() const {
}
void BluetoothDevice::DidConnectGatt() {
+ advertised_uuids_.clear();
for (const auto& callback : create_gatt_connection_success_callbacks_) {
callback.Run(
base::WrapUnique(new BluetoothGattConnection(adapter_, GetAddress())));

Powered by Google App Engine
This is Rietveld 408576698