updateFirmware

abstract suspend fun updateFirmware(firmwareUpdateActivity: Class<out Activity>): CmFirmwareUpdateResult

Initiates a firmware update on the connected module, if available. After downloading the update, will start a foreground service.

The update might cause the module to restart.

In case of external updates, the module will first go through regular update steps CmFirmwareUpdateStep. Then after updateFirmware completes, the module's firmware update status will switch to CmFirmwareUpdateStatus.ModuleUpdatingComponent while it is transferring the update to external component. For the accurate status of the ongoing firmware update please use observeFirmwareUpdateStatus.

Calling disconnect during ongoing firmware update is safe, however it may take several minutes for the module to start advertising again.

Calling updateFirmware during an ongoing firmware update will fail.

Calling setPropertyValue during an ongoing firmware update will fail.

Return

A CmFirmwareUpdateResult indicating the result of the firmware update operation.

Parameters

firmwareUpdateActivity

An Activity class to use for the foreground service notification. On click on the firmware update notification, the provided activity will open.

See also