HidD_GetInputReport() private method

private HidD_GetInputReport ( SafeFileHandle HidDeviceObject, Byte lpReportBuffer, Int32 ReportBufferLength ) : System.Boolean
HidDeviceObject Microsoft.Win32.SafeHandles.SafeFileHandle
lpReportBuffer Byte
ReportBufferLength System.Int32
return System.Boolean
コード例 #1
0
ファイル: HidDevice.cs プロジェクト: yuvalka246/ds4-tool
 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));
        }