資源描述:
《平板外設命令接口》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、一.非接觸式IC卡,接觸式IC卡,PSAM卡1.選通:7E2541FFFFFF2.通訊規(guī)范(非接觸IC,接觸IC,PSAM,磁卡,打印機,藍牙改密公用此規(guī)范):序號內容長度(字節(jié))說明1數(shù)據(jù)包頭(STX)1常量:0x022數(shù)據(jù)單元長度(Data_len)2需傳輸?shù)臄?shù)據(jù)單元Data部分的長度,高字節(jié)在前,低字節(jié)在后,以16進制表示。例如:0x0010表示Data部分有16個字節(jié)3需傳輸?shù)臄?shù)據(jù)單元數(shù)據(jù)單元格式:項目長度說明CommandH1命令高8位CommandL1命令低8位參數(shù)不定長命令參數(shù)不定數(shù)據(jù)單元長度由Da
2、ta_len定義,本數(shù)據(jù)單元頭兩個字節(jié)是命令碼(終端發(fā)送命令到讀寫器)或狀態(tài)碼(讀寫器返回數(shù)據(jù)給終端),后面是其它參數(shù)。4冗余檢驗值(LRC)1Data部分數(shù)據(jù)各字節(jié)異或值。5數(shù)據(jù)包尾(ETX)1常量:0x03傳輸中,數(shù)據(jù)包中除了數(shù)據(jù)包頭(STX)和數(shù)據(jù)包尾(ETX),其它部分都要進行字節(jié)拆分,每個字節(jié)拆分高4位、低4位兩部分,分別加上0x30,形成兩個字節(jié)。3.接觸卡命令l上電命令:00H,22H2字節(jié)命令字DelayTime2字節(jié)等待插卡時間,0:無需等待,無卡直接返回CardNo1字節(jié)接觸式用戶卡:00H-
3、0FH例:023030303530303232303030303030323203成功應答數(shù)據(jù)單元00H,00H2字節(jié)ATR不定長卡上電成功,返回ATR例(ATR:3B781300000073C84013009000):023030303F30303030333B3738313330303030303037333C3834303133303039303030323803失敗應答數(shù)據(jù)單元10H,05H接觸式用戶卡上電失敗例:023030303231303035313503l下電命令:00H,23H2字節(jié)命令字Car
4、dNo1字節(jié)接觸式用戶卡:00H-0FH例:0230303033303032333030323303成功應答數(shù)據(jù)單元00H,00H例:x02x30x30x30x32x30x30x30x30x30x30x03失敗應答數(shù)據(jù)單元10H,01Hl應用層交換命令:00H,26H2字節(jié)命令字CardNo1字節(jié)00H-0FHC-APDU不定長例(C-APDU:x00xA4x04x00x07xA0x00x00x03x33x01x01x00):023030303F303032363
5、03030303A343034303030373A30303030303033333330313031313103成功應答數(shù)據(jù)單元00H,00H2字節(jié)R-APDU不定長例(R-APDU:6147):02303030343030303036313437323603失敗應答10H,07H操作接觸式用戶卡數(shù)據(jù)出現(xiàn)錯誤例:0230303032313030373137034.PSAM卡命令l上電命令:00H,22H2字節(jié)命令字DelayTime2字節(jié)等待插卡時間,0:無需等待,無卡直接返回CardNo1字節(jié)接觸式用戶卡:1
6、0H-1FH例:023030303530303232303030303130333203成功應答數(shù)據(jù)單元00H,00H2字節(jié)ATR不定長卡上電成功,返回ATR例(ATR:3B781300000073C84013009000):023030303F30303030333B3738313330303030303037333C3834303133303039303030323803失敗應答數(shù)據(jù)單元20H,05H例:023030303232303035323503l下電命令:00H,23H2字節(jié)命令字CardNo1字節(jié)接
7、觸式用戶卡:10H-1FH例:0230303033303032333130333303成功應答數(shù)據(jù)單元00H,00H例:x02x30x30x30x32x30x30x30x30x30x30x03失敗應答數(shù)據(jù)單元20H,01Hl應用層交換命令:00H,26H2字節(jié)命令字CardNo1字節(jié)10H-1FHC-APDU不定長例(C-APDU:x00xA4x04x00x07xA0x00x00x03x33x01x01x00):023030303F3030323631303030
8、3A343034303030373A30303030303033333330313031303103成功應答數(shù)據(jù)單元00H,00H2字節(jié)R-APDU不定長例(R-APDU:6a82):023030303430303030363A38323E3803失敗應答20H,07H例:0230303032323030373237031.非接命令l上電命令:00H,24H2字節(jié)命令字D