CommandSender

Interface for sending commands and packets to the mesh network.

Functions

Link copied to clipboard
abstract fun generatePacketId(): Int

Generates a new unique packet ID.

Link copied to clipboard
abstract fun getCachedChannelSet(): ChannelSet

Returns the cached channel set.

Link copied to clipboard
abstract fun getCachedLocalConfig(): LocalConfig

Returns the cached local configuration.

Link copied to clipboard
abstract fun getCurrentPacketId(): Long

Returns the current packet ID.

Link copied to clipboard
abstract suspend fun requestNeighborInfo(requestId: Int, destNum: Int)

Requests neighbor info from a specific node.

Link copied to clipboard
abstract suspend fun requestPosition(destNum: Int, currentPosition: Position)

Requests the position of a specific node, or throws if the outbound queue rejects it.

Link copied to clipboard
abstract suspend fun requestTelemetry(requestId: Int, destNum: Int, typeValue: Int)

Requests telemetry from a specific node, or throws if the outbound queue rejects it.

Link copied to clipboard
abstract suspend fun requestTelemetryForConnection(requestId: Int, destNum: Int, typeValue: Int, expectedConnectionVersion: Long)

Requests telemetry only if expectedConnectionVersion still owns queue admission.

Link copied to clipboard
abstract suspend fun requestTraceroute(requestId: Int, destNum: Int)

Requests a traceroute to a specific node, or throws if the outbound queue rejects it.

Link copied to clipboard
abstract suspend fun requestUserInfo(destNum: Int)

Requests user info from a specific node, or throws if the outbound queue rejects it.

Link copied to clipboard
abstract suspend fun sendAdmin(destNum: Int, requestId: Int = generatePacketId(), wantResponse: Boolean = false, initFn: () -> AdminMessage)

Sends an admin message to a specific node, or throws if the outbound queue rejects it.

Link copied to clipboard
open suspend fun sendAdminAwait(destNum: Int, requestId: Int = generatePacketId(), wantResponse: Boolean = false, initFn: () -> AdminMessage): Boolean

Sends an admin message and suspends until firmware processes it and returns a routing acknowledgement.

Link copied to clipboard
abstract suspend fun sendAdminAwaitResult(destNum: Int, requestId: Int = generatePacketId(), wantResponse: Boolean = false, initFn: () -> AdminMessage): AwaitedSendResult

Detailed form of sendAdminAwait, including whether an active transport admitted the packet. Queue or transport rejection is represented by a non-accepted AwaitedSendResult with dispatched == false; it is not reported as PacketQueueRejectedException.

Link copied to clipboard
abstract suspend fun sendAdminForConnection(destNum: Int, expectedConnectionVersion: Long, requestId: Int = generatePacketId(), wantResponse: Boolean = false, initFn: () -> AdminMessage)

Sends an admin message only if expectedConnectionVersion still owns queue admission.

Link copied to clipboard
abstract fun sendAdminImmediate(destNum: Int, initFn: () -> AdminMessage)

Sends an admin message immediately, bypassing the outbound packet queue. The queue only drains while the connection state is Connected, so mid-handshake sends (e.g. set_time_only at MyNodeInfo) must use this path or they stall until the handshake finishes.

Link copied to clipboard
abstract suspend fun sendData(p: DataPacket)

Sends a data packet to the mesh. If the outbound queue refuses admission, the packet is marked org.meshtastic.core.model.MessageStatus.ERROR and PacketQueueRejectedException is thrown so the persistence owner can requeue or fail its durable record instead of treating a normal return as successful admission.

Link copied to clipboard
abstract fun sendLockdownPassphrase(passphrase: String, boots: Int = 0, hours: Int = 0, maxSessionSeconds: Int = 0, disable: Boolean = false)

Sends a lockdown passphrase to authenticate with a locked device.

Link copied to clipboard
abstract fun sendLockNow()

Sends a Lock Now command to immediately lock a locked-firmware device.

Link copied to clipboard
abstract suspend fun sendPosition(pos: Position, destNum: Int? = null, wantResponse: Boolean = false)

Sends our current position to the mesh, or throws if the outbound queue rejects it.

Link copied to clipboard
abstract suspend fun setFixedPosition(destNum: Int, pos: Position)

Sets a fixed position for a node, or throws if the outbound queue rejects the admin command.