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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "chromeos/dbus/bluetooth_device_client.h" | |
15 #include "chromeos/dbus/bluetooth_gatt_service_client.h" | |
16 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
17 #include "device/bluetooth/bluetooth_device.h" | 15 #include "device/bluetooth/bluetooth_device.h" |
18 #include "device/bluetooth/bluetooth_export.h" | 16 #include "device/bluetooth/bluetooth_export.h" |
| 17 #include "device/bluetooth/dbus/bluetooth_device_client.h" |
| 18 #include "device/bluetooth/dbus/bluetooth_gatt_service_client.h" |
19 | 19 |
20 namespace device { | 20 namespace device { |
21 class BluetoothSocketThread; | 21 class BluetoothSocketThread; |
22 } // namespace device | 22 } // namespace device |
23 | 23 |
24 namespace chromeos { | 24 namespace chromeos { |
25 | 25 |
26 class BluetoothAdapterChromeOS; | 26 class BluetoothAdapterChromeOS; |
27 class BluetoothPairingChromeOS; | 27 class BluetoothPairingChromeOS; |
28 | 28 |
29 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the | 29 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the |
30 // Chrome OS platform. | 30 // Chrome OS platform. |
31 // | 31 // |
32 // This class is not thread-safe, but is only called from the UI thread. | 32 // This class is not thread-safe, but is only called from the UI thread. |
33 // | 33 // |
34 // A socket thread is used to create sockets but posts all callbacks on the UI | 34 // A socket thread is used to create sockets but posts all callbacks on the UI |
35 // thread. | 35 // thread. |
36 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS | 36 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS |
37 : public device::BluetoothDevice, | 37 : public device::BluetoothDevice, |
38 public BluetoothGattServiceClient::Observer { | 38 public bluez::BluetoothGattServiceClient::Observer { |
39 public: | 39 public: |
40 // BluetoothDevice override | 40 // BluetoothDevice override |
41 uint32 GetBluetoothClass() const override; | 41 uint32 GetBluetoothClass() const override; |
42 std::string GetAddress() const override; | 42 std::string GetAddress() const override; |
43 VendorIDSource GetVendorIDSource() const override; | 43 VendorIDSource GetVendorIDSource() const override; |
44 uint16 GetVendorID() const override; | 44 uint16 GetVendorID() const override; |
45 uint16 GetProductID() const override; | 45 uint16 GetProductID() const override; |
46 uint16 GetDeviceID() const override; | 46 uint16 GetDeviceID() const override; |
47 bool IsPaired() const override; | 47 bool IsPaired() const override; |
48 bool IsConnected() const override; | 48 bool IsConnected() const override; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 private: | 108 private: |
109 friend class BluetoothAdapterChromeOS; | 109 friend class BluetoothAdapterChromeOS; |
110 | 110 |
111 BluetoothDeviceChromeOS( | 111 BluetoothDeviceChromeOS( |
112 BluetoothAdapterChromeOS* adapter, | 112 BluetoothAdapterChromeOS* adapter, |
113 const dbus::ObjectPath& object_path, | 113 const dbus::ObjectPath& object_path, |
114 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 114 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
115 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 115 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
116 ~BluetoothDeviceChromeOS() override; | 116 ~BluetoothDeviceChromeOS() override; |
117 | 117 |
118 // BluetoothGattServiceClient::Observer overrides. | 118 // bluez::BluetoothGattServiceClient::Observer overrides. |
119 void GattServiceAdded(const dbus::ObjectPath& object_path) override; | 119 void GattServiceAdded(const dbus::ObjectPath& object_path) override; |
120 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; | 120 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; |
121 | 121 |
122 // Called by dbus:: on completion of the D-Bus method call to get the | 122 // Called by dbus:: on completion of the D-Bus method call to get the |
123 // connection attributes of the current connection to the device. | 123 // connection attributes of the current connection to the device. |
124 void OnGetConnInfo(const ConnectionInfoCallback& callback, | 124 void OnGetConnInfo(const ConnectionInfoCallback& callback, |
125 int16 rssi, | 125 int16 rssi, |
126 int16 transmit_power, | 126 int16 transmit_power, |
127 int16 max_transmit_power); | 127 int16 max_transmit_power); |
128 void OnGetConnInfoError(const ConnectionInfoCallback& callback, | 128 void OnGetConnInfoError(const ConnectionInfoCallback& callback, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Note: This should remain the last member so it'll be destroyed and | 198 // Note: This should remain the last member so it'll be destroyed and |
199 // invalidate its weak pointers before any other members are destroyed. | 199 // invalidate its weak pointers before any other members are destroyed. |
200 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 200 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
201 | 201 |
202 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 202 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
203 }; | 203 }; |
204 | 204 |
205 } // namespace chromeos | 205 } // namespace chromeos |
206 | 206 |
207 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 207 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
OLD | NEW |