This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/23658 ) Change subject: ts_51_011: Full encoder/decoder for EF.AD ...................................................................... ts_51_011: Full encoder/decoder for EF.AD The EF.AD class only had a partial decoder and no encoder before this patch. You can now do things like pySIM-shell (MF/ADF.USIM/EF.AD)> read_binary_decoded { "ms_operation_mode": "normal_and_specific_facilities", "specific_facilities": { "ofm": false }, "len_of_mnc_in_imsi": 2 } pySIM-shell (MF/ADF.USIM/EF.AD)> update_binary_decoded '{"ms_operation_mode": "normal_and_specific_facilities", "specific_facilities": {"ofm": false}, "len_of_mnc_in_imsi": 3}' not quite all that elegant yet, but working at all. Change-Id: Id2cb66cb26b6bd08befe9f8468b0b0773da842b1 --- M pySim/ts_51_011.py 1 file changed, 18 insertions(+), 6 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py index a671f31..bd71114 100644 --- a/pySim/ts_51_011.py +++ b/pySim/ts_51_011.py @@ -502,17 +502,29 @@ # TS 51.011 Section 10.3.18 class EF_AD(TransparentEF): OP_MODE = { - 0x00: 'normal operation', - 0x80: 'type approval operations', - 0x01: 'normal operation + specific facilities', - 0x81: 'type approval + specific facilities', - 0x02: 'maintenance (off line)', - 0x04: 'cell test operation', + 0x00: 'normal', + 0x80: 'type_approval', + 0x01: 'normal_and_specific_facilities', + 0x81: 'type_approval_and_specific_facilities', + 0x02: 'maintenance_off_line', + 0x04: 'cell_test', } + OP_MODE_reverse = dict(map(reversed, OP_MODE.items())) def __init__(self, fid='6fad', sfid=None, name='EF.AD', desc='Administrative Data', size={3,4}): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) def _decode_bin(self, raw_bin): u = unpack('!BH', raw_bin[:3]) + ofm = True if u[1] & 1 else False + res = {'ms_operation_mode': self.OP_MODE.get(u[0], u[0]), 'specific_facilities': { 'ofm': ofm } } + if len(raw_bin) > 3: + res['len_of_mnc_in_imsi'] = int(raw_bin[3]) & 0xf + return res + def _encode_bin(self, abstract): + op_mode = self.OP_MODE_reverse[abstract['ms_operation_mode']] + res = pack('!BH', op_mode, abstract['specific_facilities']['ofm']) + if 'len_of_mnc_in_imsi' in abstract: + res += pack('!B', abstract['len_of_mnc_in_imsi']) + return res # TS 51.011 Section 10.3.13 class EF_CBMID(EF_CBMI): -- To view, visit https://gerrit.osmocom.org/c/pysim/+/23658 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Id2cb66cb26b6bd08befe9f8468b0b0773da842b1 Gerrit-Change-Number: 23658 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Robert Falkenberg <robert.falkenberg at tu-dortmund.de> Gerrit-Reviewer: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210406/84992fdd/attachment.htm>