advertise

abstract suspend fun advertise(connectable: Boolean, payload: D, timeout: Duration = Duration.INFINITE, block: (txPower: Int) -> Unit? = null)

Starts Bluetooth LE advertising.

Parameters

connectable

Whether the advertising should be connectable.

payload

Advertising data to be broadcast.

timeout

The advertising time limit. By default there is no timeout set.

block

A block that will be called when the advertising is started. The block will receive the actual TX power (in dBm) used for advertising.

Throws

If the required permission is denied.

If the advertising could not be started.

If the advertising data is invalid.