| 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..dd9c078bba61f246dcab0db9936561146e2fdafa 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 {
|
| + 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;
|
|
|
| @@ -35,6 +69,9 @@ class BluetoothGattServiceBlueZ : public virtual device::BluetoothGattService {
|
| // Returns the adapter associated with this service.
|
| BluetoothAdapterBlueZ* GetAdapter() const;
|
|
|
| + dbus::ObjectPath GenerateAttributeObjectPath(
|
| + const std::string attribute_type);
|
| +
|
| protected:
|
| explicit BluetoothGattServiceBlueZ(BluetoothAdapterBlueZ* adapter);
|
| ~BluetoothGattServiceBlueZ() override;
|
|
|