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 UpdateTask
checkForUpdate
(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 String
Return a string that represents the current firmware version.void
onNoUpdateRequired
(FirmwareService service, FirmwareUpdatableDevice device) No update required.boolean
onUpdateFailed
(FirmwareService service, UpdateTask task, boolean permanent) Update failed.void
onUpdateSuccess
(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, setInvalid
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.core.service.firmware.FirmwareUpdateCallback
onUpdateRequired
Methods 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:FirmwareUpdateCallback
No update required.- Specified by:
onNoUpdateRequired
in interfaceFirmwareUpdateCallback
- Parameters:
service
- the firmware servicedevice
- the device that is ready for use
-
onUpdateSuccess
Description copied from interface:FirmwareUpdateCallback
Update was successfully performed.- Specified by:
onUpdateSuccess
in interfaceFirmwareUpdateCallback
- Parameters:
service
- the firmware servicetask
- the task that just completed
-
onUpdateFailed
Description copied from interface:FirmwareUpdateCallback
Update 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:
onUpdateFailed
in 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:FirmwareUpdater
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.- Specified by:
checkForUpdate
in interfaceFirmwareUpdater
- Returns:
- the
UpdateTask
if an update is required or null if no update is required. - Throws:
Exception
-
getFirmwareDeviceId
Description copied from interface:FirmwareUpdatableDevice
Return 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:
getFirmwareDeviceId
in interfaceFirmwareUpdatableDevice
- Returns:
- the unique device id
-
checkForUpdate
Check if a firmware update is required. Return anUpdateTask
to 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.
-