C# 클래스 MonoLibUsb.Transfer.MonoUsbTransfer

파일 보기 프로젝트 열기: arvydas/BlinkStickDotNet 1 사용 예제들

공개 메소드들

메소드 설명
Alloc ( int numIsoPackets ) : MonoUsbTransfer

Allocate a libusb transfer with a specified number of isochronous packet descriptors

The returned transfer is pre-initialized for you. When the new transfer is no longer needed, it should be freed with Free.

Transfers intended for non-isochronous endpoints (e.g. control, bulk, interrupt) should specify an iso_packets count of zero.

For transfers intended for isochronous endpoints, specify an appropriate number of packet descriptors to be allocated as part of the transfer. The returned transfer is not specially initialized for isochronous I/O; you are still required to set the MonoUsbTransfer.NumIsoPackets and MonoUsbTransfer.Type fields accordingly.

It is safe to allocate a transfer with some isochronous packets and then use it on a non-isochronous endpoint. If you do this, ensure that at time of submission, MonoUsbTransfer.NumIsoPackets is 0 and that type is set appropriately.

Alloc is roughly equivalent to libusb_alloc_transfer().
Cancel ( ) : MonoUsbError

Cancels this transfer.

Cancel is roughly equivalent to libusb_cancel_transfer().

FillBulk ( MonoUsbDeviceHandle devHandle, byte endpoint, IntPtr buffer, int length, Delegate callback, IntPtr userData, int timeout ) : void

Helper function to populate the required MonoUsbTransfer properties for a bulk transfer.

FillBulk is similar to libusb_fill_bulk_transfer().

FillControl ( MonoUsbDeviceHandle devHandle, MonoUsbControlSetupHandle controlSetupHandle, Delegate callback, IntPtr userData, int timeout ) : void

Helper function to populate the required MonoUsbTransfer properties for a control transfer.

Isochronous transfers are not supported on windows.

FillControl is similar to libusb_fill_control_transfer().
FillInterrupt ( MonoUsbDeviceHandle devHandle, byte endpoint, IntPtr buffer, int length, Delegate callback, IntPtr userData, int timeout ) : void

Helper function to populate the required MonoUsbTransfer properties for an interrupt transfer.

FillInterrupt is roughly equivalent to libusb_fill_interrupt_transfer().

FillIsochronous ( MonoUsbDeviceHandle devHandle, byte endpoint, IntPtr buffer, int length, int numIsoPackets, Delegate callback, IntPtr userData, int timeout ) : void

Helper function to populate the required MonoUsbTransfer properties for an isochronous transfer.

Isochronous transfers are not supported on windows.

FillIsochronous is similar to libusb_fill_iso_transfer().
Free ( ) : void

Frees this transfer.

Free is roughly equivalent to libusb_free_transfer(). Calling Free on a transfer that has already been freed will result in a double free.

GetIsoPacketBuffer ( int packet ) : IntPtr

Convenience function to locate the position of an isochronous packet within the buffer of an isochronous transfer.

This is a thorough function which loops through all preceding packets, accumulating their lengths to find the position of the specified packet. Typically you will assign equal lengths to each packet in the transfer, and hence the above method is sub-optimal. You may wish to use GetIsoPacketBufferSimple instead.

GetIsoPacketBuffer is roughly equivalent to libusb_get_iso_packet_buffer().
GetIsoPacketBufferSimple ( int packet ) : IntPtr

Convenience function to locate the position of an isochronous packet within the buffer of an isochronous transfer, for transfers where each packet is of identical size.

This function relies on the assumption that every packet within the transfer is of identical size to the first packet. Calculating the location of the packet buffer is then just a simple calculation: buffer + (packet_size * packet)

Do not use this function on transfers other than those that have identical packet lengths for each packet.

GetIsoPacketBufferSimple is roughly equivalent to libusb_get_iso_packet_buffer_simple().
IsoPacket ( int packetNumber ) : MonoUsbIsoPacket

Gets a MonoUsbIsoPacket that represents the specified iso packet descriptor.

MonoUsbTransfer ( int numIsoPackets ) : System

Allocate a libusb transfer with a specified number of isochronous packet descriptors

The transfer is pre-initialized for you. When the new transfer is no longer needed, it should be freed with Free.

Transfers intended for non-isochronous endpoints (e.g. control, bulk, interrupt) should specify an iso_packets count of zero.

For transfers intended for isochronous endpoints, specify an appropriate number of packet descriptors to be allocated as part of the transfer. The returned transfer is not specially initialized for isochronous I/O; you are still required to set the MonoUsbTransfer.NumIsoPackets and MonoUsbTransfer.Type fields accordingly.

It is safe to allocate a transfer with some isochronous packets and then use it on a non-isochronous endpoint. If you do this, ensure that at time of submission, MonoUsbTransfer.NumIsoPackets is 0 and that type is set appropriately.

SetIsoPacketLengths ( int length ) : void

Convenience function to set the length of all packets in an isochronous transfer, based on the num_iso_packets field in the transfer structure.

SetIsoPacketLengths is roughly equivalent to libusb_set_iso_packet_lengths().

Submit ( ) : MonoUsbError

Submits this transfer.

This functions submits the USB transfer and return immediately. Submit is roughly equivalent to libusb_submit_transfer().

UniqueName ( ) : String

Gets a unqiue name for this transfer.

비공개 메소드들

메소드 설명
MonoUsbTransfer ( IntPtr pTransfer ) : System

Creates a new wrapper for transfers allocated by MonoUsbApi.AllocTransfer,

메소드 상세

Alloc() 공개 정적인 메소드

Allocate a libusb transfer with a specified number of isochronous packet descriptors

The returned transfer is pre-initialized for you. When the new transfer is no longer needed, it should be freed with Free.

Transfers intended for non-isochronous endpoints (e.g. control, bulk, interrupt) should specify an iso_packets count of zero.

For transfers intended for isochronous endpoints, specify an appropriate number of packet descriptors to be allocated as part of the transfer. The returned transfer is not specially initialized for isochronous I/O; you are still required to set the MonoUsbTransfer.NumIsoPackets and MonoUsbTransfer.Type fields accordingly.

It is safe to allocate a transfer with some isochronous packets and then use it on a non-isochronous endpoint. If you do this, ensure that at time of submission, MonoUsbTransfer.NumIsoPackets is 0 and that type is set appropriately.

Alloc is roughly equivalent to libusb_alloc_transfer().
If the transfer was not allocated.
public static Alloc ( int numIsoPackets ) : MonoUsbTransfer
numIsoPackets int number of isochronous packet descriptors to allocate.
리턴 MonoUsbTransfer

Cancel() 공개 메소드

Cancels this transfer.
Cancel is roughly equivalent to libusb_cancel_transfer().
public Cancel ( ) : MonoUsbError
리턴 MonoUsbError

FillBulk() 공개 메소드

Helper function to populate the required MonoUsbTransfer properties for a bulk transfer.
FillBulk is similar to libusb_fill_bulk_transfer().
public FillBulk ( MonoUsbDeviceHandle devHandle, byte endpoint, IntPtr buffer, int length, Delegate callback, IntPtr userData, int timeout ) : void
devHandle MonoUsbDeviceHandle handle of the device that will handle the transfer
endpoint byte address of the endpoint where this transfer will be sent
buffer System.IntPtr data buffer
length int length of data buffer
callback System.Delegate callback function to be invoked on transfer completion
userData System.IntPtr user data to pass to callback function
timeout int timeout for the transfer in milliseconds
리턴 void

FillControl() 공개 메소드

Helper function to populate the required MonoUsbTransfer properties for a control transfer.

Isochronous transfers are not supported on windows.

FillControl is similar to libusb_fill_control_transfer().
public FillControl ( MonoUsbDeviceHandle devHandle, MonoUsbControlSetupHandle controlSetupHandle, Delegate callback, IntPtr userData, int timeout ) : void
devHandle MonoUsbDeviceHandle handle of the device that will handle the transfer
controlSetupHandle MonoUsbControlSetupHandle the setup packet/control data to transfer.
callback System.Delegate callback function to be invoked on transfer completion
userData System.IntPtr user data to pass to callback function
timeout int timeout for the transfer in milliseconds
리턴 void

FillInterrupt() 공개 메소드

Helper function to populate the required MonoUsbTransfer properties for an interrupt transfer.
FillInterrupt is roughly equivalent to libusb_fill_interrupt_transfer().
public FillInterrupt ( MonoUsbDeviceHandle devHandle, byte endpoint, IntPtr buffer, int length, Delegate callback, IntPtr userData, int timeout ) : void
devHandle MonoUsbDeviceHandle handle of the device that will handle the transfer
endpoint byte address of the endpoint where this transfer will be sent
buffer System.IntPtr data buffer
length int length of data buffer
callback System.Delegate callback function to be invoked on transfer completion
userData System.IntPtr user data to pass to callback function
timeout int timeout for the transfer in milliseconds
리턴 void

FillIsochronous() 공개 메소드

Helper function to populate the required MonoUsbTransfer properties for an isochronous transfer.

Isochronous transfers are not supported on windows.

FillIsochronous is similar to libusb_fill_iso_transfer().
public FillIsochronous ( MonoUsbDeviceHandle devHandle, byte endpoint, IntPtr buffer, int length, int numIsoPackets, Delegate callback, IntPtr userData, int timeout ) : void
devHandle MonoUsbDeviceHandle handle of the device that will handle the transfer
endpoint byte address of the endpoint where this transfer will be sent
buffer System.IntPtr data buffer
length int length of data buffer
numIsoPackets int the number of isochronous packets
callback System.Delegate callback function to be invoked on transfer completion
userData System.IntPtr user data to pass to callback function
timeout int timeout for the transfer in milliseconds
리턴 void

Free() 공개 메소드

Frees this transfer.
Free is roughly equivalent to libusb_free_transfer(). Calling Free on a transfer that has already been freed will result in a double free.
public Free ( ) : void
리턴 void

GetIsoPacketBuffer() 공개 메소드

Convenience function to locate the position of an isochronous packet within the buffer of an isochronous transfer.

This is a thorough function which loops through all preceding packets, accumulating their lengths to find the position of the specified packet. Typically you will assign equal lengths to each packet in the transfer, and hence the above method is sub-optimal. You may wish to use GetIsoPacketBufferSimple instead.

GetIsoPacketBuffer is roughly equivalent to libusb_get_iso_packet_buffer().
This exception is thrown if the packet requested is >= .
public GetIsoPacketBuffer ( int packet ) : IntPtr
packet int The packet to return the address of.
리턴 System.IntPtr

GetIsoPacketBufferSimple() 공개 메소드

Convenience function to locate the position of an isochronous packet within the buffer of an isochronous transfer, for transfers where each packet is of identical size.

This function relies on the assumption that every packet within the transfer is of identical size to the first packet. Calculating the location of the packet buffer is then just a simple calculation: buffer + (packet_size * packet)

Do not use this function on transfers other than those that have identical packet lengths for each packet.

GetIsoPacketBufferSimple is roughly equivalent to libusb_get_iso_packet_buffer_simple().
This exception is thrown if the packet requested is >= .
public GetIsoPacketBufferSimple ( int packet ) : IntPtr
packet int The packet to return the address of.
리턴 System.IntPtr

IsoPacket() 공개 메소드

Gets a MonoUsbIsoPacket that represents the specified iso packet descriptor.
public IsoPacket ( int packetNumber ) : MonoUsbIsoPacket
packetNumber int The iso packet descriptor to return.
리턴 MonoUsbIsoPacket

MonoUsbTransfer() 공개 메소드

Allocate a libusb transfer with a specified number of isochronous packet descriptors

The transfer is pre-initialized for you. When the new transfer is no longer needed, it should be freed with Free.

Transfers intended for non-isochronous endpoints (e.g. control, bulk, interrupt) should specify an iso_packets count of zero.

For transfers intended for isochronous endpoints, specify an appropriate number of packet descriptors to be allocated as part of the transfer. The returned transfer is not specially initialized for isochronous I/O; you are still required to set the MonoUsbTransfer.NumIsoPackets and MonoUsbTransfer.Type fields accordingly.

It is safe to allocate a transfer with some isochronous packets and then use it on a non-isochronous endpoint. If you do this, ensure that at time of submission, MonoUsbTransfer.NumIsoPackets is 0 and that type is set appropriately.

public MonoUsbTransfer ( int numIsoPackets ) : System
numIsoPackets int number of isochronous packet descriptors to allocate.
리턴 System

SetIsoPacketLengths() 공개 메소드

Convenience function to set the length of all packets in an isochronous transfer, based on the num_iso_packets field in the transfer structure.
SetIsoPacketLengths is roughly equivalent to libusb_set_iso_packet_lengths().
public SetIsoPacketLengths ( int length ) : void
length int The length to set in each isochronous packet descriptor.
리턴 void

Submit() 공개 메소드

Submits this transfer.
This functions submits the USB transfer and return immediately. Submit is roughly equivalent to libusb_submit_transfer().
public Submit ( ) : MonoUsbError
리턴 MonoUsbError

UniqueName() 공개 메소드

Gets a unqiue name for this transfer.
public UniqueName ( ) : String
리턴 String