HeartbeatSender

class HeartbeatSender(sendToRadio: (ByteArray) -> Unit, afterHeartbeat: suspend () -> Unit? = null, logTag: String = "HeartbeatSender")(source)

Shared heartbeat sender for Meshtastic radio transports.

Constructs and sends a ToRadio(heartbeat = Heartbeat(nonce = ...)) message to keep the firmware's idle timer from expiring. Each call uses a monotonically increasing nonce to prevent the firmware's per-connection duplicate-write filter from silently dropping it.

Parameters

sendToRadio

callback to transmit the encoded heartbeat bytes to the radio

afterHeartbeat

optional suspend callback invoked after sending (e.g. to schedule a drain)

logTag

tag for log messages

Constructors

Link copied to clipboard
constructor(sendToRadio: (ByteArray) -> Unit, afterHeartbeat: suspend () -> Unit? = null, logTag: String = "HeartbeatSender")

Functions

Link copied to clipboard
suspend fun sendHeartbeat()

Sends a heartbeat to the radio.