FirmwareUpgradeManager

Manages a McuManager firmware upgrade. Once initialized, this object can only perform a single firmware upgrade for a single device to completion. In other words, the same FirmwareUpgradeManager may start the upload, cancel the upload, and call start once again to restart the firmware upgrade. However, once the upload is completed, the same FirmwareUpgradeManager cannot not be used for subsequent firmware upgrades.

Like other MCU managers, FirmwareUpgradeManagers must be initialized with a McuMgrTransport which defines the scheme and implements the transport methods for communicating with the device. FirmwareUpgradeManagers additionally require a callback and the image data to upload.

Once initialized, a firmware upgrade is started by calling start, and can be paused, resumed, and canceled using pause, resume, and cancel.

Constructors

Link copied to clipboard
constructor(@NotNull transport: @NotNull McuMgrTransport)
Construct a firmware upgrade manager.
constructor(@NotNull transport: @NotNull McuMgrTransport, @Nullable callback: @Nullable FirmwareUpgradeCallback<FirmwareUpgradeManager.State>)
Construct a firmware upgrade manager.

Types

Link copied to clipboard
enum Mode
Link copied to clipboard
Link copied to clipboard
enum State

Functions

Link copied to clipboard
open fun cancel()
Cancel the firmware upgrade.
Link copied to clipboard
Get the current State of the firmware upgrade.
Link copied to clipboard
@NotNull
open fun getTransporter(): @NotNull McuMgrTransport
Get the transporter.
Link copied to clipboard
open fun isInProgress(): Boolean
Determine whether the firmware upgrade is in progress.
Link copied to clipboard
open fun isPaused(): Boolean
Determine whether the firmware upgrade is paused.
Link copied to clipboard
open fun pause()
Pause the firmware upgrade.
Link copied to clipboard
open fun resume()
Resume a paused firmware upgrade.
Link copied to clipboard
open fun setCallbackOnUiThread(uiThreadCallbacks: Boolean)
If true, run all callbacks on the UI thread (default).
Link copied to clipboard
Sets the manager callback.
Link copied to clipboard
open fun setMode(@NotNull mode: @NotNull FirmwareUpgradeManager.Mode)
Sets the manager mode.
Link copied to clipboard
open fun start(imageData: @NotNull Array<Byte>, @NotNull settings: @NotNull FirmwareUpgradeManager.Settings)
Start the upgrade.
open fun start(@NotNull images: @NotNull ImageSet, @NotNull settings: @NotNull FirmwareUpgradeManager.Settings)
Starts an upgrade with given image set.