| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 private: | 105 private: |
| 106 friend class BluetoothAdapterChromeOS; | 106 friend class BluetoothAdapterChromeOS; |
| 107 | 107 |
| 108 BluetoothDeviceChromeOS( | 108 BluetoothDeviceChromeOS( |
| 109 BluetoothAdapterChromeOS* adapter, | 109 BluetoothAdapterChromeOS* adapter, |
| 110 const dbus::ObjectPath& object_path, | 110 const dbus::ObjectPath& object_path, |
| 111 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 111 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 112 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 112 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
| 113 ~BluetoothDeviceChromeOS() override; | 113 ~BluetoothDeviceChromeOS() override; |
| 114 | 114 |
| 115 // BluetoothGattServiceClient::Observer overrides. | 115 // bluez::BluetoothGattServiceClient::Observer overrides. |
| 116 void GattServiceAdded(const dbus::ObjectPath& object_path) override; | 116 void GattServiceAdded(const dbus::ObjectPath& object_path) override; |
| 117 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; | 117 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; |
| 118 | 118 |
| 119 // Called by dbus:: on completion of the D-Bus method call to get the | 119 // Called by dbus:: on completion of the D-Bus method call to get the |
| 120 // connection attributes of the current connection to the device. | 120 // connection attributes of the current connection to the device. |
| 121 void OnGetConnInfo(const ConnectionInfoCallback& callback, | 121 void OnGetConnInfo(const ConnectionInfoCallback& callback, |
| 122 int16 rssi, | 122 int16 rssi, |
| 123 int16 transmit_power, | 123 int16 transmit_power, |
| 124 int16 max_transmit_power); | 124 int16 max_transmit_power); |
| 125 void OnGetConnInfoError(const ConnectionInfoCallback& callback, | 125 void OnGetConnInfoError(const ConnectionInfoCallback& callback, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // Note: This should remain the last member so it'll be destroyed and | 195 // Note: This should remain the last member so it'll be destroyed and |
| 196 // invalidate its weak pointers before any other members are destroyed. | 196 // invalidate its weak pointers before any other members are destroyed. |
| 197 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 197 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
| 198 | 198 |
| 199 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 199 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 } // namespace chromeos | 202 } // namespace chromeos |
| 203 | 203 |
| 204 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 204 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
| OLD | NEW |