Class UpdateTask

java.lang.Object
com.tccc.kos.core.service.firmware.UpdateTask

public class UpdateTask extends Object
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 Details

    • UpdateTask

      public UpdateTask(String firmwareVersion, int estimatedTimeMs, String exclusivityKey)
      Create a update task to update a device
      Parameters:
      firmwareVersion - firmware version display string
      estimatedTimeMs - 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 the FutureWork returned by FirmwareUpdater.update() with this value so it should be reasonably accurate.
    • getFirmwareVersion

      public String 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

      public String 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 of getUpdater().getExclusivityKey() . Override as needed.
      Returns:
      the exclusivity key for this task
    • getUpdateRetryCount

      public int getUpdateRetryCount()
      Get the retry count for update() 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 for update() calls.
    • getUpdateRetryDelayMs

      public int getUpdateRetryDelayMs()
      Get the delay between retries of update() . Defaults to 2 seconds, update as needed.
    • setUpdateRetryDelayMs

      public void setUpdateRetryDelayMs(int delay)
      Set the delay between retries of update() .