30.11.2012 Views

USBIO Driver for Windows CE - Thesycon Systemsoftware ...

USBIO Driver for Windows CE - Thesycon Systemsoftware ...

USBIO Driver for Windows CE - Thesycon Systemsoftware ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3 Programming Interface<br />

After that, the buffer is put back to the pool and the main loop is started from the beginning.<br />

3.1.5 CUsbIoWriter Class<br />

The class CUsbIoWriter extends the CUsbIoThread class by a specific worker thread routine<br />

that continuously sends write requests to the pipe. The thread’s main routine gets a buffer<br />

from an internal buffer pool and calls the virtual member function ProcessBuffer to fill the<br />

buffer with data. After that, the buffer is sent to the pipe using the Write() function of the<br />

CUsbIoPipe class. After all buffers are submitted the routine waits <strong>for</strong> the first pending buffer<br />

to complete. If a buffer is completed by the <strong>USBIO</strong> driver the buffer is put back to the pool and<br />

the main loop is started from the beginning.<br />

3.1.6 CUsbIoBuf Class<br />

The helper class CUsbIoBuf is used as a descriptor <strong>for</strong> buffers that are processed by the class<br />

CUsbIoPipe and derived classes. One instance of the CUsbIoBuf class has to be created<br />

<strong>for</strong> each buffer. The CUsbIoBuf object stores context and status in<strong>for</strong>mation that is needed to<br />

process the buffer asynchronously.<br />

The CUsbIoBuf class contains a link element (Next pointer). This may be used to build a chain of<br />

linked buffer objects to hold them in a list. This way, the management of buffers can be simplified.<br />

3.1.7 CUsbIoBufPool Class<br />

The class CUsbIoBufPool is used to manage a pool of free buffers. It provides functions used<br />

to allocate an initial number of buffers, to get a buffer from the pool, and to put a buffer back to<br />

the pool.<br />

3.1.8 CPnPNotificator Class<br />

The class CPnPNotificator can be used to get plug and play notifications. To use the class<br />

derive a handler class from CPnPNotifyHandler and overwrite the function HandlePnPMessage().<br />

Pass a pointer to an instance of this class to the function call CPnPNotificator::Initialize().<br />

3.2 Class Library Reference<br />

CUsbIo class<br />

This class implements the interface to the <strong>USBIO</strong> device driver. It contains only general<br />

device-related functions that can be executed without a pipe context. Pipe specific functions are<br />

implemented by the UsbIoPipe class.<br />

24 <strong>USBIO</strong> <strong>Driver</strong> <strong>for</strong> <strong>Windows</strong> <strong>CE</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!