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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 257 // Indicates whether the device is known to support pairing based on its |
258 // device class and address. | 258 // device class and address. |
259 bool IsPairable() const; | 259 bool IsPairable() const; |
260 | 260 |
261 // Indicates whether the device is paired with the adapter. | 261 // 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; | 262 virtual bool IsPaired() const = 0; |
267 | 263 |
268 // Indicates whether the device is currently connected to the adapter. | 264 // Indicates whether the device is currently connected to the adapter. |
269 // Note that if IsConnected() is true, does not imply that the device is | 265 // 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 | 266 // 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 | 267 // 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 | 268 // 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. | 269 // they could be connected to the adapter but not to an application. |
274 virtual bool IsConnected() const = 0; | 270 virtual bool IsConnected() const = 0; |
275 | 271 |
276 // Indicates whether an active GATT connection exists to the device. | 272 // Indicates whether an active GATT connection exists to the device. |
277 virtual bool IsGattConnected() const = 0; | 273 virtual bool IsGattConnected() const = 0; |
278 | 274 |
279 // Indicates whether the paired device accepts connections initiated from the | 275 // Indicates whether the paired device accepts connections initiated from the |
280 // adapter. This value is undefined for unpaired devices. | 276 // adapter. This value is undefined for unpaired devices. |
281 virtual bool IsConnectable() const = 0; | 277 virtual bool IsConnectable() const = 0; |
282 | 278 |
283 // Indicates whether there is a call to Connect() ongoing. For this attribute, | 279 // 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() | 280 // we consider a call is ongoing if none of the callbacks passed to Connect() |
285 // were called after the corresponding call to Connect(). | 281 // were called after the corresponding call to Connect(). |
286 virtual bool IsConnecting() const = 0; | 282 virtual bool IsConnecting() const = 0; |
287 | 283 |
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. | 284 // Returns the set of UUIDs that this device supports. |
293 // * For classic Bluetooth devices this data is collected from both the EIR | 285 // * For classic Bluetooth devices this data is collected from both the EIR |
294 // data and SDP tables. | 286 // data and SDP tables. |
295 // * For non-connected Low Energy Devices this returns the latest advertised | 287 // * For non-connected Low Energy Devices this returns the latest advertised |
296 // UUIDs. | 288 // UUIDs. |
297 // * For connected Low Energy Devices for which services have not been | 289 // * For connected Low Energy Devices for which services have not been |
298 // discovered returns an empty list. | 290 // discovered returns an empty list. |
299 // * For connected Low Energy Devices for which services have been discovered | 291 // * For connected Low Energy Devices for which services have been discovered |
300 // returns the UUIDs of the device's services. | 292 // returns the UUIDs of the device's services. |
301 // * For dual mode devices this may be collected from both. | 293 // * 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 | 683 // Returns a localized string containing the device's bluetooth address and |
692 // a device type for display when |name_| is empty. | 684 // a device type for display when |name_| is empty. |
693 base::string16 GetAddressWithLocalizedDeviceTypeName() const; | 685 base::string16 GetAddressWithLocalizedDeviceTypeName() const; |
694 | 686 |
695 DISALLOW_COPY_AND_ASSIGN(BluetoothDevice); | 687 DISALLOW_COPY_AND_ASSIGN(BluetoothDevice); |
696 }; | 688 }; |
697 | 689 |
698 } // namespace device | 690 } // namespace device |
699 | 691 |
700 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 692 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |