ImageManagerKtx

class ImageManagerKtx(val manager: ImageManager)

A manager of the Image group of Mcu Manager, with suspending methods and flows. It wraps ImageManager.

Every suspending method waits until the response is received, and throws a McuMgrException if the request fails, or a McuMgrErrorException if the device responds with an error, that is with a non-zero return code. Cancelling the calling coroutine stops waiting for the response, but does not cancel the request, which has already been sent.

The upload and the download are long-running, and report their state using a Flow. See TransferState. To update the firmware of a device, with all the steps it takes, use no.nordicsemi.android.mcumgr.ktx.dfu.FirmwareUpgradeManagerKtx.

Use the manager to set a logger, the upload MTU, etc.

Constructors

Link copied to clipboard
constructor(manager: ImageManager)
constructor(transport: McuMgrTransport)

Creates the manager using the given transport.

Properties

Link copied to clipboard

The manager of the Mcu Manager library, which sends the requests.

Functions

Link copied to clipboard
suspend fun confirm(hash: ByteArray? = null): McuMgrImageStateResponse

Confirms the image with the given hash, or the running image, so that it is run after every reset.

Link copied to clipboard

Downloads the core dump.

Link copied to clipboard

Erases the core dump.

Link copied to clipboard

Reads the core list.

Link copied to clipboard
suspend fun coreLoad(offset: Int): McuMgrCoreLoadResponse

Reads a chunk of the core dump.

Link copied to clipboard
suspend fun erase(slot: Int? = null): McuMgrImageResponse

Erases the image in the secondary slot, or in the given slot.

Link copied to clipboard

Reads the state of the images on the device.

Link copied to clipboard

Reads the slots of the images on the device.

Link copied to clipboard

Requests the image with the given hash to be tested, that is run once, on the next reset.

Link copied to clipboard
fun upload(data: ByteArray, image: Int = 0, windowCapacity: Int = 1, memoryAlignment: Int = 1): Flow<TransferState<Unit>>

Uploads the whole image to the device.

Link copied to clipboard
suspend fun uploadChunk(data: ByteArray, offset: Int, image: Int = 0): McuMgrImageUploadResponse

Sends a single packet of the image, starting from the given offset.