UsbEndpoint getMaxPacketSize - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for UsbEndpoint getMaxPacketSize method.

This code example shows how to use the following methods:getMaxPacketSize, equals
This code example shows how to use the following methods:getMaxPacketSize
        final int interval = ep.getInterval();
        return "" + interval;
    } 
 
    public static String getMaxPacketSizeString(UsbEndpoint ep) {
        final int size = ep.getMaxPacketSize();
        return "" + size;
    } 
 
    public static String getTypeString(UsbEndpoint ep) {
        switch (ep.getType()) {
            case UsbConstants.USB_ENDPOINT_XFER_CONTROL:
                return "Control"; 
            case UsbConstants.USB_ENDPOINT_XFER_INT:
                return "Interrupt"; 
            case UsbConstants.USB_ENDPOINT_XFER_BULK:
                return "Bulk"; 
            case UsbConstants.USB_ENDPOINT_XFER_ISOC:
                return "Isochronous"; 
            default: 
4
CodeRank
This code example shows how to use the following methods:getMaxPacketSize
    public void close() { 
        connection.close();
    } 
 
    public int getMaxPacketInSize() { 
        return bulkIn.getMaxPacketSize();
    } 
 
    public int getMaxPacketOutSize() { 
        return bulkOut.getMaxPacketSize();
    } 
 
    public UsbRequest createInRequest() {
        UsbRequest r = new UsbRequest();
        r.initialize(connection, bulkIn);
        return r;
    } 
 
    public int bulkTransferOut(byte[] buffer, int length, int timeout) {
        return connection.bulkTransfer(bulkOut, buffer, length, timeout);
4
CodeRank
This code example shows how to use the following methods:getMaxPacketSize
    } 
 
    @Override 
    public int read(byte[] dest, int timeoutMillis) throws IOException {
        int readAmt = Math.min(dest.length, mReadBuffer.length);
        readAmt = Math.min(readAmt, mReadEndpoint.getMaxPacketSize());
        final int transferred = mConnection.bulkTransfer(mReadEndpoint, mReadBuffer, readAmt,
                timeoutMillis);
 
        if (transferred < 0) {
            // This sucks: we get -1 on timeout, not 0 as preferred. 
            // We *should* use UsbRequest, except it has a bug/api oversight 
            // where there is no way to determine the number of bytes read 
            // in response :\ -- http://b.android.com/28023 
            return 0; 
        } 
        System.arraycopy(mReadBuffer, 0, dest, 0, transferred);
        return transferred;
    } 
 
4
CodeRank
This code example shows how to use the following methods:getMaxPacketSize
				int writeTmoutMs
				) { 
			mUsbConnection = connection;
			mUsbEndpoint = bulkInEndpoint;
			mTimeout = writeTmoutMs;
			rcvPkt = new byte[mUsbEndpoint.getMaxPacketSize()];
		} 
 
		public UsbSerialInputStream(UsbDeviceConnection connection,
				UsbEndpoint bulkOutEndpoint) {
			this(connection, bulkOutEndpoint, DEFAULT_READ_TIMEOUT_MS);
		} 
 
		@Override 
		public int read() throws IOException { 
			synchronized(this) {
				int rcvd = read(rcvPkt, 0, 1);
				if (rcvd == 0) throw new IOException("timeout");
				return rcvPkt[0] & 0xff;
			} 
4
CodeRank

Related UsbEndpoint getMaxPacketSize Questions & Answers:

getMaxPacketSize Method Overview
Returns the endpoint's maximum packet size.
See Code Examples for other Android UsbEndpoint Methods: