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

@@ -24,7 +24,6 @@ from osmocom.utils import *
from osmocom.construct import *
from pySim.filesystem import *
from pySim.profile import match_ruim
from pySim.profile import CardProfile, CardProfileAddon
from pySim.ts_51_011 import CardProfileSIM
from pySim.ts_51_011 import DF_TELECOM, DF_GSM
@@ -191,8 +190,11 @@ class CardProfileRUIM(CardProfile):
return CardProfileSIM.decode_select_response(data_hex)
@classmethod
def match_with_card(cls, scc: SimCardCommands) -> bool:
return match_ruim(scc)
def _try_match_card(cls, scc: SimCardCommands) -> None:
""" Try to access MF/DF.CDMA via 2G APDUs (3GPP TS 11.11), if this works,
the card is considered an R-UIM card for CDMA."""
cls._mf_select_test(scc, "a0", "0000", ["3f00", "7f25"])
class AddonRUIM(CardProfileAddon):
"""An Addon that can be found on on a combined SIM + RUIM or UICC + RUIM to support CDMA."""