pySim.profile: Further refactor card <-> profile matching

The new architecture avoids sim/ruim/uicc specific methods in
pySim.profile and instead moves the profile-specific code into the
profile; it also solves everything within the class hierarchy, no need
for global methods.

Change-Id: I3b6c44d2f5cce2513c3ec8a3ce939a242f3e4901
This commit is contained in:
Harald Welte
2024-09-16 13:24:13 +02:00
committed by laforge
parent 5f2dfc28ff
commit 72186cce84
4 changed files with 51 additions and 56 deletions

View File

@@ -27,7 +27,6 @@ from osmocom.tlv import *
from pySim.utils import *
from pySim.filesystem import *
from pySim.profile import CardProfile
from pySim.profile import match_uicc
from pySim import iso7816_4
# A UICC will usually also support 2G functionality. If this is the case, we
@@ -885,8 +884,10 @@ class CardProfileUICC(CardProfile):
return flatten_dict_lists(d['fcp_template'])
@classmethod
def match_with_card(cls, scc: SimCardCommands) -> bool:
return match_uicc(scc)
def _try_match_card(cls, scc: SimCardCommands) -> None:
""" Try to access MF via UICC APDUs (3GPP TS 102.221), if this works, the
card is considered a UICC card."""
cls._mf_select_test(scc, "00", "0004", ["3f00"])
@with_default_category('TS 102 221 Specific Commands')
class AddlShellCommands(CommandSet):