Index: chromeos/dbus/bluetooth_gatt_descriptor_client.h |
diff --git a/chromeos/dbus/bluetooth_gatt_descriptor_client.h b/chromeos/dbus/bluetooth_gatt_descriptor_client.h |
index 3a7a26f57b2b773c69c9519b1836a98460dbb361..c3f24ac4ba2fdc1bdb0ba400892134cbb046657c 100644 |
--- a/chromeos/dbus/bluetooth_gatt_descriptor_client.h |
+++ b/chromeos/dbus/bluetooth_gatt_descriptor_client.h |
@@ -8,6 +8,7 @@ |
#include <string> |
#include "base/basictypes.h" |
+#include "base/callback.h" |
#include "chromeos/chromeos_export.h" |
#include "chromeos/dbus/dbus_client.h" |
#include "dbus/object_path.h" |
@@ -28,11 +29,6 @@ class CHROMEOS_EXPORT BluetoothGattDescriptorClient : public DBusClient { |
// [read-only] |
dbus::Property<dbus::ObjectPath> characteristic; |
- // Raw characteristic descriptor value read from the remote Bluetooth |
- // device. Setting the value sends a write request to the remote device. |
- // [read-write] |
- dbus::Property<std::vector<uint8> > value; |
- |
Properties(dbus::ObjectProxy* object_proxy, |
const std::string& interface_name, |
const PropertyChangedCallback& callback); |
@@ -60,6 +56,11 @@ class CHROMEOS_EXPORT BluetoothGattDescriptorClient : public DBusClient { |
const std::string& property_name) {} |
}; |
+ // Callbacks used to report the result of asynchronous methods. |
+ typedef base::Callback<void(const std::string& error_name, |
+ const std::string& error_message)> ErrorCallback; |
+ typedef base::Callback<void(const std::vector<uint8>& value)> ValueCallback; |
+ |
virtual ~BluetoothGattDescriptorClient(); |
// Adds and removes observers for events on all remote GATT descriptors. Check |
@@ -75,9 +76,28 @@ class CHROMEOS_EXPORT BluetoothGattDescriptorClient : public DBusClient { |
// |object_path|. Values should be copied if needed. |
virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; |
+ // Issues a request to read the value of GATT descriptor with object path |
+ // |object_path| and returns the value in |callback| on success. On error, |
+ // invokes |error_callback|. |
+ virtual void ReadValue(const dbus::ObjectPath& object_path, |
+ const ValueCallback& callback, |
+ const ErrorCallback& error_callback) = 0; |
+ |
+ // Issues a request to write the value of GATT descriptor with object path |
+ // |object_path| with value |value|. Invokes |callback| on success and |
+ // |error_callback| on failure. |
+ virtual void WriteValue(const dbus::ObjectPath& object_path, |
+ const std::vector<uint8>& value, |
+ const base::Closure& callback, |
+ const ErrorCallback& error_callback) = 0; |
+ |
// Creates the instance. |
static BluetoothGattDescriptorClient* Create(); |
+ // Constants used to indicate exceptional error conditions. |
+ static const char kNoResponseError[]; |
+ static const char kUnknownDescriptorError[]; |
+ |
protected: |
BluetoothGattDescriptorClient(); |