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 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // and removed from the user. | 160 // and removed from the user. |
161 virtual void DismissDisplayOrConfirm() = 0; | 161 virtual void DismissDisplayOrConfirm() = 0; |
162 }; | 162 }; |
163 | 163 |
164 // Returns true if uuid is in a a valid canonical format | 164 // Returns true if uuid is in a a valid canonical format |
165 // (see utils::CanonicalUuid). | 165 // (see utils::CanonicalUuid). |
166 static bool IsUUIDValid(const std::string& uuid); | 166 static bool IsUUIDValid(const std::string& uuid); |
167 | 167 |
168 virtual ~BluetoothDevice(); | 168 virtual ~BluetoothDevice(); |
169 | 169 |
| 170 // Returns the Bluetooth class of the device, used by GetDeviceType() |
| 171 // and metrics logging, |
| 172 virtual uint32 GetBluetoothClass() const = 0; |
| 173 |
170 // Returns the Bluetooth of address the device. This should be used as | 174 // Returns the Bluetooth of address the device. This should be used as |
171 // a unique key to identify the device and copied where needed. | 175 // a unique key to identify the device and copied where needed. |
172 virtual std::string GetAddress() const = 0; | 176 virtual std::string GetAddress() const = 0; |
173 | 177 |
| 178 // Returns the Vendor ID of the device, where available. |
| 179 virtual uint16 GetVendorID() const = 0; |
| 180 |
| 181 // Returns the Product ID of the device, where available. |
| 182 virtual uint16 GetProductID() const = 0; |
| 183 |
| 184 // Returns the Device ID of the device, typically the release or version |
| 185 // number in BCD format, where available. |
| 186 virtual uint16 GetDeviceID() const = 0; |
| 187 |
174 // Returns the name of the device suitable for displaying, this may | 188 // Returns the name of the device suitable for displaying, this may |
175 // be a synthesied string containing the address and localized type name | 189 // be a synthesied string containing the address and localized type name |
176 // if the device has no obtained name. | 190 // if the device has no obtained name. |
177 virtual string16 GetName() const; | 191 virtual string16 GetName() const; |
178 | 192 |
179 // Returns the type of the device, limited to those we support or are | 193 // Returns the type of the device, limited to those we support or are |
180 // aware of, by decoding the bluetooth class information. The returned | 194 // aware of, by decoding the bluetooth class information. The returned |
181 // values are unique, and do not overlap, so DEVICE_KEYBOARD is not also | 195 // values are unique, and do not overlap, so DEVICE_KEYBOARD is not also |
182 // DEVICE_PERIPHERAL. | 196 // DEVICE_PERIPHERAL. |
183 DeviceType GetDeviceType() const; | 197 DeviceType GetDeviceType() const; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 351 |
338 // Clears the Out Of Band pairing data for this device. Exactly one of | 352 // Clears the Out Of Band pairing data for this device. Exactly one of |
339 // |callback| or |error_callback| will be run. | 353 // |callback| or |error_callback| will be run. |
340 virtual void ClearOutOfBandPairingData( | 354 virtual void ClearOutOfBandPairingData( |
341 const base::Closure& callback, | 355 const base::Closure& callback, |
342 const ErrorCallback& error_callback) = 0; | 356 const ErrorCallback& error_callback) = 0; |
343 | 357 |
344 protected: | 358 protected: |
345 BluetoothDevice(); | 359 BluetoothDevice(); |
346 | 360 |
347 // Returns the Bluetooth class of the device, used by GetDeviceType(). | |
348 virtual uint32 GetBluetoothClass() const = 0; | |
349 | |
350 // Returns the internal name of the Bluetooth device, used by GetName(). | 361 // Returns the internal name of the Bluetooth device, used by GetName(). |
351 virtual std::string GetDeviceName() const = 0; | 362 virtual std::string GetDeviceName() const = 0; |
352 | 363 |
353 private: | 364 private: |
354 // Returns a localized string containing the device's bluetooth address and | 365 // Returns a localized string containing the device's bluetooth address and |
355 // a device type for display when |name_| is empty. | 366 // a device type for display when |name_| is empty. |
356 string16 GetAddressWithLocalizedDeviceTypeName() const; | 367 string16 GetAddressWithLocalizedDeviceTypeName() const; |
357 }; | 368 }; |
358 | 369 |
359 } // namespace device | 370 } // namespace device |
360 | 371 |
361 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 372 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |