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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const device::BluetoothUUID& uuid, | 75 const device::BluetoothUUID& uuid, |
76 const ConnectToServiceCallback& callback, | 76 const ConnectToServiceCallback& callback, |
77 const ConnectToServiceErrorCallback& error_callback) OVERRIDE; | 77 const ConnectToServiceErrorCallback& error_callback) OVERRIDE; |
78 virtual void SetOutOfBandPairingData( | 78 virtual void SetOutOfBandPairingData( |
79 const device::BluetoothOutOfBandPairingData& data, | 79 const device::BluetoothOutOfBandPairingData& data, |
80 const base::Closure& callback, | 80 const base::Closure& callback, |
81 const ErrorCallback& error_callback) OVERRIDE; | 81 const ErrorCallback& error_callback) OVERRIDE; |
82 virtual void ClearOutOfBandPairingData( | 82 virtual void ClearOutOfBandPairingData( |
83 const base::Closure& callback, | 83 const base::Closure& callback, |
84 const ErrorCallback& error_callback) OVERRIDE; | 84 const ErrorCallback& error_callback) OVERRIDE; |
| 85 virtual void StartConnectionMonitor( |
| 86 const base::Closure& callback, |
| 87 const ErrorCallback& error_callback) OVERRIDE; |
85 | 88 |
86 // Creates a pairing object with the given delegate |pairing_delegate| and | 89 // Creates a pairing object with the given delegate |pairing_delegate| and |
87 // establishes it as the pairing context for this device. All pairing-related | 90 // establishes it as the pairing context for this device. All pairing-related |
88 // method calls will be forwarded to this object until it is released. | 91 // method calls will be forwarded to this object until it is released. |
89 BluetoothPairingChromeOS* BeginPairing( | 92 BluetoothPairingChromeOS* BeginPairing( |
90 BluetoothDevice::PairingDelegate* pairing_delegate); | 93 BluetoothDevice::PairingDelegate* pairing_delegate); |
91 | 94 |
92 // Releases the current pairing object, any pairing-related method calls will | 95 // Releases the current pairing object, any pairing-related method calls will |
93 // be ignored. | 96 // be ignored. |
94 void EndPairing(); | 97 void EndPairing(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Called by dbus:: on completion of the D-Bus method call to | 166 // Called by dbus:: on completion of the D-Bus method call to |
164 // connect a peofile. | 167 // connect a peofile. |
165 void OnConnectProfile(device::BluetoothProfile* profile, | 168 void OnConnectProfile(device::BluetoothProfile* profile, |
166 const base::Closure& callback); | 169 const base::Closure& callback); |
167 void OnConnectProfileError( | 170 void OnConnectProfileError( |
168 device::BluetoothProfile* profile, | 171 device::BluetoothProfile* profile, |
169 const ConnectToProfileErrorCallback& error_callback, | 172 const ConnectToProfileErrorCallback& error_callback, |
170 const std::string& error_name, | 173 const std::string& error_name, |
171 const std::string& error_message); | 174 const std::string& error_message); |
172 | 175 |
| 176 // Called by dbus:: on completion of the D-Bus method call to start the |
| 177 // connection monitor. |
| 178 void OnStartConnectionMonitor(const base::Closure& callback); |
| 179 void OnStartConnectionMonitorError(const ErrorCallback& error_callback, |
| 180 const std::string& error_name, |
| 181 const std::string& error_message); |
| 182 |
173 // Returns the object path of the device; used by BluetoothAdapterChromeOS | 183 // Returns the object path of the device; used by BluetoothAdapterChromeOS |
174 const dbus::ObjectPath& object_path() const { return object_path_; } | 184 const dbus::ObjectPath& object_path() const { return object_path_; } |
175 | 185 |
176 // The adapter that owns this device instance. | 186 // The adapter that owns this device instance. |
177 BluetoothAdapterChromeOS* adapter_; | 187 BluetoothAdapterChromeOS* adapter_; |
178 | 188 |
179 // The dbus object path of the device object. | 189 // The dbus object path of the device object. |
180 dbus::ObjectPath object_path_; | 190 dbus::ObjectPath object_path_; |
181 | 191 |
182 // List of observers interested in event notifications from us. | 192 // List of observers interested in event notifications from us. |
183 ObserverList<device::BluetoothDevice::Observer> observers_; | 193 ObserverList<device::BluetoothDevice::Observer> observers_; |
184 | 194 |
185 // Number of ongoing calls to Connect(). | 195 // Number of ongoing calls to Connect(). |
186 int num_connecting_calls_; | 196 int num_connecting_calls_; |
187 | 197 |
| 198 // True if the connection monitor has been started, tracking the connection |
| 199 // RSSI and TX power. |
| 200 bool connection_monitor_started_; |
| 201 |
188 // UI thread task runner and socket thread object used to create sockets. | 202 // UI thread task runner and socket thread object used to create sockets. |
189 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 203 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
190 scoped_refptr<device::BluetoothSocketThread> socket_thread_; | 204 scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
191 | 205 |
192 // During pairing this is set to an object that we don't own, but on which | 206 // During pairing this is set to an object that we don't own, but on which |
193 // we can make method calls to request, display or confirm PIN Codes and | 207 // we can make method calls to request, display or confirm PIN Codes and |
194 // Passkeys. Generally it is the object that owns this one. | 208 // Passkeys. Generally it is the object that owns this one. |
195 scoped_ptr<BluetoothPairingChromeOS> pairing_; | 209 scoped_ptr<BluetoothPairingChromeOS> pairing_; |
196 | 210 |
197 // Note: This should remain the last member so it'll be destroyed and | 211 // Note: This should remain the last member so it'll be destroyed and |
198 // invalidate its weak pointers before any other members are destroyed. | 212 // invalidate its weak pointers before any other members are destroyed. |
199 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 213 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
200 | 214 |
201 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 215 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
202 }; | 216 }; |
203 | 217 |
204 } // namespace chromeos | 218 } // namespace chromeos |
205 | 219 |
206 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 220 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
OLD | NEW |