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 int
Get the retry count forcheckForUpdate()
calls.default int
Get the delay between retries ofcheckForUpdate()
.update
(UpdateTask task) Performs the actual update associated with theUpdateTask
that was returned fromcheckForUpdate()
.
-
Method Details
-
checkForUpdate
Check if firmware update is required for the specified device. ReturnsUpdateTask
if an update is required or null if no update is required. The task will be queued byFirmwareService
and passed toupdate()
when it's time to update the device. TheUpdateTask
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
Performs the actual update associated with theUpdateTask
that 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
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 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.
-