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

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: Improve comments 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
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device.cc
diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc
index bac4b638a4839a3697f52ab2df3d9ecd7c1b2065..6f61faec6904e0c89360b80cf2895f79bbc6368a 100644
--- a/device/bluetooth/bluetooth_device.cc
+++ b/device/bluetooth/bluetooth_device.cc
@@ -243,6 +243,22 @@ bool BluetoothDevice::IsTrustable() const {
return false;
}
+BluetoothDevice::UUIDList BluetoothDevice::GetUUIDs() const {
+ if (!IsGattConnected()) {
+ DCHECK(service_uuids_.empty());
+ return advertised_uuids_;
+ }
+
+ if (IsGattServicesDiscoveryComplete()) {
+ DCHECK(advertised_uuids_.empty());
+ return service_uuids_;
+ }
+
+ DCHECK(service_uuids_.empty());
+ DCHECK(advertised_uuids_.empty());
+ return BluetoothDevice::UUIDList();
+}
+
void BluetoothDevice::CreateGattConnection(
const GattConnectionCallback& callback,
const ConnectErrorCallback& error_callback) {
@@ -333,6 +349,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())));
@@ -379,6 +396,14 @@ void BluetoothDevice::RemoveGattConnection(
DisconnectGatt();
}
+void BluetoothDevice::UpdateServiceUUIDs() {
+ std::unordered_set<BluetoothUUID, BluetoothUUIDHash> uuid_set;
+ for (const auto& gatt_service_pair : gatt_services_) {
+ uuid_set.insert(gatt_service_pair.second->GetUUID());
+ }
+ service_uuids_ = UUIDList(uuid_set.begin(), uuid_set.end());
+}
+
void BluetoothDevice::ClearServiceData() { services_data_->Clear(); }
void BluetoothDevice::SetServiceData(BluetoothUUID serviceUUID,
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698