aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2022-01-21 15:42:22 +0100
committerlaforge <laforge@osmocom.org>2022-01-22 12:59:02 +0000
commit0c840f0aab3f4554003ce4467c721c3895022205 (patch)
treede72f8fa96421633319f2170e1d0bc5186b6724a
parentb3d68c0b98b78d7b14408c1eb4c3a5e2ce2a056d (diff)
ts_102_221: decode/encode EF.PL
pySIM-shell (MF/EF.PL)> read_binary_decoded [ "en", null, null, null, null ] Change-Id: I4e879ef34acee461adb8137a6315d064370b1b10
-rw-r--r--pySim/ts_102_221.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index f145d19..7cc3025 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -503,6 +503,17 @@ class EF_ICCID(TransparentEF):
class EF_PL(TransRecEF):
def __init__(self, fid='2f05', sfid=0x05, name='EF.PL', desc='Preferred Languages'):
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=2, size={2,None})
+ def _decode_record_bin(self, bin_data):
+ if bin_data == b'\xff\xff':
+ return None
+ else:
+ return bin_data.decode('ascii')
+ def _encode_record_bin(self, in_json):
+ if in_json is None:
+ return b'\xff\xff'
+ else:
+ return in_json.encode('ascii')
+
# TS 102 221 Section 13.4
class EF_ARR(LinFixedEF):