Class FirmwareService
- All Implemented Interfaces:
CtxEventListener
,ContextHandleAware
,HandleAware
,Ready
,ReadyListener
- Version:
- 2023-10-05
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFirmware
(KabFile kab) Add a firmware kab file.void
cancelUpdate
(FirmwareUpdatableDevice device) Called if a device is no longer valid.getAvailableFirmware
(String boardType, String firmwareType) Return the list of available firmware with the specified board and firmware types;getAvailableFirmware
(String boardType, String firmwareType, String boardRevision) Return the list of available firmware with the specified board and firmware types and an optional board revision.getNewestFirmware
(String boardType, String firmwareType, String ignoreVersion) Return the newest available firmware for the specified boardType and firmwareType.getNewestFirmware
(String boardType, String firmwareType, String boardRevision, String ignoreVersion) Return the newest available firmware for the specified boardType and firmwareType.getNewestFirmware
(String boardType, String firmwareType, String boardRevision, String ignoreVersion, Comparator<FirmwareInfo> versionComparator) Return the newest available firmware for the specified boardType and firmwareType.boolean
Override in subclasses to be notified when all dependencies are ready.void
queueUpdate
(UpdateTask task) Queue anUpdateTask
to be run.void
updateFirmware
(FirmwareUpdatableDevice device, FirmwareUpdater updater, FirmwareUpdateCallback callback) Queue the device for firmware update if needed.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onDependenciesReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Field Details
-
SECTION_PREFIX_FIRMWARE
- See Also:
-
-
Method Details
-
onBeanReady
public boolean onBeanReady()Description copied from class:ReadyBean
Override in subclasses to be notified when all dependencies are ready. Return true to indicate that this bean is also ready. If the bean needs to callsetReady()
later due to some async processing, return false to preventsetReady()
from being called automatically.It is recommended to override this method rather than
onDependenciesReady()
as a majority of the time it requires callingsuper.onDependneciesReady()
or explicitly callingsetReady()
which defaults to a failure mode.- Overrides:
onBeanReady
in classReadyBean
- Returns:
-
getAvailableFirmware
Return the list of available firmware with the specified board and firmware types;- Parameters:
boardType
- the type of the board to matchfirmwareType
- the type of firmware to match
-
getAvailableFirmware
public List<FirmwareInfo> getAvailableFirmware(String boardType, String firmwareType, String boardRevision) Return the list of available firmware with the specified board and firmware types and an optional board revision. Board revisions allow different versions of a given board to have different firmware.- Parameters:
boardType
- the type of the board to matchfirmwareType
- the type of firmware to matchboardRevision
- optional revision to match
-
getNewestFirmware
Return the newest available firmware for the specified boardType and firmwareType.If the optional ignoreVersion is specified and it matches the newest version, null will be returned instead of the newest firmware. This allows the currently installed firmware version to be specified so that null is returned if already installed.
This uses the default version comparator which supports four digit version numbers. To use custom version sorting, use the method with optional comparator.
- Parameters:
boardType
- the type of the board to matchfirmwareType
- the type of firmware to matchignoreVersion
- optional version to ignore
-
getNewestFirmware
public FirmwareInfo getNewestFirmware(String boardType, String firmwareType, String boardRevision, String ignoreVersion) Return the newest available firmware for the specified boardType and firmwareType. If the optional boardRevision is specified, only firmware compatible with the specified revision will be considered.If the optional ignoreVersion is specified and it matches the newest version, null will be returned instead of the newest firmware. This allows the currently installed firmware version to be specified so that null is returned if already installed.
This uses the default version comparator which supports four digit version numbers. To use custom version sorting, use the method with optional comparator.
- Parameters:
boardType
- the type of the board to matchfirmwareType
- the type of firmware to matchboardRevision
- optional revision to matchignoreVersion
- optional version to ignore
-
getNewestFirmware
public FirmwareInfo getNewestFirmware(String boardType, String firmwareType, String boardRevision, String ignoreVersion, Comparator<FirmwareInfo> versionComparator) Return the newest available firmware for the specified boardType and firmwareType. If the optional boardRevision is specified, only firmware compatible with the specified revision will be considered.If the optional ignoreVersion is specified and it matches the newest version, null will be returned instead of the newest firmware. This allows the currently installed firmware version to be specified so that null is returned if already installed.
This uses the specified comparator to compare version numbers. This allows custom versions to be used. When sorted with the comparator, the first available firmware in the resulting list is returned. If not specified, the default comparator will be used which supports four digit versions.
- Parameters:
boardType
- the type of the board to matchfirmwareType
- the type of firmware to matchboardRevision
- optional revision to matchignoreVersion
- optional version to ignoreversionComparator
- custom comparator for version numbers
-
addFirmware
Add a firmware kab file. This will process the firmware section from the kab descriptor and make the results searchable.- Parameters:
kab
- the kab that contains firmware
-
updateFirmware
public void updateFirmware(FirmwareUpdatableDevice device, FirmwareUpdater updater, FirmwareUpdateCallback callback) Queue the device for firmware update if needed. Devices will sit in this queue until firmware mgr finishes scanning all available firmware and then each device will be checked one at a time. If the firmware on a given device needs to be updated, that device will be put into the upgrade queue.- Parameters:
device
- device to updateupdater
- performs the actual updatecallback
- callback to notify when device is ready
-
cancelUpdate
Called if a device is no longer valid. This will remove it from the update process, allowing a new instance of the device to queue a new job. If an update is in progress, it will be cancelled. It's the responsibility of the updater to leave the hardware in a valid state when cancelled. -
queueUpdate
Queue anUpdateTask
to be run. This should only be called with anUpdateTask
provided toonUpdateRequired()
where this method returned false. This provides a way for user code to start the otherwise blocked update. The most common reason for this flow is in the event that a user must confirm an update. This allowsonUpdateRequired()
to return false, user code can then hold the task and callqueueUpdate()
once the user confirms the update. -
getHardwareService
-