bluetooth_gatt_descriptor_delegate_wrapper.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233
  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. #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_delegate_wrapper.h"
  5. #include "device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.h"
  6. namespace bluez {
  7. BluetoothGattDescriptorDelegateWrapper::BluetoothGattDescriptorDelegateWrapper(
  8. BluetoothLocalGattServiceBlueZ* service,
  9. BluetoothLocalGattDescriptorBlueZ* descriptor)
  10. : BluetoothGattAttributeValueDelegate(service), descriptor_(descriptor) {}
  11. void BluetoothGattDescriptorDelegateWrapper::GetValue(
  12. const dbus::ObjectPath& device_path,
  13. device::BluetoothLocalGattService::Delegate::ValueCallback callback) {
  14. service()->GetDelegate()->OnDescriptorReadRequest(
  15. GetDeviceWithPath(device_path), descriptor_, 0, std::move(callback));
  16. }
  17. void BluetoothGattDescriptorDelegateWrapper::SetValue(
  18. const dbus::ObjectPath& device_path,
  19. const std::vector<uint8_t>& value,
  20. base::OnceClosure callback,
  21. device::BluetoothLocalGattService::Delegate::ErrorCallback error_callback) {
  22. service()->GetDelegate()->OnDescriptorWriteRequest(
  23. GetDeviceWithPath(device_path), descriptor_, value, 0,
  24. std::move(callback), std::move(error_callback));
  25. }
  26. } // namespace bluez