TransferState

sealed interface TransferState<out R>

The state of an upload or a download, as reported by the flow returned by the upload and download methods.

The flow is cold: the transfer starts when the flow is collected, and is cancelled when the collection is cancelled. The first emitted state is always Started. The flow completes after Completed or Cancelled, and fails with an McuMgrException if the transfer fails.

Type Parameters

R

The type of the result of the transfer: Unit for uploads and downloads to a stream, ByteArray for downloads.

Inheritors

Types

Link copied to clipboard

The transfer has been cancelled using the controller.

Link copied to clipboard
data class Completed<out R>(val result: R) : TransferState<R>

The transfer has been completed successfully.

Link copied to clipboard
data class InProgress(val current: Int, val total: Int, val timestamp: Long) : TransferState<Nothing>

The progress of the transfer.

Link copied to clipboard
data class Started(val controller: TransferController) : TransferState<Nothing>

The transfer has been started.