Attention is currently required from: Ben I.
laforge has posted comments on this change by Ben I. ( https://gerrit.osmocom.org/c/pysim/+/41913?usp=email )
Change subject: Decode GSM 7-bit packed EF.PNN data ......................................................................
Patch Set 1:
(2 comments)
File pySim/ts_51_011.py:
https://gerrit.osmocom.org/c/pysim/+/41913/comment/04d0fe21_5aef6e1d?usp=ema... : PS1, Line 891: ef _decode(self, obj, context, path): : if len(obj) < 1: : return '' : header = obj[0] : coding_scheme = (header >> 6) & 0x01 # bit 7: 0=GSM7, 1=UCS2 : spare_bits = header & 0x07 # bits 3-1 : data = obj[1:] : if not data: : return '' : if coding_scheme == 0: : # GSM 7-bit packed : unpacked = gsm7_unpack(data, spare_bits) : return unpacked.decode('gsm03.38') : else: : # UCS-2 (UTF-16 BE) : return data.decode('utf_16_be') I'd assume this is all possible without too much imperative code and with some construct-magic.
I also see potential overlap with the existing GsmOrUcs2Adapter in pyosmocom construct.py. Although the GsmString there is an octet-aligned 7bit GSM encoding. In any case, I think having additional adapters over there seems to make more sense to me, using ideally some common codebase. Maybe we can also parameterize the existing adapters so that they can work with 8bit-aligned 7bit GSM charactres by default but when used as `GsmAdapter(octet_aligned=False)` or `GsmOrUcs2Adapter(gsm_7bit_octet_aligned=False)` or the like?
File pySim/utils.py:
https://gerrit.osmocom.org/c/pysim/+/41913/comment/ee1b7fd3_425b3ee7?usp=ema... : PS1, Line 81: de I would think those are useful/relevant beyond pySim and should go into pyosmocom instead?