| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager_client.h" | 5 #include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 ~BluetoothGattManagerClientImpl() override {} | 28 ~BluetoothGattManagerClientImpl() override {} |
| 29 | 29 |
| 30 // BluetoothGattManagerClient override. | 30 // BluetoothGattManagerClient override. |
| 31 void RegisterApplication(const dbus::ObjectPath& adapter_object_path, | 31 void RegisterApplication(const dbus::ObjectPath& adapter_object_path, |
| 32 const dbus::ObjectPath& application_path, | 32 const dbus::ObjectPath& application_path, |
| 33 const Options& options, | 33 const Options& options, |
| 34 const base::Closure& callback, | 34 const base::Closure& callback, |
| 35 const ErrorCallback& error_callback) override { | 35 const ErrorCallback& error_callback) override { |
| 36 dbus::MethodCall method_call( | 36 dbus::MethodCall method_call( |
| 37 bluetooth_gatt_manager::kBluetoothGattManagerInterface, | 37 bluetooth_gatt_manager::kBluetoothGattManagerInterface, |
| 38 bluetooth_gatt_manager::kRegisterService); | 38 bluetooth_gatt_manager::kRegisterApplication); |
| 39 | 39 |
| 40 dbus::MessageWriter writer(&method_call); | 40 dbus::MessageWriter writer(&method_call); |
| 41 writer.AppendObjectPath(application_path); | 41 writer.AppendObjectPath(application_path); |
| 42 | 42 |
| 43 // The parameters of the Options dictionary are undefined but the method | 43 // The parameters of the Options dictionary are undefined but the method |
| 44 // signature still requires a value dictionary. Pass an empty dictionary | 44 // signature still requires a value dictionary. Pass an empty dictionary |
| 45 // and fill in the contents later if and when we add any options. | 45 // and fill in the contents later if and when we add any options. |
| 46 dbus::MessageWriter array_writer(NULL); | 46 dbus::MessageWriter array_writer(NULL); |
| 47 writer.OpenArray("{sv}", &array_writer); | 47 writer.OpenArray("{sv}", &array_writer); |
| 48 writer.CloseContainer(&array_writer); | 48 writer.CloseContainer(&array_writer); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 59 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // BluetoothGattManagerClient override. | 62 // BluetoothGattManagerClient override. |
| 63 void UnregisterApplication(const dbus::ObjectPath& adapter_object_path, | 63 void UnregisterApplication(const dbus::ObjectPath& adapter_object_path, |
| 64 const dbus::ObjectPath& application_path, | 64 const dbus::ObjectPath& application_path, |
| 65 const base::Closure& callback, | 65 const base::Closure& callback, |
| 66 const ErrorCallback& error_callback) override { | 66 const ErrorCallback& error_callback) override { |
| 67 dbus::MethodCall method_call( | 67 dbus::MethodCall method_call( |
| 68 bluetooth_gatt_manager::kBluetoothGattManagerInterface, | 68 bluetooth_gatt_manager::kBluetoothGattManagerInterface, |
| 69 bluetooth_gatt_manager::kUnregisterService); | 69 bluetooth_gatt_manager::kUnregisterApplication); |
| 70 | 70 |
| 71 dbus::MessageWriter writer(&method_call); | 71 dbus::MessageWriter writer(&method_call); |
| 72 writer.AppendObjectPath(application_path); | 72 writer.AppendObjectPath(application_path); |
| 73 | 73 |
| 74 DCHECK(object_manager_); | 74 DCHECK(object_manager_); |
| 75 dbus::ObjectProxy* object_proxy = | 75 dbus::ObjectProxy* object_proxy = |
| 76 object_manager_->GetObjectProxy(adapter_object_path); | 76 object_manager_->GetObjectProxy(adapter_object_path); |
| 77 DCHECK(object_proxy); | 77 DCHECK(object_proxy); |
| 78 object_proxy->CallMethodWithErrorCallback( | 78 object_proxy->CallMethodWithErrorCallback( |
| 79 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 79 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 BluetoothGattManagerClient::BluetoothGattManagerClient() {} | 132 BluetoothGattManagerClient::BluetoothGattManagerClient() {} |
| 133 | 133 |
| 134 BluetoothGattManagerClient::~BluetoothGattManagerClient() {} | 134 BluetoothGattManagerClient::~BluetoothGattManagerClient() {} |
| 135 | 135 |
| 136 // static | 136 // static |
| 137 BluetoothGattManagerClient* BluetoothGattManagerClient::Create() { | 137 BluetoothGattManagerClient* BluetoothGattManagerClient::Create() { |
| 138 return new BluetoothGattManagerClientImpl(); | 138 return new BluetoothGattManagerClientImpl(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace bluez | 141 } // namespace bluez |
| OLD | NEW |