From: Stefanos A Date: Fri, 17 Jan 2014 18:10:03 +0000 (+0100) Subject: [Win] Wrapped additional HID APIs X-Git-Tag: 2.0-0~88^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=85e6b9f9ad78892bdd1de605e52687fba48c2de2;p=platform%2Fcore%2Fcsapi%2Fopentk.git [Win] Wrapped additional HID APIs --- diff --git a/Source/OpenTK/Platform/Windows/Bindings/HidProtocol.cs b/Source/OpenTK/Platform/Windows/Bindings/HidProtocol.cs index f674741..ce4f34f 100644 --- a/Source/OpenTK/Platform/Windows/Bindings/HidProtocol.cs +++ b/Source/OpenTK/Platform/Windows/Bindings/HidProtocol.cs @@ -50,15 +50,31 @@ namespace OpenTK.Platform.Windows 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