laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/38472?usp=email )


Change subject: pySim.ts_31_102: Add support for EF.ARFCNList
......................................................................

pySim.ts_31_102: Add support for EF.ARFCNList

Change-Id: I16797ca58c3ad6ebaf588d04fec011a0cbcfcef3
---
M pySim/ts_31_102.py
1 file changed, 31 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/72/38472/1

diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py
index b82c411..6f14ebb 100644
--- a/pySim/ts_31_102.py
+++ b/pySim/ts_31_102.py
@@ -30,7 +30,7 @@

 from construct import Optional as COptional
 from construct import Int32ub, Nibble, GreedyRange, Struct, FlagsEnum, Switch, 
this, Int16ub, Padding
-from construct import Bytewise, Int24ub, PaddedString, PrefixedArray, If
+from construct import Bytewise, Int24ub, Int24sb, PaddedString, PrefixedArray, 
If
 
 from osmocom.utils import is_hexstr
 from osmocom.tlv import *
@@ -893,6 +893,35 @@
         super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, 
**kwargs)
         self._construct = BitStruct('rfu'/BitsRFU(7), 'from_preferred'/Flag)

+# TS 31.102 Section 4.2.112 + TS 23.032 Section 6.1
+GadPoint = Struct('latitude'/Int24sb, 'longitude'/Int24sb)
+
+# TS 31.102 Section 4.2.112 (Rel ??)
+class EF_EARFCNList(TransparentEF):
+    _test_de_encode = [
+        # single data object with one EARFCN + one area of 3 points
+        ('a01a8004000100008112000001100001000002100002000003100003',
+         {'earfcn_list_tlv': [{'earfcn': 65536}, {'geographical_area': 
[{'latitude': 1, 'longitude': 1048577},
+                                                                        
{'latitude': 2, 'longitude': 1048578},
+                                                                        
{'latitude': 3, 'longitude':
+                                                                         
1048579}]}]}),
+        # single data object with one EARFCN + two areas of 3 + 4 points
+        
('a01a800400010000811200000110000100000210000200000310000381180000011000010000021000020000031000030001011000110',
+         None),
+        # two concatenated data objects with 3 points each
+        
('a01a8004000100008112000001100001000002100002000003100003a01a8004000200008112000011100011000012100012000013100013',
 None ),
+    ]
+    class Earfcn(BER_TLV_IE, tag=0x80):
+        _construct = Int32ub
+    class GeographicalArea(BER_TLV_IE, tag=0x81):
+        _construct = GreedyRange(GadPoint)
+    class EarfcnListTlv(BER_TLV_IE, tag=0xa0, 
nested=[Earfcn,GeographicalArea]):
+        pass
+    def __init__(self, fid='6ffd', sfid=None, name='EF.EARFCNList', size=(30, 
100),
+                 desc='EARFCN list for MTC/NB-IOT UEs', **kwargs):
+        super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, 
**kwargs)
+        self._tlv = self.EarfcnListTlv
+
 # TS 31.102 Section 4.2.114 (Rel 18)
 class EF_eAKA(TransparentEF):
     def __init__(self, fid='6f01', sfid=None, name='EF.eAKA', size=(1, 1),
@@ -1675,7 +1704,7 @@
             # TODO: EF.3GPPPSDATAOFF
             # TODO: EF.3GPPPSDATAOFFservicelist
             EF_XCAPConfigData(service=120),
-            # TODO: EF.EARFCNList
+            EF_EARFCNList(service=121),
             EF_MuDMiDConfigData(service=134),
             EF_eAKA(),
             EF_OCST(service=148),

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38472?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I16797ca58c3ad6ebaf588d04fec011a0cbcfcef3
Gerrit-Change-Number: 38472
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>

Reply via email to