upgrade

fun upgrade(envelope: ByteArray, settings: FirmwareUpgradeSettings = FirmwareUpgradeSettings.Builder().build(), cacheImages: CacheImageSet? = null, resourceProvider: suspend (uri: URI) -> ByteArray = { throw McuMgrException("The device requested a resource, but none can be provided: $it") }): Flow<FirmwareUpgradeState<SUITUpgradeManager.State>>

Upgrades the firmware using the given SUIT envelope.

The upgrade starts when the flow is collected, and is cancelled when the collection is. It may be paused, resumed and cancelled using the controller from FirmwareUpgradeState.Started.

Parameters

envelope

The SUIT candidate envelope.

settings

The settings of the upgrade.

cacheImages

The images to upload to the cache partitions of the device, or null.

resourceProvider

Provides the resource with the given URI, when the device requests it. It is called in the coroutine collecting the flow, and cancelled when the device does not need the resource any more. If it throws, the upgrade fails. The default implementation does not provide any resources.

Throws

if the upgrade fails.

if another upgrade is in progress.