Interface FirmwareUpdater
- All Superinterfaces:
Ready
- All Known Implementing Classes:
FirmwareUpdatableLink
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 Summary
Modifier and TypeMethodDescriptioncheckForUpdate(FirmwareService service, FirmwareUpdatableDevice device) Check if firmware update is required for the specified device.default intGet the retry count forcheckForUpdate()calls.default intGet the delay between retries ofcheckForUpdate().update(UpdateTask task) Performs the actual update associated with theUpdateTaskthat was returned fromcheckForUpdate().
-
Method Details
-
checkForUpdate
Check if firmware update is required for the specified device. ReturnsUpdateTaskif an update is required or null if no update is required. The task will be queued byFirmwareServiceand passed toupdate()when it's time to update the device. TheUpdateTaskshould 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
UpdateTaskif an update is required or null if no update is required. - Throws:
Exception
-
update
Performs the actual update associated with theUpdateTaskthat was returned fromcheckForUpdate().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
taskthe 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 forcheckForUpdate()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 ofcheckForUpdate(). Defaults to 2 seconds. Override as needed.
-