[Win] Wrapped additional HID APIs

This commit is contained in:
Stefanos A 2014-01-17 19:10:03 +01:00 committed by thefiddler
parent 2c197f09e1
commit 85e6b9f9ad

View file

@ -49,16 +49,32 @@ namespace OpenTK.Platform.Windows
[DllImport(lib, SetLastError = true, EntryPoint = "HidP_GetCaps")]
public static extern HidProtocolStatus GetCaps(IntPtr preparsed_data, ref HidProtocolCaps capabilities);
[SuppressUnmanagedCodeSecurity]
[DllImport(lib, SetLastError = true, EntryPoint = "HidP_GetData")]
public static extern HidProtocolStatus GetData(HidProtocolReportType type,
IntPtr data, ref int data_length,
IntPtr preparsed_data, IntPtr report, int report_length);
[SuppressUnmanagedCodeSecurity]
[DllImport(lib, SetLastError = true, EntryPoint = "HidP_GetScaledUsageValue")]
static public extern HidProtocolStatus GetScaledUsageValue(HidProtocolReportType type,
HIDPage usage_page, short link_collection, short usage, ref int usage_value,
IntPtr preparsed_data, IntPtr report, int report_length);
[SuppressUnmanagedCodeSecurity]
[DllImport(lib, SetLastError = true, EntryPoint = "HidP_GetUsageValue")]
public static extern HidProtocolStatus GetUsageValue(HidProtocolReportType type,
HIDPage usage_page, int link_location, short usage, ref uint usage_value,
HIDPage usage_page, short link_collection, short usage, ref uint usage_value,
IntPtr preparsed_data, IntPtr report, int report_length);
[SuppressUnmanagedCodeSecurity]
[DllImport(lib, SetLastError = true, EntryPoint = "HidP_GetValueCaps")]
public static extern HidProtocolStatus GetValueCaps(HidProtocolReportType type, IntPtr caps,
ref ushort caps_length, IntPtr preparsed_data);
[SuppressUnmanagedCodeSecurity]
[DllImport(lib, SetLastError = true, EntryPoint = "HidP_MaxDataListLength")]
public static extern int MaxDataListLength(HidProtocolReportType type, IntPtr preparsed_data);
}
enum HidProtocolReportType : ushort
@ -76,7 +92,7 @@ namespace OpenTK.Platform.Windows
[StructLayout(LayoutKind.Explicit)]
struct HidProtocolButtonCaps
{
[FieldOffset(0)] public short UsagePage;
[FieldOffset(0)] public HIDPage UsagePage;
[FieldOffset(2)] public byte ReportID;
[FieldOffset(3), MarshalAs(UnmanagedType.U1)] public bool IsAlias;
[FieldOffset(4)] public short BitField;
@ -110,7 +126,15 @@ namespace OpenTK.Platform.Windows
public ushort NumberFeatureButtonCaps;
public ushort NumberFeatureValueCaps;
public ushort NumberFeatureDataIndices;
}
[StructLayout(LayoutKind.Explicit)]
public struct HidProtocolData
{
[FieldOffset(0)] public short DataIndex;
//[FieldOffset(2)] public short Reserved;
[FieldOffset(4)] public int RawValue;
[FieldOffset(4), MarshalAs(UnmanagedType.U1)] public bool On;
}
struct HidProtocolNotRange