NodeChange

sealed interface NodeChange(source)

A delta notification of node state changes.

The SDK emits these via the RadioClient.nodes flow. Late subscribers first receive a Snapshot of all known nodes, then live deltas (Added, Updated, Removed, WentOffline, CameOnline) in causal order.

This delta-based design is efficient for large meshes: a 200-node network with frequent telemetry would be wasteful to emit as a full StateFlow<Map<NodeId, NodeInfo>> (200 entries per update). Deltas are O(1) space; subscribers can fold to a StateFlow if they prefer.

Since

0.1.0

Inheritors

Types

Link copied to clipboard
data class Added(val node: NodeInfo) : NodeChange

A new node joined the mesh or was discovered by the local node.

Link copied to clipboard
data class CameOnline(val nodeId: NodeId) : NodeChange

Emitted when a previously-offline node sends a new packet and becomes online again.

Link copied to clipboard
data class Removed(val nodeId: NodeId) : NodeChange

A node was removed from the mesh (typically after a timeout or manual removal).

Link copied to clipboard
data class Snapshot(val nodes: Map<NodeId, NodeInfo>) : NodeChange

All known nodes as a full replacement of any previously folded state.

Link copied to clipboard
data class Updated(val node: NodeInfo, val changed: Set<NodeField>) : NodeChange

An existing node's information changed.

Link copied to clipboard
data class WentOffline(val nodeId: NodeId, val lastHeard: Int) : NodeChange

Emitted when a node's NodeInfo.last_heard exceeds the configured presence timeout and transitions from online to offline.