我有一个RFID项目,希望系统检测读卡器上的卡,因为它在读取范围内,并捕获UID并继续这个过程。到目前为止,我已经放置了一个名为ScanCard的按钮,在其中我放置了读卡功能,它将返回卡的UID。我只使用两种ATR。想摆脱扫描卡按钮,想自动扫描功能。我使用的是python2.7和windows7上的HID Omnikey读卡器
atr = "3B 8F 80 01 80 4F 0C A0 00 00 03 06 0A 00 18 00 00 00 00 7A"
cardtype = ATRCardType( toBytes( "%s" %(atr) ))
cardrequest = CardRequest( timeout=1, cardType=cardtype )
cardservice = cardrequest.waitforcard()
cardservice.connection.connect()
SELECT = [0xFF, 0xCA, 0x00, 0x00, 0x00]
apdu = SELECT
print 'sending ' + toHexString(apdu)
response, sw1, sw2 = cardservice.connection.transmit( apdu )
print 'response: ', response, ' status words: ', "%x %x" % (sw1, sw2)
tagid = toHexString(response).replace(' ','')
print "tagid ",tagid
id = tagid
print" UID is",id
上面的代码就是我现在所遵循的。我需要保持等待卡无限期,有什么办法是最好的呢?在
也许可以试试official pyscard documentation,比如我链接到的监控部分。在
相关问题 更多 >
编程相关推荐