bluetooth_gatt_descriptor_delegate_wrapper.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_DELEGATE_WRAPPER_H_
  5. #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_DELEGATE_WRAPPER_H_
  6. #include <cstdint>
  7. #include <vector>
  8. #include "base/callback_forward.h"
  9. #include "base/memory/raw_ptr.h"
  10. #include "device/bluetooth/bluetooth_gatt_characteristic.h"
  11. #include "device/bluetooth/bluetooth_local_gatt_service.h"
  12. #include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h"
  13. #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
  14. #include "device/bluetooth/dbus/bluetooth_gatt_attribute_value_delegate.h"
  15. namespace bluez {
  16. class BluetoothLocalGattDescriptorBlueZ;
  17. // Wrapper class around AttributeValueDelegate to handle descriptors.
  18. class BluetoothGattDescriptorDelegateWrapper
  19. : public BluetoothGattAttributeValueDelegate {
  20. public:
  21. BluetoothGattDescriptorDelegateWrapper(
  22. BluetoothLocalGattServiceBlueZ* service,
  23. BluetoothLocalGattDescriptorBlueZ* descriptor);
  24. BluetoothGattDescriptorDelegateWrapper(
  25. const BluetoothGattDescriptorDelegateWrapper&) = delete;
  26. BluetoothGattDescriptorDelegateWrapper& operator=(
  27. const BluetoothGattDescriptorDelegateWrapper&) = delete;
  28. // BluetoothGattAttributeValueDelegate overrides:
  29. void GetValue(const dbus::ObjectPath& device_path,
  30. device::BluetoothLocalGattService::Delegate::ValueCallback
  31. callback) override;
  32. void SetValue(const dbus::ObjectPath& device_path,
  33. const std::vector<uint8_t>& value,
  34. base::OnceClosure callback,
  35. device::BluetoothLocalGattService::Delegate::ErrorCallback
  36. error_callback) override;
  37. void StartNotifications(const dbus::ObjectPath& device_path,
  38. device::BluetoothGattCharacteristic::NotificationType
  39. notification_type) override {}
  40. void StopNotifications(const dbus::ObjectPath& device_path) override {}
  41. private:
  42. raw_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor_;
  43. };
  44. } // namespace bluez
  45. #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_DELEGATE_WRAPPER_H_