CCID:CCID(USB Chip/Smart Card Interface Devices-USB芯片智能卡接口设备)标准是由几大国际级IT企业共同制定的一个标准,它提供了一种智能卡读写设备与主机或其它嵌入式主机实现相互通讯的可能。
开发中碰到几个方法不知道是什么意思..看了api后明白了.
intf.getInterfaceClass();
intf.getInterfaceSubclass();
intf.getInterfaceProtocol();
上面三个方法的返回值都是int类型.
getInterfaceClass();表示获取智能卡的设备id,具体可以看UsbConstants类.
getInterfaceSubclass();表示获取子类码.
getInterfaceProtocol();获得协议码.CCID的协议码是00h.
代码片段如下:
1 /** 2 * 找设备接口 3 */ 4 private void findInterface() { 5 if (myUsbDevice != null) { 6 Log.d(TAG, "interfaceCounts : " + myUsbDevice.getInterfaceCount()); 7 for (int i = 0; i < myUsbDevice.getInterfaceCount(); i++) { 8 UsbInterface intf = myUsbDevice.getInterface(i); 9 Log.d(TAG,10 "intf.getInterfaceClass() = "11 + intf.getInterfaceClass());12 Log.d(TAG,13 "intf.getInterfaceSubclass() = "14 + intf.getInterfaceSubclass());15 Log.d(TAG,16 "intf.getInterfaceProtocol() = "17 + intf.getInterfaceProtocol());18 if (intf.getInterfaceClass() == 319 && intf.getInterfaceSubclass() == 020 && intf.getInterfaceProtocol() == 0) {21 myInterface = intf;22 Log.d(TAG, "找到我的设备接口");23 }24 break;25 }26 }27 }
原标题:android ccid开发笔记1
关键词:Android