Class AnjayFirmwareUpdate


  • public final class AnjayFirmwareUpdate
    extends java.lang.Object
    Default implementation of Firmware Update object (/5).
    • Method Detail

      • install

        public static AnjayFirmwareUpdate install​(Anjay anjay,
                                                  AnjayFirmwareUpdateHandlers handlers,
                                                  AnjayFirmwareUpdate.InitialState initialState)
                                           throws java.lang.Exception
        Installs the Firmware Update object in an Anjay object.
        Parameters:
        anjay - Anjay object for which the Firmware Update Object is installed.
        handlers - Implemented handlers used during firmware update process.
        initialState - Information about the state to initialize the Firmware Update object in. It is intended to be used after either an orderly reboot caused by a firmware update attempt to report the update result, or by an unexpected reboot in the middle of the download process.
        Returns:
        AnjayFirmwareUpdate object which can be used to set result of the firmware update process.
        Throws:
        java.lang.Exception - In case of error.
      • setResult

        public void setResult​(AnjayFirmwareUpdate.Result result)
                       throws java.lang.Exception
        Sets the Firmware Update Result, interrupting the update process.

        A successful call to this function always sets Update State to Idle (0). If the function fails, neither Update State nor Update Result are changed.

        Some state transitions are disallowed and cause this function to fail:

        • INITIAL is never allowed and causes this function to fail.
        • SUCCESS is only allowed if the firmware application process was started by the server (an Execute operation was already performed on the Update resource of the Firmware Update object or UPDATING was used in a call to install(). Otherwise, the function fails.
        • Other values of result (various error codes) are only allowed if Firmware Update State is not Idle (0), i.e. firmware is being downloaded, was already downloaded or is being applied.

        WARNING: calling this in AnjayFirmwareUpdateHandlers.performUpgrade() handler is supported, but the result of using it from within any other of AnjayFirmwareUpdateHandlers is undefined.

        Parameters:
        result - Value of the Update Result resource to set.
        Throws:
        java.lang.Exception - If the result can't be set.