RadioClient
The main entry point to the Meshtastic SDK.
A RadioClient manages a single radio device over a chosen transport (BLE, TCP, serial, etc.) and exposes a clean async/reactive API:
Lifecycle: connect and disconnect (suspend functions; may throw).
State: connection, ownNode, nodes (reactive StateFlows and Flows).
Messaging: send and sendText (enqueue immediately; return a MessageHandle).
Drop-in philosophy: configure once with Builder, then observe and call:
val client = RadioClient.Builder()
.transport(TcpTransport(host = "192.168.1.42", port = 4403))
.storage(MyStorageProvider())
.build()
client.connect() // suspends until Connected or throws
client.sendText("Hello mesh!") // non-suspending; returns a MessageHandle
client.packets.collect { packet -> // reactive inbound stream
println(packet.decoded?.portnum)
}
client.disconnect() // graceful shutdownMulti-radio: instantiate one RadioClient per physical radio. They share nothing.
No host plumbing: foreground services, permissions, notifications, and WorkManager are the app's responsibility. The SDK owns only the engine.
Resource management: implements AutoCloseable, so client.use { … } guarantees cleanup even on exception. Prefer disconnect() (suspend) over close() (blocking) when inside a coroutine.
Since
0.1.0
Types
Properties
Most recently committed ConfigBundle for the active session.
The current connection state.
Side-channel advisory events: queue status, transport errors, key-verification prompts, drop notifications, and identity-rebind signals (MeshEvent.IdentityRebound — emitted before the engine clears storage when the device reports a different NodeNum than the one previously persisted).
Node-change deltas. Late subscribers receive a NodeChange.Snapshot immediately (single-replay), then live NodeChange.Added / NodeChange.Updated / NodeChange.Removed in causal order.
Routing API for traceRoute and neighbor enumeration. Available while connected.
Telemetry API for device and environment metrics. Available while connected.
Functions
Suspend until the device finishes streaming its NodeDB during handshake, then return the current node-snapshot map.
Blocking close for AutoCloseable conformance.
Connect and suspend until the handshake settles, returning the resolved ConfigBundle (HLP-34).
Gracefully disconnect from the device.
Pull a snapshot of all known nodes on demand.
Request the current Position from node from.
Enqueue an outbound packet for transmission.
Convenience: build a MeshPacket for the given portnum from a kotlinx.io.Buffer payload.
DSL form of RadioClient.send. Builds a MeshPacket via SendBuilder and enqueues it.
Send a PKI-encrypted unicast text message to to.
Send a Position payload to to (defaults to broadcast).
Convenience: send a text message.