transferFirmware

open suspend override fun transferFirmware(firmware: ByteArray, onProgress: suspend (Float) -> Unit): Result<Unit>(source)

Sends the firmware binary (.bin file) using the DFU object-transfer protocol.

The binary is split into objects sized by the device's reported maximum object size. After each object the device confirms the running CRC-32. On success, the bootloader validates the full image and reboots into the new firmware.

Parameters

firmware

Raw bytes of the .bin file.

onProgress

Callback receiving progress in 0.0, 1.0.