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=email :
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=email :
PS1, Line 81: de
I would think those are useful/relevant beyond pySim and should go into 
pyosmocom instead?



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

Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I4558fd011592aeeae2389fe8a1f62f3d7e21d219
Gerrit-Change-Number: 41913
Gerrit-PatchSet: 1
Gerrit-Owner: Ben I <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-CC: laforge <[email protected]>
Gerrit-Attention: Ben I <[email protected]>
Gerrit-Comment-Date: Thu, 22 Jan 2026 16:17:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Reply via email to