List of usage examples for android.hardware.usb UsbConstants USB_CLASS_CDC_DATA
int USB_CLASS_CDC_DATA
To view the source code for android.hardware.usb UsbConstants USB_CLASS_CDC_DATA.
Click Source Link
From source file:org.ros.android.android_acm_serial.AcmDevice.java
/** * Goes through the given UsbInterface's endpoints and finds the incoming * and outgoing bulk transfer endpoints. * @return Array with incoming (first) and outgoing (second) USB endpoints * @return <code>null</code> in case either of the endpoints is not found *//*from ww w .ja v a 2s . com*/ private AcmUsbEndpoints getAcmEndpoints(UsbInterface usbInterface) { UsbEndpoint outgoingEndpoint = null; UsbEndpoint incomingEndpoint = null; for (int i = 0; i < usbInterface.getEndpointCount(); i++) { UsbEndpoint endpoint = usbInterface.getEndpoint(i); log.info("Interface: " + i + "/" + "Class: " + usbInterface.getInterfaceClass()); if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_CDC_DATA) { if (endpoint.getDirection() == UsbConstants.USB_DIR_OUT) { log.info("Endpoint " + i + "/" + usbInterface.getEndpointCount() + ": " + endpoint + ". Type = " + endpoint.getType()); outgoingEndpoint = endpoint; } else if (endpoint.getDirection() == UsbConstants.USB_DIR_IN) { log.info("Endpoint " + i + "/" + usbInterface.getEndpointCount() + ": " + endpoint + ". Type = " + endpoint.getType()); incomingEndpoint = endpoint; } } } if (outgoingEndpoint == null || incomingEndpoint == null) { return null; } else { return new AcmUsbEndpoints(incomingEndpoint, outgoingEndpoint); } }
From source file:com.nps.micro.MainActivity.java
private boolean isExpectedDevice(UsbDevice device) { if (device == null) { return false; }// w ww.j a v a2 s . co m for (DeviceId devId : deviceIds) { if (devId.equals(device)) { for (int i = 0; i < device.getInterfaceCount(); i++) { if (device.getInterface(i).getInterfaceClass() == UsbConstants.USB_CLASS_CDC_DATA) { return true; } } } } return false; }