Class MagicFirmwareUpdateThingHandler
- All Implemented Interfaces:
FirmwareUpdateHandler
,ThingHandler
- Author:
- Dimitar Ivanov - Initial contribution
-
Field Summary
Fields inherited from class org.openhab.core.thing.binding.BaseThingHandler
scheduler, thing
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels a previous started firmware update.void
handleCommand
(ChannelUID channelUID, Command command) Handles a command for a given channel.void
Initializes the thing handler, e.g.boolean
Returns true, if this firmware update handler is in a state in which the firmware update can be executed, otherwise false (e.g.void
updateFirmware
(Firmware firmware, ProgressCallback progressCallback) Updates the firmware for the physical device of the thing that is handled by this firmware update handler.Methods inherited from class org.openhab.core.thing.binding.BaseThingHandler
bridgeStatusChanged, changeThingType, channelLinked, channelUnlinked, dispose, editConfiguration, editProperties, editThing, getBridge, getCallback, getConfig, getConfigAs, getConfigDescription, getConfigDescription, getThing, handleConfigurationUpdate, handleRemoval, isInitialized, isLinked, isLinked, isModifyingCurrentConfig, postCommand, postCommand, sendTimeSeries, sendTimeSeries, setCallback, thingUpdated, triggerChannel, triggerChannel, triggerChannel, triggerChannel, updateConfiguration, updateProperties, updateProperty, updateState, updateState, updateStatus, updateStatus, updateStatus, updateThing, validateConfigurationParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.thing.binding.firmware.FirmwareUpdateHandler
getThing
Methods inherited from interface org.openhab.core.thing.binding.ThingHandler
getServices
-
Constructor Details
-
MagicFirmwareUpdateThingHandler
-
-
Method Details
-
handleCommand
Description copied from interface:ThingHandler
Handles a command for a given channel.This method is only called, if the thing has been initialized (status ONLINE/OFFLINE/UNKNOWN).
- Specified by:
handleCommand
in interfaceThingHandler
- Parameters:
channelUID
- theChannelUID
of the channel to which the command was sentcommand
- theCommand
-
initialize
public void initialize()Description copied from interface:ThingHandler
Initializes the thing handler, e.g. update thing status, allocate resources, transfer configuration.This method is only called, if the
Thing
contains all required configuration parameters.Only
Thing
s with statusThingStatus.UNKNOWN
,ThingStatus.ONLINE
orThingStatus.OFFLINE
are considered as initialized by the framework. To achieve that, the status must be reported viaThingHandlerCallback.statusUpdated(Thing, ThingStatusInfo)
.The framework expects this method to be non-blocking and return quickly. For longer running initializations, the implementation has to take care of scheduling a separate job which must guarantee to set the thing status eventually.
Any anticipated error situations should be handled gracefully and need to result in
ThingStatus.OFFLINE
with the corresponding status detail (e.g. *COMMUNICATION_ERROR* or *CONFIGURATION_ERROR* including a meaningful description) instead of throwing exceptions.- Specified by:
initialize
in interfaceThingHandler
-
updateFirmware
Description copied from interface:FirmwareUpdateHandler
Updates the firmware for the physical device of the thing that is handled by this firmware update handler.- Specified by:
updateFirmware
in interfaceFirmwareUpdateHandler
- Parameters:
firmware
- the new firmware to be updated (not null)progressCallback
- the progress callback to send progress information of the firmware update process (not null)
-
cancel
public void cancel()Description copied from interface:FirmwareUpdateHandler
Cancels a previous started firmware update.- Specified by:
cancel
in interfaceFirmwareUpdateHandler
-
isUpdateExecutable
public boolean isUpdateExecutable()Description copied from interface:FirmwareUpdateHandler
Returns true, if this firmware update handler is in a state in which the firmware update can be executed, otherwise false (e.g. the thing isThingStatus.OFFLINE
or its status detail is alreadyThingStatusDetail.FIRMWARE_UPDATING
.)- Specified by:
isUpdateExecutable
in interfaceFirmwareUpdateHandler
- Returns:
- true, if this firmware update handler is in a state in which the firmware update can be executed, otherwise false
-