diff --git a/src/NTwain/Triplets/Control/TwainDirect.cs b/src/NTwain/Triplets/Control/TwainDirect.cs
new file mode 100644
index 0000000..c027908
--- /dev/null
+++ b/src/NTwain/Triplets/Control/TwainDirect.cs
@@ -0,0 +1,47 @@
+using NTwain.Data;
+using NTwain.Internals;
+using System.Runtime.InteropServices;
+
+namespace NTwain.Triplets.Control
+{
+ ///
+ /// Represents .
+ ///
+ public sealed class TwainDirect : BaseTriplet
+ {
+ internal TwainDirect(TwainSession session) : base(session) { }
+
+ ///
+ /// Sends a TWAIN Direct task from the application to the driver.
+ ///
+ ///
+ ///
+ public ReturnCode SetTask(ref TW_TWAINDIRECT task)
+ {
+ if (Is32Bit)
+ {
+ if (IsWin)
+ return NativeMethods.DsmWin32(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
+ if (IsLinux)
+ return NativeMethods.DsmLinux32(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
+ if (IsMac)
+ return NativeMethods.DsmMac32(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
+ }
+
+ if (IsWin)
+ return NativeMethods.DsmWin64(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
+ if (IsLinux)
+ return NativeMethods.DsmLinux64(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
+ if (IsMac)
+ return NativeMethods.DsmMac64(Session.Config.App32, Session.CurrentSource.Identity32,
+ DataGroups.Control, DataArgumentType.TwainDirect, Message.SetTask, ref task);
+
+ return ReturnCode.Failure;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/NTwain/Triplets/DGControl.cs b/src/NTwain/Triplets/DGControl.cs
index c6d53a4..3e38c5c 100644
--- a/src/NTwain/Triplets/DGControl.cs
+++ b/src/NTwain/Triplets/DGControl.cs
@@ -92,5 +92,11 @@ namespace NTwain.Triplets
/// Gets the operations defined for DAT_METRICS.
///
public Metrics Metrics => _metrics ?? (_metrics = new Metrics(Session));
+
+ TwainDirect _twDirect;
+ ///
+ /// Gets the operations defined for DAT_TWAINDIRECT.
+ ///
+ public TwainDirect TwainDirect => _twDirect ?? (_twDirect = new TwainDirect(Session));
}
}
diff --git a/src/NTwain/Triplets/NativeMethods.Linux32.cs b/src/NTwain/Triplets/NativeMethods.Linux32.cs
index 2780857..7900d04 100644
--- a/src/NTwain/Triplets/NativeMethods.Linux32.cs
+++ b/src/NTwain/Triplets/NativeMethods.Linux32.cs
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
Message msg,
ref TW_METRICS data);
+ [DllImport(LinuxDll, EntryPoint = EntryName)]
+ public static extern ReturnCode DsmLinux32(
+ [In, Out]TW_IDENTITY origin,
+ [In, Out]TW_IDENTITY destination,
+ DataGroups dg,
+ DataArgumentType dat,
+ Message msg,
+ ref TW_TWAINDIRECT data);
+
}
}
diff --git a/src/NTwain/Triplets/NativeMethods.Linux64.cs b/src/NTwain/Triplets/NativeMethods.Linux64.cs
index d8a5b33..5fece09 100644
--- a/src/NTwain/Triplets/NativeMethods.Linux64.cs
+++ b/src/NTwain/Triplets/NativeMethods.Linux64.cs
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
Message msg,
ref TW_METRICS data);
+ [DllImport(LinuxDll, EntryPoint = EntryName)]
+ public static extern ReturnCode DsmLinux64(
+ [In, Out]TW_IDENTITY origin,
+ [In, Out]TW_IDENTITY destination,
+ DataGroups dg,
+ DataArgumentType dat,
+ Message msg,
+ ref TW_TWAINDIRECT data);
+
}
}
diff --git a/src/NTwain/Triplets/NativeMethods.Mac32.cs b/src/NTwain/Triplets/NativeMethods.Mac32.cs
index c8523e6..0e0e2e5 100644
--- a/src/NTwain/Triplets/NativeMethods.Mac32.cs
+++ b/src/NTwain/Triplets/NativeMethods.Mac32.cs
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
Message msg,
ref TW_METRICS data);
+ [DllImport(Mac32Dll, EntryPoint = EntryName)]
+ public static extern ReturnCode DsmMac32(
+ [In, Out]TW_IDENTITY origin,
+ [In, Out]TW_IDENTITY destination,
+ DataGroups dg,
+ DataArgumentType dat,
+ Message msg,
+ ref TW_TWAINDIRECT data);
+
}
}
diff --git a/src/NTwain/Triplets/NativeMethods.Mac64.cs b/src/NTwain/Triplets/NativeMethods.Mac64.cs
index 4b50cc1..24dd1d8 100644
--- a/src/NTwain/Triplets/NativeMethods.Mac64.cs
+++ b/src/NTwain/Triplets/NativeMethods.Mac64.cs
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
Message msg,
ref TW_METRICS data);
+ [DllImport(Mac64Dll, EntryPoint = EntryName)]
+ public static extern ReturnCode DsmMac64(
+ [In, Out]TW_IDENTITY origin,
+ [In, Out]TW_IDENTITY destination,
+ DataGroups dg,
+ DataArgumentType dat,
+ Message msg,
+ ref TW_TWAINDIRECT data);
+
}
}
diff --git a/src/NTwain/Triplets/NativeMethods.Win32.cs b/src/NTwain/Triplets/NativeMethods.Win32.cs
index 71d7de6..a0b217b 100644
--- a/src/NTwain/Triplets/NativeMethods.Win32.cs
+++ b/src/NTwain/Triplets/NativeMethods.Win32.cs
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
Message msg,
ref TW_METRICS data);
+ [DllImport(WinDll, EntryPoint = EntryName)]
+ public static extern ReturnCode DsmWin32(
+ [In, Out]TW_IDENTITY origin,
+ [In, Out]TW_IDENTITY destination,
+ DataGroups dg,
+ DataArgumentType dat,
+ Message msg,
+ ref TW_TWAINDIRECT data);
+
}
}
diff --git a/src/NTwain/Triplets/NativeMethods.Win64.cs b/src/NTwain/Triplets/NativeMethods.Win64.cs
index 15cd87b..e4fdbaf 100644
--- a/src/NTwain/Triplets/NativeMethods.Win64.cs
+++ b/src/NTwain/Triplets/NativeMethods.Win64.cs
@@ -288,5 +288,14 @@ namespace NTwain.Triplets
Message msg,
ref TW_METRICS data);
+ [DllImport(WinDll, EntryPoint = EntryName)]
+ public static extern ReturnCode DsmWin64(
+ [In, Out]TW_IDENTITY origin,
+ [In, Out]TW_IDENTITY destination,
+ DataGroups dg,
+ DataArgumentType dat,
+ Message msg,
+ ref TW_TWAINDIRECT data);
+
}
}