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, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _noiseFilter; /// /// Gets the property to work with image noise filter for the current source. /// /// /// The image noise filter. /// public ICapWrapper ICapNoiseFilter { get { return _noiseFilter ?? (_noiseFilter = new CapWrapper(_source, CapabilityId.ICapNoiseFilter, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _overscan; /// /// Gets the property to work with image overscan option for the current source. /// /// /// The image overscan option. /// public ICapWrapper ICapOverScan { get { return _overscan ?? (_overscan = new CapWrapper(_source, CapabilityId.ICapOverScan, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _borderDetect; /// /// Gets the property to work with auto border detection flag for the current source. /// /// /// The auto border detection flag. /// public ICapWrapper ICapAutomaticBorderDetection { get { return _borderDetect ?? (_borderDetect = new CapWrapper(_source, CapabilityId.ICapAutomaticBorderDetection, ValueExtensions.ConvertToEnum, value => { var rc = ReturnCode.Failure; var one = new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool }; // this needs to also set undefined size optino rc = ICapUndefinedImageSize.SetValue(value); using (TWCapability capValue = new TWCapability(CapabilityId.ICapAutomaticBorderDetection, one)) { rc = _source.DGControl.Capability.Set(capValue); } return rc; })); } } private CapWrapper _autoDeskew; /// /// Gets the property to work with image auto deskew flag for the current source. /// /// /// The image auto deskew flag. /// public ICapWrapper ICapAutomaticDeskew { get { return _autoDeskew ?? (_autoDeskew = new CapWrapper(_source, CapabilityId.ICapAutomaticDeskew, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _autoRotate; /// /// Gets the property to work with image auto rotate flag for the current source. /// /// /// The image auto rotate flag. /// public ICapWrapper ICapAutomaticRotate { get { return _autoRotate ?? (_autoRotate = new CapWrapper(_source, CapabilityId.ICapAutomaticRotate, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _jpegQuality; /// /// Gets the property to work with image jpeg quality for the current source. /// /// /// The image jpeg quality. /// public ICapWrapper ICapJpegQuality { get { //TODO: verify return _jpegQuality ?? (_jpegQuality = new CapWrapper(_source, CapabilityId.ICapJpegQuality, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Int16 })); } } private CapWrapper _feederType; /// /// Gets the property to work with feeder type for the current source. /// /// /// The feeder type. /// public ICapWrapper ICapFeederType { get { return _feederType ?? (_feederType = new CapWrapper(_source, CapabilityId.ICapFeederType, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _iccProfile; /// /// Gets the property to work with image icc profile for the current source. /// /// /// The image icc profile. /// public ICapWrapper ICapICCProfile { get { return _iccProfile ?? (_iccProfile = new CapWrapper(_source, CapabilityId.ICapICCProfile, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _autoSize; /// /// Gets the property to work with image auto size option for the current source. /// /// /// The image auto size option. /// public ICapWrapper ICapAutoSize { get { return _autoSize ?? (_autoSize = new CapWrapper(_source, CapabilityId.ICapAutoSize, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _cropUseFrame; /// /// Gets the property to work with image auto crop flag for the current source. /// /// /// The image auto crop flag. /// public IReadOnlyCapWrapper ICapAutomaticCropUsesFrame { get { return _cropUseFrame ?? (_cropUseFrame = new CapWrapper(_source, CapabilityId.ICapAutomaticCropUsesFrame, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _lengthDetect; /// /// Gets the property to work with image auto length detection flag for the current source. /// /// /// The image auto length detection flag. /// public ICapWrapper ICapAutomaticLengthDetection { get { return _lengthDetect ?? (_lengthDetect = new CapWrapper(_source, CapabilityId.ICapAutomaticLengthDetection, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _autoColor; /// /// Gets the property to work with image auto color detection flag for the current source. /// /// /// The image auto color detection flag. /// public ICapWrapper ICapAutomaticColorEnabled { get { return _autoColor ?? (_autoColor = new CapWrapper(_source, CapabilityId.ICapAutomaticColorEnabled, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _autoColorNonPixel; /// /// Gets the property to work with image auto non-color pixel type for the current source. /// /// /// The image auto non-color pixel type. /// public ICapWrapper ICapAutomaticColorNonColorPixelType { get { return _autoColorNonPixel ?? (_autoColorNonPixel = new CapWrapper(_source, CapabilityId.ICapAutomaticColorNonColorPixelType, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _colorMgmt; /// /// Gets the property to work with image color management flag for the current source. /// /// /// The image color management flag. /// public ICapWrapper ICapColorManagementEnabled { get { return _colorMgmt ?? (_colorMgmt = new CapWrapper(_source, CapabilityId.ICapColorManagementEnabled, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _imgMerge; /// /// Gets the property to work with image merge option for the current source. /// /// /// The image merge option. /// public ICapWrapper ICapImageMerge { get { return _imgMerge ?? (_imgMerge = new CapWrapper(_source, CapabilityId.ICapImageMerge, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _mergeHeight; /// /// Gets the property to work with image merge height threshold for the current source. /// /// /// The image merge height threshold. /// public ICapWrapper ICapImageMergeHeightThreshold { get { return _mergeHeight ?? (_mergeHeight = new CapWrapper(_source, CapabilityId.ICapImageMergeHeightThreshold, ValueExtensions.ConvertToFix32, value => new TWOneValue { Item = (uint)value,// ((uint)dpi) << 16; ItemType = ItemType.Fix32 })); } } private CapWrapper _supportedExtInfo; /// /// Gets the property to get supported ext image info for the current source. /// /// /// The supported ext image info. /// public IReadOnlyCapWrapper ICapSupportedExtImageInfo { get { return _supportedExtInfo ?? (_supportedExtInfo = new CapWrapper(_source, CapabilityId.ICapSupportedExtImageInfo, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _filmType; /// /// Gets the property to work with image film type for the current source. /// /// /// The image film type. /// public ICapWrapper ICapFilmType { get { return _filmType ?? (_filmType = new CapWrapper(_source, CapabilityId.ICapFilmType, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _mirror; /// /// Gets the property to work with image mirror option for the current source. /// /// /// The image mirror option. /// public ICapWrapper ICapMirror { get { return _mirror ?? (_mirror = new CapWrapper(_source, CapabilityId.ICapMirror, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _jpegSubSampling; /// /// Gets the property to work with image jpeg sub sampling for the current source. /// /// /// The image jpeg sub sampling. /// public ICapWrapper ICapJpegSubsampling { get { return _jpegSubSampling ?? (_jpegSubSampling = new CapWrapper(_source, CapabilityId.ICapJpegSubsampling, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } #endregion #region general caps #region mandatory private CapWrapper _xferCount; /// /// Gets the property to work with xfer count for the current source. /// /// /// The xfer count. /// public ICapWrapper CapXferCount { get { return _xferCount ?? (_xferCount = new CapWrapper(_source, CapabilityId.CapXferCount, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = value > 0 ? (uint)value : uint.MaxValue, ItemType = ItemType.UInt16 })); } } #endregion private CapWrapper _author; /// /// Gets the property to work with the name or other identifying information about the /// Author of the image. It may include a copyright string. /// /// /// The author string. /// public ICapWrapper CapAuthor { get { return _author ?? (_author = new CapWrapper(_source, CapabilityId.CapAuthor, ValueExtensions.ConvertToString, value => { using (var cap = new TWCapability(CapabilityId.CapAuthor, value, ItemType.String128)) { return _source.DGControl.Capability.Set(cap); } })); } } private CapWrapper _caption; /// /// Gets the property to work with the general note about the acquired image. /// /// /// The general note string. /// public ICapWrapper CapCaption { get { return _caption ?? (_caption = new CapWrapper(_source, CapabilityId.CapCaption, ValueExtensions.ConvertToString, value => { using (var cap = new TWCapability(CapabilityId.CapCaption, value, ItemType.String255)) { return _source.DGControl.Capability.Set(cap); } })); } } private CapWrapper _feederEnabled; /// /// Gets the property to work with feeder enabled flag for the current source. /// /// /// The feeder enabled flag. /// public ICapWrapper CapFeederEnabled { get { return _feederEnabled ?? (_feederEnabled = new CapWrapper(_source, CapabilityId.CapFeederEnabled, ValueExtensions.ConvertToEnum, value => { var rc = ReturnCode.Failure; var one = new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool }; // we will never set feeder off, only autofeed and autoscan // but if it is true then enable feeder needs to be set first if (value == BoolType.True) { using (TWCapability enabled = new TWCapability(CapabilityId.CapFeederEnabled, one)) { rc = _source.DGControl.Capability.Set(enabled); } } // to really use feeder we must also set autofeed or autoscan, but only // for one of them since setting autoscan also sets autofeed if (CapAutoScan.CanSet) { rc = CapAutoScan.SetValue(value); } else if (CapAutoFeed.CanSet) { rc = CapAutoFeed.SetValue(value); } return rc; })); } } private CapWrapper _feederLoaded; /// /// Gets the property to work with feeder loaded flag for the current source. /// /// /// The feeder loaded flag. /// public IReadOnlyCapWrapper CapFeederLoaded { get { return _feederLoaded ?? (_feederLoaded = new CapWrapper(_source, CapabilityId.CapFeederLoaded, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _timedate; /// /// Gets the property to get the image acquired time and date. /// /// /// The time and date string. /// public IReadOnlyCapWrapper CapTimeDate { get { return _timedate ?? (_timedate = new CapWrapper(_source, CapabilityId.CapTimeDate, ValueExtensions.ConvertToString, true)); } } private CapWrapper _supportedCaps; /// /// Gets the supported caps for the current source. This is not supported by all sources. /// /// /// The supported caps. /// public IReadOnlyCapWrapper CapSupportedCaps { get { return _supportedCaps ?? (_supportedCaps = new CapWrapper(_source, CapabilityId.CapSupportedCaps, value => value.ConvertToEnum(false), true)); } } private CapWrapper _extendedCaps; /// /// Gets the extended caps for the current source. /// /// /// The extended caps. /// public ICapWrapper CapExtendedCaps { get { return _extendedCaps ?? (_extendedCaps = new CapWrapper(_source, CapabilityId.CapExtendedCaps, value => value.ConvertToEnum(false), value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _autoFeed; /// /// Gets the property to work with auto feed page flag for the current source. /// /// /// The auto feed flag. /// public ICapWrapper CapAutoFeed { get { return _autoFeed ?? (_autoFeed = new CapWrapper(_source, CapabilityId.CapAutoFeed, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _clearPage; /// /// Gets the property to work with clear page flag for the current source. /// /// /// The clear page flag. /// public ICapWrapper CapClearPage { get { return _clearPage ?? (_clearPage = new CapWrapper(_source, CapabilityId.CapClearPage, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _feedPage; /// /// Gets the property to work with feed page flag for the current source. /// /// /// The feed page flag. /// public ICapWrapper CapFeedPage { get { return _feedPage ?? (_feedPage = new CapWrapper(_source, CapabilityId.CapFeedPage, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _rewindPage; /// /// Gets the property to work with rewind page flag for the current source. /// /// /// The rewind page flag. /// public ICapWrapper CapRewindPage { get { return _rewindPage ?? (_rewindPage = new CapWrapper(_source, CapabilityId.CapRewindPage, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _indicators; /// /// Gets the property to work with indicators flag for the current source. /// /// /// The indicators flag. /// public ICapWrapper CapIndicators { get { return _indicators ?? (_indicators = new CapWrapper(_source, CapabilityId.CapIndicators, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _paperDetectable; /// /// Gets the property to work with paper sensor flag for the current source. /// /// /// The paper sensor flag. /// public IReadOnlyCapWrapper CapPaperDetectable { get { return _paperDetectable ?? (_paperDetectable = new CapWrapper(_source, CapabilityId.CapPaperDetectable, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _uiControllable; /// /// Gets the property to work with UI controllable flag for the current source. /// /// /// The UI controllable flag. /// public IReadOnlyCapWrapper CapUIControllable { get { return _uiControllable ?? (_uiControllable = new CapWrapper(_source, CapabilityId.CapUIControllable, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _devOnline; /// /// Gets the property to work with devince online flag for the current source. /// /// /// The devince online flag. /// public IReadOnlyCapWrapper CapDeviceOnline { get { return _devOnline ?? (_devOnline = new CapWrapper(_source, CapabilityId.CapDeviceOnline, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _autoScan; /// /// Gets the property to work with auto scan page flag for the current source. /// /// /// The auto scan flag. /// public ICapWrapper CapAutoScan { get { return _autoScan ?? (_autoScan = new CapWrapper(_source, CapabilityId.CapAutoScan, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _thumbsEnabled; /// /// Gets the property to work with thumbnails enabled flag for the current source. /// /// /// The thumbnails enabled flag. /// public ICapWrapper CapThumbnailsEnabled { get { return _thumbsEnabled ?? (_thumbsEnabled = new CapWrapper(_source, CapabilityId.CapThumbnailsEnabled, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _duplex; /// /// Gets the property to see what's the duplex mode for the current source. /// /// /// The duplex mode. /// public IReadOnlyCapWrapper CapDuplex { get { return _duplex ?? (_duplex = new CapWrapper(_source, CapabilityId.CapDuplex, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _duplexEnabled; /// /// Gets the property to work with duplex enabled flag for the current source. /// /// /// The duplex enabled flag. /// public ICapWrapper CapDuplexEnabled { get { return _duplexEnabled ?? (_duplexEnabled = new CapWrapper(_source, CapabilityId.CapDuplexEnabled, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _dsUIonly; /// /// Gets the property to see whether device supports UI only flag (no transfer). /// /// /// The UI only flag. /// public IReadOnlyCapWrapper CapEnableDSUIOnly { get { return _dsUIonly ?? (_dsUIonly = new CapWrapper(_source, CapabilityId.CapEnableDSUIOnly, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _dsData; /// /// Gets the property to see whether device supports custom data triplets. /// /// /// The custom data flag. /// public IReadOnlyCapWrapper CapCustomDSData { get { return _dsData ?? (_dsData = new CapWrapper(_source, CapabilityId.CapCustomDSData, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _endorser; /// /// Gets the property to work with endorser for the current source. /// /// /// The endorser option. /// public ICapWrapper CapEndorser { get { return _endorser ?? (_endorser = new CapWrapper(_source, CapabilityId.CapEndorser, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = value, ItemType = ItemType.UInt32 })); } } private CapWrapper _jobControl; /// /// Gets the property to work with job control option for the current source. /// /// /// The job control option. /// public ICapWrapper CapJobControl { get { return _jobControl ?? (_jobControl = new CapWrapper(_source, CapabilityId.CapJobControl, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _alarms; /// /// Gets the property to work with alarms for the current source. /// /// /// The alarms. /// public ICapWrapper CapAlarms { get { return _alarms ?? (_alarms = new CapWrapper(_source, CapabilityId.CapAlarms, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _alarmVolume; /// /// Gets the property to work with alarm volume for the current source. /// /// /// The alarm volume. /// public ICapWrapper CapAlarmVolume { get { return _alarmVolume ?? (_alarmVolume = new CapWrapper(_source, CapabilityId.CapAlarmVolume, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Int32 })); } } private CapWrapper _autoCapture; /// /// Gets the property to work with auto capture count for the current source. /// /// /// The auto capture count. /// public ICapWrapper CapAutomaticCapture { get { return _autoCapture ?? (_autoCapture = new CapWrapper(_source, CapabilityId.CapAutomaticCapture, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Int32 })); } } private CapWrapper _timeBeforeCap; /// /// Gets the property to work with the time before first capture (milliseconds) for the current source. /// /// /// The time before first capture. /// public ICapWrapper CapTimeBeforeFirstCapture { get { return _timeBeforeCap ?? (_timeBeforeCap = new CapWrapper(_source, CapabilityId.CapTimeBeforeFirstCapture, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Int32 })); } } private CapWrapper _timeBetweenCap; /// /// Gets the property to work with the time between captures (milliseconds) for the current source. /// /// /// The time between captures. /// public ICapWrapper CapTimeBetweenCaptures { get { return _timeBetweenCap ?? (_timeBetweenCap = new CapWrapper(_source, CapabilityId.CapTimeBetweenCaptures, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Int32 })); } } private CapWrapper _clearBuff; /// /// Gets the property to work with the clear buffers option for the current source. /// /// /// The clear buffers option. /// public ICapWrapper CapClearBuffers { get { return _clearBuff ?? (_clearBuff = new CapWrapper(_source, CapabilityId.CapClearBuffers, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _maxBatchBuff; /// /// Gets the property to work with the max buffered pages for the current source. /// /// /// The max batch buffered pages. /// public ICapWrapper CapMaxBatchBuffers { get { return _maxBatchBuff ?? (_maxBatchBuff = new CapWrapper(_source, CapabilityId.CapMaxBatchBuffers, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = value, ItemType = ItemType.UInt32 })); } } private CapWrapper _devTimeDate; /// /// Gets the property to work with the device's time and date. /// /// /// The device time and date. /// public ICapWrapper CapDeviceTimeDate { get { return _devTimeDate ?? (_devTimeDate = new CapWrapper(_source, CapabilityId.CapDeviceTimeDate, ValueExtensions.ConvertToString, value => { using (var cap = new TWCapability(CapabilityId.CapDeviceTimeDate, value, ItemType.String32)) { return _source.DGControl.Capability.Set(cap); } })); } } private CapWrapper _powerSup; /// /// Gets the property to see current device's power supply. /// /// /// The power supply indicator. /// public IReadOnlyCapWrapper CapPowerSupply { get { return _powerSup ?? (_powerSup = new CapWrapper(_source, CapabilityId.CapPowerSupply, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _camPreviewUI; /// /// Gets the property to see whether device supports camera preview UI flag. /// /// /// The camera preview UI flag. /// public IReadOnlyCapWrapper CapCameraPreviewUI { get { return _camPreviewUI ?? (_camPreviewUI = new CapWrapper(_source, CapabilityId.CapCameraPreviewUI, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _devEvent; /// /// Gets the property to work with the reported device events for the current source. /// /// /// The reported device events. /// public ICapWrapper CapDeviceEvent { get { return _devEvent ?? (_devEvent = new CapWrapper(_source, CapabilityId.CapDeviceEvent, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _serialNo; /// /// Gets the property for device serial number. /// /// /// The device serial number. /// public IReadOnlyCapWrapper CapSerialNumber { get { return _serialNo ?? (_serialNo = new CapWrapper(_source, CapabilityId.CapSerialNumber, ValueExtensions.ConvertToString, true)); } } private CapWrapper _printer; /// /// Gets the property to work with printer list for the current source. /// /// /// The printer list. /// public ICapWrapper CapPrinter { get { return _printer ?? (_printer = new CapWrapper(_source, CapabilityId.CapPrinter, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _printerEnabled; /// /// Gets the property to work with printer enabled flag. /// /// /// The printer enabled flag. /// public ICapWrapper CapPrinterEnabled { get { return _printerEnabled ?? (_printerEnabled = new CapWrapper(_source, CapabilityId.CapPrinterEnabled, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _printerIndex; /// /// Gets the property to work with the starting printer index for the current source. /// /// /// The printer index. /// public ICapWrapper CapPrinterIndex { get { return _printerIndex ?? (_printerIndex = new CapWrapper(_source, CapabilityId.CapPrinterIndex, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt32 })); } } private CapWrapper _printerMode; /// /// Gets the property to work with printer mode for the current source. /// /// /// The printer mode. /// public ICapWrapper CapPrinterMode { get { return _printerMode ?? (_printerMode = new CapWrapper(_source, CapabilityId.CapPrinterMode, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _printerString; /// /// Specifies the string(s) that are to be used in the string component when the current /// device is enabled. /// /// /// The printer string. /// public ICapWrapper CapPrinterString { get { return _printerString ?? (_printerString = new CapWrapper(_source, CapabilityId.CapPrinterString, ValueExtensions.ConvertToString, value => { using (var cap = new TWCapability(CapabilityId.CapPrinterString, value, ItemType.String255)) { return _source.DGControl.Capability.Set(cap); } })); } } private CapWrapper _printerSuffix; /// /// Specifies the string that shall be used as the current device’s suffix. /// /// /// The printer suffix string. /// public ICapWrapper CapPrinterSuffix { get { return _printerSuffix ?? (_printerSuffix = new CapWrapper(_source, CapabilityId.CapPrinterSuffix, ValueExtensions.ConvertToString, value => { using (var cap = new TWCapability(CapabilityId.CapPrinterSuffix, value, ItemType.String255)) { return _source.DGControl.Capability.Set(cap); } })); } } private CapWrapper _language; /// /// Gets the property to work with string data language for the current source. /// /// /// The language. /// public ICapWrapper CapLanguage { get { return _language ?? (_language = new CapWrapper(_source, CapabilityId.CapLanguage, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _feedAlign; /// /// Gets the property to work with feeder alignment for the current source. /// /// /// The feeder alignment. /// public ICapWrapper CapFeederAlignment { get { return _feedAlign ?? (_feedAlign = new CapWrapper(_source, CapabilityId.CapFeederAlignment, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _feedOrder; /// /// Gets the property to work with feeder order for the current source. /// /// /// The feeder order. /// public ICapWrapper CapFeederOrder { get { return _feedOrder ?? (_feedOrder = new CapWrapper(_source, CapabilityId.CapFeederOrder, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _reacuireAllow; /// /// Gets the property to see whether device supports reacquire flag. /// /// /// The reacquire flag. /// public IReadOnlyCapWrapper CapReacquireAllowed { get { return _reacuireAllow ?? (_reacuireAllow = new CapWrapper(_source, CapabilityId.CapReacquireAllowed, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _battMinutes; /// /// Gets the property to see the remaining battery power for the device. /// /// /// The battery minutes. /// public IReadOnlyCapWrapper CapBatteryMinutes { get { return _battMinutes ?? (_battMinutes = new CapWrapper(_source, CapabilityId.CapBatteryMinutes, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _battPercent; /// /// Gets the property to see the remaining battery percentage for the device. /// /// /// The battery percentage. /// public IReadOnlyCapWrapper CapBatteryPercentage { get { return _battPercent ?? (_battPercent = new CapWrapper(_source, CapabilityId.CapBatteryPercentage, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _camSide; /// /// Gets the property to work with camera side for the current source. /// /// /// The camera side. /// public ICapWrapper CapCameraSide { get { return _camSide ?? (_camSide = new CapWrapper(_source, CapabilityId.CapCameraSide, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _segmented; /// /// Gets the property to work with segmentation setting for the current source. /// /// /// The segmentation setting. /// public ICapWrapper CapSegmented { get { return _segmented ?? (_segmented = new CapWrapper(_source, CapabilityId.CapSegmented, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _camEnabled; /// /// Gets the property to work with camera enabled flag. /// /// /// The camera enabled flag. /// public ICapWrapper CapCameraEnabled { get { return _camEnabled ?? (_camEnabled = new CapWrapper(_source, CapabilityId.CapCameraEnabled, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _camOrder; /// /// Gets the property to work with camera order for the current source. /// /// /// The camera order setting. /// public ICapWrapper CapCameraOrder { get { return _camOrder ?? (_camOrder = new CapWrapper(_source, CapabilityId.CapCameraOrder, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _micrEnabled; /// /// Gets the property to work with check scanning support flag. /// /// /// The check scanning support flag. /// public ICapWrapper CapMicrEnabled { get { return _micrEnabled ?? (_micrEnabled = new CapWrapper(_source, CapabilityId.CapMicrEnabled, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _feederPrep; /// /// Gets the property to work with feeder prep flag. /// /// /// The feeder prep flag. /// public ICapWrapper CapFeederPrep { get { return _feederPrep ?? (_feederPrep = new CapWrapper(_source, CapabilityId.CapFeederPrep, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _feedPocket; /// /// Gets the property to work with feeder pocket for the current source. /// /// /// The feeder pocket setting. /// public ICapWrapper CapFeederPocket { get { return _feedPocket ?? (_feedPocket = new CapWrapper(_source, CapabilityId.CapFeederPocket, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _autoMedium; /// /// Gets the property to work with auto-sense medium (paper source) flag. /// /// /// The auto-sense medium flag. /// public ICapWrapper CapAutomaticSenseMedium { get { return _autoMedium ?? (_autoMedium = new CapWrapper(_source, CapabilityId.CapAutomaticSenseMedium, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Bool })); } } private CapWrapper _custGuid; /// /// Gets the property for device interface guid. /// /// /// The device interface guid. /// public IReadOnlyCapWrapper CapCustomInterfaceGuid { get { return _custGuid ?? (_custGuid = new CapWrapper(_source, CapabilityId.CapCustomInterfaceGuid, ValueExtensions.ConvertToString, true)); } } private CapWrapper _supportedCapsUnique; /// /// Gets the supported caps for unique segments for the current source. /// /// /// The supported caps for unique segments. /// public IReadOnlyCapWrapper CapSupportedCapsSegmentUnique { get { return _supportedCapsUnique ?? (_supportedCapsUnique = new CapWrapper(_source, CapabilityId.CapSupportedCapsSegmentUnique, value => value.ConvertToEnum(false), true)); } } private CapWrapper _supportedDat; /// /// Gets the supported caps for supported DATs. /// /// /// The supported DATs. /// public IReadOnlyCapWrapper CapSupportedDATs { get { return _supportedDat ?? (_supportedDat = new CapWrapper(_source, CapabilityId.CapSupportedDATs, ValueExtensions.ConvertToEnum, true)); } } private CapWrapper _dblFeedDetect; /// /// Gets the property to work with double feed detection option for the current source. /// /// /// The double feed detection option. /// public ICapWrapper CapDoubleFeedDetection { get { return _dblFeedDetect ?? (_dblFeedDetect = new CapWrapper(_source, CapabilityId.CapDoubleFeedDetection, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _dblFeedLength; /// /// Gets the property to work with double feed detection length for the current source. /// /// /// The double feed detection length. /// public ICapWrapper CapDoubleFeedDetectionLength { get { return _dblFeedLength ?? (_dblFeedLength = new CapWrapper(_source, CapabilityId.CapDoubleFeedDetectionLength, ValueExtensions.ConvertToFix32, value => new TWOneValue { Item = (uint)value,// ((uint)dpi) << 16; ItemType = ItemType.Fix32 })); } } private CapWrapper _dblFeedSensitivity; /// /// Gets the property to work with double feed detection sensitivity for the current source. /// /// /// The double feed detection sensitivity. /// public ICapWrapper CapDoubleFeedDetectionSensitivity { get { return _dblFeedSensitivity ?? (_dblFeedSensitivity = new CapWrapper(_source, CapabilityId.CapDoubleFeedDetectionSensitivity, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _dblFeedResp; /// /// Gets the property to work with double feed detection response for the current source. /// /// /// The double feed detection response. /// public ICapWrapper CapDoubleFeedDetectionResponse { get { return _dblFeedResp ?? (_dblFeedResp = new CapWrapper(_source, CapabilityId.CapDoubleFeedDetectionResponse, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _paperHandling; /// /// Gets the property to work with paper handling option for the current source. /// /// /// The paper handling option. /// public ICapWrapper CapPaperHandling { get { return _paperHandling ?? (_paperHandling = new CapWrapper(_source, CapabilityId.CapPaperHandling, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _indicatorMode; /// /// Gets the property to work with diplayed indicators for the current source. /// /// /// The diplayed indicators. /// public ICapWrapper CapIndicatorsMode { get { return _indicatorMode ?? (_indicatorMode = new CapWrapper(_source, CapabilityId.CapIndicatorsMode, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt16 })); } } private CapWrapper _printVOffset; /// /// Gets the property to work with printer y-offset for the current source. /// /// /// The printer y-offset. /// public ICapWrapper CapPrinterVerticalOffset { get { return _printVOffset ?? (_printVOffset = new CapWrapper(_source, CapabilityId.CapPrinterVerticalOffset, ValueExtensions.ConvertToFix32, value => new TWOneValue { Item = (uint)value,// ((uint)dpi) << 16; ItemType = ItemType.Fix32 })); } } private CapWrapper _powerSaveTime; /// /// Gets the property to work with camera power down time (seconds) for the current source. /// /// /// The camera power down time. /// public ICapWrapper CapPowerSaveTime { get { return _powerSaveTime ?? (_powerSaveTime = new CapWrapper(_source, CapabilityId.CapPowerSaveTime, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.Int32 })); } } private CapWrapper _printCharRot; /// /// Gets the property to work with printer character rotation for the current source. /// /// /// The printer character rotation. /// public ICapWrapper CapPrinterCharRotation { get { return _printCharRot ?? (_printCharRot = new CapWrapper(_source, CapabilityId.CapPrinterCharRotation, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt32 })); } } private CapWrapper _printFontStyle; /// /// Gets the property to work with printer font style for the current source. /// /// /// The printer font style. /// public ICapWrapper CapPrinterFontStyle { get { return _printFontStyle ?? (_printFontStyle = new CapWrapper(_source, CapabilityId.CapPrinterFontStyle, ValueExtensions.ConvertToEnum, false)); } } private CapWrapper _printerIdxLeadChar; /// /// Set the character to be used for filling the leading digits before the counter value if the /// counter digits are fewer than . /// /// /// The printer leading string. /// public ICapWrapper CapPrinterIndexLeadChar { get { return _printerIdxLeadChar ?? (_printerIdxLeadChar = new CapWrapper(_source, CapabilityId.CapPrinterIndexLeadChar, ValueExtensions.ConvertToString, value => { using (var cap = new TWCapability(CapabilityId.CapPrinterIndexLeadChar, value, ItemType.String32)) { return _source.DGControl.Capability.Set(cap); } })); } } private CapWrapper _printIdxMax; /// /// Gets the property to work with printer index max value for the current source. /// /// /// The printer index max value. /// public ICapWrapper CapPrinterIndexMaxValue { get { return _printIdxMax ?? (_printIdxMax = new CapWrapper(_source, CapabilityId.CapPrinterIndexMaxValue, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = value, ItemType = ItemType.UInt32 })); } } private CapWrapper _printNumDigit; /// /// Gets the property to work with printer number digits value for the current source. /// /// /// The printer number digits value. /// public ICapWrapper CapPrinterIndexNumDigits { get { return _printNumDigit ?? (_printNumDigit = new CapWrapper(_source, CapabilityId.CapPrinterIndexNumDigits, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt32 })); } } private CapWrapper _printIdxStep; /// /// Gets the property to work with printer index step value for the current source. /// /// /// The printer index step value. /// public ICapWrapper CapPrinterIndexStep { get { return _printIdxStep ?? (_printIdxStep = new CapWrapper(_source, CapabilityId.CapPrinterIndexStep, ValueExtensions.ConvertToEnum, value => new TWOneValue { Item = (uint)value, ItemType = ItemType.UInt32 })); } } private CapWrapper _printIdxTrig; /// /// Gets the property to work with printer index trigger for the current source. /// /// /// The printer index trigger. /// public ICapWrapper CapPrinterIndexTrigger { get { return _printIdxTrig ?? (_printIdxTrig = new CapWrapper(_source, CapabilityId.CapPrinterIndexTrigger, ValueExtensions.ConvertToEnum, false)); } } private CapWrapper _printPreview; /// /// Gets the next print values. /// /// /// The next print values. /// public IReadOnlyCapWrapper CapPrinterStringPreview { get { return _printPreview ?? (_printPreview = new CapWrapper(_source, CapabilityId.CapPrinterStringPreview, ValueExtensions.ConvertToString, true)); } } #endregion } }