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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void OnCancelPairingError(const std::string& error_name, | 139 void OnCancelPairingError(const std::string& error_name, |
140 const std::string& error_message); | 140 const std::string& error_message); |
141 | 141 |
142 // Internal method to set the device as trusted. Trusted devices can connect | 142 // Internal method to set the device as trusted. Trusted devices can connect |
143 // to us automatically, and we can connect to them after rebooting; it also | 143 // to us automatically, and we can connect to them after rebooting; it also |
144 // causes the device to be remembered by the stack even if not paired. | 144 // causes the device to be remembered by the stack even if not paired. |
145 // |success| to the callback indicates whether or not the request succeeded. | 145 // |success| to the callback indicates whether or not the request succeeded. |
146 void SetTrusted(); | 146 void SetTrusted(); |
147 void OnSetTrusted(bool success); | 147 void OnSetTrusted(bool success); |
148 | 148 |
| 149 // Internal method to enable the connection monitor when connecting to this |
| 150 // device. The connection monitor mode tracks the connection RSSI and TX |
| 151 // power of the connection. |
| 152 void StartConnectionMonitor(); |
| 153 void OnStartConnectionMonitor(); |
| 154 void OnStartConnectionMonitorError(const std::string& error_name, |
| 155 const std::string& error_message); |
| 156 |
149 // Called by dbus:: on completion of the D-Bus method call to disconnect the | 157 // Called by dbus:: on completion of the D-Bus method call to disconnect the |
150 // device. | 158 // device. |
151 void OnDisconnect(const base::Closure& callback); | 159 void OnDisconnect(const base::Closure& callback); |
152 void OnDisconnectError(const ErrorCallback& error_callback, | 160 void OnDisconnectError(const ErrorCallback& error_callback, |
153 const std::string& error_name, | 161 const std::string& error_name, |
154 const std::string& error_message); | 162 const std::string& error_message); |
155 | 163 |
156 // Called by dbus:: on failure of the D-Bus method call to unpair the device; | 164 // Called by dbus:: on failure of the D-Bus method call to unpair the device; |
157 // there is no matching completion call since this object is deleted in the | 165 // there is no matching completion call since this object is deleted in the |
158 // process of unpairing. | 166 // process of unpairing. |
(...skipping 19 matching lines...) Expand all Loading... |
178 | 186 |
179 // The dbus object path of the device object. | 187 // The dbus object path of the device object. |
180 dbus::ObjectPath object_path_; | 188 dbus::ObjectPath object_path_; |
181 | 189 |
182 // List of observers interested in event notifications from us. | 190 // List of observers interested in event notifications from us. |
183 ObserverList<device::BluetoothDevice::Observer> observers_; | 191 ObserverList<device::BluetoothDevice::Observer> observers_; |
184 | 192 |
185 // Number of ongoing calls to Connect(). | 193 // Number of ongoing calls to Connect(). |
186 int num_connecting_calls_; | 194 int num_connecting_calls_; |
187 | 195 |
| 196 // True if the connection monitor has been started, tracking the connection |
| 197 // RSSI and TX power. |
| 198 bool connection_monitor_started_; |
| 199 |
188 // UI thread task runner and socket thread object used to create sockets. | 200 // UI thread task runner and socket thread object used to create sockets. |
189 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 201 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
190 scoped_refptr<device::BluetoothSocketThread> socket_thread_; | 202 scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
191 | 203 |
192 // During pairing this is set to an object that we don't own, but on which | 204 // 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 | 205 // we can make method calls to request, display or confirm PIN Codes and |
194 // Passkeys. Generally it is the object that owns this one. | 206 // Passkeys. Generally it is the object that owns this one. |
195 scoped_ptr<BluetoothPairingChromeOS> pairing_; | 207 scoped_ptr<BluetoothPairingChromeOS> pairing_; |
196 | 208 |
197 // Note: This should remain the last member so it'll be destroyed and | 209 // Note: This should remain the last member so it'll be destroyed and |
198 // invalidate its weak pointers before any other members are destroyed. | 210 // invalidate its weak pointers before any other members are destroyed. |
199 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 211 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
200 | 212 |
201 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 213 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
202 }; | 214 }; |
203 | 215 |
204 } // namespace chromeos | 216 } // namespace chromeos |
205 | 217 |
206 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 218 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
OLD | NEW |