laforge submitted this change.

View Change


Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
pySim/cat: Fix contruct for Address class/IE

Something like "this._.total_len-1" only works during decode. Let's
use GreedyBytes instead, working for encode and decode.

Change-Id: Idf8326298cab7ebc68b09c7e829bfc2061222f51
---
M pySim/cat.py
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/pySim/cat.py b/pySim/cat.py
index 1dff194..fdaf8f3 100644
--- a/pySim/cat.py
+++ b/pySim/cat.py
@@ -32,7 +32,7 @@
# TS 102 223 Section 8.1
class Address(COMPR_TLV_IE, tag=0x06):
_construct = Struct('ton_npi'/Int8ub,
- 'call_number'/BcdAdapter(Bytes(this._.total_len-1)))
+ 'call_number'/BcdAdapter(GreedyBytes))

# TS 102 223 Section 8.2
class AlphaIdentifier(COMPR_TLV_IE, tag=0x05):

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf8326298cab7ebc68b09c7e829bfc2061222f51
Gerrit-Change-Number: 36839
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-CC: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: merged