parse_tlv now takes offset arguments
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@104 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
parent
cad6f9cbd1
commit
74f51895ad
|
@ -61,9 +61,18 @@ class Card:
|
|||
"""Reset the card."""
|
||||
self.card.reconnect(init=pycsc.SCARD_RESET_CARD)
|
||||
|
||||
def cmd_parsetlv(self):
|
||||
"Decode the TLV data in the last response"
|
||||
print TLV_utils.decode(self.last_result.data, tags=self.TLV_OBJECTS)
|
||||
def cmd_parsetlv(self, start = None, end = None):
|
||||
"Decode the TLV data in the last response, start and end are optional"
|
||||
lastlen = len(self.last_result.data)
|
||||
if start is not None:
|
||||
start = (lastlen + (int(start,0) % lastlen) ) % lastlen
|
||||
else:
|
||||
start = 0
|
||||
if end is not None:
|
||||
end = (lastlen + (int(end,0) % lastlen) ) % lastlen
|
||||
else:
|
||||
end = lastlen
|
||||
print TLV_utils.decode(self.last_result.data[start:end], tags=self.TLV_OBJECTS)
|
||||
|
||||
COMMANDS = {
|
||||
"reset": cmd_reset,
|
||||
|
|
Loading…
Reference in New Issue