Index: chromeos/dbus/bluetooth_gatt_characteristic_client.h |
diff --git a/chromeos/dbus/bluetooth_gatt_characteristic_client.h b/chromeos/dbus/bluetooth_gatt_characteristic_client.h |
index 2935e4af90613ba75f1986e2ec80b69cb5a3543a..e5d48adb16fa58af07dbf1f0f90a9568aa776655 100644 |
--- a/chromeos/dbus/bluetooth_gatt_characteristic_client.h |
+++ b/chromeos/dbus/bluetooth_gatt_characteristic_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,10 +29,6 @@ class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient { |
// [read-only] |
dbus::Property<dbus::ObjectPath> service; |
- // Characteristic 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; |
- |
// List of flags representing the GATT "Characteristic Properties bit field" |
// and properties read from the GATT "Characteristic Extended Properties" |
// descriptor bit field. [read-only, optional] |
@@ -62,8 +59,20 @@ class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient { |
virtual void GattCharacteristicPropertyChanged( |
const dbus::ObjectPath& object_path, |
const std::string& property_name) {} |
+ |
+ // Called when a "ValueUpdated" signal is received from the remote GATT |
+ // characteristic with object path |object_path| with characteristic value |
+ // |value|. |
+ virtual void GattCharacteristicValueUpdated( |
+ const dbus::ObjectPath& object_path, |
+ const std::vector<uint8>& value) {} |
}; |
+ // 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 ~BluetoothGattCharacteristicClient(); |
// Adds and removes observers for events on all remote GATT characteristics. |
@@ -79,9 +88,28 @@ class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : 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 characteristic 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 characteristic 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 BluetoothGattCharacteristicClient* Create(); |
+ // Constants used to indicate exceptional error conditions. |
+ static const char kNoResponseError[]; |
+ static const char kUnknownCharacteristicError[]; |
+ |
protected: |
BluetoothGattCharacteristicClient(); |