mirror of
https://github.com/soukoku/ntwain.git
synced 2025-09-19 10:08:00 +08:00
Added PassThru triplet.
This commit is contained in:
47
src/NTwain/Triplets/Control/PassThru.cs
Normal file
47
src/NTwain/Triplets/Control/PassThru.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using NTwain.Data;
|
||||||
|
using NTwain.Internals;
|
||||||
|
|
||||||
|
namespace NTwain.Triplets.Control
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents <see cref="DataArgumentType.PassThru"/>.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class PassThru : BaseTriplet
|
||||||
|
{
|
||||||
|
internal PassThru(TwainSession session) : base(session) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PASSTHRU is intended for the use of Source writers writing diagnostic applications. It allows
|
||||||
|
/// raw communication with the currently selected device in the Source.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">The pass thru data.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ReturnCode PassThrough(ref TW_PASSTHRU data)
|
||||||
|
{
|
||||||
|
if (Is32Bit)
|
||||||
|
{
|
||||||
|
if (IsWin)
|
||||||
|
return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.PassThru, Message.PassThru, ref data);
|
||||||
|
if (IsLinux)
|
||||||
|
return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.PassThru, Message.PassThru, ref data);
|
||||||
|
if (IsMac)
|
||||||
|
return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.PassThru, Message.PassThru, ref data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsWin)
|
||||||
|
return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.PassThru, Message.PassThru, ref data);
|
||||||
|
if (IsLinux)
|
||||||
|
return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.PassThru, Message.PassThru, ref data);
|
||||||
|
if (IsMac)
|
||||||
|
return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
|
||||||
|
DataGroups.Control, DataArgumentType.PassThru, Message.PassThru, ref data);
|
||||||
|
|
||||||
|
return ReturnCode.Failure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -51,6 +51,12 @@ namespace NTwain.Triplets
|
|||||||
CustomDSData _custDSData;
|
CustomDSData _custDSData;
|
||||||
internal CustomDSData CustomDSData => _custDSData ?? (_custDSData = new CustomDSData(Session));
|
internal CustomDSData CustomDSData => _custDSData ?? (_custDSData = new CustomDSData(Session));
|
||||||
|
|
||||||
|
PassThru _passThru;
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the operations defined for DAT_PASSTHRU.
|
||||||
|
/// </summary>
|
||||||
|
public PassThru PassThru => _passThru ?? (_passThru = new PassThru(Session));
|
||||||
|
|
||||||
XferGroup _xferGroup;
|
XferGroup _xferGroup;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the operations defined for DAT_XFERGROUP.
|
/// Gets the operations defined for DAT_XFERGROUP.
|
||||||
|
Reference in New Issue
Block a user