Index: device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h |
diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h |
index b9e495913fafe146603ecbbe91f4a77fe4443ace..0ddf375ac3b257711e9fec05a15495a35a3461af 100644 |
--- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h |
+++ b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h |
@@ -6,15 +6,15 @@ |
#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_ |
#include <stdint.h> |
- |
#include <string> |
#include <vector> |
-#include "base/callback.h" |
#include "base/macros.h" |
#include "dbus/bus.h" |
+#include "dbus/message.h" |
#include "dbus/object_path.h" |
#include "device/bluetooth/bluetooth_export.h" |
+#include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h" |
namespace bluez { |
@@ -34,50 +34,20 @@ namespace bluez { |
// "Value" property. |
class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProvider { |
public: |
- // Interface for reacting to GATT characteristic descriptor value requests. |
- class Delegate { |
- public: |
- virtual ~Delegate() {} |
- |
- // ValueCallback is used for methods that require a descriptor value |
- // to be returned. |
- typedef base::Callback<void(const std::vector<uint8_t>&)> ValueCallback; |
- |
- // ErrorCallback is used by methods to report failure. |
- typedef base::Closure ErrorCallback; |
- |
- // This method will be called when a remote device requests to read the |
- // value of the exported GATT descriptor. 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 |
- // descriptor 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. |
- virtual void GetDescriptorValue(const ValueCallback& callback, |
- const ErrorCallback& error_callback) = 0; |
- |
- // This method will be called, when a remote device requests to write the |
- // value of the exported GATT descriptor. 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 |
- // descriptor 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. |
- // |
- // The delegate should use this method to perform any side-effects that may |
- // occur based on the set value and potentially send a property changed |
- // signal to notify the Bluetooth daemon that the value has changed. |
- virtual void SetDescriptorValue(const std::vector<uint8_t>& value, |
- const base::Closure& callback, |
- const ErrorCallback& error_callback) = 0; |
- }; |
- |
virtual ~BluetoothGattDescriptorServiceProvider(); |
// Send a PropertyChanged signal to notify the Bluetooth daemon that the value |
// of the "Value" property has changed to |value|. |
virtual void SendValueChanged(const std::vector<uint8_t>& value) = 0; |
+ // Writes the descriptor's properties into the provided writer. If |
+ // value is not null, it is written also, otherwise no value property is |
+ // written. |
+ virtual void WriteProperties(dbus::MessageWriter* writer, |
+ const std::vector<uint8_t>* value) {} |
+ |
+ virtual const dbus::ObjectPath& object_path() const = 0; |
+ |
// Creates the instance, where |bus| is the D-Bus bus connection to export |
// the object onto, |uuid| is the 128-bit GATT descriptor UUID, |permissions| |
// is the list of attribute permissions, |characteristic_path| is the object |
@@ -94,7 +64,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProvider { |
static BluetoothGattDescriptorServiceProvider* Create( |
dbus::Bus* bus, |
const dbus::ObjectPath& object_path, |
- Delegate* delegate, |
+ BluetoothGattServiceBlueZ::AttributeValueDelegate* delegate, |
const std::string& uuid, |
const std::vector<std::string>& permissions, |
const dbus::ObjectPath& characteristic_path); |