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

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

Issue 1914893002: DBus changes for implementing local GATT attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_classes
Patch Set: test leak 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/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
new file mode 100644
index 0000000000000000000000000000000000000000..f44847aab58d2d415546bc5629c10f6635a94b49
--- /dev/null
+++ b/device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_ATTRIBUTE_VALUE_DELEGATE_H_
+#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_ATTRIBUTE_VALUE_DELEGATE_H_
+
+#include <cstdint>
+#include <vector>
+
+#include "base/callback_forward.h"
+#include "device/bluetooth/bluetooth_local_gatt_service.h"
+
+namespace bluez {
+
+// A simpler interface for reacting to GATT attribute value requests by the
+// DBus attribute service providers.
+class BluetoothGattAttributeValueDelegate {
+ public:
+ 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
+ // 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;
+};
+
+} // namespace bluez
+
+#endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_ATTRIBUTE_VALUE_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698