mirror of https://gerrit.osmocom.org/pysim
utils: Add DataObjectSequence.encode_multi()
This is the analogous to the decode_multi() method. Change-Id: Ifdd1b1bd4d67f447638858c3e92742ca6f884bfa
This commit is contained in:
parent
785d484709
commit
0dcdfbfe94
|
@ -1561,6 +1561,18 @@ class DataObjectSequence:
|
||||||
i += 1
|
i += 1
|
||||||
return encoded
|
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:
|
class CardCommand:
|
||||||
"""A single card command / instruction."""
|
"""A single card command / instruction."""
|
||||||
|
|
Loading…
Reference in New Issue