mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-17 02:48:34 +03:00
This is all quite complicated. In general, the TLV_IE.to_dict() method obviously is expected to return a dict (with key equal to the snake-case name of the class, value to the decode IE value). This single-entry dict can then be passed back to the from_dict() method to build the binary representation. However, with a TLV_IE_Collection, any TLV_IE can occur any number of times, so we need an array to represent it (dict would need unique key, which doesn't exist in multiple instances of same TLV IE). Hence, the TLV_IE_Collection.to_dict() method actually returns a list of dicts, rather than a dict itself. Each dict in the list represents one TLV_IE. When encoding such a TLV_IE_Collection back from the list-of-dicts, we so far didn't handle this special case and tried to de-serialize with a class-name-keyed dict, which doesn't work. This patch fixes a regression in the aram_store_ref_ar_do pySim-shell command which got introduced in Change-Id I3dd5204510e5c32ef1c4a999258d87cb3f1df8c8 While we're fixing it, add some additional comments to why things are how they are. Change-Id: Ibdd30cf1652c864f167b1b655b49a87941e15fd5