mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-30 19:14:53 +03:00
pySim.apdu: Refactor cmd_to_dict() method
Let's factor out the "automatic processing using _tlv / _construct" as a separate method. This way we enable a derived class to first call that automatic processing method, and then amend its output in a second step. Change-Id: I1f066c0f1502020c88d99026c25bf2e283c3b4f5
This commit is contained in:
@@ -292,6 +292,10 @@ class ApduCommand(Apdu, metaclass=ApduCommandMeta):
|
|||||||
if callable(method):
|
if callable(method):
|
||||||
return method()
|
return method()
|
||||||
else:
|
else:
|
||||||
|
return self._cmd_to_dict()
|
||||||
|
|
||||||
|
def _cmd_to_dict(self) -> Dict:
|
||||||
|
"""back-end function performing automatic decoding using _construct / _tlv."""
|
||||||
r = {}
|
r = {}
|
||||||
method = getattr(self, '_decode_p1p2', None)
|
method = getattr(self, '_decode_p1p2', None)
|
||||||
if callable(method):
|
if callable(method):
|
||||||
|
|||||||
Reference in New Issue
Block a user