C# Class LibUsbDotNet.UsbEndpointReader

Contains methods for retrieving data from a EndpointType.Bulk or EndpointType.Interrupt endpoint using the overloaded Read(byte[],int,out int) functions or a DataReceived event.
Before using the DataReceived event, the DataReceivedEnabled property must be set to true. While the DataReceivedEnabled property is True, the overloaded Read(byte[],int,out int) functions cannot be used.
Inheritance: LibUsbDotNet.Main.UsbEndpointBase
Show file Open project: arvydas/BlinkStickDotNet Class Usage Examples

Public Methods

Method Description
Read ( IntPtr buffer, int offset, int count, int timeout, int &transferLength ) : ErrorCode

Reads data from the current UsbEndpointReader.

Read ( byte buffer, int timeout, int &transferLength ) : ErrorCode

Reads data from the current UsbEndpointReader.

Read ( byte buffer, int offset, int count, int timeout, int &transferLength ) : ErrorCode

Reads data from the current UsbEndpointReader.

Read ( object buffer, int timeout, int &transferLength ) : ErrorCode

Reads data from the current UsbEndpointReader.

Read ( object buffer, int offset, int count, int timeout, int &transferLength ) : ErrorCode

Reads data from the current UsbEndpointReader.

ReadFlush ( ) : ErrorCode

Reads/discards data from the enpoint until no more data is available.

Private Methods

Method Description
CreateTransferContext ( ) : UsbTransfer
ReadData ( object context ) : void
StartReadThread ( ) : void
StartStopReadThread ( ) : void
StopReadThread ( ) : bool
UsbEndpointReader ( UsbDevice usbDevice, int readBufferSize, ReadEndpointID readEndpointID, EndpointType endpointType ) : System

Method Details

Read() public method

Reads data from the current UsbEndpointReader.
public Read ( IntPtr buffer, int offset, int count, int timeout, int &transferLength ) : ErrorCode
buffer System.IntPtr The buffer to store the recieved data in.
offset int The position in buffer to start storing the data.
count int The maximum number of bytes to receive.
timeout int Maximum time to wait for the transfer to complete. If the transfer times out, the IO operation will be cancelled.
transferLength int Number of bytes actually transferred.
return ErrorCode

Read() public method

Reads data from the current UsbEndpointReader.
public Read ( byte buffer, int timeout, int &transferLength ) : ErrorCode
buffer byte The buffer to store the recieved data in.
timeout int Maximum time to wait for the transfer to complete. If the transfer times out, the IO operation will be cancelled.
transferLength int Number of bytes actually transferred.
return ErrorCode

Read() public method

Reads data from the current UsbEndpointReader.
public Read ( byte buffer, int offset, int count, int timeout, int &transferLength ) : ErrorCode
buffer byte The buffer to store the recieved data in.
offset int The position in buffer to start storing the data.
count int The maximum number of bytes to receive.
timeout int Maximum time to wait for the transfer to complete. If the transfer times out, the IO operation will be cancelled.
transferLength int Number of bytes actually transferred.
return ErrorCode

Read() public method

Reads data from the current UsbEndpointReader.
public Read ( object buffer, int timeout, int &transferLength ) : ErrorCode
buffer object The buffer to store the recieved data in.
timeout int Maximum time to wait for the transfer to complete. If the transfer times out, the IO operation will be cancelled.
transferLength int Number of bytes actually transferred.
return ErrorCode

Read() public method

Reads data from the current UsbEndpointReader.
public Read ( object buffer, int offset, int count, int timeout, int &transferLength ) : ErrorCode
buffer object The buffer to store the recieved data in.
offset int The position in buffer to start storing the data.
count int The maximum number of bytes to receive.
timeout int Maximum time to wait for the transfer to complete. If the transfer times out, the IO operation will be cancelled.
transferLength int Number of bytes actually transferred.
return ErrorCode

ReadFlush() public method

Reads/discards data from the enpoint until no more data is available.
public ReadFlush ( ) : ErrorCode
return ErrorCode