DfuError

sealed interface DfuError

Failure conditions during a firmware update.

Every subtype is both a DfuError and an Exception, so errors can be caught with standard try/catch and also pattern-matched via when. Errors are surfaced through DfuProgress.Failed when using DfuController.

Inheritors

Types

Link copied to clipboard
data class Aborted(val message: String = "DFU was aborted") : Exception, DfuError

The DFU was cancelled by calling DfuController.abort.

Link copied to clipboard
data class CharacteristicNotFound(val name: String, val message: String = "DFU characteristic not found: ") : Exception, DfuError

A required DFU GATT characteristic is missing from the service.

Link copied to clipboard
data class ChecksumMismatch(val expected: UInt, val actual: UInt) : Exception, DfuError

CRC32 verification failed after transferring an object.

Link copied to clipboard
data class FirmwareParseError(val message: String, val cause: Throwable? = null) : Exception, DfuError

The firmware .zip archive could not be parsed.

Link copied to clipboard
data class HashMismatch(val algorithm: String, val expected: String, val actual: String) : Exception, DfuError

Hash verification failed after transferring firmware.

Link copied to clipboard
data class ImageSlotError(val message: String) : Exception, DfuError

MCUboot image slot management error.

Link copied to clipboard
data class NotConnected(val message: String = "Peripheral is not connected") : Exception, DfuError

Peripheral was not in Connected state when the DFU started.

Link copied to clipboard
data class ProtocolError(val opcode: Int, val resultCode: Int, val message: String) : Exception, DfuError

The peripheral returned an error response to a DFU command.

Link copied to clipboard
data class ServiceNotFound(val message: String = "DFU service not found on peripheral") : Exception, DfuError

The peripheral does not expose the required DFU GATT service.

Link copied to clipboard
data class Timeout(val message: String = "DFU operation timed out") : Exception, DfuError

A DFU command did not receive a response within the configured DfuOptions.commandTimeout.

Link copied to clipboard
data class TransferFailed(val message: String, val cause: Throwable? = null) : Exception, DfuError

Catch-all for transport-level failures (disconnects, write errors).