Class Command
java.lang.Object
org.networkupstools.jnut.Command
Class representing a command of a device.
It can be used to retrieve description and execute commands.
A Command object can be retrieved from Device instance
and cannot be constructed directly.
- Author:
- Emilien Kia
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute()Execute the instant command without any optional argument.Execute the instant command with an optional parameter.Execute the instant command with an optional parameter, and optionally waiting for completion.Retrieve the command description from UPSD and store it in a cache.Return the device to which the command can be executed.getName()Return the command name.
-
Constructor Details
-
Command
-
-
Method Details
-
getDevice
Return the device to which the command can be executed.- Returns:
- Attached device.
-
getName
-
getDescription
Retrieve the command description from UPSD and store it in a cache.- Returns:
- Command description
- Throws:
IOExceptionNutException
-
execute
Execute the instant command without any optional argument.- Returns:
- Tracking ID if tracking is enabled, or null.
- Throws:
IOExceptionNutException
-
execute
Execute the instant command with an optional parameter.- Parameters:
param- Command parameter (the value may be null to not send it; however, an empty string may be a valid value for server side, so a""argument would be sent).- Returns:
- Tracking ID if tracking is enabled, or null.
- Throws:
IOExceptionNutException
-
execute
public TrackingID execute(String param, int waitIntervalSec, int waitMaxCount) throws IOException, NutException Execute the instant command with an optional parameter, and optionally waiting for completion.- Parameters:
param- Command parameter (the value may be null to not send it; however, an empty string may be a valid value for server side, so a""argument would be sent).waitIntervalSec- Interval between checks in seconds (if >= 1).waitMaxCount- Maximum number of checks (if >= 1).- Returns:
- Tracking ID if tracking is enabled (and not waiting), or null.
- Throws:
IOExceptionNutException
-