Index: device/bluetooth/bluez/bluetooth_gatt_service_bluez.h |
diff --git a/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h b/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h |
index 45932d09d3130ca105edd8a6744ec8609acc8668..ffc5f5540deaadf663c6d9121be875ca3b679d51 100644 |
--- a/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h |
+++ b/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h |
@@ -5,13 +5,14 @@ |
#ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ |
#define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ |
-#include <map> |
+#include <cstdint> |
#include <string> |
#include <vector> |
+#include "base/callback_forward.h" |
#include "base/macros.h" |
#include "dbus/object_path.h" |
-#include "device/bluetooth/bluetooth_gatt_service.h" |
+#include "device/bluetooth/bluetooth_local_gatt_service.h" |
namespace bluez { |
@@ -22,6 +23,39 @@ class BluetoothDeviceBlueZ; |
// for GATT services on platforms that use BlueZ. |
class BluetoothGattServiceBlueZ : public virtual device::BluetoothGattService { |
public: |
+ // A simpler interface for reacting to GATT attribute value requests by the |
+ // DBus attribute service providers. |
+ class AttributeValueDelegate { |
scheib
2016/04/26 06:03:32
Usually the delegate interface is defined on the c
rkc
2016/04/26 18:23:59
This delegate is used by both characteristics and
scheib
2016/04/27 05:12:59
I see that it is a delegate used by two dbus class
rkc
2016/04/27 19:41:06
Moving to its own class in bluez/dbus.
Done.
|
+ public: |
+ virtual ~AttributeValueDelegate() {} |
+ |
+ // This method will be called when a remote device requests to read the |
+ // value of the exported GATT attribute. Invoke |callback| with a value |
+ // to return that value to the requester. Invoke |error_callback| to report |
+ // a failure to read the value. This can happen, for example, if the |
+ // attribute has no read permission set. Either callback should be |
+ // 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 device::BluetoothLocalGattService::Delegate::ValueCallback& |
+ callback, |
+ const device::BluetoothLocalGattService::Delegate::ErrorCallback& |
+ error_callback) = 0; |
+ |
+ // This method will be called, when a remote device requests to write the |
+ // value of the exported GATT attribute. Invoke |callback| to report |
+ // that the value was successfully written. Invoke |error_callback| to |
+ // report a failure to write the value. This can happen, for example, if the |
+ // attribute has no write permission set. Either callback should be |
+ // 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 std::vector<uint8_t>& value, |
+ const base::Closure& callback, |
+ const device::BluetoothLocalGattService::Delegate::ErrorCallback& |
+ error_callback) = 0; |
+ }; |
+ |
// device::BluetoothGattService overrides. |
std::string GetIdentifier() const override; |