BluetoothServer

A Bluetooth Server that makes the Hardware advertise AdvertiseData and exposes LocalService to connect to.

Inheritors

Properties

Link copied to clipboard
abstract val isAdvertising: StateFlow<Boolean>

A StateFlow indicating whether this server is currently advertising

Link copied to clipboard
abstract val services: StateFlow<List<LocalService>>

A StateFlow of the LocalServices that are currently discoverable

Link copied to clipboard
abstract val status: StateFlow<ServerStatus>

A StateFlow of the ServerStatus of this Server

Functions

Link copied to clipboard
abstract suspend fun add(uuid: UUID, service: LocalService.DSL.Primary.() -> Unit): LocalService?

Attempts to add a LocalService at a given UUID and suspends until it has been added.

Link copied to clipboard
abstract suspend fun advertise(data: AdvertiseData.Builder.() -> Unit): Boolean

Starts advertising with the given data

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
abstract suspend fun remove(service: LocalService): Boolean

Attempts to remove a LocalService and suspends until it has been removed.

Link copied to clipboard
abstract suspend fun removeAllServices(): Boolean

Attempts to remove all LocalService and suspends until they have been removed.

Link copied to clipboard
abstract fun stopAdvertising()

Stops advertising any AdvertiseData