com.tuneology.sane
Class OptionDescriptor

java.lang.Object
  |
  +--com.tuneology.sane.OptionDescriptor
Direct Known Subclasses:
BooleanOption, ButtonOption, FixedOption, GroupOption, IntegerOption, StringOption

public class OptionDescriptor
extends java.lang.Object

Option descriptors are at the same time the most intricate and powerful type in the SANE standard. Options are used to control virtually all aspects of device operation. Much of the power of the SANE API stems from the fact that most device controls are completely described by their respective option descriptor. Thus, a frontend can control a scanner abstractly, without requiring knowledge as to what the purpose of any given option is. Conversely, a scanner can describe its controls without requiring knowledge of how the frontend operates.

Version:
$Id$
Author:
Fran Taylor

Method Summary
 int getCap()
          Describes what capabilities the option posseses.
 java.lang.String getDescription()
          A (potentially very) long string that can be used as a help text to describe the option.
 java.lang.Object[] getElements()
          Returns an array of constraint elements for the option.
 java.lang.String getName()
          String that uniquely identifies the option.
 SaneRange getRange()
          If not null, indicates a range of values for the option.
 int getSize()
          Returns the number of elements in the option.
 java.lang.String getTitle()
          A single-line string that can be used by the frontend as a title string.
 int getUnit()
          Specifies the type of the option value.
 void setAutomatic()
          Turn on automatic mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
String that uniquely identifies the option. The name must be unique for a given device (i.e., the option names across different backends or devices need not be unique). The option name must consist of lowercase letters (a-z), digits (0-9), or the dash character (-) only. The first character must be a lower-case letter (i.e., not a digit or a dash).

Returns:
the string that uniquely describes the button.

getTitle

public java.lang.String getTitle()
A single-line string that can be used by the frontend as a title string. This should typically be a short (one or two-word) string that is chosen based on the function of the option.

Returns:
the title of the option.

getDescription

public java.lang.String getDescription()
A (potentially very) long string that can be used as a help text to describe the option. It is the responsibility of the frontend to break the string into managable-length lines. Newline characters in this string should be interpreted as paragraph breaks.

Returns:
the description of the option.

getUnit

public int getUnit()
Specifies the type of the option value. The possible values are: TYPE_BOOL, TYPE_INT, TYPE_FIXED, TYPE_STRING, TYPE_BUTTON, and TYPE_GROUP.

Returns:
the type of the option value.

getCap

public int getCap()
Describes what capabilities the option posseses. This is a bitset that is formed as the inclusive logical OR of the capabilities:

CAP_SOFT_SELECT
CAP_HARD_SELECT
CAP_SOFT_DETECT
CAP_EMULATED
CAP_AUTOMATIC
CAP_INACTIVE
CAP_ADVANCED
CAP_ALWAYS_SETTABLE

Returns:
the capabilities of the option.

getSize

public int getSize()
Returns the number of elements in the option.

Returns:
the number of elements in the option.

getElements

public java.lang.Object[] getElements()
Returns an array of constraint elements for the option.

Returns:
an array of constraint elements for the option.

getRange

public SaneRange getRange()
If not null, indicates a range of values for the option.

Returns:
a range of values for the option, or null if not applicable.

setAutomatic

public void setAutomatic()
                  throws SaneException
Turn on automatic mode. Backend or device will automatically select an appropriate value. This mode remains effective until overridden by an explicit set value request.

Throws:
SaneException