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/bluez/bluetooth_remote_gatt_characteristic_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 << "."; | 280 << "."; |
281 | 281 |
282 bluez::BluezDBusManager::Get() | 282 bluez::BluezDBusManager::Get() |
283 ->GetBluetoothGattCharacteristicClient() | 283 ->GetBluetoothGattCharacteristicClient() |
284 ->ReadValue(object_path(), callback, | 284 ->ReadValue(object_path(), callback, |
285 base::Bind(&BluetoothRemoteGattCharacteristicBlueZ::OnError, | 285 base::Bind(&BluetoothRemoteGattCharacteristicBlueZ::OnError, |
286 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 286 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
287 } | 287 } |
288 | 288 |
289 void BluetoothRemoteGattCharacteristicBlueZ::WriteRemoteCharacteristic( | 289 void BluetoothRemoteGattCharacteristicBlueZ::WriteRemoteCharacteristic( |
290 const std::vector<uint8_t>& new_value, | 290 const std::vector<uint8_t>& value, |
291 const base::Closure& callback, | 291 const base::Closure& callback, |
292 const ErrorCallback& error_callback) { | 292 const ErrorCallback& error_callback) { |
293 VLOG(1) << "Sending GATT characteristic write request to characteristic: " | 293 VLOG(1) << "Sending GATT characteristic write request to characteristic: " |
294 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() | 294 << GetIdentifier() << ", UUID: " << GetUUID().canonical_value() |
295 << ", with value: " << new_value << "."; | 295 << ", with value: " << value << "."; |
296 | 296 |
297 bluez::BluezDBusManager::Get() | 297 bluez::BluezDBusManager::Get() |
298 ->GetBluetoothGattCharacteristicClient() | 298 ->GetBluetoothGattCharacteristicClient() |
299 ->WriteValue(object_path(), new_value, callback, | 299 ->WriteValue(object_path(), value, callback, |
300 base::Bind(&BluetoothRemoteGattCharacteristicBlueZ::OnError, | 300 base::Bind(&BluetoothRemoteGattCharacteristicBlueZ::OnError, |
301 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 301 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
302 } | 302 } |
303 | 303 |
304 void BluetoothRemoteGattCharacteristicBlueZ::SubscribeToNotifications( | 304 void BluetoothRemoteGattCharacteristicBlueZ::SubscribeToNotifications( |
305 device::BluetoothRemoteGattDescriptor* ccc_descriptor, | 305 device::BluetoothRemoteGattDescriptor* ccc_descriptor, |
306 const base::Closure& callback, | 306 const base::Closure& callback, |
307 const ErrorCallback& error_callback) { | 307 const ErrorCallback& error_callback) { |
308 // TODO(http://crbug.com/636275): Implement this method | 308 // TODO(http://crbug.com/636275): Implement this method |
309 NOTIMPLEMENTED(); | 309 NOTIMPLEMENTED(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 const ErrorCallback& error_callback, | 470 const ErrorCallback& error_callback, |
471 const std::string& error_name, | 471 const std::string& error_name, |
472 const std::string& error_message) { | 472 const std::string& error_message) { |
473 VLOG(1) << "Operation failed: " << error_name | 473 VLOG(1) << "Operation failed: " << error_name |
474 << ", message: " << error_message; | 474 << ", message: " << error_message; |
475 error_callback.Run( | 475 error_callback.Run( |
476 BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name)); | 476 BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name)); |
477 } | 477 } |
478 | 478 |
479 } // namespace bluez | 479 } // namespace bluez |
OLD | NEW |