2014-05-15 19:29:03 +08:00
|
|
|
|
using NTwain.Data;
|
|
|
|
|
using NTwain.Internals;
|
|
|
|
|
|
|
|
|
|
namespace NTwain.Triplets
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This is to support custom DAT value for custom capability defined by some manufacturers.
|
|
|
|
|
/// </summary>
|
2014-09-15 19:24:13 +08:00
|
|
|
|
public sealed class CapabilityCustom : TripletBase
|
2014-05-15 19:29:03 +08:00
|
|
|
|
{
|
|
|
|
|
internal CapabilityCustom(ITwainSessionInternal session) : base(session) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the Source’s Current, Default and Available Values for a specified capability.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode Get(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 7, DataGroups.Control, (DataArgumentType)customDAT, Message.Get);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.Get, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the Source’s Current Value for the specified capability.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode GetCurrent(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 7, DataGroups.Control, (DataArgumentType)customDAT, Message.GetCurrent);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.GetCurrent, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the Source’s Default Value. This is the Source’s preferred default value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode GetDefault(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 7, DataGroups.Control, (DataArgumentType)customDAT, Message.GetDefault);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.GetDefault, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns help text suitable for use in a GUI; for instance: "Specify the amount of detail in an
|
|
|
|
|
/// image. Higher values result in more detail." for ICapXRESOLUTION.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode GetHelp(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 4, DataGroups.Control, (DataArgumentType)customDAT, Message.GetHelp);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.GetHelp, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns a label suitable for use in a GUI, for instance "Resolution:"
|
|
|
|
|
/// for ICapXRESOLUTION.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode GetLabel(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 4, DataGroups.Control, (DataArgumentType)customDAT, Message.GetLabel);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.GetLabel, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Return all of the labels for a capability of type <see cref="TWArray"/> or <see cref="TWEnumeration"/>, for example
|
|
|
|
|
/// "US Letter" for ICapSupportedSizes’ TWSS_USLETTER.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode GetLabelEnum(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 4, DataGroups.Control, (DataArgumentType)customDAT, Message.GetLabelEnum);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.GetLabelEnum, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the Source’s support status of this capability.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode QuerySupport(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 7, DataGroups.Control, (DataArgumentType)customDAT, Message.QuerySupport);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.QuerySupport, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Change the Current Value of the specified capability back to its power-on value and return the
|
|
|
|
|
/// new Current Value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode Reset(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 4, DataGroups.Control, (DataArgumentType)customDAT, Message.Reset);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.Reset, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This command resets all of the current values and constraints to their defaults for all of the
|
|
|
|
|
/// negotiable capabilities supported by the driver.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode ResetAll(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 4, DataGroups.Control, (DataArgumentType)customDAT, Message.ResetAll);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.ResetAll, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Changes the Current Value(s) and Available Values of the specified capability to those specified
|
|
|
|
|
/// by the application. As of TWAIN 2.2 this only modifies the Current Value of the specified capability, constraints cannot be
|
|
|
|
|
/// changed with this.
|
|
|
|
|
/// Current Values are set when the container is a <see cref="TWOneValue"/> or <see cref="TWArray"/>. Available and
|
|
|
|
|
/// Current Values are set when the container is a <see cref="TWEnumeration"/> or <see cref="TWRange"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode Set(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 6, DataGroups.Control, (DataArgumentType)customDAT, Message.Set);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.Set, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Changes the Current Value(s) and Available Value(s) of the specified capability to those specified
|
|
|
|
|
/// by the application.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// Current Values are set when the container is a <see cref="TWOneValue"/> or <see cref="TWArray"/>. Available and
|
|
|
|
|
/// Current Values are set when the container is a <see cref="TWEnumeration"/> or <see cref="TWRange"/>.
|
|
|
|
|
/// <param name="customDAT">The custom DAT_* value from manufacturer.</param>
|
|
|
|
|
/// <param name="capability">The capability.</param>
|
|
|
|
|
/// <returns></returns>
|
2014-07-01 19:23:55 +08:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DAT")]
|
2014-05-15 19:29:03 +08:00
|
|
|
|
public ReturnCode SetConstraint(ushort customDAT, TWCapability capability)
|
|
|
|
|
{
|
|
|
|
|
Session.VerifyState(4, 7, DataGroups.Control, (DataArgumentType)customDAT, Message.SetConstraint);
|
2014-05-20 19:25:57 +08:00
|
|
|
|
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, (DataArgumentType)customDAT, Message.SetConstraint, capability);
|
2014-05-15 19:29:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|