Completed all triplet mapping.

This commit is contained in:
soukoku
2014-04-04 18:51:44 -04:00
parent 428a024124
commit c7ca66836b
7 changed files with 147 additions and 24 deletions

View File

@@ -113,7 +113,8 @@ namespace NTwain.Triplets
/// <summary>
/// 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="TWEnumeration"/> or <see cref="TWRange"/>.
/// </summary>
@@ -125,6 +126,18 @@ namespace NTwain.Triplets
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);
}
}
}

View File

@@ -4,39 +4,33 @@ using NTwain.Values;
namespace NTwain.Triplets
{
// TODO: implement this
public sealed class XferGroup : OpBase
{
internal XferGroup(ITwainSessionInternal session) : base(session) { }
/// <summary>
/// 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.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public ReturnCode Get(out uint value)
public ReturnCode Get(ref uint value)
{
Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.XferGroup, Message.Get);
throw new NotImplementedException();
// 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;
Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.XferGroup, Message.Get);
return PInvoke.DsmEntry(Session.AppId, Session.SourceId, DataGroups.Control, DataArgumentType.XferGroup, Message.Get, ref value);
}
public ReturnCode Set(uint value)
/// <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)
{
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);
}
}
}