mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-29 12:52:06 +03:00
transport: Make all calls go through base class send_apdu_raw()
This allows us to add APDU tracing at one central location in the code Change-Id: Id0593a2e6d846cc3151443f1022ae7ee030e6673
This commit is contained in:
@@ -68,7 +68,7 @@ class LinkBase(object):
|
|||||||
data : string (in hex) of returned data (ex. "074F4EFFFF")
|
data : string (in hex) of returned data (ex. "074F4EFFFF")
|
||||||
sw : string (in hex) of status word (ex. "9000")
|
sw : string (in hex) of status word (ex. "9000")
|
||||||
"""
|
"""
|
||||||
pass
|
return self._send_apdu_raw(pdu)
|
||||||
|
|
||||||
def send_apdu(self, pdu):
|
def send_apdu(self, pdu):
|
||||||
"""Sends an APDU and auto fetch response data
|
"""Sends an APDU and auto fetch response data
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class CalypsoSimLink(LinkBase):
|
|||||||
def wait_for_card(self, timeout = None, newcardonly = False):
|
def wait_for_card(self, timeout = None, newcardonly = False):
|
||||||
pass # Nothing to do really ...
|
pass # Nothing to do really ...
|
||||||
|
|
||||||
def send_apdu_raw(self, pdu):
|
def _send_apdu_raw(self, pdu):
|
||||||
|
|
||||||
# Request FULL reset
|
# Request FULL reset
|
||||||
req_msg = L1CTLMessageSIM(h2b(pdu))
|
req_msg = L1CTLMessageSIM(h2b(pdu))
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class ModemATCommandLink(LinkBase):
|
|||||||
def wait_for_card(self, timeout=None, newcardonly=False):
|
def wait_for_card(self, timeout=None, newcardonly=False):
|
||||||
pass # Nothing to do really ...
|
pass # Nothing to do really ...
|
||||||
|
|
||||||
def send_apdu_raw(self, pdu):
|
def _send_apdu_raw(self, pdu):
|
||||||
# Prepare the command as described in 8.17
|
# Prepare the command as described in 8.17
|
||||||
cmd = 'AT+CSIM=%d,\"%s\"' % (len(pdu), pdu)
|
cmd = 'AT+CSIM=%d,\"%s\"' % (len(pdu), pdu)
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class PcscSimLink(LinkBase):
|
|||||||
self.connect()
|
self.connect()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def send_apdu_raw(self, pdu):
|
def _send_apdu_raw(self, pdu):
|
||||||
|
|
||||||
apdu = h2i(pdu)
|
apdu = h2i(pdu)
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class SerialSimLink(LinkBase):
|
|||||||
def _rx_byte(self):
|
def _rx_byte(self):
|
||||||
return self._sl.read()
|
return self._sl.read()
|
||||||
|
|
||||||
def send_apdu_raw(self, pdu):
|
def _send_apdu_raw(self, pdu):
|
||||||
|
|
||||||
pdu = h2b(pdu)
|
pdu = h2b(pdu)
|
||||||
data_len = ord(pdu[4]) # P3
|
data_len = ord(pdu[4]) # P3
|
||||||
|
|||||||
Reference in New Issue
Block a user