Bluetooth Low Energy Device, discovered by the BluetoothLeManager component. More...
| Import Statement: | import Felgo 4.0 |
| Since: | Felgo 3.7.0 |
General info and usage examples for Bluetooth LE: Use Bluetooth Low Energy
Bluetooth Low Energy Services for the device are exposed in the QVariantList services property, and can only be used after service discovery has finished, which is triggered by calling the BluetoothLeDevice::connect() method.
The only notified property apart from services is the RSSI signal strength. The value is updated while discovery is running, including continuous discovery mode, making it usable for distance estimation scenarios such as indoor location.
|
Error : enumeration |
Indicates all possible error conditions found during the connection and the underlying controller's existence.
BluetoothLeDevice.NoError No error has occurred.BluetoothLeDevice.UnknownError An unknown error has occurred.BluetoothLeDevice.UnknownRemoteDeviceError The remote Bluetooth Low Energy device with the address passed to the constructor of this class cannot be found.BluetoothLeDevice.NetworkError The attempt to read from or write to the remote device failed.BluetoothLeDevice.InvalidBluetoothAdapterError The local Bluetooth device with the address passed to the constructor of this class cannot be found or there is no local Bluetooth device.BluetoothLeDevice.ConnectionError The attempt to connect to the remote device failed.BluetoothLeDevice.AdvertisingError The attempt to start advertising failed.BluetoothLeDevice.RemoteHostClosedError The remote device closed the connection.BluetoothLeDevice.AuthorizationError The local Bluetooth device closed the connection due to insufficient authorization.|
address : string |
The remote device address, on Android the MAC address is returned, on iOS a UUID address is provided by the operating system instead, the format is "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit.
|
connected : bool |
Current connection state to the remote device.
|
discovered : bool |
Cached devices set the discovered property to false during discovery, once it's discovered again by the BluetoothLeManager component, this property is set back to true, this property is useful to make sure the device is still available.
|
error : BluetoothLeDevice::Error |
Error state for the connection to the remote device and the underlying connection QLowEnergyController.
|
name : string |
The name reported by the remote device, can be empty if the remote device does not advertise it.
|
rssi : int |
The latest reported RSSI signal strength. The value is refreshed as long as device discovery is active.
|
services : list<BluetoothLeService> |
The device discovered services.
|
serviceDiscoveryFinished() |
Service discovery has finished after a successful connection and the current device and services are ready to be used.
Note: The corresponding handler is onServiceDiscoveryFinished.
|
void connect() |
Request a connection to the remote device.
|
void disconnect() |
Disconnect from the remote device if an active connection exists.
|
void setDevice(QVariantMap device, bool connect) |
Set a device from a BluetoothLeManager::deviceDiscovered() signal to this BluetoothLeDevice instance. Use this to describe expected devices in a declarative way in QML and then set the discovered device. This method also triggers a connection request after successfully setting the device.
|
void setDevice(QVariantMap device) |
This function overloads setDevice().
Set a device from a BluetoothLeManager::deviceDiscovered() signal to this BluetoothLeDevice instance. Use this to describe expected devices in a declarative way in QML and then set the discovered device. This method does not trigger a connection. Use the overloaded method setDevice() if a connection request is desired.