HidD_GetInputReport() 개인적인 메소드

private HidD_GetInputReport ( SafeFileHandle HidDeviceObject, Byte lpReportBuffer, Int32 ReportBufferLength ) : System.Boolean
HidDeviceObject Microsoft.Win32.SafeHandles.SafeFileHandle
lpReportBuffer Byte
ReportBufferLength System.Int32
리턴 System.Boolean
예제 #1
0
 public bool ReadInputReport(byte[] data)
 {
     if (safeReadHandle == null)
     {
         safeReadHandle = OpenHandle(_devicePath, true);
     }
     return(NativeMethods.HidD_GetInputReport(safeReadHandle, data, data.Length));
 }
예제 #2
0
        /// <summary>
        /// Reads an input report from the Control channel.  This method provides access to report data for devices that
        /// do not use the interrupt channel to communicate for specific usages.
        /// </summary>
        /// <param name="reportId">The report ID to read from the device</param>
        /// <returns>The HID report that is read.  The report will contain the success status of the read request</returns>
        ///
        public HidReport ReadReportSync(byte reportId)
        {
            byte[] cmdBuffer = new byte[Capabilities.InputReportByteLength];
            cmdBuffer[0] = reportId;
            bool          bSuccess   = NativeMethods.HidD_GetInputReport(ReadHandle, cmdBuffer, cmdBuffer.Length);
            HidDeviceData deviceData = new HidDeviceData(cmdBuffer, bSuccess ? HidDeviceData.ReadStatus.Success : HidDeviceData.ReadStatus.NoDataRead);

            return(new HidReport(Capabilities.InputReportByteLength, deviceData));
        }