Set how commands will be executed. By default, all commands are executed in a global queue (QueueType.global),
with each command waiting for the previous one to finish.
Clear a queue.
Use BleCommandQueue.globalQueueId to clear the global queue.
To clear the queue of a specific device, use deviceId as id.
If no id is provided, all queues will be cleared.
Connect to a device.
It is advised to stop scanning before connecting.
It throws error if device connection fails.
Default connection timeout is 60 sec.
Returns connection state of the device.
All platforms will return Connected/Disconnected states.
Android and Apple can also return Connecting/Disconnecting states.
Get connected devices to the system (connected by any app).
Use withServices to filter devices by services.
On Apple, withServices is required to get any connected devices. If not passed, several 18XX generic services will be set by default.
On Android, Linux and Windows, if withServices is used, then internally all services will be discovered for each device first (either by connecting or by using cached services).
Not supported on Web.
Check if has permissions.
withAndroidFineLocation is used to check fine location permission on Android 12+ (API 31+).
On Android lower than 12, this method will check location permission regardless of the withAndroidFineLocation value.
Windows, Linux and Web will always return true.
receivesAdvertisements returns true on web if the browser supports receiving advertisements from a certain deviceId.
The rest of the platforms will always return true.
If true, then you will be getting scanResult updates for this device.
Request permissions.
if all permissions are already granted or granted by user, this method will succeed.
it will throw exception if permissions are denied by user.
withAndroidFineLocation is used to request fine location permission on Android 12+ (API 31+).
on Android lower than 12, this method will request location permission regardless of the withAndroidFineLocation value.
Windows, Linux and Web will always succeed.
Start scan.
Scan results will arrive in onScanResult listener.
It might throw errors if Bluetooth is not available.
webRequestOptions is supported on Web only.