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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ERROR_UNKNOWN, | 90 ERROR_UNKNOWN, |
91 ERROR_INPROGRESS, | 91 ERROR_INPROGRESS, |
92 ERROR_FAILED, | 92 ERROR_FAILED, |
93 ERROR_AUTH_FAILED, | 93 ERROR_AUTH_FAILED, |
94 ERROR_AUTH_CANCELED, | 94 ERROR_AUTH_CANCELED, |
95 ERROR_AUTH_REJECTED, | 95 ERROR_AUTH_REJECTED, |
96 ERROR_AUTH_TIMEOUT, | 96 ERROR_AUTH_TIMEOUT, |
97 ERROR_UNSUPPORTED_DEVICE | 97 ERROR_UNSUPPORTED_DEVICE |
98 }; | 98 }; |
99 | 99 |
| 100 typedef std::vector<BluetoothUUID> UUIDList; |
| 101 |
100 // Interface for negotiating pairing of bluetooth devices. | 102 // Interface for negotiating pairing of bluetooth devices. |
101 class PairingDelegate { | 103 class PairingDelegate { |
102 public: | 104 public: |
103 virtual ~PairingDelegate() {} | 105 virtual ~PairingDelegate() {} |
104 | 106 |
105 // This method will be called when the Bluetooth daemon requires a | 107 // This method will be called when the Bluetooth daemon requires a |
106 // PIN Code for authentication of the device |device|, the delegate should | 108 // PIN Code for authentication of the device |device|, the delegate should |
107 // obtain the code from the user and call SetPinCode() on the device to | 109 // obtain the code from the user and call SetPinCode() on the device to |
108 // provide it, or RejectPairing() or CancelPairing() to reject or cancel | 110 // provide it, or RejectPairing() or CancelPairing() to reject or cancel |
109 // the request. | 111 // the request. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 virtual bool IsConnecting() const = 0; | 249 virtual bool IsConnecting() const = 0; |
248 | 250 |
249 // Indicates whether the device can be trusted, based on device properties, | 251 // Indicates whether the device can be trusted, based on device properties, |
250 // such as vendor and product id. | 252 // such as vendor and product id. |
251 bool IsTrustable() const; | 253 bool IsTrustable() const; |
252 | 254 |
253 // Returns the set of UUIDs that this device supports. For classic Bluetooth | 255 // Returns the set of UUIDs that this device supports. For classic Bluetooth |
254 // devices this data is collected from both the EIR data and SDP tables, | 256 // devices this data is collected from both the EIR data and SDP tables, |
255 // for Low Energy devices this data is collected from AD and GATT primary | 257 // for Low Energy devices this data is collected from AD and GATT primary |
256 // services, for dual mode devices this may be collected from both./ | 258 // services, for dual mode devices this may be collected from both./ |
257 typedef std::vector<BluetoothUUID> UUIDList; | |
258 virtual UUIDList GetUUIDs() const = 0; | 259 virtual UUIDList GetUUIDs() const = 0; |
259 | 260 |
260 // The ErrorCallback is used for methods that can fail in which case it | 261 // The ErrorCallback is used for methods that can fail in which case it |
261 // is called, in the success case the callback is simply not called. | 262 // is called, in the success case the callback is simply not called. |
262 typedef base::Callback<void()> ErrorCallback; | 263 typedef base::Callback<void()> ErrorCallback; |
263 | 264 |
264 // The ConnectErrorCallback is used for methods that can fail with an error, | 265 // The ConnectErrorCallback is used for methods that can fail with an error, |
265 // passed back as an error code argument to this callback. | 266 // passed back as an error code argument to this callback. |
266 // In the success case this callback is not called. | 267 // In the success case this callback is not called. |
267 typedef base::Callback<void(enum ConnectErrorCode)> ConnectErrorCallback; | 268 typedef base::Callback<void(enum ConnectErrorCode)> ConnectErrorCallback; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 443 |
443 private: | 444 private: |
444 // Returns a localized string containing the device's bluetooth address and | 445 // Returns a localized string containing the device's bluetooth address and |
445 // a device type for display when |name_| is empty. | 446 // a device type for display when |name_| is empty. |
446 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 447 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
447 }; | 448 }; |
448 | 449 |
449 } // namespace device | 450 } // namespace device |
450 | 451 |
451 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 452 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |