public class Control extends Object
Control objects are not directly instantiated. Instead a
list of Controls associated with a VideoDevice
can be obtained by calling getControlList().
Once the controls are no longer used, they must be released by calling
releaseControlList(). Any attempt
to use a control after it has been released will result in a
StateException.V4L4JConstants.CTRL_TYPE_BUTTON: Such controls take only 2 different
values: 0 and 1V4L4JConstants.CTRL_TYPE_SLIDER: Controls of this type take a range
of values between a minimum value (returned by getMinValue()) and a
maximum value (returned by getMaxValue()) with an increment value
(returned by getStepValue())V4L4JConstants.CTRL_TYPE_SWITCH: Switch controls do not take any
specific value, and attempting to read its current value will always return
0. Setting any value will activate the switch.V4L4JConstants.CTRL_TYPE_DISCRETE: These controls accept only specific
discrete values, which can be retrieved using getDiscreteValues().
Each discrete value may be accompanied by a description, which is returned by
getDiscreteValueNames().V4L4JConstants.CTRL_TYPE_STRING: These controls accept string values,
which can be retrieved using getStringValue() and set with
setStringValue(String). Calls to any other get/set methods will result in
UnsupportedMethod exceptions. getMinValue() & getMaxValue()
return the smallest / largest string length (number of characters) this control will accept.
getStepValue() specify the step length of the string.V4L4JConstants.CTRL_TYPE_LONG: These controls accept long values,
between Long.MIN_VALUE and Long.MAX_VALUE with a step value
of 1. The actual value is set / retrieved
with setLongValue(long) and getLongValue().
Calls to any other get/set methods, getMinValue(),
getMaxValue() and getStepValue() will result in UnsupportedMethod
exceptions.V4L4JConstants.CTRL_TYPE_BITMASK: These controls accept bitmask values,
between 0 and Integer.MAX_VALUE with a step value
of 1. The actual value is set / retrieved
with setValue(int) and getValue().
Calls to any other get/set methods will result in UnsupportedMethod
exceptions.| Modifier and Type | Method and Description |
|---|---|
int |
decreaseValue()
This method decreases this control's current value by its step (as returned
by
getStepValue(). |
int |
getDefaultValue()
This method returns the default value for this control
|
List<String> |
getDiscreteValueNames()
This method returns the list of names for each of the supported discrete values.
|
List<Integer> |
getDiscreteValues()
This method returns a list of the discrete values accepted by this control.
|
Map<String,Integer> |
getDiscreteValuesMap()
This method returns a map of all discrete value names and their values.
|
long |
getLongValue()
This method retrieves the current long value of this control.
|
int |
getMaxValue()
This method retrieves the maximum value this control will accept.
|
int |
getMinValue()
This method retrieves the minimum value this control will accept.
|
String |
getName()
This method retrieves the name of this control.
|
int |
getStepValue()
This method retrieves the increment to be used when setting a new value
for this control.
|
String |
getStringValue()
This method retrieves the current string value of this control.
|
int |
getType()
This method retrieves the type of this control.
|
int |
getValue()
This method retrieves the current value of this control.
|
int |
increaseValue()
This method increases this control's current value by its step (as returned
by
getStepValue()). |
long |
setLongValue(long value)
This method sets a new long value for this control.
|
String |
setStringValue(String value)
This method sets a new string value for this control.
|
int |
setValue(int value)
This method sets a new value for this control.
|
public int getValue()
throws ControlException
ControlException - if the value cannot be retrievedUnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_STRING
(and you should be using getStringValue() instead) or
if this control is of type V4L4JConstants.CTRL_TYPE_LONG
(and you should be using setLongValue(long) instead).StateException - if this control has been released and must not be used anymore.public int setValue(int value)
throws ControlException
getDefaultValue()).value - the new valueControlException - if the value can not be set.UnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_STRING
(and you should be using setStringValue(String) instead) or
if this control is of type V4L4JConstants.CTRL_TYPE_LONG
(and you should be using setLongValue(long) instead).StateException - if this control has been released and must not be used anymore.public String getStringValue() throws ControlException
ControlException - if the value cannot be retrievedUnsupportedMethod - if this control
is not of type V4L4JConstants.CTRL_TYPE_STRING.StateException - if this control has been released and must not be used anymore.public String setStringValue(String value) throws ControlException
value - the new valueControlException - if the value can not be set, or if the new string value's length
is under / over the minimum / maximum length.UnsupportedMethod - if this control is not of type V4L4JConstants.CTRL_TYPE_STRING,StateException - if this control has been released and must not be used anymore.public long getLongValue()
throws ControlException
ControlException - if the value cannot be retrievedUnsupportedMethod - if this control
is not of type V4L4JConstants.CTRL_TYPE_LONG.StateException - if this control has been released and must not be used anymore.public long setLongValue(long value)
throws ControlException
value - the new valueControlException - if the value can not be set.UnsupportedMethod - if this control is not of type V4L4JConstants.CTRL_TYPE_LONG,StateException - if this control has been released and must not be used anymore.public int increaseValue()
throws ControlException
getStepValue()). The returned value is the new value
of the control, which for normal controls will be identical to the old one plus
the step value. However, some controls (for example relative values like pan
or tilt) are write-only and getting their value does not make sense. In this case,
this method sets the new value to the default one plus the step value.
Note that, the return value in this case is still the control's default value
(as returned by getDefaultValue()), not the default one plus the step value.ControlException - if the value cannot be increasedUnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_STRING
or V4L4JConstants.CTRL_TYPE_LONGStateException - if this control has been released and must not be used anymore.public int decreaseValue()
throws ControlException
getStepValue(). The returned value is the new value
of the control, which for normal controls will be identical to the old one minus
the step value. However, some controls (for example relative values like pan
or tilt) are write-only and getting their value does not make sense. In this case,
this method sets the new value to the default one minus the step value.
Note that, the return value in this case is still the control's default value
(as returned by getDefaultValue()), not the default one plus the step value.ControlException - if the value can not be increasedUnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_STRING
or V4L4JConstants.CTRL_TYPE_LONGStateException - if this control has been released and must not be used anymore.public int getMaxValue()
StateException - if this control has been released and must not be used anymore.UnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_LONGpublic int getMinValue()
StateException - if this control has been released and must not be used anymore.UnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_LONGpublic String getName()
StateException - if this control has been released and must not be used anymore.public int getStepValue()
getMin() + K*getStep()
where K is an integer, and the result is less or equal to getMaxValue().
For string control, this method returns the step size of the string.StateException - if this control has been released and must not be used anymore.UnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_LONGpublic int getType()
V4L4JConstants.CTRL_TYPE_BUTTON, V4L4JConstants.CTRL_TYPE_SLIDER,
V4L4JConstants.CTRL_TYPE_SWITCH, V4L4JConstants.CTRL_TYPE_DISCRETE,
V4L4JConstants.CTRL_TYPE_STRING, V4L4JConstants.CTRL_TYPE_LONG,
V4L4JConstants.CTRL_TYPE_BITMASK.StateException - if this control has been released and must not be used anymore.public int getDefaultValue()
UnsupportedMethod - if this control is of type V4L4JConstants.CTRL_TYPE_STRINGStateException - if this control has been released and must not be used anymorepublic List<Integer> getDiscreteValues()
getDiscreteValueNames().
So a value at index 'i' in the list returned by this method, matches the name
at the same index in the list returned by getDiscreteValueNames().UnsupportedMethod - if this control does not support discrete values.
Check this control's type (with getType()) and use the appropriate method.StateException - if this control has been released and must not be used anymorepublic List<String> getDiscreteValueNames()
getDiscreteValues().
So the name at index 'i' in the list returned by this method, matches the value
at the same index in the list returned by getDiscreteValues().UnsupportedMethod - if this control does not support discrete values.
Check this control's type (with getType()) and use the appropriate method.StateException - if this control has been released and must not be used anymorepublic Map<String,Integer> getDiscreteValuesMap()
UnsupportedMethod - if this control does not support discrete values.
Check this control's type (with getType()) and use the appropriate method.StateException - if this control has been released and must not be used anymoreCopyright © 2013-2015 Bartosz Firyn (sarxos). All Rights Reserved.