예제 #1
0
파일: acg.py 프로젝트: TanujSharma/acgtools
	def __parse_tag(self, cmd, uid):
		if not self.__ext_id:
			return tag(uid)

		if self.__ext_reqa:
			if len(uid) in [6, 9, 12]:
				t = iso1443a(uid[2:], reqa = uid[:2])
			elif len(uid) == 13: # ??????
				t = iso1443b(uid[0:4],
						app = uid[4:8],
						protocol = uid[8:11],
						cid = uid[11])
			else:
				raise ACG_BadResponse(cmd, bin2asc(uid))
		else:
			if len(uid) in [5, 8, 11]:
				t = iso1443a(uid[1:], cascade = uid[0])
			elif len(uid) == 12:
				t = iso1443b(uid[0:4],
						app = uid[4:8],
						protocol = uid[8:11],
						cid = uid[11])
			else:
				raise ACG_BadResponse(cmd, bin2asc(uid))
		return t
예제 #2
0
파일: tag.py 프로젝트: TanujSharma/acgtools
	def __init__(self, id):
		self.serial = id
		self.serial_str = bin2asc(id)
		self.baud = None
		self.frame_size = None
		self.typename = "UNKNOWN"
		self.iso1443a = False
		self.iso1443b = False
예제 #3
0
파일: acg.py 프로젝트: TanujSharma/acgtools
	def apdu(self, pdu):
		ret = self.__trancieve("t%.2x1f02%s"%(len(pdu) + 1,
							bin2asc(pdu)))
		bin = asc2bin(ret)
		if len(bin) < 4:
			raise ACG_IOError("Bad PDU response: %s"%ret)
		bin = bin[2:]
		return (bin[:-2], ord(bin[-2:-1]), ord(bin[-1:]))