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, this is not an issue.

Please, note that the the method suspends during the first 3 steps of the firmware update: CmFirmwareUpdateStep.Fetching, CmFirmwareUpdateStep.Initiating, CmFirmwareUpdateStep.Uploading. In case of external updates, the last step of the update CmFirmwareUpdateStep.Updating might run after updateFirmware completes. 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