void Initialize(HidPreparsedData preparsedData)
        {
            capabilities = HidP.GetCaps(preparsedData);

            var buttonCaps = HidP.GetButtonCaps(preparsedData, HidPReportType.Input);

            ButtonSets = buttonCaps.Select(i => new HidButtonSet(this, i)).ToArray();

            var valueCaps = HidP.GetValueCaps(preparsedData, HidPReportType.Input);

            ValueSets = valueCaps.Select(i => new HidValueSet(this, i)).ToArray();
        }
Beispiel #2
0
        private void InitializeFileStream()
        {
            if (dev.OpenDeviceForIoctl())
            {
                using (HidPreparsedData preparsedData = new HidPreparsedData(dev.Handle))
                {
                    NativeApi.HIDP_CAPS Capabilities = new NativeApi.HIDP_CAPS();
                    NativeApi.HidP_GetCaps(preparsedData.Handle, ref Capabilities);
                    bufferSize = Capabilities.InputReportByteLength;
                }

                if (dev.OpenDeviceForRead())
                {
                    state = new DeviceReadState(new FileStream(dev.Handle, FileAccess.Read), new byte[bufferSize]);
                }
                else
                {
                    throw new Exception("Unable to open device for Read");
                }
            }
        }
 public HidReader(HidPreparsedData preparsedData) =>
Beispiel #4
0
 public HidPreparsedDataPtr(HidPreparsedData handle)
     : base(IntPtr.Zero, true) =>
     this.handle = HidPreparsedData.GetRawValue(handle);