NodeId

value class NodeId(val raw: Int)(source)

Type-safe wrapper for Meshtastic node identifiers (uint32).

The wire format is uint32; the full 32-bit range is permitted. The backing field is a Kotlin Int interpreted as an unsigned 32-bit value, so any bit pattern is valid — no additional validation is performed.

Reserved values:

  • 0x00000000LOCAL (the local node, "this radio")

  • 0xFFFFFFFFBROADCAST (all nodes on the mesh)

Validation note: value-class init blocks only run from Kotlin call sites; bytecode constructed via reflection or generated code can bypass them. Because NodeId permits the full uint32 range there is no init check, so this is moot in practice.

Java interop: properties returning NodeId expose non-mangled boxed accessors (e.g. node.getNodeId() rather than getNodeId-PPSJZE4()) thanks to -Xjvm-expose-boxed (see KmpLibraryConventionPlugin). From Java: nodeId.getRaw() to read the underlying int.

Since

0.1.0

Constructors

Link copied to clipboard
constructor(raw: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns true if this is NodeId.BROADCAST.

Link copied to clipboard

Returns true if this is a specific node address (neither local nor broadcast).

Link copied to clipboard
val raw: Int

Functions

Link copied to clipboard
fun NodeId.isLocal(own: NodeId? = null): Boolean

Returns true if this is NodeId.LOCAL or matches the supplied own ID. Useful for filtering packets originating from the host.

Link copied to clipboard

Returns the 8-character hex representation of this NodeId (e.g., "aabbccdd"). Does not include the ! or 0x prefix.

Link copied to clipboard
open override fun toString(): String

Renders as the canonical Meshtastic !aabbccdd user-id string.