laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve
ts_31_102: Fix several bugs in EF_ECC encoder

The encoder function apparently was never tested, it didn't match at all
the output of the decoder, not even in terms of the string keys of the
dict.

Change-Id: Id67bc39d52c4dfb39dc7756d8041cbd552ccbbc4
---
M pySim/ts_31_102.py
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py
index 4d1c3dc..4125f4a 100644
--- a/pySim/ts_31_102.py
+++ b/pySim/ts_31_102.py
@@ -622,9 +622,12 @@
if in_json is None:
return b'\xff\xff\xff\xff'
code = EF_ECC.cc_construct.build(in_json['call_code'])
- svc_category = EF_ECC.category_construct.build(in_json['category'])
- alpha_id = EF_ECC.alpha_construct.build(in_json['alpha_id'])
- # FIXME: alpha_id needs padding up to 'record_length - 4'
+ svc_category = EF_ECC.category_construct.build(in_json['service_category'])
+ if 'alpha_id' in in_json:
+ alpha_id = EF_ECC.alpha_construct.build(in_json['alpha_id'])
+ # FIXME: alpha_id needs padding up to 'record_length - 4'
+ else:
+ alpha_id = b''
return code + alpha_id + svc_category



To view, visit change 31123. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Id67bc39d52c4dfb39dc7756d8041cbd552ccbbc4
Gerrit-Change-Number: 31123
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged