Package SampleUdpDevice
Class Device.CommonSubDeviceToolset
java.lang.Object
SampleUdpDevice.Device.CommonSubDeviceToolset
- Enclosing class:
- Device
Class used to check whether command and return parameters are correct.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintChecks whether response is a valid response for commandintcheckValidCommand(String command, String response, String[] opportunities)Checks whether the second part of a command and the corresponding response are formally correct.voidsaveCurrentStatusInformation(String[][] commands)Saves the current state of a sub-device before a status request.voidsetNewStatusInformation(String[] resp)Handles status changes.voidMethod to be overwritten.booleanMethod to be overwritten.voidMethod to be called after status changes have been stored to perform event handling.voidMethod to be overwritten.
-
Constructor Details
-
CommonSubDeviceToolset
protected CommonSubDeviceToolset()
-
-
Method Details
-
check
Checks whether response is a valid response for command- Parameters:
command- Both parts of a command.response- Both parts of a response, first parts of command and response must be equal.- Returns:
- Return values specify the result of validation. The following values are supported:
- 1: The response is a valid response.
- 0: This ReturnValueChecker cannot validate this command.
- -1: The response is an invalid or unknown value.
- -2: The command is invalid.
-
checkValidCommand
Checks whether the second part of a command and the corresponding response are formally correct.- Parameters:
command- Right request part (part right of ":").response- Right part of response (part right of ":").opportunities- List of functions supported by a specific sub-device.- Returns:
- Length of fuction name if valid, otherwise 0.
-
saveCurrentStatusInformation
Saves the current state of a sub-device before a status request. The saved values will usually be compared with the new status after the request. If different, one or more events may be thrown.- Parameters:
commands- One-dimensional array of commands to for status update. Commands to update the specific sub- command must be appended on return.
-
setNewStatusInformation
Handles status changes.- Parameters:
resp- Parameter strings as returned by the status update commands given by saveCurrentStatusInformation. The strings are in the same sequence as the commands.
-
statusUpdateEventProcessing
public void statusUpdateEventProcessing()Method to be called after status changes have been stored to perform event handling. -
statusUpdateProcessing
public void statusUpdateProcessing()Method to be overwritten. Will be called if device is online to perform event handling. -
statusPowerOnlineProcessing
public boolean statusPowerOnlineProcessing()Method to be overwritten. Will be called to generate power online event for sub-device before other StatusUpdateEvents will be thrown.- Returns:
- The previous power state.
-
statusPowerOfflineProcessing
public void statusPowerOfflineProcessing()Method to be overwritten. Will be called to generate power offline event for sub-device after all other StatusUpdateEvents, have been thrown.
-