C# Class LibUsbDotNet.Main.UsbTransfer

Base class for async transfer context.
Inheritance: IDisposable, IAsyncResult
Show file Open project: arvydas/BlinkStickDotNet Class Usage Examples

Protected Properties

Property Type Description
mHasWaitBeenCalled bool
mIsoPacketSize int
mOriginalCount int
mOriginalOffset int
mTimeout int
mTransferCancelEvent System.Threading.ManualResetEvent
mTransferCompleteEvent System.Threading.ManualResetEvent
mTransferLOCK object

Public Methods

Method Description
Cancel ( ) : ErrorCode

Cancels a pending transfer that was previously submitted with Submit.

Dispose ( ) : void

Cancels any pending transfer and frees resources.

Fill ( IntPtr buffer, int offset, int count, int timeout ) : void

Fills the transfer with the data to Submit.

Fill ( IntPtr buffer, int offset, int count, int timeout, int isoPacketSize ) : void

Fills the transfer with the data to Submit an isochronous transfer.

Fill ( object buffer, int offset, int count, int timeout ) : void

Fills the transfer with the data to Submit.

Fill ( object buffer, int offset, int count, int timeout, int isoPacketSize ) : void

Fills the transfer with the data to Submit an isochronous transfer.

IncrementTransfer ( int amount ) : bool

Increments the internal counters to the next transfer batch (for transfers greater than UsbEndpointBase.MaxReadWrite)

Reset ( ) : void

Resets the transfer to its orignal state.

Prepares a UsbTransfer to be resubmitted.

Submit ( ) : ErrorCode

Submits the transfer.

This functions submits the USB transfer and return immediately.

Wait ( int &transferredCount ) : ErrorCode

Wait for the transfer to complete, timeout, or get cancelled.

Wait ( int &transferredCount, bool cancel ) : ErrorCode

Wait for the transfer to complete, timeout, or get cancelled.

Protected Methods

Method Description
UsbTransfer ( UsbEndpointBase endpointBase ) : System

Private Methods

Method Description
SyncTransfer ( UsbTransfer transferContext, IntPtr buffer, int offset, int length, int timeout, int &transferLength ) : ErrorCode
SyncTransfer ( UsbTransfer transferContext, IntPtr buffer, int offset, int length, int timeout, int isoPacketSize, int &transferLength ) : ErrorCode

Method Details

Cancel() public method

Cancels a pending transfer that was previously submitted with Submit.
public Cancel ( ) : ErrorCode
return ErrorCode

Dispose() public method

Cancels any pending transfer and frees resources.
public Dispose ( ) : void
return void

Fill() public method

Fills the transfer with the data to Submit.
public Fill ( IntPtr buffer, int offset, int count, int timeout ) : void
buffer System.IntPtr The buffer.
offset int The offset on the buffer where the transfer should read/write.
count int The number of bytes to transfer.
timeout int Time (milliseconds) to wait before the transfer times out.
return void

Fill() public method

Fills the transfer with the data to Submit an isochronous transfer.
public Fill ( IntPtr buffer, int offset, int count, int timeout, int isoPacketSize ) : void
buffer System.IntPtr The buffer.
offset int The offset on the buffer where the transfer should read/write.
count int The number of bytes to transfer.
timeout int Time (milliseconds) to wait before the transfer times out.
isoPacketSize int Size of each isochronous packet.
return void

Fill() public method

Fills the transfer with the data to Submit.
public Fill ( object buffer, int offset, int count, int timeout ) : void
buffer object The buffer; See for more details.
offset int The offset on the buffer where the transfer should read/write.
count int The number of bytes to transfer.
timeout int Time (milliseconds) to wait before the transfer times out.
return void

Fill() public method

Fills the transfer with the data to Submit an isochronous transfer.
public Fill ( object buffer, int offset, int count, int timeout, int isoPacketSize ) : void
buffer object The buffer; See for more details.
offset int The offset on the buffer where the transfer should read/write.
count int The number of bytes to transfer.
timeout int Time (milliseconds) to wait before the transfer times out.
isoPacketSize int Size of each isochronous packet.
return void

IncrementTransfer() public method

Increments the internal counters to the next transfer batch (for transfers greater than UsbEndpointBase.MaxReadWrite)
public IncrementTransfer ( int amount ) : bool
amount int This will usually be the total transferred on the previous batch.
return bool

Reset() public method

Resets the transfer to its orignal state.
Prepares a UsbTransfer to be resubmitted.
public Reset ( ) : void
return void

Submit() public abstract method

Submits the transfer.
This functions submits the USB transfer and return immediately.
public abstract Submit ( ) : ErrorCode
return ErrorCode

UsbTransfer() protected method

protected UsbTransfer ( UsbEndpointBase endpointBase ) : System
endpointBase UsbEndpointBase
return System

Wait() public method

Wait for the transfer to complete, timeout, or get cancelled.
public Wait ( int &transferredCount ) : ErrorCode
transferredCount int The number of bytes transferred on .
return ErrorCode

Wait() public abstract method

Wait for the transfer to complete, timeout, or get cancelled.
public abstract Wait ( int &transferredCount, bool cancel ) : ErrorCode
transferredCount int The number of bytes transferred on .
cancel bool If true, the transfer is cancelled if it does not complete within the time specified in .
return ErrorCode

Property Details

mHasWaitBeenCalled protected property

protected bool mHasWaitBeenCalled
return bool

mIsoPacketSize protected property

protected int mIsoPacketSize
return int

mOriginalCount protected property

protected int mOriginalCount
return int

mOriginalOffset protected property

protected int mOriginalOffset
return int

mTimeout protected property

protected int mTimeout
return int

mTransferCancelEvent protected property

protected ManualResetEvent,System.Threading mTransferCancelEvent
return System.Threading.ManualResetEvent

mTransferCompleteEvent protected property

protected ManualResetEvent,System.Threading mTransferCompleteEvent
return System.Threading.ManualResetEvent

mTransferLOCK protected property

protected object mTransferLOCK
return object