I am woundering if there is a way to retrieve a list of allowed values for a state variable, or the allowed range of values for a state variable. I am developing a dynamic interface for devices and would like to use these values in generating input fields.
Currently, CyberLink has no the functions to get the allowed values.
However, I added the functions now. Please repleace the following files in org.cybergarage.upnp package using allowedvalue_patch.zip.
Please see the following sample, and check it :-)
Action powerAction = ....
Argument powerArg = getPowerAction.getArgument("Power");
StateVariable powerState = powerArg.getRelatedStateVariable();
AllowedValueList allowList = powerState.getAllowedValueList();
for (int n=0; n<allowList.size(); n++)
System.out.println("[" + n + "] = " + allowList.getAllowedValue(n));
AllowedValueRange allowRange = powerState.getAllowedValueRange();
System.out.println("maximum = " + allowRange.getMaximum());
System.out.println("minimum = " + allowRange.getMinimum());
System.out.println("step = " + allowRange.getStep());
I uploaded the patch to the following URL.
Exactly what I needed.
Should there be an updated StateVariable class too. From what I can see the StateVariavle class does not contain the method getAllowedValueRange().
I uploaded the patch that included StateVariable.java too again. Please check it.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.