DfuController

class DfuController(peripheral: Peripheral, protocol: DfuProtocol = NordicDfuProtocol())

Orchestrates a firmware update over BLE.

Connects the DFU protocol to the BLE peripheral and exposes the update as a cold Flow of DfuProgress states. Collecting the flow starts the transfer; cancelling collection or calling abort stops it.

Parameters

peripheral

a connected Peripheral running a DFU service

protocol

DFU protocol implementation. Defaults to NordicDfuProtocol.

Constructors

Link copied to clipboard
constructor(peripheral: Peripheral, protocol: DfuProtocol = NordicDfuProtocol())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun abort()

Cancel a DFU that is currently in progress. Safe to call if no DFU is active.

Link copied to clipboard
fun performDfu(firmware: FirmwarePackage, options: DfuOptions = DfuOptions()): Flow<DfuProgress>

Start a firmware update and observe its progress.