| 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" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // be ignored. | 89 // be ignored. |
| 90 void EndPairing(); | 90 void EndPairing(); |
| 91 | 91 |
| 92 // Returns the current pairing object or NULL if no pairing is in progress. | 92 // Returns the current pairing object or NULL if no pairing is in progress. |
| 93 BluetoothPairingChromeOS* GetPairing() const; | 93 BluetoothPairingChromeOS* GetPairing() const; |
| 94 | 94 |
| 95 // Returns the object path of the device. | 95 // Returns the object path of the device. |
| 96 const dbus::ObjectPath& object_path() const { return object_path_; } | 96 const dbus::ObjectPath& object_path() const { return object_path_; } |
| 97 | 97 |
| 98 // Returns the adapter which owns this device instance. | 98 // Returns the adapter which owns this device instance. |
| 99 BluetoothAdapterChromeOS* adapter() const { return adapter_; } | 99 BluetoothAdapterChromeOS* adapter() const; |
| 100 | 100 |
| 101 protected: | 101 protected: |
| 102 // BluetoothDevice override | 102 // BluetoothDevice override |
| 103 std::string GetDeviceName() const override; | 103 std::string GetDeviceName() const override; |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 friend class BluetoothAdapterChromeOS; | 106 friend class BluetoothAdapterChromeOS; |
| 107 | 107 |
| 108 BluetoothDeviceChromeOS( | 108 BluetoothDeviceChromeOS( |
| 109 BluetoothAdapterChromeOS* adapter, | 109 BluetoothAdapterChromeOS* adapter, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 const std::string& error_name, | 166 const std::string& error_name, |
| 167 const std::string& error_message); | 167 const std::string& error_message); |
| 168 | 168 |
| 169 // Called by dbus:: on failure of the D-Bus method call to unpair the device; | 169 // Called by dbus:: on failure of the D-Bus method call to unpair the device; |
| 170 // there is no matching completion call since this object is deleted in the | 170 // there is no matching completion call since this object is deleted in the |
| 171 // process of unpairing. | 171 // process of unpairing. |
| 172 void OnForgetError(const ErrorCallback& error_callback, | 172 void OnForgetError(const ErrorCallback& error_callback, |
| 173 const std::string& error_name, | 173 const std::string& error_name, |
| 174 const std::string& error_message); | 174 const std::string& error_message); |
| 175 | 175 |
| 176 // The adapter that owns this device instance. | |
| 177 BluetoothAdapterChromeOS* adapter_; | |
| 178 | |
| 179 // The dbus object path of the device object. | 176 // The dbus object path of the device object. |
| 180 dbus::ObjectPath object_path_; | 177 dbus::ObjectPath object_path_; |
| 181 | 178 |
| 182 // Number of ongoing calls to Connect(). | 179 // Number of ongoing calls to Connect(). |
| 183 int num_connecting_calls_; | 180 int num_connecting_calls_; |
| 184 | 181 |
| 185 // True if the connection monitor has been started, tracking the connection | 182 // True if the connection monitor has been started, tracking the connection |
| 186 // RSSI and TX power. | 183 // RSSI and TX power. |
| 187 bool connection_monitor_started_; | 184 bool connection_monitor_started_; |
| 188 | 185 |
| 189 // UI thread task runner and socket thread object used to create sockets. | 186 // UI thread task runner and socket thread object used to create sockets. |
| 190 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 187 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 191 scoped_refptr<device::BluetoothSocketThread> socket_thread_; | 188 scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
| 192 | 189 |
| 193 // During pairing this is set to an object that we don't own, but on which | 190 // During pairing this is set to an object that we don't own, but on which |
| 194 // we can make method calls to request, display or confirm PIN Codes and | 191 // we can make method calls to request, display or confirm PIN Codes and |
| 195 // Passkeys. Generally it is the object that owns this one. | 192 // Passkeys. Generally it is the object that owns this one. |
| 196 scoped_ptr<BluetoothPairingChromeOS> pairing_; | 193 scoped_ptr<BluetoothPairingChromeOS> pairing_; |
| 197 | 194 |
| 198 // 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 |
| 199 // invalidate its weak pointers before any other members are destroyed. | 196 // invalidate its weak pointers before any other members are destroyed. |
| 200 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 197 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
| 201 | 198 |
| 202 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 199 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
| 203 }; | 200 }; |
| 204 | 201 |
| 205 } // namespace chromeos | 202 } // namespace chromeos |
| 206 | 203 |
| 207 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 204 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
| OLD | NEW |