I am writing a WinForms application that transfers data to a HID class USB device. My application uses the excellent universal HID library v6.0, which can be found here . In a nutshell, when I need to write data to a device, this is the code that gets called:
private async void RequestToSendOutputReport(List<byte[]> byteArrays) { foreach (byte[] b in byteArrays) { while (condition) {
When my code drops out of the while loop, I need to read some data from the device. However, the device cannot answer right away, so I need to wait for this call to return before continuing. Since it currently exists, RequestToGetInputReport () is declared as follows:
private async void RequestToGetInputReport() {
For what it's worth, the declaration for GetInputReportViaInterruptTransfer () looks like this:
internal async Task<int> GetInputReportViaInterruptTransfer()
Unfortunately, I am not very good at working with the new async / await technologies in .NET 4.5. I read a little earlier about the “Wait” keyword, and this gave the impression that the call to GetInputReportViaInterruptTransfer () inside RequestToGetInputReport () would wait (and maybe this is so?), But this does not look like the call to RequestToGetInputReport () itself waits, because that I seem to return immediately to the while loop?
Can someone clarify the behavior that I see?
c # asynchronous async-await
bmt22033 01 Mar. '13 at 3:07 2013-03-01 03:07
source share