Main Site Documentation

Usb Client data receive event?



Is there a way to get some event when data arrives over usb?
Cdc Class and CdcStream class does not have events,
but maybe there is an event class in netmf system that can be use to norify when new data arrives?



I don’t think such a mechanism exists. When I was working with CDC I asked for the same thing and the answer was no!

However you can poll the port and fire an event if something is received.


Ohh, that’s bad.

I think there is no usb data receive event even a custom HID device.
Ok I will implement it with simple data polling. But there will be problems I think - in my case computer will send lot of data, mostly images and when system refresh display at same time when new data arrives, there may be a data loss. Probably I will try solve this using a thread and fifo buffer but it will be more complex than I want. Another way is modifying firmware source and add these events… and lose code compability when new netmf version goes out.


Modifying the firmware source will be a huge work… to be honest I am not sure to have enough skill and time to do that.

However you can poll easily and compute the polling period using the worth case. Your polling method just have to free the serial buffer and fill a fifo then you can process the fifo or fire an event.

You’re not even forced to instantiate thread explicitely just deal with events netmf will manage the remaining and tricky parts