Chromium Code Reviews| Index: device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h |
| diff --git a/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h b/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h |
| index 69898e63e222bec360e2bde4d2d2fc50dee35d77..2e211241d17c28170af2b56a4c6d1dab272eb4a9 100644 |
| --- a/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h |
| +++ b/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h |
| @@ -9,15 +9,21 @@ |
| #include <vector> |
| #include "base/callback_forward.h" |
| +#include "dbus/object_path.h" |
| +#include "device/bluetooth/bluetooth_device.h" |
| #include "device/bluetooth/bluetooth_local_gatt_service.h" |
| namespace bluez { |
| +class BluetoothLocalGattServiceBlueZ; |
| + |
| // A simpler interface for reacting to GATT attribute value requests by the |
| // DBus attribute service providers. |
| class BluetoothGattAttributeValueDelegate { |
| public: |
| - virtual ~BluetoothGattAttributeValueDelegate() {} |
| + explicit BluetoothGattAttributeValueDelegate( |
| + BluetoothLocalGattServiceBlueZ* service); |
| + virtual ~BluetoothGattAttributeValueDelegate(); |
| // This method will be called when a remote device requests to read the |
| // value of the exported GATT attribute. Invoke |callback| with a value |
| @@ -27,6 +33,7 @@ class BluetoothGattAttributeValueDelegate { |
| // invoked after a reasonable amount of time, since the request will time |
| // out if left pending for too long causing a disconnection. |
| virtual void GetValue( |
| + const dbus::ObjectPath& device_path, |
| const device::BluetoothLocalGattService::Delegate::ValueCallback& |
| callback, |
| const device::BluetoothLocalGattService::Delegate::ErrorCallback& |
| @@ -40,6 +47,7 @@ class BluetoothGattAttributeValueDelegate { |
| // invoked after a reasonable amount of time, since the request will time |
| // out if left pending for too long causing a disconnection. |
| virtual void SetValue( |
| + const dbus::ObjectPath& device_path, |
| const std::vector<uint8_t>& value, |
| const base::Closure& callback, |
| const device::BluetoothLocalGattService::Delegate::ErrorCallback& |
| @@ -54,6 +62,17 @@ class BluetoothGattAttributeValueDelegate { |
| // notifications for this characteristic. This will never be called for |
| // descriptors. |
| virtual void StopNotifications() = 0; |
| + |
| + protected: |
| + // Gets the Bluetooth device object on the current service's adapter with |
| + // the given object path. |
| + device::BluetoothDevice* GetDeviceWithPath( |
| + const dbus::ObjectPath& object_path); |
| + |
| + BluetoothLocalGattServiceBlueZ* service() { return service_; } |
| + |
| + private: |
| + BluetoothLocalGattServiceBlueZ* service_; |
|
xiyuan
2016/05/16 21:27:07
Having a data member in an interface looks strange
rkc
2016/05/16 21:44:29
It is needed by the derived classes + this class.
xiyuan
2016/05/16 22:05:00
Acknowledged.
|
| }; |
| } // namespace bluez |