summaryrefslogtreecommitdiffstats
path: root/device/bluetooth/bluetooth_device.h
diff options
context:
space:
mode:
authorjosephsih <josephsih@chromium.org>2016-02-24 02:17:23 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-24 10:18:54 +0000
commit098a1cd80c1398b4bea2c1bc83c5dca686b5b42d (patch)
tree8551038fb7319e42b419d444651827ead956a6a5 /device/bluetooth/bluetooth_device.h
parent3f96177578cf0511174d42546a70660cc8d6eeeb (diff)
downloadchromium_src-098a1cd80c1398b4bea2c1bc83c5dca686b5b42d.zip
chromium_src-098a1cd80c1398b4bea2c1bc83c5dca686b5b42d.tar.gz
chromium_src-098a1cd80c1398b4bea2c1bc83c5dca686b5b42d.tar.bz2
Determine device type via bluetooth appearance in OOBE
In OOBE, the device type is determined exclusively based on the bluetooth class. However, some keyboards do not advertise the bluetooth class. Instead, the bluetooth appearance is advertised. This patch utilizes the bluetooth appearance to determine the device type if the bluetooth class information is missing. Note that this patch only takes effect on keyboard-less devices such as Mickey and Monroe. BUG=578337, 546616 TEST=Execute the steps below: 1. Let a keyboard-less device boot into OOBE. 2. Unfold Microsoft Universal Foldable Keyboard to power it on. 3. Press Func 1 key on the keyboard for a few seconds until its back light begins blinking. 4. Press "OS" key on the top right corner a few times until Android logo lights on. 3. Observe the pairing takes effect and asks the user to type the pin code. (Without this patch, the pairing never takes effect since the particular keyboard is not considered as a keyboard.) Review URL: https://codereview.chromium.org/1656253002 Cr-Commit-Position: refs/heads/master@{#377257}
Diffstat (limited to 'device/bluetooth/bluetooth_device.h')
-rw-r--r--device/bluetooth/bluetooth_device.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index 2bf6f35..82cc1ce 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -78,6 +78,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// The value returned if the RSSI or transmit power cannot be read.
static const int kUnknownPower = 127;
+ // The value returned if the appearance is not present.
+ static const uint16_t kAppearanceNotPresent = 0xffc0;
struct DEVICE_BLUETOOTH_EXPORT ConnectionInfo {
int rssi;
@@ -223,6 +225,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// number in BCD format, where available.
virtual uint16_t GetDeviceID() const = 0;
+ // Returns the appearance of the device.
+ virtual uint16_t GetAppearance() const = 0;
+
// Returns the name of the device suitable for displaying, this may
// be a synthesized string containing the address and localized type name
// if the device has no obtained name.
@@ -232,6 +237,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// aware of, by decoding the bluetooth class information. The returned
// values are unique, and do not overlap, so DEVICE_KEYBOARD is not also
// DEVICE_PERIPHERAL.
+ //
+ // Returns the type of the device, limited to those we support or are aware
+ // of, by decoding the bluetooth class information for Classic devices or
+ // by decoding the device's appearance for LE devices. For example,
+ // Microsoft Universal Foldable Keyboard only advertises the appearance.
DeviceType GetDeviceType() const;
// Indicates whether the device is known to support pairing based on its