mirror of
https://github.com/soukoku/ntwain.git
synced 2025-11-26 02:10:23 +08:00
Completed all triplet mapping.
This commit is contained in:
@@ -113,7 +113,8 @@ namespace NTwain.Triplets
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes the Current Value(s) and Available Values of the specified capability to those specified
|
/// Changes the Current Value(s) and Available Values of the specified capability to those specified
|
||||||
/// by the application.
|
/// 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="TWOneValue"/> or <see cref="TWArray"/>. Available and
|
||||||
/// Current Values are set when the container is a <see cref="TWEnumeration"/> or <see cref="TWRange"/>.
|
/// Current Values are set when the container is a <see cref="TWEnumeration"/> or <see cref="TWRange"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -125,6 +126,18 @@ namespace NTwain.Triplets
|
|||||||
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, capability);
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, capability);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO implement SetConstraint
|
/// <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="capability">The capability.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReturnCode SetConstraint(TWCapability capability)
|
||||||
|
{
|
||||||
|
Session.VerifyState(4, 7, DataGroups.Control, DataArgumentType.Capability, Message.SetConstraint);
|
||||||
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.SetConstraint, capability);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,39 +4,33 @@ using NTwain.Values;
|
|||||||
|
|
||||||
namespace NTwain.Triplets
|
namespace NTwain.Triplets
|
||||||
{
|
{
|
||||||
// TODO: implement this
|
|
||||||
|
|
||||||
public sealed class XferGroup : OpBase
|
public sealed class XferGroup : OpBase
|
||||||
{
|
{
|
||||||
internal XferGroup(ITwainSessionInternal session) : base(session) { }
|
internal XferGroup(ITwainSessionInternal session) : base(session) { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the Data Group (the type of data) for the upcoming transfer. The Source is required to
|
/// Returns the Data Group (the type of data) for the upcoming transfer. The Source is required to
|
||||||
/// only supply one of the DGs specified in the SupportedGroups field of origin.
|
/// only supply one of the DGs specified in the SupportedGroups field of origin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ReturnCode Get(out uint value)
|
public ReturnCode Get(ref uint value)
|
||||||
{
|
{
|
||||||
Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.XferGroup, Message.Get);
|
Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.XferGroup, Message.Get);
|
||||||
throw new NotImplementedException();
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
|
||||||
|
|
||||||
// TODO: I have no idea if this even works, just something that looks logical.
|
|
||||||
// Does memory from pointer need to be released once we got the value?
|
|
||||||
|
|
||||||
//IntPtr ptr = IntPtr.Zero;
|
|
||||||
//var rc = Custom.DsmEntry(Session.AppId, Session.SourceId, DataGroup.Control, DataArgumentType.XferGroup, Message.Get, ref ptr);
|
|
||||||
//unsafe
|
|
||||||
//{
|
|
||||||
// uint* realPtr = (uint*)ptr.ToPointer();
|
|
||||||
// value = (*realPtr);
|
|
||||||
//}
|
|
||||||
//return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The transfer group determines the kind of data being passed from the Source to the Application.
|
||||||
|
/// By default a TWAIN Source must default to DG_IMAGE. Currently the only other data group
|
||||||
|
/// supported is DG_AUDIO, which is a feature supported by some digital cameras.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The value.</param>
|
||||||
|
/// <returns></returns>
|
||||||
public ReturnCode Set(uint value)
|
public ReturnCode Set(uint value)
|
||||||
{
|
{
|
||||||
Session.VerifyState(6, 6, DataGroups.Control, DataArgumentType.XferGroup, Message.Set);
|
Session.VerifyState(6, 6, DataGroups.Control, DataArgumentType.XferGroup, Message.Set);
|
||||||
throw new NotImplementedException();
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, DataGroups.Control, DataArgumentType.XferGroup, Message.Set, ref value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,54 @@ namespace NTwain.Triplets
|
|||||||
{
|
{
|
||||||
internal Filter(ITwainSessionInternal session) : base(session) { }
|
internal Filter(ITwainSessionInternal session) : base(session) { }
|
||||||
|
|
||||||
//TODO: implement this
|
|
||||||
|
/// <summary>
|
||||||
|
/// Causes the Source to return the filter parameters that will be used during the next image
|
||||||
|
/// acquisition.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">The filter.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReturnCode Get(out TWFilter filter)
|
||||||
|
{
|
||||||
|
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.Filter, Message.Get);
|
||||||
|
filter = new TWFilter();
|
||||||
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Get, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Causes the Source to return the power-on default values applied to the filter.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">The filter.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReturnCode GetDefault(out TWFilter filter)
|
||||||
|
{
|
||||||
|
Session.VerifyState(4, 6, DataGroups.Image, DataArgumentType.Filter, Message.GetDefault);
|
||||||
|
filter = new TWFilter();
|
||||||
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.GetDefault, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows the Application to configure the filter parameters that will be used during the next image
|
||||||
|
/// acquisition.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">The filter.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReturnCode Set(TWFilter filter)
|
||||||
|
{
|
||||||
|
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.Filter, Message.Set);
|
||||||
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Set, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return the Source to using its power-on default values when it is applying the filter.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">The filter.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReturnCode Reset(out TWFilter filter)
|
||||||
|
{
|
||||||
|
Session.VerifyState(4, 4, DataGroups.Image, DataArgumentType.Filter, Message.Reset);
|
||||||
|
filter = new TWFilter();
|
||||||
|
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, Message.Reset, filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,17 @@ namespace NTwain.Triplets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Filter _filter;
|
||||||
|
public Filter Filter
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_filter == null) { _filter = new Filter(_session); }
|
||||||
|
return _filter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GrayResponse _grayResponse;
|
GrayResponse _grayResponse;
|
||||||
public GrayResponse GrayResponse
|
public GrayResponse GrayResponse
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,6 +39,18 @@ namespace NTwain.Triplets
|
|||||||
else { return NativeMethods.DsmEntry32(origin, destination, dg, dat, msg, ref data); }
|
else { return NativeMethods.DsmEntry32(origin, destination, dg, dat, msg, ref data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ReturnCode DsmEntry(
|
||||||
|
TWIdentity origin,
|
||||||
|
TWIdentity destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref uint data)
|
||||||
|
{
|
||||||
|
if (Is64Bit) { return NativeMethods.DsmEntry64(origin, destination, dg, dat, msg, ref data); }
|
||||||
|
else { return NativeMethods.DsmEntry32(origin, destination, dg, dat, msg, ref data); }
|
||||||
|
}
|
||||||
|
|
||||||
public static ReturnCode DsmEntry(
|
public static ReturnCode DsmEntry(
|
||||||
TWIdentity origin,
|
TWIdentity origin,
|
||||||
TWIdentity destination,
|
TWIdentity destination,
|
||||||
@@ -234,6 +246,15 @@ namespace NTwain.Triplets
|
|||||||
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ExtImageInfo, msg, data); }
|
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.ExtImageInfo, msg, data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ReturnCode DsmEntry(
|
||||||
|
TWIdentity origin,
|
||||||
|
TWIdentity destination,
|
||||||
|
Message msg,
|
||||||
|
TWFilter data)
|
||||||
|
{
|
||||||
|
if (Is64Bit) { return NativeMethods.DsmEntry64(origin, destination, DataGroups.Image, DataArgumentType.Filter, msg, data); }
|
||||||
|
else { return NativeMethods.DsmEntry32(origin, destination, DataGroups.Image, DataArgumentType.Filter, msg, data); }
|
||||||
|
}
|
||||||
|
|
||||||
public static ReturnCode DsmEntry(
|
public static ReturnCode DsmEntry(
|
||||||
TWIdentity origin,
|
TWIdentity origin,
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref IntPtr data);
|
ref IntPtr data);
|
||||||
|
|
||||||
|
[DllImport("twain_32", EntryPoint = "#1")]
|
||||||
|
public static extern ReturnCode DsmEntry32(
|
||||||
|
[In, Out]TWIdentity origin,
|
||||||
|
[In, Out]TWIdentity destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref uint data);
|
||||||
|
|
||||||
[DllImport("twain_32", EntryPoint = "#1")]
|
[DllImport("twain_32", EntryPoint = "#1")]
|
||||||
public static extern ReturnCode DsmEntry32(
|
public static extern ReturnCode DsmEntry32(
|
||||||
[In, Out]TWIdentity origin,
|
[In, Out]TWIdentity origin,
|
||||||
@@ -180,6 +189,15 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
[In, Out]TWExtImageInfo data);
|
[In, Out]TWExtImageInfo data);
|
||||||
|
|
||||||
|
[DllImport("twain_32", EntryPoint = "#1")]
|
||||||
|
public static extern ReturnCode DsmEntry32(
|
||||||
|
[In, Out]TWIdentity origin,
|
||||||
|
[In, Out]TWIdentity destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
[In, Out]TWFilter data);
|
||||||
|
|
||||||
[DllImport("twain_32", EntryPoint = "#1")]
|
[DllImport("twain_32", EntryPoint = "#1")]
|
||||||
public static extern ReturnCode DsmEntry32(
|
public static extern ReturnCode DsmEntry32(
|
||||||
[In, Out]TWIdentity origin,
|
[In, Out]TWIdentity origin,
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
ref IntPtr data);
|
ref IntPtr data);
|
||||||
|
|
||||||
|
[DllImport("twaindsm", EntryPoint = "#1")]
|
||||||
|
public static extern ReturnCode DsmEntry64(
|
||||||
|
[In, Out]TWIdentity origin,
|
||||||
|
[In, Out]TWIdentity destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
ref uint data);
|
||||||
|
|
||||||
[DllImport("twaindsm", EntryPoint = "#1")]
|
[DllImport("twaindsm", EntryPoint = "#1")]
|
||||||
public static extern ReturnCode DsmEntry64(
|
public static extern ReturnCode DsmEntry64(
|
||||||
[In, Out]TWIdentity origin,
|
[In, Out]TWIdentity origin,
|
||||||
@@ -180,6 +189,15 @@ namespace NTwain.Triplets
|
|||||||
Message msg,
|
Message msg,
|
||||||
[In, Out]TWExtImageInfo data);
|
[In, Out]TWExtImageInfo data);
|
||||||
|
|
||||||
|
[DllImport("twaindsm", EntryPoint = "#1")]
|
||||||
|
public static extern ReturnCode DsmEntry64(
|
||||||
|
[In, Out]TWIdentity origin,
|
||||||
|
[In, Out]TWIdentity destination,
|
||||||
|
DataGroups dg,
|
||||||
|
DataArgumentType dat,
|
||||||
|
Message msg,
|
||||||
|
[In, Out]TWFilter data);
|
||||||
|
|
||||||
[DllImport("twaindsm", EntryPoint = "#1")]
|
[DllImport("twaindsm", EntryPoint = "#1")]
|
||||||
public static extern ReturnCode DsmEntry64(
|
public static extern ReturnCode DsmEntry64(
|
||||||
[In, Out]TWIdentity origin,
|
[In, Out]TWIdentity origin,
|
||||||
|
|||||||
Reference in New Issue
Block a user