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

Unified Diff: device/bluetooth/bluez/bluetooth_device_bluez.h

Issue 2105423003: bluetooth: Update the map of GATT services when services resolve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Address luiz's comments Created 4 years, 5 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/bluez/bluetooth_device_bluez.h
diff --git a/device/bluetooth/bluez/bluetooth_device_bluez.h b/device/bluetooth/bluez/bluetooth_device_bluez.h
index 41d67aaad8b74ead2243089771bd569090e17f4f..d6e396285b0d83b04031f93a70280c010ae2cbad 100644
--- a/device/bluetooth/bluez/bluetooth_device_bluez.h
+++ b/device/bluetooth/bluez/bluetooth_device_bluez.h
@@ -19,7 +19,6 @@
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/bluez/bluetooth_service_record_bluez.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
namespace device {
@@ -40,7 +39,6 @@ class BluetoothPairingBlueZ;
// thread.
class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
: public device::BluetoothDevice,
- public bluez::BluetoothDeviceClient::Observer,
public bluez::BluetoothGattServiceClient::Observer {
public:
using GetServiceRecordsCallback =
@@ -139,18 +137,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
scoped_refptr<device::BluetoothSocketThread> socket_thread);
~BluetoothDeviceBlueZ() override;
- // bluez::BluetoothDeviceClient::Observer overrides
- void DevicePropertyChanged(const dbus::ObjectPath& object_path,
- const std::string& property_name) override;
-
// bluez::BluetoothGattServiceClient::Observer overrides
void GattServiceAdded(const dbus::ObjectPath& object_path) override;
void GattServiceRemoved(const dbus::ObjectPath& object_path) override;
- // Called by the constructor to initialize the map of GATT services associated
- // with this device and to invoke NotifyGattDiscoveryComplete() with each
- // cached service.
- void InitializeGattServiceMap();
+ // Called once all services have been discovered. Invokes
+ // NotifyGattDiscoveryComplete() for services for which we haven't notified
+ // before e.g. if a services is exposed during construction but services
+ // haven't been resolved yet..
+ void UpdateGattServices(const dbus::ObjectPath& object_path);
// Called by dbus:: on completion of the D-Bus method call to get the
// connection attributes of the current connection to the device.
@@ -232,16 +227,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
// RSSI and TX power.
bool connection_monitor_started_;
+ // Keeps track of all services for which we've called
+ // NotifyGattDiscoveryComplete().
+ std::unordered_set<device::BluetoothRemoteGattService*>
+ discovery_complete_notified_;
+
// UI thread task runner and socket thread object used to create sockets.
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
scoped_refptr<device::BluetoothSocketThread> socket_thread_;
- // This vector temporarily caches the newly added services for later
- // notification of discovery complete. Once DevicePropertyChange is invoked
- // with a toggle of ServicesResolved property, the
- // NotifyGattDiscoveryComplete() will be called with each service once.
- std::vector<device::BluetoothRemoteGattService*>
- newly_discovered_gatt_services_;
// During pairing this is set to an object that we don't own, but on which
// we can make method calls to request, display or confirm PIN Codes and

Powered by Google App Engine
This is Rietveld 408576698