Class Variable
java.lang.Object
org.networkupstools.jnut.Variable
Class representing a variable of a device.
It can be used to get and set its value (if possible).
A Variable object can be retrieved from a Device instance
and cannot be constructed directly.
- Author:
- Emilien Kia
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the variable description from UPSD and store it in a cache.Return the device to which the variable is related.String[]Retrieve the list of possible values for an ENUM variable.getName()Return the variable name.String[]Retrieve the list of possible ranges for a RANGE variable.getType()Retrieve the variable type from UPSD.getValue()Retrieve the variable value from UPSD and store it in a cache.Set the variable value.Set the variable value, optionally waiting for completion.
-
Constructor Details
-
Variable
-
-
Method Details
-
getDevice
Return the device to which the variable is related.- Returns:
- Attached device.
-
getName
-
getValue
Retrieve the variable value from UPSD and store it in a cache.- Returns:
- Variable value
- Throws:
IOExceptionNutException
-
getDescription
Retrieve the variable description from UPSD and store it in a cache.- Returns:
- Variable description
- Throws:
IOExceptionNutException
-
setValue
Set the variable value. Note the new value can be applied with a little delay, depending on UPSD and connection.- Parameters:
value- New value for the variable- Returns:
- Tracking ID if tracking is enabled, or null.
- Throws:
IOExceptionNutException
-
setValue
public TrackingID setValue(String value, int waitIntervalSec, int waitMaxCount) throws IOException, NutException Set the variable value, optionally waiting for completion.- Parameters:
value- New value for the variable.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
-
getType
Retrieve the variable type from UPSD.- Returns:
- Variable type string.
- Throws:
IOExceptionNutException
-
getEnumList
Retrieve the list of possible values for an ENUM variable.- Returns:
- List of values.
- Throws:
IOExceptionNutException
-
getRangeList
Retrieve the list of possible ranges for a RANGE variable.- Returns:
- List of range strings or structured data.
- Throws:
IOExceptionNutException
-