Class FirmwareUpdatableLink
java.lang.Object
com.tccc.kos.core.service.hardware.HardwareLink
com.tccc.kos.core.service.firmware.FirmwareUpdatableLink
- All Implemented Interfaces:
Ready,FirmwareUpdatableDevice,FirmwareUpdateCallback,FirmwareUpdater,BoardIdentifier
public abstract class FirmwareUpdatableLink
extends HardwareLink
implements FirmwareUpdatableDevice, FirmwareUpdater, FirmwareUpdateCallback
Base class for
HardwareLink that supports firmware update.- Since:
- 1.0
- Version:
- 2023-10-07
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract UpdateTaskcheckForUpdate(FirmwareService service) Check if a firmware update is required.checkForUpdate(FirmwareService service, FirmwareUpdatableDevice device) Check if firmware update is required for the specified device.Return a unique id for this device.abstract StringReturn a string that represents the current firmware version.voidonNoUpdateRequired(FirmwareService service, FirmwareUpdatableDevice device) No update required.booleanonUpdateFailed(FirmwareService service, UpdateTask task, boolean permanent) Update failed.voidonUpdateSuccess(FirmwareService service, UpdateTask task) Update was successfully performed.Methods inherited from class com.tccc.kos.core.service.hardware.HardwareLink
close, getBoard, getFirmwareVersions, getIdentity, getInstanceId, getLinkType, getMfgSerialNum, getRevision, getSerialNum, getType, isValid, setInvalidMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tccc.kos.core.service.firmware.FirmwareUpdateCallback
onUpdateRequiredMethods inherited from interface com.tccc.kos.core.service.firmware.FirmwareUpdater
getCheckForUpdateRetryCount, getCheckForUpdateRetryDelayMs, update
-
Constructor Details
-
FirmwareUpdatableLink
public FirmwareUpdatableLink()
-
-
Method Details
-
onNoUpdateRequired
Description copied from interface:FirmwareUpdateCallbackNo update required.- Specified by:
onNoUpdateRequiredin interfaceFirmwareUpdateCallback- Parameters:
service- the firmware servicedevice- the device that is ready for use
-
onUpdateSuccess
Description copied from interface:FirmwareUpdateCallbackUpdate was successfully performed.- Specified by:
onUpdateSuccessin interfaceFirmwareUpdateCallback- Parameters:
service- the firmware servicetask- the task that just completed
-
onUpdateFailed
Description copied from interface:FirmwareUpdateCallbackUpdate failed. If the permanent flag isn't set, returning true will retry the update automatically. Once permanent is set, no more retries will be attempted.- Specified by:
onUpdateFailedin interfaceFirmwareUpdateCallback- Parameters:
service- the firmware servicetask- the task that just failedpermanent- if true, no more update attempts will be performed- Returns:
- true to retry, false to abort
-
checkForUpdate
public UpdateTask checkForUpdate(FirmwareService service, FirmwareUpdatableDevice device) throws Exception Description copied from interface:FirmwareUpdaterCheck 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.- Specified by:
checkForUpdatein interfaceFirmwareUpdater- Returns:
- the
UpdateTaskif an update is required or null if no update is required. - Throws:
Exception
-
getFirmwareDeviceId
Description copied from interface:FirmwareUpdatableDeviceReturn a unique id for this device. A particular device should always return the same id, but no two devices in a system should return the same id. This is used to track a device through the update process, and needs to support the device rebooting and being queued back into the update process while the previous update was still finishing. This id is used to link these records. This is typically the device serial number.- Specified by:
getFirmwareDeviceIdin interfaceFirmwareUpdatableDevice- Returns:
- the unique device id
-
checkForUpdate
Check if a firmware update is required. Return anUpdateTaskto perform the update if required, or null if no update is required.- Throws:
Exception
-
getFirmwareVersion
Return a string that represents the current firmware version. This is used for display purposes only, not as part of the firmware update process.
-