scanFor

suspend fun scanFor(macAddress: String? = null, service: String? = null, name: String? = null, settings: ScanSettings? = null, priority: Priority = Priority.Balanced, timeout: Long = DEFAULT_TIMEOUT): BluetoothConnection?

Scans for a single bluetooth device and automatically connects with it Requires at least one filter being them: macAddress, service and name

Return

A nullable BluetoothConnection instance, when null meaning that the specified device was not found

Parameters

macAddress

Optional filter, if provided searches for the specified mac address

service

Optional filter, if provided searches for the specified service uuid

name

Optional filter, if provided searches for the specified device name

settings

Native object to specify the scan settings (The default setting is only recommended for really fast scans)

timeout

Scan time limit, when exceeded throws an ScanTimeoutException

See also

For a variation using callbacks

Filters:

Throws

When the timeout is reached

When an error occurs