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 Details

    • FirmwareUpdatableLink

      public FirmwareUpdatableLink()
  • Method Details

    • onNoUpdateRequired

      public void onNoUpdateRequired(FirmwareService service, FirmwareUpdatableDevice device)
      Description copied from interface: FirmwareUpdateCallback
      No update required.
      Specified by:
      onNoUpdateRequired in interface FirmwareUpdateCallback
      Parameters:
      service - the firmware service
      device - the device that is ready for use
    • onUpdateSuccess

      public void onUpdateSuccess(FirmwareService service, UpdateTask task)
      Description copied from interface: FirmwareUpdateCallback
      Update was successfully performed.
      Specified by:
      onUpdateSuccess in interface FirmwareUpdateCallback
      Parameters:
      service - the firmware service
      task - the task that just completed
    • onUpdateFailed

      public boolean onUpdateFailed(FirmwareService service, UpdateTask task, boolean permanent)
      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 interface FirmwareUpdateCallback
      Parameters:
      service - the firmware service
      task - the task that just failed
      permanent - 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. Returns UpdateTask if an update is required or null if no update is required. The task will be queued by FirmwareService and passed to update() when it's time to update the device. The UpdateTask 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 interface FirmwareUpdater
      Returns:
      the UpdateTask if an update is required or null if no update is required.
      Throws:
      Exception
    • getFirmwareDeviceId

      public String 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 interface FirmwareUpdatableDevice
      Returns:
      the unique device id
    • checkForUpdate

      public abstract UpdateTask checkForUpdate(FirmwareService service) throws Exception
      Check if a firmware update is required. Return an UpdateTask to perform the update if required, or null if no update is required.
      Throws:
      Exception
    • getFirmwareVersion

      public abstract String 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.