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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Possible values that may be returned by GetVendorIDSource(), | 54 // Possible values that may be returned by GetVendorIDSource(), |
55 // indicating different organisations that allocate the identifiers returned | 55 // indicating different organisations that allocate the identifiers returned |
56 // by GetVendorID(). | 56 // by GetVendorID(). |
57 enum VendorIDSource { | 57 enum VendorIDSource { |
58 VENDOR_ID_UNKNOWN, | 58 VENDOR_ID_UNKNOWN, |
59 VENDOR_ID_BLUETOOTH, | 59 VENDOR_ID_BLUETOOTH, |
60 VENDOR_ID_USB, | 60 VENDOR_ID_USB, |
61 VENDOR_ID_MAX_VALUE = VENDOR_ID_USB | 61 VENDOR_ID_MAX_VALUE = VENDOR_ID_USB |
62 }; | 62 }; |
63 | 63 |
64 // Possible values that may be returned by GetDeviceType(), representing | |
65 // different types of bluetooth device that we support or are aware of | |
66 // decoded from the bluetooth class information. | |
67 enum DeviceType { | |
68 DEVICE_UNKNOWN, | |
69 DEVICE_COMPUTER, | |
70 DEVICE_PHONE, | |
71 DEVICE_MODEM, | |
72 DEVICE_AUDIO, | |
73 DEVICE_CAR_AUDIO, | |
74 DEVICE_VIDEO, | |
75 DEVICE_PERIPHERAL, | |
76 DEVICE_JOYSTICK, | |
77 DEVICE_GAMEPAD, | |
78 DEVICE_KEYBOARD, | |
79 DEVICE_MOUSE, | |
80 DEVICE_TABLET, | |
81 DEVICE_KEYBOARD_MOUSE_COMBO | |
82 }; | |
83 | |
84 // The value returned if the RSSI or transmit power cannot be read. | 64 // The value returned if the RSSI or transmit power cannot be read. |
85 static const int kUnknownPower = 127; | 65 static const int kUnknownPower = 127; |
86 // The value returned if the appearance is not present. | 66 // The value returned if the appearance is not present. |
87 static const uint16_t kAppearanceNotPresent = 0xffc0; | 67 static const uint16_t kAppearanceNotPresent = 0xffc0; |
88 | 68 |
89 struct DEVICE_BLUETOOTH_EXPORT ConnectionInfo { | 69 struct DEVICE_BLUETOOTH_EXPORT ConnectionInfo { |
90 int rssi; | 70 int rssi; |
91 int transmit_power; | 71 int transmit_power; |
92 int max_transmit_power; | 72 int max_transmit_power; |
93 | 73 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 243 |
264 // Returns the type of the device, limited to those we support or are | 244 // Returns the type of the device, limited to those we support or are |
265 // aware of, by decoding the bluetooth class information. The returned | 245 // aware of, by decoding the bluetooth class information. The returned |
266 // values are unique, and do not overlap, so DEVICE_KEYBOARD is not also | 246 // values are unique, and do not overlap, so DEVICE_KEYBOARD is not also |
267 // DEVICE_PERIPHERAL. | 247 // DEVICE_PERIPHERAL. |
268 // | 248 // |
269 // Returns the type of the device, limited to those we support or are aware | 249 // Returns the type of the device, limited to those we support or are aware |
270 // of, by decoding the bluetooth class information for Classic devices or | 250 // of, by decoding the bluetooth class information for Classic devices or |
271 // by decoding the device's appearance for LE devices. For example, | 251 // by decoding the device's appearance for LE devices. For example, |
272 // Microsoft Universal Foldable Keyboard only advertises the appearance. | 252 // Microsoft Universal Foldable Keyboard only advertises the appearance. |
273 DeviceType GetDeviceType() const; | 253 BluetoothDeviceType GetDeviceType() const; |
274 | 254 |
275 // Indicates whether the device is known to support pairing based on its | 255 // Indicates whether the device is known to support pairing based on its |
276 // device class and address. | 256 // device class and address. |
277 bool IsPairable() const; | 257 bool IsPairable() const; |
278 | 258 |
279 // Indicates whether the device is paired with the adapter. | 259 // Indicates whether the device is paired with the adapter. |
280 // On Chrome OS this function also returns true if the user has connected | 260 // On Chrome OS this function also returns true if the user has connected |
281 // to the device in the past. | 261 // to the device in the past. |
282 // TODO(crbug.com/649651): Change Chrome OS to only return true if the | 262 // TODO(crbug.com/649651): Change Chrome OS to only return true if the |
283 // device is actually paired. | 263 // device is actually paired. |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 627 |
648 private: | 628 private: |
649 // Returns a localized string containing the device's bluetooth address and | 629 // Returns a localized string containing the device's bluetooth address and |
650 // a device type for display when |name_| is empty. | 630 // a device type for display when |name_| is empty. |
651 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 631 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
652 }; | 632 }; |
653 | 633 |
654 } // namespace device | 634 } // namespace device |
655 | 635 |
656 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 636 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |