Service

abstract fun Service(uuid: Uuid, builder: ServiceScope.() -> Unit = {})

Declares a service with the given UUID.

Sample code:

Service(<Some UUID>) {
Characteristic(
uuid = <Some UUID>,
properties = CharacteristicProperty.READ and CharacteristicProperty.NOTIFY,
permission = Permission.READ,
) {
// Note: Client Characteristic Configuration descriptor is added automatically.

CharacteristicUserDescriptionDescriptor("Some description")
}
Characteristic(...)
IncludedService(<Some UUID>) {
Characteristic(...)
}
}

Parameters

uuid

The UUID of the service.

builder

Scope of the primary service.


open fun Service(shortUuid: Int, builder: ServiceScope.() -> Unit = {})

Declares a service with the given 16 or 32 bit short UUID.

Parameters

shortUuid

The 16 or 32 bit short UUID of the service.

builder

Scope of the primary service.

See also