XModemManager

Handles the XModem-CRC receive protocol for file transfers from the connected device.

The device (sender) initiates transfers in response to admin file-read requests. The Android client (receiver) acknowledges each 128-byte block and signals end-of-transfer acceptance.

Usage:

  1. Optionally call setTransferName with the filename being requested so the emitted XModemFile is labelled correctly.

  2. Route every FromRadio.xmodemPacket here via handleIncomingXModem.

  3. Collect fileTransferFlow to receive completed files.

Properties

Link copied to clipboard
abstract val fileTransferFlow: Flow<XModemFile>

Hot flow that emits once per completed transfer. Backpressure is handled by a small buffer; older transfers are dropped if the consumer is slow.

Functions

Link copied to clipboard
abstract fun cancel()

Cancels any in-progress transfer and sends a CAN control byte to the device.

Link copied to clipboard
abstract fun handleIncomingXModem(packet: XModem)

Routes an incoming XModem packet from the device to the receive state machine.

Link copied to clipboard
abstract fun setTransferName(name: String)

Sets the name to attach to the next completed transfer.