Esempio n. 1
0
            internal HidDeviceValueCapabilities(HidApi.HIDP_VALUE_CAPS caps)
            {
                UsagePage         = caps.UsagePage;
                ReportId          = caps.ReportID;
                IsAlias           = caps.IsAlias;
                BitField          = caps.BitField;
                LinkCollection    = caps.LinkCollection;
                LinkUsage         = caps.LinkUsage;
                LinkUsagePage     = caps.LinkUsagePage;
                IsRange           = caps.IsRange;
                IsStringRange     = caps.IsStringRange;
                IsDesignatorRange = caps.IsDesignatorRange;
                IsAbsolute        = caps.IsAbsolute;
                HasNull           = caps.HasNull;
                Reserved          = caps.Reserved;
                BitSize           = caps.BitSize;
                ReportCount       = caps.ReportCount;
                Reserved2         = new[] {
                    caps.Reserved2a,
                    caps.Reserved2b,
                    caps.Reserved2c,
                    caps.Reserved2d,
                    caps.Reserved2e
                };
                UnitsExp    = caps.UnitsExp;
                Units       = caps.Units;
                LogicalMin  = caps.LogicalMin;
                LogicalMax  = caps.LogicalMax;
                PhysicalMin = caps.PhysicalMin;
                PhysicalMax = caps.PhysicalMax;

                Range    = new HidDeviceButtonRange(caps.Range);
                NotRange = new HidDeviceButtonNotRange(caps.NotRange);
            }
Esempio n. 2
0
        HidDeviceValueCapabilities[] GetDeviceValueCapabilities(IntPtr handle)
        {
            var capsLength        = (short)capabilities.NumberInputValueCaps;
            var valueCapabilities = new HidApi.HIDP_VALUE_CAPS[capsLength];

            using (var dataContext = new PreparsedDataContext(handle)) {
                HidApi.HidP_GetValueCaps(HidApi.HIDP_REPORT_TYPE.Input, valueCapabilities, ref capsLength, dataContext.Handle);
            }

            return(valueCapabilities.Select(caps => new HidDeviceValueCapabilities(caps)).ToArray());
        }