| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_delegate_wrapper.h
" | 5 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_delegate_wrapper.h
" |
| 6 | 6 |
| 7 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h" | 7 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h" |
| 8 | 8 |
| 9 namespace bluez { | 9 namespace bluez { |
| 10 | 10 |
| 11 BluetoothGattCharacteristicDelegateWrapper:: | 11 BluetoothGattCharacteristicDelegateWrapper:: |
| 12 BluetoothGattCharacteristicDelegateWrapper( | 12 BluetoothGattCharacteristicDelegateWrapper( |
| 13 BluetoothLocalGattServiceBlueZ* service, | 13 BluetoothLocalGattServiceBlueZ* service, |
| 14 BluetoothLocalGattCharacteristicBlueZ* characteristic) | 14 BluetoothLocalGattCharacteristicBlueZ* characteristic) |
| 15 : service_(service), characteristic_(characteristic) {} | 15 : BluetoothGattAttributeValueDelegate(service), |
| 16 characteristic_(characteristic) {} |
| 16 | 17 |
| 17 void BluetoothGattCharacteristicDelegateWrapper::GetValue( | 18 void BluetoothGattCharacteristicDelegateWrapper::GetValue( |
| 19 const dbus::ObjectPath& device_path, |
| 18 const device::BluetoothLocalGattService::Delegate::ValueCallback& callback, | 20 const device::BluetoothLocalGattService::Delegate::ValueCallback& callback, |
| 19 const device::BluetoothLocalGattService::Delegate::ErrorCallback& | 21 const device::BluetoothLocalGattService::Delegate::ErrorCallback& |
| 20 error_callback) { | 22 error_callback) { |
| 21 service_->GetDelegate()->OnCharacteristicReadRequest( | 23 service()->GetDelegate()->OnCharacteristicReadRequest( |
| 22 nullptr, characteristic_, 0, callback, error_callback); | 24 GetDeviceWithPath(device_path), characteristic_, 0, callback, |
| 25 error_callback); |
| 23 } | 26 } |
| 24 | 27 |
| 25 void BluetoothGattCharacteristicDelegateWrapper::SetValue( | 28 void BluetoothGattCharacteristicDelegateWrapper::SetValue( |
| 29 const dbus::ObjectPath& device_path, |
| 26 const std::vector<uint8_t>& value, | 30 const std::vector<uint8_t>& value, |
| 27 const base::Closure& callback, | 31 const base::Closure& callback, |
| 28 const device::BluetoothLocalGattService::Delegate::ErrorCallback& | 32 const device::BluetoothLocalGattService::Delegate::ErrorCallback& |
| 29 error_callback) { | 33 error_callback) { |
| 30 service_->GetDelegate()->OnCharacteristicWriteRequest( | 34 service()->GetDelegate()->OnCharacteristicWriteRequest( |
| 31 nullptr, characteristic_, value, 0, callback, error_callback); | 35 GetDeviceWithPath(device_path), characteristic_, value, 0, callback, |
| 36 error_callback); |
| 32 } | 37 } |
| 33 | 38 |
| 34 void BluetoothGattCharacteristicDelegateWrapper::StartNotifications() { | 39 void BluetoothGattCharacteristicDelegateWrapper::StartNotifications() { |
| 35 service_->GetDelegate()->OnNotificationsStart(nullptr, characteristic_); | 40 service()->GetDelegate()->OnNotificationsStart(nullptr, characteristic_); |
| 36 } | 41 } |
| 37 | 42 |
| 38 void BluetoothGattCharacteristicDelegateWrapper::StopNotifications() { | 43 void BluetoothGattCharacteristicDelegateWrapper::StopNotifications() { |
| 39 service_->GetDelegate()->OnNotificationsStop(nullptr, characteristic_); | 44 service()->GetDelegate()->OnNotificationsStop(nullptr, characteristic_); |
| 40 } | 45 } |
| 41 | 46 |
| 42 } // namespace bluez | 47 } // namespace bluez |
| OLD | NEW |