laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/27649
)
Change subject: utils: Add DataObjectSequence.encode_multi()
......................................................................
utils: Add DataObjectSequence.encode_multi()
This is the analogous to the decode_multi() method.
Change-Id: Ifdd1b1bd4d67f447638858c3e92742ca6f884bfa
---
M pySim/utils.py
1 file changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/49/27649/1
diff --git a/pySim/utils.py b/pySim/utils.py
index 8a7fcdb..ef770f9 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -1561,6 +1561,18 @@
i += 1
return encoded
+ def encode_multi(self, decoded) -> bytes:
+ """Encode multiple occurrences of the sequence from the decoded
input data.
+ Args:
+ decoded : list of json-serializable input data; one sequence per list item
+ Returns:
+ binary encoded output data
+ """
+ encoded = bytearray()
+ for d in decoded:
+ encoded += self.encode(d)
+ return encoded
+
class CardCommand:
"""A single card command / instruction."""
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/27649
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ifdd1b1bd4d67f447638858c3e92742ca6f884bfa
Gerrit-Change-Number: 27649
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange