Attention is currently required from: laforge, pespin.
fixeria has posted comments on this change. (
https://gerrit.osmocom.org/c/pysim/+/31066
)
Change subject: ts_51_011: Implement Extended BCD Coding
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
File pySim/ts_51_011.py:
https://gerrit.osmocom.org/c/pysim/+/31066/comment/7c605ca1_69d6a9f0
PS2, Line 366:
'dialing_nr'/ExtendedBcdAdapter(BcdAdapter(Rpad(Bytes(10)))),
yes, the ExtendedBcdAdapter is written in a way that
it just translates the */# characters, and in o […]
But then it's not really a
BcdAdapter, if it simply translates the */# characters? I don't want to block your
work, but currently it looks cumbersome and confusing. Here is my proposal:
class ExtendedBcdAdapter(BcdAdapter):
"""convert a bytes() type to a string of BCD nibbles, replacing a/b
with */# """
def _decode(self, obj, context, path):
obj =
obj.lower().replace("a","*").replace("b","#")
return super()._decode(obj, context, path)
def _encode(self, obj, context, path):
obj = obj.replace("*","a").replace("#","b")
return super()._encode(obj, context, path)
With this implementation it can be used directly.
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/31066
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ifcec13e9b296dba7bec34b7872192b7ce185c23c
Gerrit-Change-Number: 31066
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 26 Jan 2023 15:18:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment