Interface FirmwareUpdater

All Superinterfaces:
Ready
All Known Implementing Classes:
FirmwareUpdatableLink

public interface FirmwareUpdater extends Ready
Interface for the actual update routine for a given device. This extends Ready and the updater will not be used until it is ready.
Version:
2023-09-10
  • Method Details

    • checkForUpdate

      UpdateTask checkForUpdate(FirmwareService service, FirmwareUpdatableDevice device) throws Exception
      Check if firmware update is required for the specified device. Returns UpdateTask if an update is required or null if no update is required. The task will be queued by FirmwareService and passed to update() when it's time to update the device. The UpdateTask should contain all necessary information to perform the update.

      If this throws an exception, the operation is considered to have failed. After a getCheckForUpdateRetryCount() number of consecutive failures, the update process will abort and the device will be unusable.

      Returns:
      the UpdateTask if an update is required or null if no update is required.
      Throws:
      Exception
    • update

      FutureWork update(UpdateTask task) throws Exception
      Performs the actual update associated with the UpdateTask that was returned from checkForUpdate() .

      If this throws an exception or the future is not successful, the operation is considered to have failed. After the number of retries specified in the task the update process will abort and the board will be unusable.

      It is possible for the future to be cancelled. The updater must leave the hardware in a valid state when cancelled. This may mean finishing the update in order to assure the hardware can still boot. By default, futures are not interruptable so cancel will not be visible while the future is in its runnable.

      Parameters:
      task - the update task to perform
      Returns:
      future for the update
      Throws:
      Exception
    • getCheckForUpdateRetryCount

      default int getCheckForUpdateRetryCount()
      Get the retry count for checkForUpdate() calls. After this many attempts the device will be unusable as it cannot be determined whether the board needs an update or not. Defaults to 3. Override as needed.
    • getCheckForUpdateRetryDelayMs

      default int getCheckForUpdateRetryDelayMs()
      Get the delay between retries of checkForUpdate() . Defaults to 2 seconds. Override as needed.