Beispiel #1
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 #2
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 #3
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 #4
0
        public static void FreePreparsedData(HidPreparsedData preparsedData)
        {
            var preparsedDataPointer = HidPreparsedData.GetRawValue(preparsedData);

            HidD_FreePreparsedData(preparsedDataPointer);
        }
Beispiel #5
0
        public static NtStatus TryGetCaps(HidPreparsedData preparsedData, out HidPCaps capabilities)
        {
            var preparsedDataPtr = HidPreparsedData.GetRawValue(preparsedData);

            return(HidP_GetCaps(preparsedDataPtr, out capabilities));
        }
Beispiel #6
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));
        }