Files
ntwain/NTwain/DataSource.Caps.cs

646 lines
23 KiB
C#
Raw Normal View History

2014-04-02 19:13:15 -04:00
using NTwain.Data;
2014-04-20 20:45:08 -04:00
using System;
2014-04-02 19:01:21 -04:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
2014-04-02 19:01:21 -04:00
namespace NTwain
{
2014-09-11 21:14:41 -04:00
// this contains all cap-related methods prefixed with Cap
partial class DataSource
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
#region low-level cap stuff
2014-04-20 22:24:05 -04:00
/// <summary>
/// Gets the actual supported operations for a capability.
/// </summary>
/// <param name="capId">The cap identifier.</param>
/// <returns></returns>
public QuerySupports CapQuerySupport(CapabilityId capId)
2014-04-20 22:24:05 -04:00
{
QuerySupports retVal = QuerySupports.None;
2014-04-20 22:24:05 -04:00
using (TWCapability cap = new TWCapability(capId))
{
2014-09-02 19:10:35 -04:00
var rc = _session.DGControl.Capability.QuerySupport(cap);
2014-04-20 22:24:05 -04:00
if (rc == ReturnCode.Success)
{
2014-05-22 21:29:22 -04:00
var read = CapabilityReader.ReadValue(cap);
2014-04-20 22:24:05 -04:00
if (read.ContainerType == ContainerType.OneValue)
{
retVal = read.OneValue.ConvertToEnum<QuerySupports>();
2014-04-20 22:24:05 -04:00
}
}
}
return retVal;
}
2014-04-02 19:01:21 -04:00
/// <summary>
/// Gets the current value for a capability.
2014-04-02 19:01:21 -04:00
/// </summary>
/// <param name="capId">The cap id.</param>
/// <returns></returns>
2014-05-19 21:26:44 -04:00
public object CapGetCurrent(CapabilityId capId)
2014-04-02 19:01:21 -04:00
{
using (TWCapability cap = new TWCapability(capId))
{
2014-09-02 19:10:35 -04:00
var rc = _session.DGControl.Capability.GetCurrent(cap);
2014-04-02 19:01:21 -04:00
if (rc == ReturnCode.Success)
{
2014-05-22 21:29:22 -04:00
var read = CapabilityReader.ReadValue(cap);
switch (read.ContainerType)
2014-04-02 19:01:21 -04:00
{
case ContainerType.Enum:
2014-09-17 07:33:52 -04:00
if (read.CollectionValues != null && read.CollectionValues.Count > read.EnumCurrentIndex)
2014-04-02 19:01:21 -04:00
{
return read.CollectionValues[read.EnumCurrentIndex];
2014-04-02 19:01:21 -04:00
}
break;
case ContainerType.OneValue:
return read.OneValue;
2014-04-02 19:01:21 -04:00
case ContainerType.Range:
return read.RangeCurrentValue;
case ContainerType.Array:
// no source should ever return an array but anyway
if (read.CollectionValues != null)
2014-04-02 19:01:21 -04:00
{
return read.CollectionValues.FirstOrDefault();
2014-04-02 19:01:21 -04:00
}
break;
}
}
}
return null;
2014-04-02 19:01:21 -04:00
}
2014-09-17 07:33:52 -04:00
/// <summary>
/// Gets the default value for a capability.
/// </summary>
/// <param name="capId">The cap id.</param>
/// <returns></returns>
public object CapGetDefault(CapabilityId capId)
{
using (TWCapability cap = new TWCapability(capId))
{
var rc = _session.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;
}
2014-04-02 19:01:21 -04:00
/// <summary>
/// A general method that tries to get capability values from current <see cref="DataSource" />.
2014-04-02 19:01:21 -04:00
/// </summary>
/// <param name="capabilityId">The capability unique identifier.</param>
/// <returns></returns>
2014-09-17 07:33:52 -04:00
public IList<object> CapGet(CapabilityId capabilityId)
2014-04-02 19:01:21 -04:00
{
var list = new List<object>();
2014-04-02 19:01:21 -04:00
using (TWCapability cap = new TWCapability(capabilityId))
{
2014-09-02 19:10:35 -04:00
var rc = _session.DGControl.Capability.Get(cap);
2014-04-02 19:01:21 -04:00
if (rc == ReturnCode.Success)
{
cap.ReadMultiCapValues(list);
2014-04-02 19:01:21 -04:00
}
}
return list;
}
/// <summary>
2014-09-17 07:33:52 -04:00
/// Resets all values and constraint to power-on defaults.
2014-04-02 19:01:21 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <param name="capabilityId">The capability identifier.</param>
2014-04-02 19:01:21 -04:00
/// <returns></returns>
2014-09-17 07:33:52 -04:00
public ReturnCode ResetAll(CapabilityId capabilityId)
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
using (TWCapability cap = new TWCapability(capabilityId)
{
ContainerType = ContainerType.DoNotCare
})
{
var rc = DGControl.Capability.ResetAll(cap);
return rc;
}
2014-04-02 19:01:21 -04:00
}
/// <summary>
2014-09-17 07:33:52 -04:00
/// Resets the current value to power-on default.
2014-04-02 19:01:21 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <param name="capabilityId">The capability identifier.</param>
2014-04-02 19:01:21 -04:00
/// <returns></returns>
2014-09-17 07:33:52 -04:00
public ReturnCode Reset(CapabilityId capabilityId)
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
using (TWCapability cap = new TWCapability(capabilityId)
{
ContainerType = ContainerType.DoNotCare
})
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
var rc = DGControl.Capability.Reset(cap);
return rc;
2014-04-02 19:01:21 -04:00
}
}
#endregion
2014-09-17 07:33:52 -04:00
#region high-level caps
2014-04-02 19:01:21 -04:00
2014-09-17 07:33:52 -04:00
private CapabilityControl<XferMech> _imgXferMech;
2014-04-02 19:01:21 -04:00
/// <summary>
2014-09-17 07:33:52 -04:00
/// Gets the property to work with image <see cref="XferMech"/> for the current source.
2014-04-02 19:01:21 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <value>
/// The image xfer mech.
/// </value>
public CapabilityControl<XferMech> CapImageXferMech
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
get
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
if (_imgXferMech == null)
{
_imgXferMech = new CapabilityControl<XferMech>(this, CapabilityId.ICapXferMech, CapRoutines.EnumRoutine<XferMech>,
value => new TWCapability(CapabilityId.ICapXferMech, new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
return _imgXferMech;
2014-04-02 19:01:21 -04:00
}
}
2014-09-17 07:33:52 -04:00
private CapabilityControl<XferMech> _audXferMech;
2014-04-02 19:01:21 -04:00
/// <summary>
2014-09-17 07:33:52 -04:00
/// Gets the property to work with audio <see cref="XferMech"/> for the current source.
2014-04-02 19:01:21 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <value>
/// The audio xfer mech.
/// </value>
public CapabilityControl<XferMech> CapAudioXferMech
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
get
{
if (_audXferMech == null)
{
_audXferMech = new CapabilityControl<XferMech>(this, CapabilityId.ACapXferMech, CapRoutines.EnumRoutine<XferMech>,
value => new TWCapability(CapabilityId.ACapXferMech, new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
return _audXferMech;
}
2014-04-02 19:01:21 -04:00
}
2014-09-17 07:33:52 -04:00
private CapabilityControl<CompressionType> _compression;
2014-04-02 19:01:21 -04:00
/// <summary>
2014-09-17 07:33:52 -04:00
/// Gets the property to work with image <see cref="CompressionType"/> for the current source.
2014-04-02 19:01:21 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <value>
/// The image compression.
/// </value>
public CapabilityControl<CompressionType> CapImageCompression
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
get
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
if (_compression == null)
{
_compression = new CapabilityControl<CompressionType>(this, CapabilityId.ICapCompression, CapRoutines.EnumRoutine<CompressionType>,
value => new TWCapability(CapabilityId.ICapCompression, new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
return _compression;
2014-04-02 19:01:21 -04:00
}
}
2014-09-17 07:33:52 -04:00
private CapabilityControl<FileFormat> _fileFormat;
2014-04-07 19:46:03 -04:00
/// <summary>
2014-09-17 07:33:52 -04:00
/// Gets the property to work with image <see cref="FileFormat"/> for the current source.
2014-04-07 19:46:03 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <value>
/// The image file format.
/// </value>
public CapabilityControl<FileFormat> CapImageFileFormat
2014-04-07 19:46:03 -04:00
{
2014-09-17 07:33:52 -04:00
get
{
if (_fileFormat == null)
{
_fileFormat = new CapabilityControl<FileFormat>(this, CapabilityId.ICapImageFileFormat, CapRoutines.EnumRoutine<FileFormat>,
value => new TWCapability(CapabilityId.ICapImageFileFormat, new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
return _fileFormat;
}
2014-04-07 19:46:03 -04:00
}
2014-09-17 07:33:52 -04:00
private CapabilityControl<PixelType> _pixelType;
2014-04-07 19:46:03 -04:00
/// <summary>
2014-09-17 07:33:52 -04:00
/// Gets the property to work with image <see cref="PixelType"/> for the current source.
2014-04-07 19:46:03 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <value>
/// The image pixel type.
/// </value>
public CapabilityControl<PixelType> CapImagePixelType
2014-04-07 19:46:03 -04:00
{
2014-09-17 07:33:52 -04:00
get
{
if (_pixelType == null)
{
_pixelType = new CapabilityControl<PixelType>(this, CapabilityId.ICapPixelType, CapRoutines.EnumRoutine<PixelType>,
value => new TWCapability(CapabilityId.ICapPixelType, new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
return _pixelType;
}
2014-04-07 19:46:03 -04:00
}
2014-09-17 07:33:52 -04:00
private CapabilityControl<SupportedSize> _supportSize;
2014-04-07 19:46:03 -04:00
/// <summary>
2014-09-17 07:33:52 -04:00
/// Gets the property to work with image <see cref="SupportedSize"/> for the current source.
2014-04-07 19:46:03 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <value>
/// The image supported size.
/// </value>
public CapabilityControl<SupportedSize> CapImageSupportedSize
2014-04-07 19:46:03 -04:00
{
2014-09-17 07:33:52 -04:00
get
2014-04-07 19:46:03 -04:00
{
2014-09-17 07:33:52 -04:00
if (_supportSize == null)
{
_supportSize = new CapabilityControl<SupportedSize>(this, CapabilityId.ICapSupportedSizes, CapRoutines.EnumRoutine<SupportedSize>,
value => new TWCapability(CapabilityId.ICapSupportedSizes, new TWOneValue
{
Item = (uint)value,
ItemType = ItemType.UInt16
}));
}
return _supportSize;
2014-04-07 19:46:03 -04:00
}
}
2014-09-17 07:33:52 -04:00
private CapabilityControl<BoolType> _autoDeskew;
2014-04-07 19:46:03 -04:00
/// <summary>
2014-09-17 07:33:52 -04:00
/// Gets the property to work with image auto deskew flag for the current source.
2014-04-07 19:46:03 -04:00
/// </summary>
2014-09-17 07:33:52 -04:00
/// <value>
/// The image supported size.
/// </value>
public CapabilityControl<BoolType> CapImageAutoDeskew
2014-04-07 19:46:03 -04:00
{
2014-09-17 07:33:52 -04:00
get
2014-04-07 19:46:03 -04:00
{
2014-09-17 07:33:52 -04:00
if (_autoDeskew == null)
{
_autoDeskew = new CapabilityControl<BoolType>(this, CapabilityId.ICapAutomaticDeskew, CapRoutines.EnumRoutine<BoolType>, null);
}
return _autoDeskew;
2014-04-07 19:46:03 -04:00
}
}
#endregion
2014-04-02 19:01:21 -04:00
#region dpi
/// <summary>
/// Gets the supported DPI values for the current source.
/// Only call this at state 4 or higher.
/// </summary>
/// <returns></returns>
public IList<TWFix32> CapGetDPIs()
2014-04-02 19:01:21 -04:00
{
2014-09-17 07:33:52 -04:00
var list = CapGet(CapabilityId.ICapXResolution);
return list.Select(o => o.ConvertToFix32()).ToList();
2014-04-02 19:01:21 -04:00
}
/// <summary>
/// Change the DPI value for the current source.
/// </summary>
/// <param name="dpi">The DPI.</param>
/// <returns></returns>
public ReturnCode CapSetDPI(TWFix32 dpi)
2014-04-02 19:01:21 -04:00
{
return CapSetDPI(dpi, dpi);
2014-04-02 19:01:21 -04:00
}
/// <summary>
/// Change the DPI value for the current source.
/// </summary>
/// <param name="xDPI">The x DPI.</param>
/// <param name="yDPI">The y DPI.</param>
/// <returns></returns>
public ReturnCode CapSetDPI(TWFix32 xDPI, TWFix32 yDPI)
2014-04-02 19:01:21 -04:00
{
TWOneValue one = new TWOneValue();
one.Item = (uint)xDPI;// ((uint)dpi) << 16;
one.ItemType = ItemType.Fix32;
using (TWCapability xres = new TWCapability(CapabilityId.ICapXResolution, one))
{
2014-09-02 19:10:35 -04:00
var rc = _session.DGControl.Capability.Set(xres);
2014-04-02 19:01:21 -04:00
if (rc == ReturnCode.Success)
{
one.Item = (uint)yDPI;
using (TWCapability yres = new TWCapability(CapabilityId.ICapYResolution, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(yres);
2014-04-02 19:01:21 -04:00
}
}
return rc;
}
}
#endregion
#region onesie flags
/// <summary>
/// Change the auto deskew flag for the current source.
/// </summary>
2014-04-22 06:50:58 -04:00
/// <param name="useIt">if set to <c>true</c> use it.</param>
2014-04-02 19:01:21 -04:00
/// <returns></returns>
public ReturnCode CapSetAutoDeskew(bool useIt)
2014-04-02 19:01:21 -04:00
{
var rc = ReturnCode.Failure;
if (SupportedCaps.Contains(CapabilityId.ICapAutomaticDeskew))
2014-04-02 19:01:21 -04:00
{
if (Identity.ProtocolMajor >= 2)
2014-04-02 19:01:21 -04:00
{
// if using twain 2.0 will need to use enum instead of onevalue (yuck)
TWEnumeration en = new TWEnumeration();
en.ItemList = new object[] { (uint)(useIt ? 1 : 0) };
en.ItemType = ItemType.Bool;
using (TWCapability dx = new TWCapability(CapabilityId.ICapAutomaticDeskew, en))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
else
{
TWOneValue one = new TWOneValue();
one.Item = (uint)(useIt ? 1 : 0);
one.ItemType = ItemType.Bool;
using (TWCapability capValue = new TWCapability(CapabilityId.ICapAutomaticDeskew, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(capValue);
2014-04-02 19:01:21 -04:00
}
}
}
return rc;
}
/// <summary>
/// Change the auto rotate flag for the current source.
/// </summary>
2014-04-22 06:50:58 -04:00
/// <param name="useIt">if set to <c>true</c> use it.</param>
2014-04-02 19:01:21 -04:00
/// <returns></returns>
public ReturnCode CapSetAutoRotate(bool useIt)
2014-04-02 19:01:21 -04:00
{
var rc = ReturnCode.Failure;
if (SupportedCaps.Contains(CapabilityId.ICapAutomaticRotate))
2014-04-02 19:01:21 -04:00
{
if (Identity.ProtocolMajor >= 2)
2014-04-02 19:01:21 -04:00
{
// if using twain 2.0 will need to use enum instead of onevalue (yuck)
TWEnumeration en = new TWEnumeration();
en.ItemList = new object[] { (uint)(useIt ? 1 : 0) };
en.ItemType = ItemType.Bool;
using (TWCapability dx = new TWCapability(CapabilityId.ICapAutomaticRotate, en))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
else
{
TWOneValue one = new TWOneValue();
one.Item = (uint)(useIt ? 1 : 0);
one.ItemType = ItemType.Bool;
using (TWCapability capValue = new TWCapability(CapabilityId.ICapAutomaticRotate, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(capValue);
2014-04-02 19:01:21 -04:00
}
}
}
return rc;
}
/// <summary>
/// Change the auto border detection flag for the current source.
/// </summary>
2014-04-22 06:50:58 -04:00
/// <param name="useIt">if set to <c>true</c> use it.</param>
2014-04-02 19:01:21 -04:00
/// <returns></returns>
public ReturnCode CapSetBorderDetection(bool useIt)
2014-04-02 19:01:21 -04:00
{
var rc = ReturnCode.Failure;
if (SupportedCaps.Contains(CapabilityId.ICapAutomaticBorderDetection))
2014-04-02 19:01:21 -04:00
{
// this goes along with undefinedimagesize so that also
// needs to be set
if (Identity.ProtocolMajor >= 2)
2014-04-02 19:01:21 -04:00
{
// if using twain 2.0 will need to use enum instead of onevalue (yuck)
TWEnumeration en = new TWEnumeration();
en.ItemList = new object[] { (uint)(useIt ? 1 : 0) };
en.ItemType = ItemType.Bool;
using (TWCapability dx = new TWCapability(CapabilityId.ICapUndefinedImageSize, en))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
using (TWCapability dx = new TWCapability(CapabilityId.ICapAutomaticBorderDetection, en))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
else
{
TWOneValue one = new TWOneValue();
one.Item = (uint)(useIt ? 1 : 0);
one.ItemType = ItemType.Bool;
using (TWCapability capValue = new TWCapability(CapabilityId.ICapUndefinedImageSize, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(capValue);
2014-04-02 19:01:21 -04:00
}
using (TWCapability capValue = new TWCapability(CapabilityId.ICapAutomaticBorderDetection, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(capValue);
2014-04-02 19:01:21 -04:00
}
}
}
return rc;
}
/// <summary>
/// Change the duplex flag for the current source.
/// </summary>
2014-04-22 06:50:58 -04:00
/// <param name="useIt">if set to <c>true</c> to use it.</param>
2014-04-02 19:01:21 -04:00
/// <returns></returns>
public ReturnCode CapSetDuplex(bool useIt)
2014-04-02 19:01:21 -04:00
{
if (Identity.ProtocolMajor >= 2)
2014-04-02 19:01:21 -04:00
{
// twain 2 likes to use enum :(
TWEnumeration en = new TWEnumeration();
en.ItemList = new object[] { (uint)(useIt ? 1 : 0) };
en.ItemType = ItemType.Bool;
using (TWCapability dx = new TWCapability(CapabilityId.CapDuplexEnabled, en))
{
2014-09-02 19:10:35 -04:00
return _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
else
{
TWOneValue one = new TWOneValue();
one.Item = (uint)(useIt ? 1 : 0);
one.ItemType = ItemType.Bool;
using (TWCapability dx = new TWCapability(CapabilityId.CapDuplexEnabled, one))
{
2014-09-02 19:10:35 -04:00
return _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
}
/// <summary>
/// Change the use feeder flag for the current source.
/// </summary>
2014-04-22 06:50:58 -04:00
/// <param name="useIt">if set to <c>true</c> use it.</param>
2014-04-02 19:01:21 -04:00
/// <returns></returns>
public ReturnCode CapSetFeeder(bool useIt)
2014-04-02 19:01:21 -04:00
{
var rc = ReturnCode.Failure;
if (SupportedCaps.Contains(CapabilityId.CapFeederEnabled))
2014-04-02 19:01:21 -04:00
{
if (Identity.ProtocolMajor >= 2)
2014-04-02 19:01:21 -04:00
{
// if using twain 2.0 will need to use enum instead of onevalue (yuck)
TWEnumeration en = new TWEnumeration();
en.ItemList = new object[] { (ushort)(useIt ? 1 : 0) };
en.ItemType = ItemType.Bool;
// we will never set feeder off, only autofeed and autoscan
// but if it is to SET then enable feeder needs to be set first
if (useIt)
{
using (TWCapability dx = new TWCapability(CapabilityId.CapFeederEnabled, en))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
// to really use feeder we must also set autofeed or autoscan, but only
// for one of them since setting autoscan also sets autofeed
if (SupportedCaps.Contains(CapabilityId.CapAutoScan))
2014-04-02 19:01:21 -04:00
{
using (TWCapability dx = new TWCapability(CapabilityId.CapAutoScan, en))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
else if (SupportedCaps.Contains(CapabilityId.CapAutoFeed))
2014-04-02 19:01:21 -04:00
{
using (TWCapability dx = new TWCapability(CapabilityId.CapAutoFeed, en))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(dx);
2014-04-02 19:01:21 -04:00
}
}
}
else
{
TWOneValue one = new TWOneValue();
one.Item = (uint)(useIt ? 1 : 0);
one.ItemType = ItemType.Bool;
if (useIt)
{
using (TWCapability enabled = new TWCapability(CapabilityId.CapFeederEnabled, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(enabled);
2014-04-02 19:01:21 -04:00
}
}
// to really use feeder we must also set autofeed or autoscan, but only
// for one of them since setting autoscan also sets autofeed
if (SupportedCaps.Contains(CapabilityId.CapAutoScan))
2014-04-02 19:01:21 -04:00
{
using (TWCapability autoScan = new TWCapability(CapabilityId.CapAutoScan, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(autoScan);
2014-04-02 19:01:21 -04:00
}
}
else if (SupportedCaps.Contains(CapabilityId.CapAutoFeed))
2014-04-02 19:01:21 -04:00
{
using (TWCapability autoScan = new TWCapability(CapabilityId.CapAutoFeed, one))
{
2014-09-02 19:10:35 -04:00
rc = _session.DGControl.Capability.Set(autoScan);
2014-04-02 19:01:21 -04:00
}
}
}
}
return rc;
}
#endregion
}
}