| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_device_client.h" | 5 #include "device/bluetooth/dbus/bluetooth_device_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 const ConnectionParameters& conn_params, | 437 const ConnectionParameters& conn_params, |
| 438 const base::Closure& callback, | 438 const base::Closure& callback, |
| 439 const ErrorCallback& error_callback) override { | 439 const ErrorCallback& error_callback) override { |
| 440 dbus::ObjectProxy* object_proxy = | 440 dbus::ObjectProxy* object_proxy = |
| 441 object_manager_->GetObjectProxy(object_path); | 441 object_manager_->GetObjectProxy(object_path); |
| 442 if (!object_proxy) { | 442 if (!object_proxy) { |
| 443 error_callback.Run(kUnknownDeviceError, ""); | 443 error_callback.Run(kUnknownDeviceError, ""); |
| 444 return; | 444 return; |
| 445 } | 445 } |
| 446 | 446 |
| 447 // TODO(crbug.com/725367): Use constants in cros_system_api once it is | |
| 448 // rolled. | |
| 449 dbus::MethodCall method_call( | 447 dbus::MethodCall method_call( |
| 450 bluetooth_plugin_device::kBluetoothPluginInterface, | 448 bluetooth_plugin_device::kBluetoothPluginInterface, |
| 451 "SetLEConnectionParameters"); | 449 bluetooth_plugin_device::kSetLEConnectionParameters); |
| 452 | 450 |
| 453 dbus::MessageWriter writer(&method_call); | 451 dbus::MessageWriter writer(&method_call); |
| 454 dbus::MessageWriter dict_writer(nullptr); | 452 dbus::MessageWriter dict_writer(nullptr); |
| 455 writer.OpenArray("{sq}", &dict_writer); | 453 writer.OpenArray("{sq}", &dict_writer); |
| 456 | 454 |
| 457 { | 455 { |
| 458 dbus::MessageWriter dict_entry_writer(nullptr); | 456 dbus::MessageWriter dict_entry_writer(nullptr); |
| 459 dict_writer.OpenDictEntry(&dict_entry_writer); | 457 dict_writer.OpenDictEntry(&dict_entry_writer); |
| 460 dict_entry_writer.AppendString("MinimumConnectionInterval"); | 458 dict_entry_writer.AppendString( |
| 459 bluetooth_plugin_device:: |
| 460 kLEConnectionParameterMinimumConnectionInterval); |
| 461 dict_entry_writer.AppendUint16(conn_params.min_connection_interval); | 461 dict_entry_writer.AppendUint16(conn_params.min_connection_interval); |
| 462 dict_writer.CloseContainer(&dict_entry_writer); | 462 dict_writer.CloseContainer(&dict_entry_writer); |
| 463 } | 463 } |
| 464 | 464 |
| 465 { | 465 { |
| 466 dbus::MessageWriter dict_entry_writer(nullptr); | 466 dbus::MessageWriter dict_entry_writer(nullptr); |
| 467 dict_writer.OpenDictEntry(&dict_entry_writer); | 467 dict_writer.OpenDictEntry(&dict_entry_writer); |
| 468 dict_entry_writer.AppendString("MaximumConnectionInterval"); | 468 dict_entry_writer.AppendString( |
| 469 bluetooth_plugin_device:: |
| 470 kLEConnectionParameterMaximumConnectionInterval); |
| 469 dict_entry_writer.AppendUint16(conn_params.max_connection_interval); | 471 dict_entry_writer.AppendUint16(conn_params.max_connection_interval); |
| 470 dict_writer.CloseContainer(&dict_entry_writer); | 472 dict_writer.CloseContainer(&dict_entry_writer); |
| 471 } | 473 } |
| 472 | 474 |
| 473 writer.CloseContainer(&dict_writer); | 475 writer.CloseContainer(&dict_writer); |
| 474 | 476 |
| 475 object_proxy->CallMethodWithErrorCallback( | 477 object_proxy->CallMethodWithErrorCallback( |
| 476 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 478 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 477 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, | 479 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, |
| 478 weak_ptr_factory_.GetWeakPtr(), callback), | 480 weak_ptr_factory_.GetWeakPtr(), callback), |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 615 |
| 614 BluetoothDeviceClient::BluetoothDeviceClient() {} | 616 BluetoothDeviceClient::BluetoothDeviceClient() {} |
| 615 | 617 |
| 616 BluetoothDeviceClient::~BluetoothDeviceClient() {} | 618 BluetoothDeviceClient::~BluetoothDeviceClient() {} |
| 617 | 619 |
| 618 BluetoothDeviceClient* BluetoothDeviceClient::Create() { | 620 BluetoothDeviceClient* BluetoothDeviceClient::Create() { |
| 619 return new BluetoothDeviceClientImpl(); | 621 return new BluetoothDeviceClientImpl(); |
| 620 } | 622 } |
| 621 | 623 |
| 622 } // namespace bluez | 624 } // namespace bluez |
| OLD | NEW |