OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 // Indicates whether the device is currently pairing and expecting | 235 // Indicates whether the device is currently pairing and expecting |
236 // confirmation of a displayed passkey. | 236 // confirmation of a displayed passkey. |
237 virtual bool ExpectingConfirmation() const = 0; | 237 virtual bool ExpectingConfirmation() const = 0; |
238 | 238 |
239 // SocketCallback is used by ConnectToService to return a BluetoothSocket to | 239 // SocketCallback is used by ConnectToService to return a BluetoothSocket to |
240 // the caller, or NULL if there was an error. The socket will remain open | 240 // the caller, or NULL if there was an error. The socket will remain open |
241 // until the last reference to the returned BluetoothSocket is released. | 241 // until the last reference to the returned BluetoothSocket is released. |
242 typedef base::Callback<void(scoped_refptr<BluetoothSocket>)> | 242 typedef base::Callback<void(scoped_refptr<BluetoothSocket>)> |
243 SocketCallback; | 243 SocketCallback; |
244 | 244 |
245 // Sets whether the device is visible to the owning adapter to |visible|. | |
246 virtual void SetVisible(bool visible); | |
247 | |
keybuk
2013/03/21 18:03:34
I was planning to remove this method from Chrome O
youngki
2013/03/21 18:43:28
Okay I removed SetVisible. I wasn't aware of your
keybuk
2013/03/21 18:46:25
Basically Visible is meaningless ;) it's used in C
youngki
2013/03/21 20:07:20
Agreed.
| |
245 // Initiates a connection to the device, pairing first if necessary. | 248 // Initiates a connection to the device, pairing first if necessary. |
246 // | 249 // |
247 // Method calls will be made on the supplied object |pairing_delegate| | 250 // Method calls will be made on the supplied object |pairing_delegate| |
248 // to indicate what display, and in response should make method calls | 251 // to indicate what display, and in response should make method calls |
249 // back to the device object. Not all devices require user responses | 252 // back to the device object. Not all devices require user responses |
250 // during pairing, so it is normal for |pairing_delegate| to receive no | 253 // during pairing, so it is normal for |pairing_delegate| to receive no |
251 // calls. To explicitly force a low-security connection without bonding, | 254 // calls. To explicitly force a low-security connection without bonding, |
252 // pass NULL, though this is ignored if the device is already paired. | 255 // pass NULL, though this is ignored if the device is already paired. |
253 // | 256 // |
254 // If the request fails, |error_callback| will be called; otherwise, | 257 // If the request fails, |error_callback| will be called; otherwise, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 const base::Closure& callback, | 320 const base::Closure& callback, |
318 const ErrorCallback& error_callback) = 0; | 321 const ErrorCallback& error_callback) = 0; |
319 | 322 |
320 // Clears the Out Of Band pairing data for this device. Exactly one of | 323 // Clears the Out Of Band pairing data for this device. Exactly one of |
321 // |callback| or |error_callback| will be run. | 324 // |callback| or |error_callback| will be run. |
322 virtual void ClearOutOfBandPairingData( | 325 virtual void ClearOutOfBandPairingData( |
323 const base::Closure& callback, | 326 const base::Closure& callback, |
324 const ErrorCallback& error_callback) = 0; | 327 const ErrorCallback& error_callback) = 0; |
325 | 328 |
326 protected: | 329 protected: |
327 BluetoothDevice(); | 330 BluetoothDevice(const std::string& name, |
331 const std::string& address, | |
332 uint32 bluetooth_class, | |
333 bool connected, | |
334 bool bonded); | |
328 | 335 |
329 // The Bluetooth class of the device, a bitmask that may be decoded using | 336 // The Bluetooth class of the device, a bitmask that may be decoded using |
330 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm | 337 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm |
331 uint32 bluetooth_class_; | 338 uint32 bluetooth_class_; |
332 | 339 |
333 // The name of the device, as supplied by the remote device. | 340 // The name of the device, as supplied by the remote device. |
334 std::string name_; | 341 std::string name_; |
335 | 342 |
336 // The Bluetooth address of the device. | 343 // The Bluetooth address of the device. |
337 std::string address_; | 344 std::string address_; |
(...skipping 16 matching lines...) Expand all Loading... | |
354 | 361 |
355 private: | 362 private: |
356 // Returns a localized string containing the device's bluetooth address and | 363 // Returns a localized string containing the device's bluetooth address and |
357 // a device type for display when |name_| is empty. | 364 // a device type for display when |name_| is empty. |
358 string16 GetAddressWithLocalizedDeviceTypeName() const; | 365 string16 GetAddressWithLocalizedDeviceTypeName() const; |
359 }; | 366 }; |
360 | 367 |
361 } // namespace device | 368 } // namespace device |
362 | 369 |
363 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 370 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |