-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Implement TLV List type #25238
Conversation
PR #25238: Size comparison from cad990f to 5901ecf Increases (1 build for cc32xx)
Full report (1 build for cc32xx)
|
5901ecf
to
7f7790f
Compare
PR #25238: Size comparison from cad990f to 7f7790f Full report (1 build for cc32xx)
|
@erjiaqing my suggesion of using "list" name may have conflicted with the python 'list' type :( I see a lot of CI errors ... if that is the cause, may revert. It stutters, but at least it works. |
PR #25238: Size comparison from fc0e4a2 to bb95898 Full report (1 build for cc32xx)
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Not stale |
408bebd
to
e1d059e
Compare
PR #25238: Size comparison from ca83f16 to e1d059e Increases (9 builds for bl602, cc32xx, telink)
Decreases (4 builds for esp32, nrfconnect, telink)
Full report (57 builds for bl602, bl702, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
PR #25238: Size comparison from d700f2f to 96081ef Increases (8 builds for cc32xx, cyw30739, esp32, telink)
Decreases (15 builds for bl602, bl702, esp32, nrfconnect, psoc6, telink)
Full report (57 builds for bl602, bl702, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
96081ef
to
c0b1f51
Compare
PR #25238: Size comparison from da183fb to c0b1f51 Increases (9 builds for bl702, cc32xx, psoc6, telink)
Decreases (7 builds for bl602, esp32, nrfconnect, telink)
Full report (57 builds for bl602, bl702, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
The Python library has a limited support of the TLV list type, which is a TLV container supports anonymous tags.
This PR enhances the TLV module in the Python library to have a better support of TLV Lists in CHIP TLV.
API Implemented (also in the doc string)
A TLVList can be constructed from a
list
of tuples of tag and value.None
stands for "anonymous tag".e.g.
Constructs a list of three items, tag 1 is 'a', tag 2 is 'b' and with an anonymous item 'c'.
Since TLVLists are ordered, it is meanful to iterate over an list:
e.g.
Outputs:
One can also append items into an list:
e.g.
The content of
l
will be[(1, 'a'), (2, 'b'), (None, 'c'), (3, 'd')]
One can access an item in the list via the tag.
e.g.
It is also possible to get an item via the index since it is ordered:
e.g.
Tests
See src/controller/python/test/unit_tests/test_tlv.py