Beispiel #1
0
        public static uint HidP_GetUsageValue(HidPReportType hidPReportType, UsageDescriptor usage, ushort linkCollection, byte[] preparsedData, byte[] report)
        {
            uint result  = 0;
            uint success = HidP_GetUsageValue(hidPReportType, usage.UsagePage, linkCollection, usage.Usage, ref result, preparsedData, report, (uint)report.Length);

            return(result);
        }
Beispiel #2
0
        public static NtStatus TryGetUsageValueArray(HidPreparsedData preparsedData, HidPReportType reportType, ushort usagePage, ushort linkCollection, ushort usage, ushort usageValueByteLength, byte[] report, int reportLength, out byte[] usageValue)
        {
            var preparsedDataPtr = HidPreparsedData.GetRawValue(preparsedData);

            usageValue = new byte[usageValueByteLength];

            return(HidP_GetUsageValueArray(reportType, usagePage, linkCollection, usage, usageValue, usageValueByteLength, preparsedDataPtr, report, (uint)reportLength));
        }
Beispiel #3
0
        public static extern bool HidP_GetValueCaps(
            HidPReportType ReportType,

            [MarshalAs(UnmanagedType.LPArray)]
            [Out]
            HidPValueCapsRange[] ValueCaps,
            ref ushort ValueCapsLength,
            IntPtr PreparsedData
            );
Beispiel #4
0
        public static NtStatus TryGetUsages(HidPreparsedData preparsedData, HidPReportType reportType, ushort usagePage, ushort linkCollection, byte[] report, int reportLength, out ushort[] usageList)
        {
            var  preparsedDataPtr = HidPreparsedData.GetRawValue(preparsedData);
            uint usageCount       = 0;

            HidP_GetUsages(reportType, usagePage, linkCollection, null, ref usageCount, preparsedDataPtr, report, (uint)reportLength);

            usageList = new ushort[usageCount];

            return(HidP_GetUsages(reportType, usagePage, linkCollection, usageList, ref usageCount, preparsedDataPtr, report, (uint)reportLength));
        }
Beispiel #5
0
        public static ushort[] HidP_GetUsages(HidPReportType hidPReportType, ushort usagePage, ushort linkCollection, byte[] preparsedData, byte[] report)
        {
            ushort[] usageList   = new ushort[20];
            uint     usageLength = (uint)usageList.Length;

            uint success = HidP_GetUsages(hidPReportType, usagePage, linkCollection, usageList, ref usageLength, preparsedData, report, (uint)report.Length);

            ushort[] results = new ushort[usageLength];
            Buffer.BlockCopy(usageList, 0, results, 0, (int)usageLength * 2);

            return(results);
        }
Beispiel #6
0
        public static NtStatus TryGetValueCaps(HidPreparsedData preparsedData, HidPReportType reportType, out HidPValueCaps[] valueCaps)
        {
            var preparsedDataPtr = HidPreparsedData.GetRawValue(preparsedData);
            var caps             = GetCaps(preparsedData);
            var capsCount        = reportType switch
            {
                HidPReportType.Input => caps.NumberInputValueCaps,
                HidPReportType.Output => caps.NumberOutputValueCaps,
                HidPReportType.Feature => caps.NumberFeatureValueCaps,
                _ => throw new ArgumentException($"Invalid HidPReportType: {reportType}", nameof(reportType)),
            };

            valueCaps = new HidPValueCaps[capsCount];

            return(HidP_GetValueCaps(reportType, valueCaps, ref capsCount, preparsedDataPtr));
        }
Beispiel #7
0
 static extern NtStatus HidP_GetUsageValueArray(HidPReportType reportType, ushort usagePage, ushort linkCollection, ushort usage, [Out] byte[] usageValue, ushort usageValueByteLength, IntPtr preparsedData, byte[] report, uint reportLength);
Beispiel #8
0
 public static byte[] GetUsageValueArray(HidPreparsedData preparsedData, HidPReportType reportType, HidPValueCaps valueCaps, ushort usage, byte[] report, int reportLength) =>
 GetUsageValueArray(preparsedData, reportType, valueCaps.UsagePage, valueCaps.LinkCollection, usage, (ushort)(valueCaps.BitSize * valueCaps.ReportCount), report, reportLength);
Beispiel #9
0
 static extern NtStatus HidP_GetScaledUsageValue(HidPReportType reportType, ushort usagePage, ushort linkCollection, ushort usage, out int usageValue, IntPtr preparsedData, byte[] report, uint reportLength);
Beispiel #10
0
        public static byte[] GetUsageValueArray(HidPreparsedData preparsedData, HidPReportType reportType, ushort usagePage, ushort linkCollection, ushort usage, ushort usageValueByteLength, byte[] report, int reportLength)
        {
            TryGetUsageValueArray(preparsedData, reportType, usagePage, linkCollection, usage, usageValueByteLength, report, reportLength, out var usageValue).EnsureSuccess();

            return(usageValue);
        }
Beispiel #11
0
 static extern NtStatus HidP_GetUsages(HidPReportType reportType, ushort usagePage, ushort linkCollection, [Out] ushort[] usageList, ref uint usageLength, IntPtr preparsedData, byte[] report, uint reportLength);
Beispiel #12
0
 public static NtStatus TryGetUsages(HidPreparsedData preparsedData, HidPReportType reportType, HidPButtonCaps buttonCaps, byte[] report, int reportLength, out ushort[] usageList) =>
 TryGetUsages(preparsedData, reportType, buttonCaps.UsagePage, buttonCaps.LinkCollection, report, reportLength, out usageList);
Beispiel #13
0
 public static extern NtStatus HidP_GetScaledUsageValue(HidPReportType ReportType, ushort UsagePage, ushort LinkCollection, ushort Usage, out int UsageValue, IntPtr pPreparsedData, byte[] Report, uint ReportLength);
Beispiel #14
0
 public static extern NtStatus HidP_GetUsages(HidPReportType ReportType, ushort UsagePage, ushort LinkCollection, [Out] ushort[] UsageList, ref uint UsageLength, IntPtr pPreparsedData, byte[] Report, uint ReportLength);
Beispiel #15
0
        public static int GetScaledUsageValue(HidPreparsedData preparsedData, HidPReportType reportType, ushort usagePage, ushort linkCollection, ushort usage, byte[] report, int reportLength)
        {
            TryGetScaledUsageValue(preparsedData, reportType, usagePage, linkCollection, usage, report, reportLength, out var usageValue).EnsureSuccess();

            return(usageValue);
        }
Beispiel #16
0
 public static NtStatus TryGetUsageValue(HidPreparsedData preparsedData, HidPReportType reportType, HidPValueCaps valueCaps, ushort usage, byte[] report, int reportLength, out int usageValue) =>
 TryGetUsageValue(preparsedData, reportType, valueCaps.UsagePage, valueCaps.LinkCollection, usage, report, reportLength, out usageValue);
Beispiel #17
0
        public static HidPValueCaps[] GetValueCaps(HidPreparsedData preparsedData, HidPReportType reportType)
        {
            TryGetValueCaps(preparsedData, reportType, out var valueCaps).EnsureSuccess();

            return(valueCaps);
        }
Beispiel #18
0
 public static ushort[] GetUsages(HidPreparsedData preparsedData, HidPReportType reportType, HidPButtonCaps buttonCaps, byte[] report, int reportLength) =>
 GetUsages(preparsedData, reportType, buttonCaps.UsagePage, buttonCaps.LinkCollection, report, reportLength);
Beispiel #19
0
 static extern NtStatus HidP_GetButtonCaps(HidPReportType reportType, [Out] HidPButtonCaps[] buttonCaps, ref ushort buttonCapsLength, IntPtr preparsedData);
Beispiel #20
0
        public static ushort[] GetUsages(HidPreparsedData preparsedData, HidPReportType reportType, ushort usagePage, ushort linkCollection, byte[] report, int reportLength)
        {
            TryGetUsages(preparsedData, reportType, usagePage, linkCollection, report, reportLength, out var usageList).EnsureSuccess();

            return(usageList);
        }
Beispiel #21
0
        public static HidPButtonCaps[] GetButtonCaps(HidPreparsedData preparsedData, HidPReportType reportType)
        {
            TryGetButtonCaps(preparsedData, reportType, out var buttonCaps).EnsureSuccess();

            return(buttonCaps);
        }
Beispiel #22
0
 public static int GetScaledUsageValue(HidPreparsedData preparsedData, HidPReportType reportType, HidPValueCaps valueCaps, ushort usage, byte[] report, int reportLength) =>
 GetScaledUsageValue(preparsedData, reportType, valueCaps.UsagePage, valueCaps.LinkCollection, usage, report, reportLength);
Beispiel #23
0
        public static NtStatus TryGetScaledUsageValue(HidPreparsedData preparsedData, HidPReportType reportType, ushort usagePage, ushort linkCollection, ushort usage, byte[] report, int reportLength, out int usageValue)
        {
            var preparsedDataPtr = HidPreparsedData.GetRawValue(preparsedData);

            return(HidP_GetScaledUsageValue(reportType, usagePage, linkCollection, usage, out usageValue, preparsedDataPtr, report, (uint)reportLength));
        }
Beispiel #24
0
 private static extern uint HidP_GetUsages(HidPReportType hidPReportType, ushort usagePage, ushort linkCollection, ushort[] usageList, ref uint usageLength, byte[] preparsedData, byte[] report, uint reportLength);
Beispiel #25
0
 static extern NtStatus HidP_GetValueCaps(HidPReportType reportType, [Out] HidPValueCaps[] valueCaps, ref ushort valueCapsLength, IntPtr preparsedData);
Beispiel #26
0
 public static extern NtStatus HidP_GetValueCaps(HidPReportType ReportType, [Out] HidPValueCaps[] Values, ref ushort ValueCapsLength, IntPtr pPreparsedData);