Attention is currently required from: Ben I.
2 comments:
File pySim/ts_51_011.py:
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:
I would think those are useful/relevant beyond pySim and should go into pyosmocom instead?
To view, visit change 41913. To unsubscribe, or for help writing mail filters, visit settings.