| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // aware of, by decoding the bluetooth class information. The returned | 247 // aware of, by decoding the bluetooth class information. The returned |
| 248 // values are unique, and do not overlap, so DEVICE_KEYBOARD is not also | 248 // values are unique, and do not overlap, so DEVICE_KEYBOARD is not also |
| 249 // DEVICE_PERIPHERAL. | 249 // DEVICE_PERIPHERAL. |
| 250 // | 250 // |
| 251 // Returns the type of the device, limited to those we support or are aware | 251 // Returns the type of the device, limited to those we support or are aware |
| 252 // of, by decoding the bluetooth class information for Classic devices or | 252 // of, by decoding the bluetooth class information for Classic devices or |
| 253 // by decoding the device's appearance for LE devices. For example, | 253 // by decoding the device's appearance for LE devices. For example, |
| 254 // Microsoft Universal Foldable Keyboard only advertises the appearance. | 254 // Microsoft Universal Foldable Keyboard only advertises the appearance. |
| 255 BluetoothDeviceType GetDeviceType() const; | 255 BluetoothDeviceType GetDeviceType() const; |
| 256 | 256 |
| 257 // Indicates whether the device is known to support pairing based on its | |
| 258 // device class and address. | |
| 259 bool IsPairable() const; | |
| 260 | |
| 261 // Indicates whether the device is paired with the adapter. | 257 // Indicates whether the device is paired with the adapter. |
| 262 // On Chrome OS this function also returns true if the user has connected | |
| 263 // to the device in the past. | |
| 264 // TODO(crbug.com/649651): Change Chrome OS to only return true if the | |
| 265 // device is actually paired. | |
| 266 virtual bool IsPaired() const = 0; | 258 virtual bool IsPaired() const = 0; |
| 267 | 259 |
| 268 // Indicates whether the device is currently connected to the adapter. | 260 // Indicates whether the device is currently connected to the adapter. |
| 269 // Note that if IsConnected() is true, does not imply that the device is | 261 // Note that if IsConnected() is true, does not imply that the device is |
| 270 // connected to any application or service. If the device is not paired, it | 262 // connected to any application or service. If the device is not paired, it |
| 271 // could be still connected to the adapter for other reason, for example, to | 263 // could be still connected to the adapter for other reason, for example, to |
| 272 // request the adapter's SDP records. The same holds for paired devices, since | 264 // request the adapter's SDP records. The same holds for paired devices, since |
| 273 // they could be connected to the adapter but not to an application. | 265 // they could be connected to the adapter but not to an application. |
| 274 virtual bool IsConnected() const = 0; | 266 virtual bool IsConnected() const = 0; |
| 275 | 267 |
| 276 // Indicates whether an active GATT connection exists to the device. | 268 // Indicates whether an active GATT connection exists to the device. |
| 277 virtual bool IsGattConnected() const = 0; | 269 virtual bool IsGattConnected() const = 0; |
| 278 | 270 |
| 279 // Indicates whether the paired device accepts connections initiated from the | 271 // Indicates whether the paired device accepts connections initiated from the |
| 280 // adapter. This value is undefined for unpaired devices. | 272 // adapter. This value is undefined for unpaired devices. |
| 281 virtual bool IsConnectable() const = 0; | 273 virtual bool IsConnectable() const = 0; |
| 282 | 274 |
| 283 // Indicates whether there is a call to Connect() ongoing. For this attribute, | 275 // Indicates whether there is a call to Connect() ongoing. For this attribute, |
| 284 // we consider a call is ongoing if none of the callbacks passed to Connect() | 276 // we consider a call is ongoing if none of the callbacks passed to Connect() |
| 285 // were called after the corresponding call to Connect(). | 277 // were called after the corresponding call to Connect(). |
| 286 virtual bool IsConnecting() const = 0; | 278 virtual bool IsConnecting() const = 0; |
| 287 | 279 |
| 288 // Indicates whether the device can be trusted, based on device properties, | |
| 289 // such as vendor and product id. | |
| 290 bool IsTrustable() const; | |
| 291 | |
| 292 // Returns the set of UUIDs that this device supports. | 280 // Returns the set of UUIDs that this device supports. |
| 293 // * For classic Bluetooth devices this data is collected from both the EIR | 281 // * For classic Bluetooth devices this data is collected from both the EIR |
| 294 // data and SDP tables. | 282 // data and SDP tables. |
| 295 // * For non-connected Low Energy Devices this returns the latest advertised | 283 // * For non-connected Low Energy Devices this returns the latest advertised |
| 296 // UUIDs. | 284 // UUIDs. |
| 297 // * For connected Low Energy Devices for which services have not been | 285 // * For connected Low Energy Devices for which services have not been |
| 298 // discovered returns an empty list. | 286 // discovered returns an empty list. |
| 299 // * For connected Low Energy Devices for which services have been discovered | 287 // * For connected Low Energy Devices for which services have been discovered |
| 300 // returns the UUIDs of the device's services. | 288 // returns the UUIDs of the device's services. |
| 301 // * For dual mode devices this may be collected from both. | 289 // * For dual mode devices this may be collected from both. |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // Returns a localized string containing the device's bluetooth address and | 679 // Returns a localized string containing the device's bluetooth address and |
| 692 // a device type for display when |name_| is empty. | 680 // a device type for display when |name_| is empty. |
| 693 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 681 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
| 694 | 682 |
| 695 DISALLOW_COPY_AND_ASSIGN(BluetoothDevice); | 683 DISALLOW_COPY_AND_ASSIGN(BluetoothDevice); |
| 696 }; | 684 }; |
| 697 | 685 |
| 698 } // namespace device | 686 } // namespace device |
| 699 | 687 |
| 700 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 688 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |