Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h

Issue 301093003: device/bluetooth: Update characteristic value D-Bus bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
index 849655a4b535f23a765c350f2770ded7b3ebae9f..91c3f6297ffd4964fe6326dbea8f27e26acb4f40 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/memory/weak_ptr.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_gatt_characteristic.h"
@@ -32,6 +33,7 @@ class BluetoothRemoteGattServiceChromeOS;
// platform.
class BluetoothRemoteGattCharacteristicChromeOS
: public device::BluetoothGattCharacteristic,
+ public BluetoothGattCharacteristicClient::Observer,
public BluetoothGattDescriptorClient::Observer {
public:
// device::BluetoothGattCharacteristic overrides.
@@ -68,6 +70,11 @@ class BluetoothRemoteGattCharacteristicChromeOS
const dbus::ObjectPath& object_path);
virtual ~BluetoothRemoteGattCharacteristicChromeOS();
+ // BluetoothGattCharacteristicClient::Observer overrides.
+ virtual void GattCharacteristicValueUpdated(
+ const dbus::ObjectPath& object_path,
+ const std::vector<uint8>& value) OVERRIDE;
+
// BluetoothGattDescriptorClient::Observer overrides.
virtual void GattDescriptorAdded(
const dbus::ObjectPath& object_path) OVERRIDE;
@@ -77,17 +84,16 @@ class BluetoothRemoteGattCharacteristicChromeOS
const dbus::ObjectPath& object_path,
const std::string& property_name) OVERRIDE;
- // Called by dbus:: on completion of the request to get the characteristic
- // value.
- void OnGetValue(const ValueCallback& callback,
- const ErrorCallback& error_callback,
- bool success);
+ // Called by dbus:: on successful completion of a request to read
+ // the characteristic value.
+ void OnValueSuccess(const ValueCallback& callback,
+ const std::vector<uint8>& value);
- // Called by dbus:: on completion of the request to set the characteristic
- // value.
- void OnSetValue(const base::Closure& callback,
- const ErrorCallback& error_callback,
- bool success);
+ // Called by dbus:: on unsuccessful completion of a request to read or write
+ // the characteristic value.
+ void OnError(const ErrorCallback& error_callback,
+ const std::string& error_name,
+ const std::string& error_message);
// Object path of the D-Bus characteristic object.
dbus::ObjectPath object_path_;
@@ -95,6 +101,10 @@ class BluetoothRemoteGattCharacteristicChromeOS
// The GATT service this GATT characteristic belongs to.
BluetoothRemoteGattServiceChromeOS* service_;
+ // The cached characteristic value based on the most recent read or
+ // notification.
+ std::vector<uint8> cached_value_;
+
// Mapping from GATT descriptor object paths to descriptor objects owned by
// this characteristic. Since the Chrome OS implementation uses object paths
// as unique identifiers, we also use this mapping to return descriptors by

Powered by Google App Engine
This is Rietveld 408576698