SetIsoPacketLengths() public method

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.
return void
コード例 #1
0
        private void allocTransfer(UsbEndpointBase endpointBase, bool ownsTransfer, int isoPacketSize, int count)
        {
            int numIsoPackets = 0;
            if (isoPacketSize > 0)
                numIsoPackets = count/isoPacketSize;
            freeTransfer();
            mTransfer = MonoUsbTransfer.Alloc(numIsoPackets);
            mOwnsTransfer = ownsTransfer;
            mTransfer.Type = endpointBase.Type;
            mTransfer.Endpoint = endpointBase.EpNum;
            mTransfer.NumIsoPackets = numIsoPackets;

            if (!mCompleteEventHandle.IsAllocated)
                mCompleteEventHandle = GCHandle.Alloc(mTransferCompleteEvent);
            mTransfer.PtrUserData = GCHandle.ToIntPtr(mCompleteEventHandle);
            
            if (numIsoPackets > 0)
                mTransfer.SetIsoPacketLengths(isoPacketSize);


        }
コード例 #2
0
        private void allocTransfer(UsbEndpointBase endpointBase, bool ownsTransfer, int isoPacketSize, int count)
        {
            int numIsoPackets = 0;

            // Patch for using libusb-1.0 on windows with libusbwK.sys
            EndpointType endpointType = endpointBase.Type;
            if (UsbDevice.IsLinux)
            {

                if (isoPacketSize > 0)
                    numIsoPackets = count/isoPacketSize;
            }
            else
            {
                if (endpointType == EndpointType.Isochronous)
                    endpointType = EndpointType.Bulk;
            }
            ///////////////////////////////////////////////////////////////

            freeTransfer();
            mTransfer = MonoUsbTransfer.Alloc(numIsoPackets);
            mOwnsTransfer = ownsTransfer;
            mTransfer.Type = endpointType;
            mTransfer.Endpoint = endpointBase.EpNum;
            mTransfer.NumIsoPackets = numIsoPackets;

            if (!mCompleteEventHandle.IsAllocated)
                mCompleteEventHandle = GCHandle.Alloc(mTransferCompleteEvent);
            mTransfer.PtrUserData = GCHandle.ToIntPtr(mCompleteEventHandle);

            if (numIsoPackets > 0)
                mTransfer.SetIsoPacketLengths(isoPacketSize);
        }