Class UpdateTask
java.lang.Object
com.tccc.kos.core.service.firmware.UpdateTask
Base class for a for update tasks generated by a given
FirmwareUpdater
which
contains all the state necessary for the updater to actually perform the update
of the associated device. An instance will only be used to attempt a single update.
If the update fails, another instance will be created to retry the update.
This class can be extended to add additional information to pass it to the updater when it's time to update the board.
- Version:
- 2023-09-10
-
Constructor Summary
ConstructorsConstructorDescriptionUpdateTask
(String firmwareVersion, int estimatedTimeMs, String exclusivityKey) Create a update task to update a device -
Method Summary
Modifier and TypeMethodDescriptionint
Return the estimated time for the update to be performed.Return the exclusivity key for this task.Return display string for the firmware version this task is trying to install.int
Get the retry count forupdate()
calls.int
Get the delay between retries ofupdate()
.void
setUpdateRetryCount
(int count) Set the retry count forupdate()
calls.void
setUpdateRetryDelayMs
(int delay) Set the delay between retries ofupdate()
.
-
Constructor Details
-
UpdateTask
Create a update task to update a device- Parameters:
firmwareVersion
- firmware version display stringestimatedTimeMs
- estimated update time
-
-
Method Details
-
getEstimatedTimeMs
public int getEstimatedTimeMs()Return the estimated time for the update to be performed.FirmwareService
will override the estimated time of theFutureWork
returned byFirmwareUpdater.update()
with this value so it should be reasonably accurate. -
getFirmwareVersion
Return display string for the firmware version this task is trying to install. This is only used for display and reporting and may contain information specific to just this particular update (bootloader vs. application) as some hardware requires multiple update passes to fully update firmware. -
getExclusivityKey
Return the exclusivity key for this task. Any tasks that return the same key will be run sequentially. This is useful for devices that share a common bus that only allows one update at a time. Tasks with different keys or no key (returns null) can be run concurrently. By default this will return the value ofgetUpdater().getExclusivityKey()
. Override as needed.- Returns:
- the exclusivity key for this task
-
getUpdateRetryCount
public int getUpdateRetryCount()Get the retry count forupdate()
calls. After this many attempts the board will be unusable as it cannot be updated. Defaults to 3, update as needed. -
setUpdateRetryCount
public void setUpdateRetryCount(int count) Set the retry count forupdate()
calls. -
getUpdateRetryDelayMs
public int getUpdateRetryDelayMs()Get the delay between retries ofupdate()
. Defaults to 2 seconds, update as needed. -
setUpdateRetryDelayMs
public void setUpdateRetryDelayMs(int delay) Set the delay between retries ofupdate()
.
-