using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NTwain
{
///
/// Exposes capabilities of a data source as properties.
///
public class Capabilities
{
IDataSource _source;
///
/// Initializes a new instance of the class.
///
/// The source.
public Capabilities(IDataSource source)
{
if (source == null) { throw new ArgumentNullException("source"); }
_source = source;
}
#region non-wrapped cap calls
///
/// Gets the actual supported operations for a capability. This is not supported by all sources.
///
/// The capability id.
///
public QuerySupports? QuerySupport(CapabilityId capabilityId)
{
QuerySupports? retVal = null;
using (TWCapability cap = new TWCapability(capabilityId))
{
cap.ContainerType = ContainerType.OneValue;
var rc = _source.DGControl.Capability.QuerySupport(cap);
if (rc == ReturnCode.Success)
{
var read = CapabilityReader.ReadValue(cap);
if (read.ContainerType == ContainerType.OneValue)
{
retVal = read.OneValue.ConvertToEnum();
}
}
}
return retVal;
}
///
/// Gets the current value for a capability.
///
/// The capability id.
///
public object GetCurrent(CapabilityId capabilityId)
{
using (TWCapability cap = new TWCapability(capabilityId))
{
var rc = _source.DGControl.Capability.GetCurrent(cap);
if (rc == ReturnCode.Success)
{
var read = CapabilityReader.ReadValue(cap);
switch (read.ContainerType)
{
case ContainerType.Enum:
if (read.CollectionValues != null && read.CollectionValues.Count > read.EnumCurrentIndex)
{
return read.CollectionValues[read.EnumCurrentIndex];
}
break;
case ContainerType.OneValue:
return read.OneValue;
case ContainerType.Range:
return read.RangeCurrentValue;
case ContainerType.Array:
// no source should ever return an array but anyway
if (read.CollectionValues != null)
{
return read.CollectionValues.FirstOrDefault();
}
break;
}
}
}
return null;
}
///
/// Gets the default value for a capability.
///
/// The capability id.
///
public object GetDefault(CapabilityId capabilityId)
{
using (TWCapability cap = new TWCapability(capabilityId))
{
var rc = _source.DGControl.Capability.GetDefault(cap);
if (rc == ReturnCode.Success)
{
var read = CapabilityReader.ReadValue(cap);
switch (read.ContainerType)
{
case ContainerType.Enum:
if (read.CollectionValues != null && read.CollectionValues.Count > read.EnumDefaultIndex)
{
return read.CollectionValues[read.EnumDefaultIndex];
}
break;
case ContainerType.OneValue:
return read.OneValue;
case ContainerType.Range:
return read.RangeDefaultValue;
case ContainerType.Array:
// no source should ever return an array but anyway
if (read.CollectionValues != null)
{
return read.CollectionValues.FirstOrDefault();
}
break;
}
}
}
return null;
}
///
/// A general method that tries to get capability values from current .
///
/// The capability id.
///
public IEnumerable GetValues(CapabilityId capabilityId)
{
using (TWCapability cap = new TWCapability(capabilityId))
{
var rc = _source.DGControl.Capability.Get(cap);
if (rc == ReturnCode.Success)
{
return CapabilityReader.ReadValue(cap).EnumerateCapValues();
}
}
return Enumerable.Empty();
}
///
/// Gets all the possible values of this capability without expanding.
/// This may be required to work with large range values that cannot be safely enumerated
/// with .
///
/// The capability id.
///
public CapabilityReader GetValuesRaw(CapabilityId capabilityId)
{
using (TWCapability cap = new TWCapability(capabilityId))
{
var rc = _source.DGControl.Capability.Get(cap);
if (rc == ReturnCode.Success)
{
return CapabilityReader.ReadValue(cap);
}
}
return new CapabilityReader();
}
///
/// Resets all values and constraint to power-on defaults.
///
///
public ReturnCode ResetAll()
{
using (TWCapability cap = new TWCapability(CapabilityId.CapSupportedCaps))
{
var rc = _source.DGControl.Capability.ResetAll(cap);
return rc;
}
}
///
/// Resets the current value to power-on default.
///
/// The capability id.
///
public ReturnCode Reset(CapabilityId capabilityId)
{
using (TWCapability cap = new TWCapability(capabilityId))
{
var rc = _source.DGControl.Capability.Reset(cap);
return rc;
}
}
#endregion
#region audio caps
private CapWrapper _audXferMech;
///
/// Gets the property to work with audio for the current source.
///
///
/// The audio xfer mech.
///
public ICapWrapper ACapXferMech
{
get
{
return _audXferMech ?? (_audXferMech = new CapWrapper(_source, CapabilityId.ACapXferMech, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
#endregion
#region img caps
#region mandatory
private CapWrapper _compression;
///
/// Gets the property to work with image for the current source.
///
///
/// The image compression.
///
public ICapWrapper ICapCompression
{
get
{
return _compression ?? (_compression = new CapWrapper(_source, CapabilityId.ICapCompression, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _pixelType;
///
/// Gets the property to work with image for the current source.
///
///
/// The image pixel type.
///
public ICapWrapper ICapPixelType
{
get
{
return _pixelType ?? (_pixelType = new CapWrapper(_source, CapabilityId.ICapPixelType, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _imgUnits;
///
/// Gets the property to work with image for the current source.
///
///
/// The image unit of measure.
///
public ICapWrapper ICapUnits
{
get
{
return _imgUnits ?? (_imgUnits = new CapWrapper(_source, CapabilityId.ICapUnits, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _imgXferMech;
///
/// Gets the property to work with image for the current source.
///
///
/// The image xfer mech.
///
public ICapWrapper ICapXferMech
{
get
{
return _imgXferMech ?? (_imgXferMech = new CapWrapper(_source, CapabilityId.ICapXferMech, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
#endregion
private CapWrapper _autoBright;
///
/// Gets the property to work with image auto brightness flag for the current source.
///
///
/// The image auto brightness flag.
///
public ICapWrapper ICapAutoBright
{
get
{
return _autoBright ?? (_autoBright = new CapWrapper(_source, CapabilityId.ICapAutoBright, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Bool
}));
}
}
private CapWrapper _brightness;
///
/// Gets the property to work with image brightness for the current source.
///
///
/// The image brightness.
///
public ICapWrapper ICapBrightness
{
get
{
return _brightness ?? (_brightness = new CapWrapper(_source, CapabilityId.ICapBrightness, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _contrast;
///
/// Gets the property to work with image contrast for the current source.
///
///
/// The image contrast.
///
public ICapWrapper ICapContrast
{
get
{
return _contrast ?? (_contrast = new CapWrapper(_source, CapabilityId.ICapContrast, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _custHalftone;
///
/// Gets the property to work with image square-cell halftone for the current source.
///
///
/// The image square-cell halftone.
///
public ICapWrapper ICapCustHalftone
{
get
{
return _custHalftone ?? (_custHalftone = new CapWrapper(_source, CapabilityId.ICapCustHalftone, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt8
}));
}
}
private CapWrapper _exposureTime;
///
/// Gets the property to work with image exposure time (in seconds) for the current source.
///
///
/// The image exposure time.
///
public ICapWrapper ICapExposureTime
{
get
{
return _exposureTime ?? (_exposureTime = new CapWrapper(_source, CapabilityId.ICapExposureTime, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _filter;
///
/// Gets the property to work with image color filter for the current source.
///
///
/// The image color filter type.
///
public ICapWrapper ICapFilter
{
get
{
return _filter ?? (_filter = new CapWrapper(_source, CapabilityId.ICapFilter, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _gamma;
///
/// Gets the property to work with image gamma value for the current source.
///
///
/// The image gamma.
///
public ICapWrapper ICapGamma
{
get
{
return _gamma ?? (_gamma = new CapWrapper(_source, CapabilityId.ICapGamma, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _halftones;
///
/// Gets the property to work with image halftone patterns for the current source.
///
///
/// The image halftone patterns.
///
public ICapWrapper ICapHalftones
{
get
{
return _halftones ?? (_halftones = new CapWrapper(_source, CapabilityId.ICapHalftones, ValueExtensions.ConvertToString, false));
}
}
private CapWrapper _highlight;
///
/// Gets the property to work with image highlight value for the current source.
///
///
/// The image highlight.
///
public ICapWrapper ICapHighlight
{
get
{
return _highlight ?? (_highlight = new CapWrapper(_source, CapabilityId.ICapHighlight, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _fileFormat;
///
/// Gets the property to work with image for the current source.
///
///
/// The image file format.
///
public ICapWrapper ICapImageFileFormat
{
get
{
return _fileFormat ?? (_fileFormat = new CapWrapper(_source, CapabilityId.ICapImageFileFormat, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _lampState;
///
/// Gets the property to work with image lamp state flag for the current source.
///
///
/// The image lamp state flag.
///
public ICapWrapper ICapLampState
{
get
{
return _lampState ?? (_lampState = new CapWrapper(_source, CapabilityId.ICapLampState, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Bool
}));
}
}
private CapWrapper _lightSource;
///
/// Gets the property to work with image light source for the current source.
///
///
/// The image light source.
///
public ICapWrapper ICapLightSource
{
get
{
return _lightSource ?? (_lightSource = new CapWrapper(_source, CapabilityId.ICapLightSource, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _orientation;
///
/// Gets the property to work with image orientation for the current source.
///
///
/// The image orientation.
///
public ICapWrapper ICapOrientation
{
get
{
return _orientation ?? (_orientation = new CapWrapper(_source, CapabilityId.ICapOrientation, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _physicalWidth;
///
/// Gets the property to work with image physical width for the current source.
///
///
/// The image physical width.
///
public IReadOnlyCapWrapper ICapPhysicalWidth
{
get
{
return _physicalWidth ?? (_physicalWidth = new CapWrapper(_source, CapabilityId.ICapPhysicalWidth, ValueExtensions.ConvertToFix32, true));
}
}
private CapWrapper _physicalHeight;
///
/// Gets the property to work with image physical height for the current source.
///
///
/// The image physical height.
///
public IReadOnlyCapWrapper ICapPhysicalHeight
{
get
{
return _physicalHeight ?? (_physicalHeight = new CapWrapper(_source, CapabilityId.ICapPhysicalHeight, ValueExtensions.ConvertToFix32, true));
}
}
private CapWrapper _shadow;
///
/// Gets the property to work with image shadow value for the current source.
///
///
/// The image shadow.
///
public ICapWrapper ICapShadow
{
get
{
return _shadow ?? (_shadow = new CapWrapper(_source, CapabilityId.ICapShadow, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _frames;
///
/// Gets the property to work with the list of frames the source will acquire on each page.
///
///
/// The capture frames.
///
public ICapWrapper ICapFrames
{
get
{
return _frames ?? (_frames = new CapWrapper(_source, CapabilityId.ICapFrames, ValueExtensions.ConvertToFrame,
value =>
{
using (var cap = new TWCapability(CapabilityId.ICapFrames, value))
{
return _source.DGControl.Capability.Set(cap);
}
}));
}
}
private CapWrapper _nativeXRes;
///
/// Gets the property to work with image's native x-axis resolution for the current source.
///
///
/// The image's native x-axis resolution.
///
public IReadOnlyCapWrapper ICapXNativeResolution
{
get
{
return _nativeXRes ?? (_nativeXRes = new CapWrapper(_source, CapabilityId.ICapXNativeResolution, ValueExtensions.ConvertToFix32, true));
}
}
private CapWrapper _nativeYRes;
///
/// Gets the property to work with image's native y-axis resolution for the current source.
///
///
/// The image's native y-axis resolution.
///
public IReadOnlyCapWrapper ICapYNativeResolution
{
get
{
return _nativeYRes ?? (_nativeYRes = new CapWrapper(_source, CapabilityId.ICapYNativeResolution, ValueExtensions.ConvertToFix32, true));
}
}
private CapWrapper _xResolution;
///
/// Gets the property to work with image x-axis resolution for the current source.
///
///
/// The image x-axis resolution.
///
public ICapWrapper ICapXResolution
{
get
{
return _xResolution ?? (_xResolution = new CapWrapper(_source, CapabilityId.ICapXResolution, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _yResolution;
///
/// Gets the property to work with image y-axis resolution for the current source.
///
///
/// The image y-axis resolution.
///
public ICapWrapper ICapYResolution
{
get
{
return _yResolution ?? (_yResolution = new CapWrapper(_source, CapabilityId.ICapYResolution, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _maxFrames;
///
/// Gets the property to work with image max frames for the current source.
///
///
/// The image max frames.
///
public ICapWrapper ICapMaxFrames
{
get
{
return _maxFrames ?? (_maxFrames = new CapWrapper(_source, CapabilityId.ICapMaxFrames, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _tiles;
///
/// Gets the property to work with image tiles flag for the current source.
///
///
/// The image tiles flag.
///
public ICapWrapper ICapTiles
{
get
{
return _tiles ?? (_tiles = new CapWrapper(_source, CapabilityId.ICapTiles, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Bool
}));
}
}
private CapWrapper _bitOrder;
///
/// Gets the property to work with image for the current source.
///
///
/// The image bit order.
///
public ICapWrapper ICapBitOrder
{
get
{
return _bitOrder ?? (_bitOrder = new CapWrapper(_source, CapabilityId.ICapBitOrder, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _ccittKFactor;
///
/// Gets the property to work with image CCITT K factor for the current source.
///
///
/// The image CCITT K factor.
///
public ICapWrapper ICapCCITTKFactor
{
get
{
return _ccittKFactor ?? (_ccittKFactor = new CapWrapper(_source, CapabilityId.ICapCCITTKFactor, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _lightPath;
///
/// Gets the property to work with image light path for the current source.
///
///
/// The image light path.
///
public ICapWrapper ICapLightPath
{
get
{
return _lightPath ?? (_lightPath = new CapWrapper(_source, CapabilityId.ICapLightPath, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _pixelFlavor;
///
/// Gets the property to work with image pixel flavor for the current source.
///
///
/// The image pixel flavor.
///
public ICapWrapper ICapPixelFlavor
{
get
{
return _pixelFlavor ?? (_pixelFlavor = new CapWrapper(_source, CapabilityId.ICapPixelFlavor, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _planarChunky;
///
/// Gets the property to work with image color format for the current source.
///
///
/// The image color format.
///
public ICapWrapper ICapPlanarChunky
{
get
{
return _planarChunky ?? (_planarChunky = new CapWrapper(_source, CapabilityId.ICapPlanarChunky, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _rotation;
///
/// Gets the property to work with image rotation for the current source.
///
///
/// The image rotation.
///
public ICapWrapper ICapRotation
{
get
{
return _rotation ?? (_rotation = new CapWrapper(_source, CapabilityId.ICapRotation, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _supportSize;
///
/// Gets the property to work with image for the current source.
///
///
/// The image supported size.
///
public ICapWrapper ICapSupportedSizes
{
get
{
return _supportSize ?? (_supportSize = new CapWrapper(_source, CapabilityId.ICapSupportedSizes, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _threshold;
///
/// Gets the property to work with image threshold for the current source.
///
///
/// The image threshold.
///
public ICapWrapper ICapThreshold
{
get
{
return _threshold ?? (_threshold = new CapWrapper(_source, CapabilityId.ICapThreshold, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _xscaling;
///
/// Gets the property to work with image x-axis scaling for the current source.
///
///
/// The image x-axis scaling.
///
public ICapWrapper ICapXScaling
{
get
{
return _xscaling ?? (_xscaling = new CapWrapper(_source, CapabilityId.ICapXScaling, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _yscaling;
///
/// Gets the property to work with image y-axis scaling for the current source.
///
///
/// The image y-axis scaling.
///
public ICapWrapper ICapYScaling
{
get
{
return _yscaling ?? (_yscaling = new CapWrapper(_source, CapabilityId.ICapYScaling, ValueExtensions.ConvertToFix32,
value => new TWOneValue
{
Item = (uint)value,// ((uint)dpi) << 16;
ItemType = ItemType.Fix32
}));
}
}
private CapWrapper _bitorderCodes;
///
/// Gets the property to work with image CCITT compression for the current source.
///
///
/// The image bit order for CCITT compression.
///
public ICapWrapper ICapBitOrderCodes
{
get
{
return _bitorderCodes ?? (_bitorderCodes = new CapWrapper(_source, CapabilityId.ICapBitOrderCodes, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _pixelFlavorCodes;
///
/// Gets the property to work with image CCITT compression for the current source.
///
///
/// The image pixel flavor for CCITT compression.
///
public ICapWrapper ICapPixelFlavorCodes
{
get
{
return _pixelFlavorCodes ?? (_pixelFlavorCodes = new CapWrapper(_source, CapabilityId.ICapPixelFlavorCodes, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _jpegPixelType;
///
/// Gets the property to work with image jpeg compression for the current source.
///
///
/// The image pixel type for jpeg compression.
///
public ICapWrapper ICapJpegPixelType
{
get
{
return _jpegPixelType ?? (_jpegPixelType = new CapWrapper(_source, CapabilityId.ICapJpegPixelType, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _timeFill;
///
/// Gets the property to work with image CCITT time fill for the current source.
///
///
/// The image CCITT time fill.
///
public ICapWrapper ICapTimeFill
{
get
{
return _timeFill ?? (_timeFill = new CapWrapper(_source, CapabilityId.ICapTimeFill, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _bitDepth;
///
/// Gets the property to work with image bit depth for the current source.
///
///
/// The image bit depth.
///
public ICapWrapper ICapBitDepth
{
get
{
return _bitDepth ?? (_bitDepth = new CapWrapper(_source, CapabilityId.ICapBitDepth, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _bitDepthReduction;
///
/// Gets the property to work with image bit depth reduction method for the current source.
///
///
/// The image bit depth reduction method.
///
public ICapWrapper ICapBitDepthReduction
{
get
{
return _bitDepthReduction ?? (_bitDepthReduction = new CapWrapper(_source, CapabilityId.ICapBitDepthReduction, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _undefinedImgSize;
///
/// Gets the property to work with image undefined size flag for the current source.
///
///
/// The image undefined size flag.
///
public ICapWrapper ICapUndefinedImageSize
{
get
{
return _undefinedImgSize ?? (_undefinedImgSize = new CapWrapper(_source, CapabilityId.ICapUndefinedImageSize, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Bool
}));
}
}
private CapWrapper _imgDataSet;
///
/// Gets or sets the image indices that will be delivered during the standard image transfer done in
/// States 6 and 7.
///
///
/// The image indicies.
///
public ICapWrapper ICapImageDataSet
{
get
{
return _imgDataSet ?? (_imgDataSet = new CapWrapper(_source, CapabilityId.ICapImageDataSet, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt32
}));
}
}
private CapWrapper _extImgInfo;
///
/// Gets the property to work with ext image info flag for the current source.
///
///
/// The ext image info flag.
///
public ICapWrapper ICapExtImageInfo
{
get
{
return _extImgInfo ?? (_extImgInfo = new CapWrapper(_source, CapabilityId.ICapExtImageInfo, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Bool
}));
}
}
private CapWrapper _minHeight;
///
/// Gets the property to work with image minimum height for the current source.
///
///
/// The image minimumm height.
///
public IReadOnlyCapWrapper ICapMinimumHeight
{
get
{
return _minHeight ?? (_minHeight = new CapWrapper(_source, CapabilityId.ICapMinimumHeight, ValueExtensions.ConvertToFix32, true));
}
}
private CapWrapper _minWidth;
///
/// Gets the property to work with image minimum width for the current source.
///
///
/// The image minimumm width.
///
public IReadOnlyCapWrapper ICapMinimumWidth
{
get
{
return _minWidth ?? (_minWidth = new CapWrapper(_source, CapabilityId.ICapMinimumWidth, ValueExtensions.ConvertToFix32, true));
}
}
private CapWrapper _autoDiscBlankPg;
///
/// Gets the property to work with image blank page behavior for the current source.
///
///
/// The image blank page behavior.
///
public ICapWrapper ICapAutoDiscardBlankPages
{
get
{
return _autoDiscBlankPg ?? (_autoDiscBlankPg = new CapWrapper(_source, CapabilityId.ICapAutoDiscardBlankPages, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Int32
}));
}
}
private CapWrapper _flipRotation;
///
/// Gets the property to work with image flip-rotation behavior for the current source.
///
///
/// The image flip-rotation behavior.
///
public ICapWrapper ICapFlipRotation
{
get
{
return _flipRotation ?? (_flipRotation = new CapWrapper(_source, CapabilityId.ICapFlipRotation, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Int32
}));
}
}
private CapWrapper _barcodeDetectEnabled;
///
/// Gets the property to work with image barcode detection flag for the current source.
///
///
/// The image barcode detection flag.
///
public ICapWrapper ICapBarcodeDetectionEnabled
{
get
{
return _barcodeDetectEnabled ?? (_barcodeDetectEnabled = new CapWrapper(_source, CapabilityId.ICapBarcodeDetectionEnabled, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Bool
}));
}
}
private CapWrapper _barcodeType;
///
/// Gets the property to work with image barcode types for the current source.
///
///
/// The image barcode types.
///
public IReadOnlyCapWrapper ICapSupportedBarcodeTypes
{
get
{
return _barcodeType ?? (_barcodeType = new CapWrapper(_source, CapabilityId.ICapSupportedBarcodeTypes, ValueExtensions.ConvertToEnum, true));
}
}
private CapWrapper _barcodeMaxPriority;
///
/// Gets the property to work with image barcode max search priorities for the current source.
///
///
/// The image barcode max search priorities.
///
public ICapWrapper ICapBarcodeMaxSearchPriorities
{
get
{
return _barcodeMaxPriority ?? (_barcodeMaxPriority = new CapWrapper(_source, CapabilityId.ICapBarcodeMaxSearchPriorities, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt32
}));
}
}
private CapWrapper _barcodeSearchPriority;
///
/// Gets the property to work with image barcode search priority for the current source.
///
///
/// The image barcode search priority.
///
public ICapWrapper ICapBarcodeSearchPriorities
{
get
{
return _barcodeSearchPriority ?? (_barcodeSearchPriority = new CapWrapper(_source, CapabilityId.ICapBarcodeSearchPriorities, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _barcodeSearchMode;
///
/// Gets the property to work with image barcode search direction for the current source.
///
///
/// The image barcode search direction.
///
public ICapWrapper ICapBarcodeSearchMode
{
get
{
return _barcodeSearchMode ?? (_barcodeSearchMode = new CapWrapper(_source, CapabilityId.ICapBarcodeSearchMode, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _barcodeMaxRetries;
///
/// Gets the property to work with image barcode max search retries for the current source.
///
///
/// The image barcode max search retries.
///
public ICapWrapper ICapBarcodeMaxRetries
{
get
{
return _barcodeMaxRetries ?? (_barcodeMaxRetries = new CapWrapper(_source, CapabilityId.ICapBarcodeMaxRetries, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt32
}));
}
}
private CapWrapper _barcodeTimeout;
///
/// Gets the property to work with image barcode max search timeout for the current source.
///
///
/// The image barcode max search timeout.
///
public ICapWrapper ICapBarcodeTimeout
{
get
{
return _barcodeTimeout ?? (_barcodeTimeout = new CapWrapper(_source, CapabilityId.ICapBarcodeTimeout, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt32
}));
}
}
private CapWrapper _zoomFactor;
///
/// Gets the property to work with image zoom factor for the current source.
///
///
/// The image zoom factor.
///
public ICapWrapper ICapZoomFactor
{
get
{
return _zoomFactor ?? (_zoomFactor = new CapWrapper(_source, CapabilityId.ICapZoomFactor, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _patchcodeDetectEnabled;
///
/// Gets the property to work with image patch code detection flag for the current source.
///
///
/// The image patch code detection flag.
///
public ICapWrapper ICapPatchCodeDetectionEnabled
{
get
{
return _patchcodeDetectEnabled ?? (_patchcodeDetectEnabled = new CapWrapper(_source, CapabilityId.ICapPatchCodeDetectionEnabled, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.Bool
}));
}
}
private CapWrapper _patchcodeType;
///
/// Gets the property to work with image patch code types for the current source.
///
///
/// The image patch code types.
///
public IReadOnlyCapWrapper ICapSupportedPatchCodeTypes
{
get
{
return _patchcodeType ?? (_patchcodeType = new CapWrapper(_source, CapabilityId.ICapSupportedPatchCodeTypes, ValueExtensions.ConvertToEnum, true));
}
}
private CapWrapper _patchcodeMaxPriority;
///
/// Gets the property to work with image patch code max search priorities for the current source.
///
///
/// The image patch code max search priorities.
///
public ICapWrapper ICapPatchCodeMaxSearchPriorities
{
get
{
return _patchcodeMaxPriority ?? (_patchcodeMaxPriority = new CapWrapper(_source, CapabilityId.ICapPatchCodeMaxSearchPriorities, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt32
}));
}
}
private CapWrapper _patchcodeSearchPriority;
///
/// Gets the property to work with image patch code search priority for the current source.
///
///
/// The image patch code search priority.
///
public ICapWrapper ICapPatchCodeSearchPriorities
{
get
{
return _patchcodeSearchPriority ?? (_patchcodeSearchPriority = new CapWrapper(_source, CapabilityId.ICapPatchCodeSearchPriorities, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _patchcodeSearchMode;
///
/// Gets the property to work with image patch code search direction for the current source.
///
///
/// The image patch code search direction.
///
public ICapWrapper ICapPatchCodeSearchMode
{
get
{
return _patchcodeSearchMode ?? (_patchcodeSearchMode = new CapWrapper(_source, CapabilityId.ICapPatchCodeSearchMode, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _patchCodeMaxRetries;
///
/// Gets the property to work with image patch code max search retries for the current source.
///
///
/// The image patch code max search retries.
///
public ICapWrapper ICapPatchCodeMaxRetries
{
get
{
return _patchCodeMaxRetries ?? (_patchCodeMaxRetries = new CapWrapper(_source, CapabilityId.ICapPatchCodeMaxRetries, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt32
}));
}
}
private CapWrapper _patchCodeTimeout;
///
/// Gets the property to work with image patch code max search timeout for the current source.
///
///
/// The image patch code max search timeout.
///
public ICapWrapper ICapPatchCodeTimeout
{
get
{
return _patchCodeTimeout ?? (_patchCodeTimeout = new CapWrapper(_source, CapabilityId.ICapPatchCodeTimeout, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = value,
ItemType = ItemType.UInt32
}));
}
}
private CapWrapper _flashUsed2;
///
/// Gets the property to work with flash option for the current source.
///
///
/// The flash option.
///
public ICapWrapper ICapFlashUsed2
{
get
{
return _flashUsed2 ?? (_flashUsed2 = new CapWrapper(_source, CapabilityId.ICapFlashUsed2, ValueExtensions.ConvertToEnum,
value => new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
}
private CapWrapper _imgFilter;
///
/// Gets the property to work with image enhancement filter for the current source.
///
///
/// The image enhancement filter.
///
public ICapWrapper ICapImageFilter
{
get
{
return _imgFilter ?? (_imgFilter = new CapWrapper(_source, CapabilityId.ICapImageFilter, ValueExtensions.ConvertToEnum