本文整理汇总了Java中android.hardware.usb.UsbConstants.USB_CLASS_CSCID属性的典型用法代码示例。如果您正苦于以下问题:Java UsbConstants.USB_CLASS_CSCID属性的具体用法?Java UsbConstants.USB_CLASS_CSCID怎么用?Java UsbConstants.USB_CLASS_CSCID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.hardware.usb.UsbConstants
的用法示例。
在下文中一共展示了UsbConstants.USB_CLASS_CSCID属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nameForClass
private static String nameForClass(UsbDevice usbDevice) {
int classType = usbDevice.getDeviceClass();
switch (classType) {
case UsbConstants.USB_CLASS_AUDIO:
return "Audio";
case UsbConstants.USB_CLASS_CDC_DATA:
return "CDC Control";
case UsbConstants.USB_CLASS_COMM:
return "Communications";
case UsbConstants.USB_CLASS_CONTENT_SEC:
return "Content Security";
case UsbConstants.USB_CLASS_CSCID:
return "Content Smart Card";
case UsbConstants.USB_CLASS_HID:
return "Human Interface Device";
case UsbConstants.USB_CLASS_HUB:
return "Hub";
case UsbConstants.USB_CLASS_MASS_STORAGE:
return "Mass Storage";
case UsbConstants.USB_CLASS_MISC:
return "Wireless Miscellaneous";
case UsbConstants.USB_CLASS_PHYSICA:
return "Physical";
case UsbConstants.USB_CLASS_PRINTER:
return "Printer";
case UsbConstants.USB_CLASS_STILL_IMAGE:
return "Still Image";
case UsbConstants.USB_CLASS_VENDOR_SPEC:
return String.format("Vendor Specific 0x%02x", classType);
case UsbConstants.USB_CLASS_VIDEO:
return "Video";
case UsbConstants.USB_CLASS_WIRELESS_CONTROLLER:
return "Wireless Controller";
default:
return "";
}
}
示例2: nameForClass
public static String nameForClass(int classType) {
switch (classType) {
case UsbConstants.USB_CLASS_APP_SPEC:
return String.format("Application Specific 0x%02x", classType);
case UsbConstants.USB_CLASS_AUDIO:
return "Audio";
case UsbConstants.USB_CLASS_CDC_DATA:
return "CDC Control";
case UsbConstants.USB_CLASS_COMM:
return "Communications";
case UsbConstants.USB_CLASS_CONTENT_SEC:
return "Content Security";
case UsbConstants.USB_CLASS_CSCID:
return "Content Smart Card";
case UsbConstants.USB_CLASS_HID:
return "Human Interface Device";
case UsbConstants.USB_CLASS_HUB:
return "Hub";
case UsbConstants.USB_CLASS_MASS_STORAGE:
return "Mass Storage";
case UsbConstants.USB_CLASS_MISC:
return "Wireless Miscellaneous";
case UsbConstants.USB_CLASS_PER_INTERFACE:
return "(Defined Per Interface)";
case UsbConstants.USB_CLASS_PHYSICA:
return "Physical";
case UsbConstants.USB_CLASS_PRINTER:
return "Printer";
case UsbConstants.USB_CLASS_STILL_IMAGE:
return "Still Image";
case UsbConstants.USB_CLASS_VENDOR_SPEC:
return String.format("Vendor Specific 0x%02x", classType);
case UsbConstants.USB_CLASS_VIDEO:
return "Video";
case UsbConstants.USB_CLASS_WIRELESS_CONTROLLER:
return "Wireless Controller";
default:
return String.format("0x%02x", classType);
}
}
示例3: isCCIDCompliant
public static boolean isCCIDCompliant(UsbDevice usbDevice) {
if (usbDevice.getDeviceClass() == UsbConstants.USB_CLASS_CSCID) {
return true;
} else if (usbDevice.getDeviceClass() == UsbConstants.USB_CLASS_PER_INTERFACE) {
for (int i = 0; i < usbDevice.getInterfaceCount(); i++) {
if (usbDevice.getInterface(i).getInterfaceClass() == UsbConstants.USB_CLASS_CSCID) {
return true;
}
}
}
return false;
}
示例4: open
public synchronized void open() throws IOException {
if (usbDevice == null) throw new IllegalArgumentException("Device can't be null");
if (usbInterface == null) {
for (int i = 0; i < usbDevice.getInterfaceCount(); i++) {
UsbInterface usbIf = usbDevice.getInterface(i);
if (usbIf.getInterfaceClass() == UsbConstants.USB_CLASS_CSCID) {
usbInterface = usbIf;
}
}
if (usbInterface == null)
throw new IllegalStateException("The device hasn't a smart card reader");
}
usbConnection = usbManager.openDevice(usbDevice);
usbConnection.claimInterface(usbInterface, true);
sequence = 0;
//Get the interfaces
for (int i = 0; i < usbInterface.getEndpointCount(); i++) {
UsbEndpoint usbEp = usbInterface.getEndpoint(i);
if (usbEp.getDirection() == UsbConstants.USB_DIR_IN && usbEp.getType() == UsbConstants.USB_ENDPOINT_XFER_INT) {
usbInterrupt = usbEp;
}
if (usbEp.getDirection() == UsbConstants.USB_DIR_OUT && usbEp.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
usbOut = usbEp;
}
if (usbEp.getDirection() == UsbConstants.USB_DIR_IN && usbEp.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
usbIn = usbEp;
}
}
//check for pinPad
CCIDDescriptor desc = CCIDDescriptor.Parse(usbConnection.getRawDescriptors()).get(usbInterface.getId());
pinPad = desc.getPinSupports().contains(CCIDDescriptor.PINSupport.Verification);
supportApdu = desc.getFeatures().contains(CCIDDescriptor.Feature.ShortAPDU) || desc.getFeatures().contains(CCIDDescriptor.Feature.ShortAndExtendedAPDU);
autoInit = desc.getFeatures().contains(CCIDDescriptor.Feature.AutoParamConfigViaATR);
//Listen for state changes
setupStateListener();
}