android ccid開發筆記1,androidccid

來源:互聯網
上載者:User

android ccid開發筆記1,androidccid

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     }

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.