Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: device/bluetooth/bluetooth_device_experimental_chromeos.cc

Issue 14048007: Bluetooth: D-Bus client interface for org.bluez.Input1 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: interface deletion order fixed. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/bluetooth_device_experimental_chromeos.h" 5 #include "device/bluetooth/bluetooth_device_experimental_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chromeos/dbus/dbus_thread_manager.h" 8 #include "chromeos/dbus/dbus_thread_manager.h"
9 #include "chromeos/dbus/experimental_bluetooth_adapter_client.h" 9 #include "chromeos/dbus/experimental_bluetooth_adapter_client.h"
10 #include "chromeos/dbus/experimental_bluetooth_agent_manager_client.h" 10 #include "chromeos/dbus/experimental_bluetooth_agent_manager_client.h"
11 #include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h" 11 #include "chromeos/dbus/experimental_bluetooth_agent_service_provider.h"
12 #include "chromeos/dbus/experimental_bluetooth_device_client.h" 12 #include "chromeos/dbus/experimental_bluetooth_device_client.h"
13 #include "chromeos/dbus/experimental_bluetooth_input_client.h"
13 #include "dbus/bus.h" 14 #include "dbus/bus.h"
14 #include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h" 15 #include "device/bluetooth/bluetooth_adapter_experimental_chromeos.h"
15 #include "device/bluetooth/bluetooth_socket.h" 16 #include "device/bluetooth/bluetooth_socket.h"
16 #include "third_party/cros_system_api/dbus/service_constants.h" 17 #include "third_party/cros_system_api/dbus/service_constants.h"
17 18
18 using device::BluetoothDevice; 19 using device::BluetoothDevice;
19 20
20 namespace { 21 namespace {
21 22
22 // The agent path is relatively meaningless since BlueZ only supports one 23 // The agent path is relatively meaningless since BlueZ only supports one
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 bool BluetoothDeviceExperimentalChromeOS::IsConnected() const { 84 bool BluetoothDeviceExperimentalChromeOS::IsConnected() const {
84 ExperimentalBluetoothDeviceClient::Properties* properties = 85 ExperimentalBluetoothDeviceClient::Properties* properties =
85 DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> 86 DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()->
86 GetProperties(object_path_); 87 GetProperties(object_path_);
87 DCHECK(properties); 88 DCHECK(properties);
88 89
89 return properties->connected.value(); 90 return properties->connected.value();
90 } 91 }
91 92
92 bool BluetoothDeviceExperimentalChromeOS::IsConnectable() const { 93 bool BluetoothDeviceExperimentalChromeOS::IsConnectable() const {
93 // TODO(deymo): implement 94 ExperimentalBluetoothInputClient::Properties* input_properties =
94 return false; 95 DBusThreadManager::Get()->GetExperimentalBluetoothInputClient()->
96 GetProperties(object_path_);
97 // GetProperties returns NULL when the device does not implement the given
98 // interface. Non HID devices are normally connectable.
99 if (!input_properties)
100 return true;
101
102 return input_properties->reconnect_mode.value() != "device";
95 } 103 }
96 104
97 bool BluetoothDeviceExperimentalChromeOS::IsConnecting() const { 105 bool BluetoothDeviceExperimentalChromeOS::IsConnecting() const {
98 return num_connecting_calls_ > 0; 106 return num_connecting_calls_ > 0;
99 } 107 }
100 108
101 BluetoothDeviceExperimentalChromeOS::ServiceList 109 BluetoothDeviceExperimentalChromeOS::ServiceList
102 BluetoothDeviceExperimentalChromeOS::GetServices() const { 110 BluetoothDeviceExperimentalChromeOS::GetServices() const {
103 ExperimentalBluetoothDeviceClient::Properties* properties = 111 ExperimentalBluetoothDeviceClient::Properties* properties =
104 DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()-> 112 DBusThreadManager::Get()->GetExperimentalBluetoothDeviceClient()->
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 if (!confirmation_callback_.is_null()) { 611 if (!confirmation_callback_.is_null()) {
604 confirmation_callback_.Run(status); 612 confirmation_callback_.Run(status);
605 confirmation_callback_.Reset(); 613 confirmation_callback_.Reset();
606 callback_run = true; 614 callback_run = true;
607 } 615 }
608 616
609 return callback_run; 617 return callback_run;
610 } 618 }
611 619
612 } // namespace chromeos 620 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/mock_dbus_thread_manager_without_gmock.cc ('k') | device/bluetooth/bluetooth_experimental_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698