aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-04-07 00:30:10 +0200
committerlaforge <laforge@osmocom.org>2021-04-06 22:53:18 +0000
commitd7a7e17a4824a910af9b7595952b53eb36bf611a (patch)
treec30c083f78c333ad9aaaaf926a005decf75ddb9d
parentf431189a9ef87b85e65f3663529861715752bb57 (diff)
utils.py: Add missing dec_plmn function.
This function is being used e.g. for ADF.USIM/EF.FPLMN entries. The EF_PLMNsel class also already uses a function by this name, we just haven't had any actual implementation around. Change-Id: Iacb45c90bb6491ebb89a477a85ef1f3129b38788
-rw-r--r--pySim/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/pySim/utils.py b/pySim/utils.py
index 8b23929..6a093fa 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -137,6 +137,12 @@ def enc_plmn(mcc, mnc):
mnc += "F" # pad to 3 digits if needed
return (mcc[1] + mcc[0]) + (mnc[2] + mcc[2]) + (mnc[1] + mnc[0])
+def dec_plmn(threehexbytes:Hexstr) -> dict:
+ res = {'mcc': 0, 'mnc': 0 }
+ res['mcc'] = dec_mcc_from_plmn(threehexbytes)
+ res['mnc'] = dec_mnc_from_plmn(threehexbytes)
+ return res
+
def dec_spn(ef):
byte1 = int(ef[0:2])
hplmn_disp = (byte1&0x01 == 0x01)