This project has moved. For the latest updates, please go here.

Capability Containers

Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected. To help categorize the supported values, Saraff.Twain.NET defines four types of containers for capabilities.
  • Object
A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value. For example, a capability that indicates the presence of a document
feeder could be of this type.
  • Object[]
An array of values that describes the current logical item. The available values may be a larger array of
values. For example, a list of the names, such as the supported capabilities list returned by the
CAP_SUPPORTEDCAPS capability, would use this type of container.
  • Twain32.Range
Many capabilities allow users to select their current value from a range of regularly spaced values. The
capability can specify the minimum and maximum acceptable values and the incremental step size between values. For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600).
  • Twain32.Enumeration
This is the most general type because it defines a list of values from which the Current Value can be chosen. The values do not progress uniformly through a range and there is not a consistent step size between the values. For example, if a Source’s resolution options did not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600).

var _cap=this._twain32.GetCap(TwCap.Contrast);
if(_cap is Twain32.Enumeration) {
    // TWON_ENUMERATION
} else if(_cap is Twain32.Range) {
    // TWON_RANGE
} else if(_cap is object[]) {
    // TWON_ARRAY
} else {
    // TWON_ONEVALUE
}

Last edited Nov 26, 2016 at 7:09 PM by SARAFF, version 1