| Index: device/bluetooth/bluetooth_local_gatt_characteristic.h
|
| diff --git a/device/bluetooth/bluetooth_local_gatt_characteristic_bluez.h b/device/bluetooth/bluetooth_local_gatt_characteristic.h
|
| similarity index 15%
|
| copy from device/bluetooth/bluetooth_local_gatt_characteristic_bluez.h
|
| copy to device/bluetooth/bluetooth_local_gatt_characteristic.h
|
| index 386200d3b13ac87dbb86678838c76d1282befbc5..f062452ef60371088d11c53c36414ec5ef48691f 100644
|
| --- a/device/bluetooth/bluetooth_local_gatt_characteristic_bluez.h
|
| +++ b/device/bluetooth/bluetooth_local_gatt_characteristic.h
|
| @@ -2,67 +2,61 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_
|
| -#define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_
|
| +#ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_H_
|
| +#define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_H_
|
|
|
| #include <stdint.h>
|
| #include <vector>
|
|
|
| -#include "base/callback_forward.h"
|
| #include "base/macros.h"
|
| -#include "base/memory/weak_ptr.h"
|
| -#include "dbus/object_path.h"
|
| -#include "device/bluetooth/bluetooth_gatt_characteristic_bluez.h"
|
| +#include "device/bluetooth/bluetooth_export.h"
|
| +#include "device/bluetooth/bluetooth_gatt_characteristic.h"
|
| +#include "device/bluetooth/bluetooth_local_gatt_service.h"
|
| #include "device/bluetooth/bluetooth_uuid.h"
|
|
|
| namespace device {
|
|
|
| -class BluetoothGattDescriptor;
|
| -class BluetoothGattService;
|
| -
|
| -} // namespace device
|
| -
|
| -namespace bluez {
|
| -
|
| -class BluetoothLocalGattDescriptorBlueZ;
|
| -class BluetoothLocalGattServiceBlueZ;
|
| -
|
| -// The BluetoothLocalGattCharacteristicBlueZ class implements
|
| -// BluetoothGattCharacteristic for remote GATT characteristics for platforms
|
| -// that use BlueZ.
|
| -class BluetoothLocalGattCharacteristicBlueZ
|
| - : public BluetoothGattCharacteristicBlueZ {
|
| +// BluetoothLocalGattCharacteristic represents a local GATT characteristic. This
|
| +// class is used to represent GATT characteristics that belong to a locally
|
| +// hosted service. To achieve this, users need to specify the instance of the
|
| +// GATT service that contains this characteristic during construction.
|
| +//
|
| +// Note: We use virtual inheritance on the GATT characteristic since it will be
|
| +// inherited by platform specific versions of the GATT characteristic classes
|
| +// also. The platform specific remote GATT characteristic classes will inherit
|
| +// both this class and their GATT characteristic class, hence causing an
|
| +// inheritance diamond.
|
| +class DEVICE_BLUETOOTH_EXPORT BluetoothLocalGattCharacteristic
|
| + : public virtual BluetoothGattCharacteristic {
|
| public:
|
| - // device::BluetoothGattCharacteristic overrides.
|
| - device::BluetoothUUID GetUUID() const override;
|
| - bool IsLocal() const override;
|
| - const std::vector<uint8_t>& GetValue() const override;
|
| - Properties GetProperties() const override;
|
| - bool IsNotifying() const override;
|
| - bool AddDescriptor(device::BluetoothGattDescriptor* descriptor) override;
|
| - bool UpdateValue(const std::vector<uint8_t>& value) override;
|
| - void StartNotifySession(const NotifySessionCallback& callback,
|
| - const ErrorCallback& error_callback) override;
|
| - void ReadRemoteCharacteristic(const ValueCallback& callback,
|
| - const ErrorCallback& error_callback) override;
|
| - void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value,
|
| - const base::Closure& callback,
|
| - const ErrorCallback& error_callback) override;
|
| + // Constructs a BluetoothLocalGattCharacteristic associated with a local GATT
|
| + // service when the adapter is in the peripheral role.
|
| + //
|
| + // This method constructs a characteristic with UUID |uuid|, initial cached
|
| + // value |value|, properties |properties|, and permissions |permissions|.
|
| + // |value| will be cached and returned for read requests and automatically set
|
| + // for write requests by default, unless an instance of
|
| + // BluetoothRemoteGattService::Delegate has been provided to the associated
|
| + // BluetoothRemoteGattService instance, in which case the delegate will handle
|
| + // read and write requests. The service instance will contain this
|
| + // characteristic.
|
| + // TODO(rkc): Investigate how to handle |PROPERTY_EXTENDED_PROPERTIES|
|
| + // correctly.
|
| + static BluetoothLocalGattCharacteristic* Create(
|
| + const BluetoothUUID& uuid,
|
| + const std::vector<uint8_t>& value,
|
| + Properties properties,
|
| + Permissions permissions,
|
| + BluetoothLocalGattService* service);
|
| +
|
| + protected:
|
| + BluetoothLocalGattCharacteristic();
|
| + ~BluetoothLocalGattCharacteristic() override;
|
|
|
| private:
|
| - friend class BluetoothLocalGattServiceBlueZ;
|
| -
|
| - BluetoothLocalGattCharacteristicBlueZ(BluetoothLocalGattServiceBlueZ* service,
|
| - const dbus::ObjectPath& object_path);
|
| - ~BluetoothLocalGattCharacteristicBlueZ() override;
|
| -
|
| - // Note: This should remain the last member so it'll be destroyed and
|
| - // invalidate its weak pointers before any other members are destroyed.
|
| - base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ);
|
| + DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristic);
|
| };
|
|
|
| -} // namespace bluez
|
| +} // namespace device
|
|
|
| -#endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_
|
| +#endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_H_
|
|
|