PacketHandler

Interface for handling the transmission of packets to the radio and managing the packet queue.

Functions

Link copied to clipboard
abstract suspend fun completeDispatchedResponse(dataRequestId: Int, complete: Boolean)

Completes the strict routing response for dataRequestId when an active transport already dispatched that packet. Replies that arrive before dispatch are stale and ignored. The packet ID remains reserved until both the firmware queue stage and this routing stage are terminal.

Link copied to clipboard
abstract fun handleQueueStatus(queueStatus: QueueStatus)

Processes queue status updates from the radio.

Link copied to clipboard
abstract fun rearmSendAckTimeouts()

Re-arms the send-ACK timeout for every persisted packet still awaiting its routing ACK/NAK, so sends orphaned by a disconnect or app restart become retryable instead of showing as sending forever. Call once per connection, after the radio config is loaded.

Link copied to clipboard
abstract suspend fun sendToRadio(packet: MeshPacket): Boolean

Adds a mesh packet to the queue for sending.

abstract fun sendToRadio(p: ToRadio)

Sends a command/packet directly to the radio.

Link copied to clipboard
open suspend fun sendToRadioAndAwait(packet: MeshPacket): Boolean

Adds a mesh packet to the queue and suspends until its routing acknowledgement arrives.

Link copied to clipboard
abstract suspend fun sendToRadioAndAwaitResult(packet: MeshPacket): AwaitedSendResult

Detailed form of sendToRadioAndAwait, including whether an active transport admitted the packet.

Link copied to clipboard
abstract suspend fun sendToRadioForConnection(packet: MeshPacket, expectedConnectionVersion: Long): Boolean

Adds packet only while expectedConnectionVersion still owns the connected lifecycle generation.

Link copied to clipboard
abstract fun stopPacketQueue()

Stops the packet queue.