UsbInterface getEndpoint - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:getEndpoint, getEndpointCount
            Log.e(TAG, "could not find interface");
            return; 
        } 
        UsbInterface intf = device.getInterface(0);
        // device should have one endpoint 
        if (intf.getEndpointCount() != 1) {
            Log.e(TAG, "could not find endpoint");
            return; 
        } 
        // endpoint should be of type interrupt 
        UsbEndpoint ep = intf.getEndpoint(0);
        if (ep.getType() != UsbConstants.USB_ENDPOINT_XFER_INT) {
            Log.e(TAG, "endpoint is not interrupt type");
            return; 
        } 
        mDevice = device;
        mEndpointIntr = ep;
        if (device != null) {
            UsbDeviceConnection connection = mUsbManager.openDevice(device);
            if (connection != null && connection.claimInterface(intf, true)) {
7
CodeRank
This code example shows how to use the following methods:getEndpoint, getEndpointCount
			toast.show();
			return; 
		} 
		UsbInterface intf = device.getInterface(0);
		// device should have two endpoints 
		if (intf.getEndpointCount() != 2) {
			Toast toast = Toast.makeText(context, "could not find endpoint", duration);
			toast.show();
			return; 
		} 
 
		// endpoint should be of type bulk 
		UsbEndpoint ep = intf.getEndpoint(0);
		UsbEndpoint epOut = null;
		UsbEndpoint epIn = null;
		if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
			if (ep.getDirection() == UsbConstants.USB_DIR_OUT) {
				epOut = ep;
				//Toast toast = Toast.makeText(context, "endpoint 0 is out", duration); 
				//toast.show(); 

5
CodeRank
This code example shows how to use the following methods:getEndpoint
        // class should be USB_CLASS_CDC_DATA 
 
        if (!mConnection.claimInterface(mDataInterface, true)) {
            throw new IOException("Could not claim data interface.");
        } 
        mReadEndpoint = mDataInterface.getEndpoint(1);
        Log.d(TAG, "Read endpoint direction: " + mReadEndpoint.getDirection());
        mWriteEndpoint = mDataInterface.getEndpoint(0);
        Log.d(TAG, "Write endpoint direction: " + mWriteEndpoint.getDirection());
 
        Log.d(TAG, "Setting line coding");
        setBaudRate(115200); 
 
    } 
 
    private static final int USB_RECIP_INTERFACE = 0x01;
    private static final int USB_RT_ACM = UsbConstants.USB_TYPE_CLASS | USB_RECIP_INTERFACE;
 
    private static final int SET_LINE_CODING = 0x20;  // USB CDC 1.1 section 6.2
 
4
CodeRank
This code example shows how to use the following methods:getEndpoint, getEndpointCount
			appendLogText("could not find interface"); 
			return; 
		} 
		UsbInterface intf = device.getInterface(0);
		// device should have one endpoint 
		if (intf.getEndpointCount() != 1) {
			appendLogText("could not find endpoint"); 
			return; 
		} 
		// endpoint should be of type interrupt 
		UsbEndpoint ep = intf.getEndpoint(0);
		if (ep.getType() != UsbConstants.USB_ENDPOINT_XFER_INT) {
 
			appendLogText("endpoint is not interrupt type"); 
			return; 
		} 
 
		mDevice = device;
		mEndpointIntr = ep;
		if (device != null) {
4
CodeRank
This code example shows how to use the following methods:getEndpoint

Related UsbInterface getEndpoint Questions & Answers:

getEndpoint Method Overview
Returns the UsbEndpoint at the given index.
See Code Examples for other Android UsbInterface Methods: