GenericLevelServer

Generic Level Server for a local mesh element.

Represents a variable-level device on the mesh network (e.g., dimmable light, volume control, position servo). The server maintains the current signed 16-bit level and handles incoming GET/SET messages from remote clients.

Level range: -32768 to 32767. Common mappings include:

  • 0x0000 = off, 0x7FFF = full brightness (lighting)

  • 0x0000 = mute, 0x7FFF = max volume (audio)

Properties

Link copied to clipboard

Maximum allowed level.

Link copied to clipboard

Minimum allowed level.

Link copied to clipboard
val state: StateFlow<Int>

Current level state (-32768 to 32767).

Functions

Link copied to clipboard
suspend fun setLevel(level: Int)

Set the level locally (e.g., from a physical knob or slider).

Link copied to clipboard
fun setRange(min: Int, max: Int)

Set the level range for this server.