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

Unified Diff: device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h

Issue 1979163002: Add DBus plumbing and tests for sending devices with ATT read/writes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@devices
Patch Set: Created 4 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/dbus/bluetooth_gatt_attribute_value_delegate.h
diff --git a/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h b/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h
index 69898e63e222bec360e2bde4d2d2fc50dee35d77..2e211241d17c28170af2b56a4c6d1dab272eb4a9 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h
+++ b/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h
@@ -9,15 +9,21 @@
#include <vector>
#include "base/callback_forward.h"
+#include "dbus/object_path.h"
+#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_local_gatt_service.h"
namespace bluez {
+class BluetoothLocalGattServiceBlueZ;
+
// A simpler interface for reacting to GATT attribute value requests by the
// DBus attribute service providers.
class BluetoothGattAttributeValueDelegate {
public:
- virtual ~BluetoothGattAttributeValueDelegate() {}
+ explicit BluetoothGattAttributeValueDelegate(
+ BluetoothLocalGattServiceBlueZ* service);
+ virtual ~BluetoothGattAttributeValueDelegate();
// This method will be called when a remote device requests to read the
// value of the exported GATT attribute. Invoke |callback| with a value
@@ -27,6 +33,7 @@ class BluetoothGattAttributeValueDelegate {
// 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 dbus::ObjectPath& device_path,
const device::BluetoothLocalGattService::Delegate::ValueCallback&
callback,
const device::BluetoothLocalGattService::Delegate::ErrorCallback&
@@ -40,6 +47,7 @@ class BluetoothGattAttributeValueDelegate {
// 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 dbus::ObjectPath& device_path,
const std::vector<uint8_t>& value,
const base::Closure& callback,
const device::BluetoothLocalGattService::Delegate::ErrorCallback&
@@ -54,6 +62,17 @@ class BluetoothGattAttributeValueDelegate {
// notifications for this characteristic. This will never be called for
// descriptors.
virtual void StopNotifications() = 0;
+
+ protected:
+ // Gets the Bluetooth device object on the current service's adapter with
+ // the given object path.
+ device::BluetoothDevice* GetDeviceWithPath(
+ const dbus::ObjectPath& object_path);
+
+ BluetoothLocalGattServiceBlueZ* service() { return service_; }
+
+ private:
+ BluetoothLocalGattServiceBlueZ* service_;
xiyuan 2016/05/16 21:27:07 Having a data member in an interface looks strange
rkc 2016/05/16 21:44:29 It is needed by the derived classes + this class.
xiyuan 2016/05/16 22:05:00 Acknowledged.
};
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698