mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-29 00:49:21 +03:00
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
This commit is contained in:
@@ -137,6 +137,12 @@ def enc_plmn(mcc, mnc):
|
|||||||
mnc += "F" # pad to 3 digits if needed
|
mnc += "F" # pad to 3 digits if needed
|
||||||
return (mcc[1] + mcc[0]) + (mnc[2] + mcc[2]) + (mnc[1] + mnc[0])
|
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):
|
def dec_spn(ef):
|
||||||
byte1 = int(ef[0:2])
|
byte1 = int(ef[0:2])
|
||||||
hplmn_disp = (byte1&0x01 == 0x01)
|
hplmn_disp = (byte1&0x01 == 0x01)
|
||||||
|
|||||||
Reference in New Issue
Block a user