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