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

Unified Diff: device/bluetooth/bluez/bluetooth_gatt_service_bluez.h

Issue 1915803002: Bluetooth class changes for implementing local GATT attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: magic values fix Created 4 years, 8 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/bluez/bluetooth_gatt_service_bluez.h
diff --git a/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h b/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h
index 45932d09d3130ca105edd8a6744ec8609acc8668..ffc5f5540deaadf663c6d9121be875ca3b679d51 100644
--- a/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h
+++ b/device/bluetooth/bluez/bluetooth_gatt_service_bluez.h
@@ -5,13 +5,14 @@
#ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_
#define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_
-#include <map>
+#include <cstdint>
#include <string>
#include <vector>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_gatt_service.h"
+#include "device/bluetooth/bluetooth_local_gatt_service.h"
namespace bluez {
@@ -22,6 +23,39 @@ class BluetoothDeviceBlueZ;
// for GATT services on platforms that use BlueZ.
class BluetoothGattServiceBlueZ : public virtual device::BluetoothGattService {
public:
+ // A simpler interface for reacting to GATT attribute value requests by the
+ // DBus attribute service providers.
+ class AttributeValueDelegate {
scheib 2016/04/26 06:03:32 Usually the delegate interface is defined on the c
rkc 2016/04/26 18:23:59 This delegate is used by both characteristics and
scheib 2016/04/27 05:12:59 I see that it is a delegate used by two dbus class
rkc 2016/04/27 19:41:06 Moving to its own class in bluez/dbus. Done.
+ public:
+ virtual ~AttributeValueDelegate() {}
+
+ // This method will be called when a remote device requests to read the
+ // value of the exported GATT attribute. 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
+ // attribute 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 causing a disconnection.
+ virtual void GetValue(
+ const device::BluetoothLocalGattService::Delegate::ValueCallback&
+ callback,
+ const device::BluetoothLocalGattService::Delegate::ErrorCallback&
+ error_callback) = 0;
+
+ // This method will be called, when a remote device requests to write the
+ // value of the exported GATT attribute. 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
+ // attribute 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 causing a disconnection.
+ virtual void SetValue(
+ const std::vector<uint8_t>& value,
+ const base::Closure& callback,
+ const device::BluetoothLocalGattService::Delegate::ErrorCallback&
+ error_callback) = 0;
+ };
+
// device::BluetoothGattService overrides.
std::string GetIdentifier() const override;

Powered by Google App Engine
This is Rietveld 408576698