| 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 "chromeos/dbus/bluetooth_device_client.h" | 5 #include "device/bluetooth/dbus/bluetooth_device_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
| 11 #include "dbus/message.h" | 11 #include "dbus/message.h" |
| 12 #include "dbus/object_manager.h" | 12 #include "dbus/object_manager.h" |
| 13 #include "dbus/object_proxy.h" | 13 #include "dbus/object_proxy.h" |
| 14 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace bluez { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Value returned for the the RSSI or TX power if it cannot be read. | 20 // Value returned for the the RSSI or TX power if it cannot be read. |
| 21 const int kUnknownPower = 127; | 21 const int kUnknownPower = 127; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 const char BluetoothDeviceClient::kNoResponseError[] = | 25 const char BluetoothDeviceClient::kNoResponseError[] = |
| 26 "org.chromium.Error.NoResponse"; | 26 "org.chromium.Error.NoResponse"; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 RegisterProperty(bluetooth_device::kTrustedProperty, &trusted); | 43 RegisterProperty(bluetooth_device::kTrustedProperty, &trusted); |
| 44 RegisterProperty(bluetooth_device::kBlockedProperty, &blocked); | 44 RegisterProperty(bluetooth_device::kBlockedProperty, &blocked); |
| 45 RegisterProperty(bluetooth_device::kAliasProperty, &alias); | 45 RegisterProperty(bluetooth_device::kAliasProperty, &alias); |
| 46 RegisterProperty(bluetooth_device::kAdapterProperty, &adapter); | 46 RegisterProperty(bluetooth_device::kAdapterProperty, &adapter); |
| 47 RegisterProperty(bluetooth_device::kLegacyPairingProperty, &legacy_pairing); | 47 RegisterProperty(bluetooth_device::kLegacyPairingProperty, &legacy_pairing); |
| 48 RegisterProperty(bluetooth_device::kModaliasProperty, &modalias); | 48 RegisterProperty(bluetooth_device::kModaliasProperty, &modalias); |
| 49 RegisterProperty(bluetooth_device::kRSSIProperty, &rssi); | 49 RegisterProperty(bluetooth_device::kRSSIProperty, &rssi); |
| 50 RegisterProperty(bluetooth_device::kTxPowerProperty, &tx_power); | 50 RegisterProperty(bluetooth_device::kTxPowerProperty, &tx_power); |
| 51 } | 51 } |
| 52 | 52 |
| 53 BluetoothDeviceClient::Properties::~Properties() { | 53 BluetoothDeviceClient::Properties::~Properties() {} |
| 54 } | |
| 55 | |
| 56 | 54 |
| 57 // The BluetoothDeviceClient implementation used in production. | 55 // The BluetoothDeviceClient implementation used in production. |
| 58 class BluetoothDeviceClientImpl | 56 class BluetoothDeviceClientImpl : public BluetoothDeviceClient, |
| 59 : public BluetoothDeviceClient, | 57 public dbus::ObjectManager::Interface { |
| 60 public dbus::ObjectManager::Interface { | |
| 61 public: | 58 public: |
| 62 BluetoothDeviceClientImpl() | 59 BluetoothDeviceClientImpl() |
| 63 : object_manager_(NULL), weak_ptr_factory_(this) {} | 60 : object_manager_(NULL), weak_ptr_factory_(this) {} |
| 64 | 61 |
| 65 ~BluetoothDeviceClientImpl() override { | 62 ~BluetoothDeviceClientImpl() override { |
| 66 object_manager_->UnregisterInterface( | 63 object_manager_->UnregisterInterface( |
| 67 bluetooth_device::kBluetoothDeviceInterface); | 64 bluetooth_device::kBluetoothDeviceInterface); |
| 68 } | 65 } |
| 69 | 66 |
| 70 // BluetoothDeviceClient override. | 67 // BluetoothDeviceClient override. |
| 71 void AddObserver(BluetoothDeviceClient::Observer* observer) override { | 68 void AddObserver(BluetoothDeviceClient::Observer* observer) override { |
| 72 DCHECK(observer); | 69 DCHECK(observer); |
| 73 observers_.AddObserver(observer); | 70 observers_.AddObserver(observer); |
| 74 } | 71 } |
| 75 | 72 |
| 76 // BluetoothDeviceClient override. | 73 // BluetoothDeviceClient override. |
| 77 void RemoveObserver(BluetoothDeviceClient::Observer* observer) override { | 74 void RemoveObserver(BluetoothDeviceClient::Observer* observer) override { |
| 78 DCHECK(observer); | 75 DCHECK(observer); |
| 79 observers_.RemoveObserver(observer); | 76 observers_.RemoveObserver(observer); |
| 80 } | 77 } |
| 81 | 78 |
| 82 // dbus::ObjectManager::Interface override. | 79 // dbus::ObjectManager::Interface override. |
| 83 dbus::PropertySet* CreateProperties( | 80 dbus::PropertySet* CreateProperties( |
| 84 dbus::ObjectProxy* object_proxy, | 81 dbus::ObjectProxy* object_proxy, |
| 85 const dbus::ObjectPath& object_path, | 82 const dbus::ObjectPath& object_path, |
| 86 const std::string& interface_name) override { | 83 const std::string& interface_name) override { |
| 87 Properties* properties = new Properties( | 84 Properties* properties = |
| 88 object_proxy, | 85 new Properties(object_proxy, interface_name, |
| 89 interface_name, | 86 base::Bind(&BluetoothDeviceClientImpl::OnPropertyChanged, |
| 90 base::Bind(&BluetoothDeviceClientImpl::OnPropertyChanged, | 87 weak_ptr_factory_.GetWeakPtr(), object_path)); |
| 91 weak_ptr_factory_.GetWeakPtr(), | |
| 92 object_path)); | |
| 93 return static_cast<dbus::PropertySet*>(properties); | 88 return static_cast<dbus::PropertySet*>(properties); |
| 94 } | 89 } |
| 95 | 90 |
| 96 // BluetoothDeviceClient override. | 91 // BluetoothDeviceClient override. |
| 97 std::vector<dbus::ObjectPath> GetDevicesForAdapter( | 92 std::vector<dbus::ObjectPath> GetDevicesForAdapter( |
| 98 const dbus::ObjectPath& adapter_path) override { | 93 const dbus::ObjectPath& adapter_path) override { |
| 99 std::vector<dbus::ObjectPath> object_paths, device_paths; | 94 std::vector<dbus::ObjectPath> object_paths, device_paths; |
| 100 device_paths = object_manager_->GetObjectsWithInterface( | 95 device_paths = object_manager_->GetObjectsWithInterface( |
| 101 bluetooth_device::kBluetoothDeviceInterface); | 96 bluetooth_device::kBluetoothDeviceInterface); |
| 102 for (std::vector<dbus::ObjectPath>::iterator iter = device_paths.begin(); | 97 for (std::vector<dbus::ObjectPath>::iterator iter = device_paths.begin(); |
| 103 iter != device_paths.end(); ++iter) { | 98 iter != device_paths.end(); ++iter) { |
| 104 Properties* properties = GetProperties(*iter); | 99 Properties* properties = GetProperties(*iter); |
| 105 if (properties->adapter.value() == adapter_path) | 100 if (properties->adapter.value() == adapter_path) |
| 106 object_paths.push_back(*iter); | 101 object_paths.push_back(*iter); |
| 107 } | 102 } |
| 108 return object_paths; | 103 return object_paths; |
| 109 } | 104 } |
| 110 | 105 |
| 111 // BluetoothDeviceClient override. | 106 // BluetoothDeviceClient override. |
| 112 Properties* GetProperties(const dbus::ObjectPath& object_path) override { | 107 Properties* GetProperties(const dbus::ObjectPath& object_path) override { |
| 113 return static_cast<Properties*>( | 108 return static_cast<Properties*>(object_manager_->GetProperties( |
| 114 object_manager_->GetProperties( | 109 object_path, bluetooth_device::kBluetoothDeviceInterface)); |
| 115 object_path, | |
| 116 bluetooth_device::kBluetoothDeviceInterface)); | |
| 117 } | 110 } |
| 118 | 111 |
| 119 // BluetoothDeviceClient override. | 112 // BluetoothDeviceClient override. |
| 120 void Connect(const dbus::ObjectPath& object_path, | 113 void Connect(const dbus::ObjectPath& object_path, |
| 121 const base::Closure& callback, | 114 const base::Closure& callback, |
| 122 const ErrorCallback& error_callback) override { | 115 const ErrorCallback& error_callback) override { |
| 123 dbus::MethodCall method_call( | 116 dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface, |
| 124 bluetooth_device::kBluetoothDeviceInterface, | 117 bluetooth_device::kConnect); |
| 125 bluetooth_device::kConnect); | |
| 126 | 118 |
| 127 dbus::ObjectProxy* object_proxy = | 119 dbus::ObjectProxy* object_proxy = |
| 128 object_manager_->GetObjectProxy(object_path); | 120 object_manager_->GetObjectProxy(object_path); |
| 129 if (!object_proxy) { | 121 if (!object_proxy) { |
| 130 error_callback.Run(kUnknownDeviceError, ""); | 122 error_callback.Run(kUnknownDeviceError, ""); |
| 131 return; | 123 return; |
| 132 } | 124 } |
| 133 | 125 |
| 134 // Connect may take an arbitrary length of time, so use no timeout. | 126 // Connect may take an arbitrary length of time, so use no timeout. |
| 135 object_proxy->CallMethodWithErrorCallback( | 127 object_proxy->CallMethodWithErrorCallback( |
| 136 &method_call, | 128 &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, |
| 137 dbus::ObjectProxy::TIMEOUT_INFINITE, | |
| 138 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, | 129 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, |
| 139 weak_ptr_factory_.GetWeakPtr(), callback), | 130 weak_ptr_factory_.GetWeakPtr(), callback), |
| 140 base::Bind(&BluetoothDeviceClientImpl::OnError, | 131 base::Bind(&BluetoothDeviceClientImpl::OnError, |
| 141 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 132 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 142 } | 133 } |
| 143 | 134 |
| 144 // BluetoothDeviceClient override. | 135 // BluetoothDeviceClient override. |
| 145 void Disconnect(const dbus::ObjectPath& object_path, | 136 void Disconnect(const dbus::ObjectPath& object_path, |
| 146 const base::Closure& callback, | 137 const base::Closure& callback, |
| 147 const ErrorCallback& error_callback) override { | 138 const ErrorCallback& error_callback) override { |
| 148 dbus::MethodCall method_call( | 139 dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface, |
| 149 bluetooth_device::kBluetoothDeviceInterface, | 140 bluetooth_device::kDisconnect); |
| 150 bluetooth_device::kDisconnect); | |
| 151 | 141 |
| 152 dbus::ObjectProxy* object_proxy = | 142 dbus::ObjectProxy* object_proxy = |
| 153 object_manager_->GetObjectProxy(object_path); | 143 object_manager_->GetObjectProxy(object_path); |
| 154 if (!object_proxy) { | 144 if (!object_proxy) { |
| 155 error_callback.Run(kUnknownDeviceError, ""); | 145 error_callback.Run(kUnknownDeviceError, ""); |
| 156 return; | 146 return; |
| 157 } | 147 } |
| 158 | 148 |
| 159 object_proxy->CallMethodWithErrorCallback( | 149 object_proxy->CallMethodWithErrorCallback( |
| 160 &method_call, | 150 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 161 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | |
| 162 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, | 151 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, |
| 163 weak_ptr_factory_.GetWeakPtr(), callback), | 152 weak_ptr_factory_.GetWeakPtr(), callback), |
| 164 base::Bind(&BluetoothDeviceClientImpl::OnError, | 153 base::Bind(&BluetoothDeviceClientImpl::OnError, |
| 165 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 154 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 166 } | 155 } |
| 167 | 156 |
| 168 // BluetoothDeviceClient override. | 157 // BluetoothDeviceClient override. |
| 169 void ConnectProfile(const dbus::ObjectPath& object_path, | 158 void ConnectProfile(const dbus::ObjectPath& object_path, |
| 170 const std::string& uuid, | 159 const std::string& uuid, |
| 171 const base::Closure& callback, | 160 const base::Closure& callback, |
| 172 const ErrorCallback& error_callback) override { | 161 const ErrorCallback& error_callback) override { |
| 173 dbus::MethodCall method_call( | 162 dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface, |
| 174 bluetooth_device::kBluetoothDeviceInterface, | 163 bluetooth_device::kConnectProfile); |
| 175 bluetooth_device::kConnectProfile); | |
| 176 | 164 |
| 177 dbus::MessageWriter writer(&method_call); | 165 dbus::MessageWriter writer(&method_call); |
| 178 writer.AppendString(uuid); | 166 writer.AppendString(uuid); |
| 179 | 167 |
| 180 dbus::ObjectProxy* object_proxy = | 168 dbus::ObjectProxy* object_proxy = |
| 181 object_manager_->GetObjectProxy(object_path); | 169 object_manager_->GetObjectProxy(object_path); |
| 182 if (!object_proxy) { | 170 if (!object_proxy) { |
| 183 error_callback.Run(kUnknownDeviceError, ""); | 171 error_callback.Run(kUnknownDeviceError, ""); |
| 184 return; | 172 return; |
| 185 } | 173 } |
| 186 | 174 |
| 187 // Connect may take an arbitrary length of time, so use no timeout. | 175 // Connect may take an arbitrary length of time, so use no timeout. |
| 188 object_proxy->CallMethodWithErrorCallback( | 176 object_proxy->CallMethodWithErrorCallback( |
| 189 &method_call, | 177 &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, |
| 190 dbus::ObjectProxy::TIMEOUT_INFINITE, | |
| 191 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, | 178 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, |
| 192 weak_ptr_factory_.GetWeakPtr(), callback), | 179 weak_ptr_factory_.GetWeakPtr(), callback), |
| 193 base::Bind(&BluetoothDeviceClientImpl::OnError, | 180 base::Bind(&BluetoothDeviceClientImpl::OnError, |
| 194 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 181 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 195 } | 182 } |
| 196 | 183 |
| 197 // BluetoothDeviceClient override. | 184 // BluetoothDeviceClient override. |
| 198 void DisconnectProfile(const dbus::ObjectPath& object_path, | 185 void DisconnectProfile(const dbus::ObjectPath& object_path, |
| 199 const std::string& uuid, | 186 const std::string& uuid, |
| 200 const base::Closure& callback, | 187 const base::Closure& callback, |
| 201 const ErrorCallback& error_callback) override { | 188 const ErrorCallback& error_callback) override { |
| 202 dbus::MethodCall method_call( | 189 dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface, |
| 203 bluetooth_device::kBluetoothDeviceInterface, | 190 bluetooth_device::kDisconnectProfile); |
| 204 bluetooth_device::kDisconnectProfile); | |
| 205 | 191 |
| 206 dbus::MessageWriter writer(&method_call); | 192 dbus::MessageWriter writer(&method_call); |
| 207 writer.AppendString(uuid); | 193 writer.AppendString(uuid); |
| 208 | 194 |
| 209 dbus::ObjectProxy* object_proxy = | 195 dbus::ObjectProxy* object_proxy = |
| 210 object_manager_->GetObjectProxy(object_path); | 196 object_manager_->GetObjectProxy(object_path); |
| 211 if (!object_proxy) { | 197 if (!object_proxy) { |
| 212 error_callback.Run(kUnknownDeviceError, ""); | 198 error_callback.Run(kUnknownDeviceError, ""); |
| 213 return; | 199 return; |
| 214 } | 200 } |
| 215 | 201 |
| 216 object_proxy->CallMethodWithErrorCallback( | 202 object_proxy->CallMethodWithErrorCallback( |
| 217 &method_call, | 203 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 218 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | |
| 219 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, | 204 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, |
| 220 weak_ptr_factory_.GetWeakPtr(), callback), | 205 weak_ptr_factory_.GetWeakPtr(), callback), |
| 221 base::Bind(&BluetoothDeviceClientImpl::OnError, | 206 base::Bind(&BluetoothDeviceClientImpl::OnError, |
| 222 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 207 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 223 } | 208 } |
| 224 | 209 |
| 225 // BluetoothDeviceClient override. | 210 // BluetoothDeviceClient override. |
| 226 void Pair(const dbus::ObjectPath& object_path, | 211 void Pair(const dbus::ObjectPath& object_path, |
| 227 const base::Closure& callback, | 212 const base::Closure& callback, |
| 228 const ErrorCallback& error_callback) override { | 213 const ErrorCallback& error_callback) override { |
| 229 dbus::MethodCall method_call( | 214 dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface, |
| 230 bluetooth_device::kBluetoothDeviceInterface, | 215 bluetooth_device::kPair); |
| 231 bluetooth_device::kPair); | |
| 232 | 216 |
| 233 dbus::ObjectProxy* object_proxy = | 217 dbus::ObjectProxy* object_proxy = |
| 234 object_manager_->GetObjectProxy(object_path); | 218 object_manager_->GetObjectProxy(object_path); |
| 235 if (!object_proxy) { | 219 if (!object_proxy) { |
| 236 error_callback.Run(kUnknownDeviceError, ""); | 220 error_callback.Run(kUnknownDeviceError, ""); |
| 237 return; | 221 return; |
| 238 } | 222 } |
| 239 | 223 |
| 240 // Pairing may take an arbitrary length of time, so use no timeout. | 224 // Pairing may take an arbitrary length of time, so use no timeout. |
| 241 object_proxy->CallMethodWithErrorCallback( | 225 object_proxy->CallMethodWithErrorCallback( |
| 242 &method_call, | 226 &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, |
| 243 dbus::ObjectProxy::TIMEOUT_INFINITE, | |
| 244 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, | 227 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, |
| 245 weak_ptr_factory_.GetWeakPtr(), callback), | 228 weak_ptr_factory_.GetWeakPtr(), callback), |
| 246 base::Bind(&BluetoothDeviceClientImpl::OnError, | 229 base::Bind(&BluetoothDeviceClientImpl::OnError, |
| 247 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 230 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 248 } | 231 } |
| 249 | 232 |
| 250 // BluetoothDeviceClient override. | 233 // BluetoothDeviceClient override. |
| 251 void CancelPairing(const dbus::ObjectPath& object_path, | 234 void CancelPairing(const dbus::ObjectPath& object_path, |
| 252 const base::Closure& callback, | 235 const base::Closure& callback, |
| 253 const ErrorCallback& error_callback) override { | 236 const ErrorCallback& error_callback) override { |
| 254 dbus::MethodCall method_call( | 237 dbus::MethodCall method_call(bluetooth_device::kBluetoothDeviceInterface, |
| 255 bluetooth_device::kBluetoothDeviceInterface, | 238 bluetooth_device::kCancelPairing); |
| 256 bluetooth_device::kCancelPairing); | |
| 257 | 239 |
| 258 dbus::ObjectProxy* object_proxy = | 240 dbus::ObjectProxy* object_proxy = |
| 259 object_manager_->GetObjectProxy(object_path); | 241 object_manager_->GetObjectProxy(object_path); |
| 260 if (!object_proxy) { | 242 if (!object_proxy) { |
| 261 error_callback.Run(kUnknownDeviceError, ""); | 243 error_callback.Run(kUnknownDeviceError, ""); |
| 262 return; | 244 return; |
| 263 } | 245 } |
| 264 object_proxy->CallMethodWithErrorCallback( | 246 object_proxy->CallMethodWithErrorCallback( |
| 265 &method_call, | 247 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 266 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | |
| 267 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, | 248 base::Bind(&BluetoothDeviceClientImpl::OnSuccess, |
| 268 weak_ptr_factory_.GetWeakPtr(), callback), | 249 weak_ptr_factory_.GetWeakPtr(), callback), |
| 269 base::Bind(&BluetoothDeviceClientImpl::OnError, | 250 base::Bind(&BluetoothDeviceClientImpl::OnError, |
| 270 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 251 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
| 271 } | 252 } |
| 272 | 253 |
| 273 // BluetoothDeviceClient override. | 254 // BluetoothDeviceClient override. |
| 274 void GetConnInfo(const dbus::ObjectPath& object_path, | 255 void GetConnInfo(const dbus::ObjectPath& object_path, |
| 275 const ConnInfoCallback& callback, | 256 const ConnInfoCallback& callback, |
| 276 const ErrorCallback& error_callback) override { | 257 const ErrorCallback& error_callback) override { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // Called by BluetoothPropertySet when a property value is changed, | 303 // Called by BluetoothPropertySet when a property value is changed, |
| 323 // either by result of a signal or response to a GetAll() or Get() | 304 // either by result of a signal or response to a GetAll() or Get() |
| 324 // call. Informs observers. | 305 // call. Informs observers. |
| 325 void OnPropertyChanged(const dbus::ObjectPath& object_path, | 306 void OnPropertyChanged(const dbus::ObjectPath& object_path, |
| 326 const std::string& property_name) { | 307 const std::string& property_name) { |
| 327 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, | 308 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, |
| 328 DevicePropertyChanged(object_path, property_name)); | 309 DevicePropertyChanged(object_path, property_name)); |
| 329 } | 310 } |
| 330 | 311 |
| 331 // Called when a response for successful method call is received. | 312 // Called when a response for successful method call is received. |
| 332 void OnSuccess(const base::Closure& callback, | 313 void OnSuccess(const base::Closure& callback, dbus::Response* response) { |
| 333 dbus::Response* response) { | |
| 334 DCHECK(response); | 314 DCHECK(response); |
| 335 callback.Run(); | 315 callback.Run(); |
| 336 } | 316 } |
| 337 | 317 |
| 338 // Called when a response for the GetConnInfo method is received. | 318 // Called when a response for the GetConnInfo method is received. |
| 339 void OnGetConnInfoSuccess(const ConnInfoCallback& callback, | 319 void OnGetConnInfoSuccess(const ConnInfoCallback& callback, |
| 340 dbus::Response* response) { | 320 dbus::Response* response) { |
| 341 int16 rssi = kUnknownPower; | 321 int16 rssi = kUnknownPower; |
| 342 int16 transmit_power = kUnknownPower; | 322 int16 transmit_power = kUnknownPower; |
| 343 int16 max_transmit_power = kUnknownPower; | 323 int16 max_transmit_power = kUnknownPower; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 360 |
| 381 // Weak pointer factory for generating 'this' pointers that might live longer | 361 // Weak pointer factory for generating 'this' pointers that might live longer |
| 382 // than we do. | 362 // than we do. |
| 383 // Note: This should remain the last member so it'll be destroyed and | 363 // Note: This should remain the last member so it'll be destroyed and |
| 384 // invalidate its weak pointers before any other members are destroyed. | 364 // invalidate its weak pointers before any other members are destroyed. |
| 385 base::WeakPtrFactory<BluetoothDeviceClientImpl> weak_ptr_factory_; | 365 base::WeakPtrFactory<BluetoothDeviceClientImpl> weak_ptr_factory_; |
| 386 | 366 |
| 387 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClientImpl); | 367 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClientImpl); |
| 388 }; | 368 }; |
| 389 | 369 |
| 390 BluetoothDeviceClient::BluetoothDeviceClient() { | 370 BluetoothDeviceClient::BluetoothDeviceClient() {} |
| 391 } | |
| 392 | 371 |
| 393 BluetoothDeviceClient::~BluetoothDeviceClient() { | 372 BluetoothDeviceClient::~BluetoothDeviceClient() {} |
| 394 } | |
| 395 | 373 |
| 396 BluetoothDeviceClient* BluetoothDeviceClient::Create() { | 374 BluetoothDeviceClient* BluetoothDeviceClient::Create() { |
| 397 return new BluetoothDeviceClientImpl(); | 375 return new BluetoothDeviceClientImpl(); |
| 398 } | 376 } |
| 399 | 377 |
| 400 } // namespace chromeos | 378 } // namespace bluez |
| OLD | NEW |