diff --git a/src/NTwain/Triplets/Control/PassThru.cs b/src/NTwain/Triplets/Control/PassThru.cs new file mode 100644 index 0000000..2bf9d81 --- /dev/null +++ b/src/NTwain/Triplets/Control/PassThru.cs @@ -0,0 +1,47 @@ +using NTwain.Data; +using NTwain.Internals; + +namespace NTwain.Triplets.Control +{ + /// + /// Represents . + /// + public sealed class PassThru : BaseTriplet + { + internal PassThru(TwainSession session) : base(session) { } + + /// + /// PASSTHRU is intended for the use of Source writers writing diagnostic applications. It allows + /// raw communication with the currently selected device in the Source. + /// + /// The pass thru data. + /// + 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; + } + } +} \ No newline at end of file diff --git a/src/NTwain/Triplets/DGControl.cs b/src/NTwain/Triplets/DGControl.cs index 0097138..0e6ef0c 100644 --- a/src/NTwain/Triplets/DGControl.cs +++ b/src/NTwain/Triplets/DGControl.cs @@ -51,6 +51,12 @@ namespace NTwain.Triplets CustomDSData _custDSData; internal CustomDSData CustomDSData => _custDSData ?? (_custDSData = new CustomDSData(Session)); + PassThru _passThru; + /// + /// Gets the operations defined for DAT_PASSTHRU. + /// + public PassThru PassThru => _passThru ?? (_passThru = new PassThru(Session)); + XferGroup _xferGroup; /// /// Gets the operations defined for DAT_XFERGROUP.