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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" |
9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
10 #include "dbus/bus.h" | 11 #include "dbus/bus.h" |
11 #include "dbus/message.h" | 12 #include "dbus/message.h" |
12 #include "dbus/object_manager.h" | 13 #include "dbus/object_manager.h" |
13 #include "dbus/object_proxy.h" | 14 #include "dbus/object_proxy.h" |
14 #include "third_party/cros_system_api/dbus/service_constants.h" | 15 #include "third_party/cros_system_api/dbus/service_constants.h" |
15 | 16 |
16 namespace bluez { | 17 namespace bluez { |
17 | 18 |
18 namespace { | 19 namespace { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 313 |
313 // Called when a response for successful method call is received. | 314 // Called when a response for successful method call is received. |
314 void OnSuccess(const base::Closure& callback, dbus::Response* response) { | 315 void OnSuccess(const base::Closure& callback, dbus::Response* response) { |
315 DCHECK(response); | 316 DCHECK(response); |
316 callback.Run(); | 317 callback.Run(); |
317 } | 318 } |
318 | 319 |
319 // Called when a response for the GetConnInfo method is received. | 320 // Called when a response for the GetConnInfo method is received. |
320 void OnGetConnInfoSuccess(const ConnInfoCallback& callback, | 321 void OnGetConnInfoSuccess(const ConnInfoCallback& callback, |
321 dbus::Response* response) { | 322 dbus::Response* response) { |
322 int16 rssi = kUnknownPower; | 323 int16_t rssi = kUnknownPower; |
323 int16 transmit_power = kUnknownPower; | 324 int16_t transmit_power = kUnknownPower; |
324 int16 max_transmit_power = kUnknownPower; | 325 int16_t max_transmit_power = kUnknownPower; |
325 | 326 |
326 if (!response) { | 327 if (!response) { |
327 LOG(ERROR) << "GetConnInfo succeeded, but no response received."; | 328 LOG(ERROR) << "GetConnInfo succeeded, but no response received."; |
328 callback.Run(rssi, transmit_power, max_transmit_power); | 329 callback.Run(rssi, transmit_power, max_transmit_power); |
329 return; | 330 return; |
330 } | 331 } |
331 | 332 |
332 dbus::MessageReader reader(response); | 333 dbus::MessageReader reader(response); |
333 if (!reader.PopInt16(&rssi) || !reader.PopInt16(&transmit_power) || | 334 if (!reader.PopInt16(&rssi) || !reader.PopInt16(&transmit_power) || |
334 !reader.PopInt16(&max_transmit_power)) { | 335 !reader.PopInt16(&max_transmit_power)) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 371 |
371 BluetoothDeviceClient::BluetoothDeviceClient() {} | 372 BluetoothDeviceClient::BluetoothDeviceClient() {} |
372 | 373 |
373 BluetoothDeviceClient::~BluetoothDeviceClient() {} | 374 BluetoothDeviceClient::~BluetoothDeviceClient() {} |
374 | 375 |
375 BluetoothDeviceClient* BluetoothDeviceClient::Create() { | 376 BluetoothDeviceClient* BluetoothDeviceClient::Create() { |
376 return new BluetoothDeviceClientImpl(); | 377 return new BluetoothDeviceClientImpl(); |
377 } | 378 } |
378 | 379 |
379 } // namespace bluez | 380 } // namespace bluez |
OLD | NEW |