aboutsummaryrefslogtreecommitdiffstats
path: root/pySim/gsm_r.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-12-27 17:06:58 +0100
committerHarald Welte <laforge@osmocom.org>2023-12-28 08:08:54 +0100
commit842fbdb15d50588bc427e9ed75ad720e578efb38 (patch)
tree2f294b90d42bd0593268b4eaac64ee87360263fc /pySim/gsm_r.py
parentdffe7af5789d9a59d6e12c43a449eaf2955f8443 (diff)
add PlmnAdapter for decoding PLMN bcd-strings like 262f01 to 262-01
The human representation of a PLMN is usually MCC-MNC like 262-01 or 262-001. Let's add a PlmnAdapter for use within construct, so we can properly decode that. Change-Id: I96f276e6dcdb54a5a3d2bcde5ee6dbaf981ed789
Diffstat (limited to 'pySim/gsm_r.py')
-rw-r--r--pySim/gsm_r.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pySim/gsm_r.py b/pySim/gsm_r.py
index cd111d6..db7819c 100644
--- a/pySim/gsm_r.py
+++ b/pySim/gsm_r.py
@@ -202,12 +202,12 @@ class EF_Shunting(TransparentEF):
class EF_GsmrPLMN(LinFixedEF):
"""Section 7.7"""
_test_de_encode = [
- ( "22f860f86f8d6f8e01", { "plmn": "228f06", "class_of_network": {
+ ( "22f860f86f8d6f8e01", { "plmn": "228-06", "class_of_network": {
"supported": { "vbs": True, "vgcs": True, "emlpp": True,
"fn": True, "eirene": True }, "preference": 0 },
"ic_incoming_ref_tbl": "6f8d", "outgoing_ref_tbl": "6f8e",
"ic_table_ref": "01" } ),
- ( "22f810416f8d6f8e02", { "plmn": "228f01", "class_of_network": {
+ ( "22f810416f8d6f8e02", { "plmn": "228-01", "class_of_network": {
"supported": { "vbs": False, "vgcs": False, "emlpp": False,
"fn": True, "eirene": False }, "preference": 1 },
"ic_incoming_ref_tbl": "6f8d", "outgoing_ref_tbl": "6f8e",
@@ -216,7 +216,7 @@ class EF_GsmrPLMN(LinFixedEF):
def __init__(self):
super().__init__(fid='6ff5', sfid=None, name='EF.GsmrPLMN',
desc='GSM-R network selection', rec_len=(9, 9))
- self._construct = Struct('plmn'/BcdAdapter(Bytes(3)),
+ self._construct = Struct('plmn'/PlmnAdapter(Bytes(3)),
'class_of_network'/BitStruct('supported'/FlagsEnum(BitsInteger(5), vbs=1, vgcs=2, emlpp=4, fn=8, eirene=16),
'preference'/BitsInteger(3)),
'ic_incoming_ref_tbl'/HexAdapter(Bytes(2)),