-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Json to Tlv and Tlv to Json Converters Implementation in CPP #27635
Json to Tlv and Tlv to Json Converters Implementation in CPP #27635
Conversation
PR #27635: Size comparison from fcf37c2 to 4f8a84a Increases (2 builds for cc32xx, qpg)
Full report (4 builds for cc32xx, mbed, qpg)
|
4f8a84a
to
e025293
Compare
PR #27635: Size comparison from a28b007 to 21d6e00 Increases (1 build for cc32xx)
Full report (1 build for cc32xx)
|
PR #27635: Size comparison from a28b007 to 175d94b Increases (18 builds for bl702, bl702l, cc32xx, linux, psoc6, telink)
Decreases (10 builds for bl702, bl702l, efr32, telink)
Full report (60 builds for bl602, bl702, bl702l, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving conditional on comments being addressed (except the one that is already tracked in a followup issue).
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
…lly used in stored values. Made the values consistent everywhere
PR #27635: Size comparison from 1465733 to 102219e Increases (1 build for cc32xx)
Decreases (1 build for cc32xx)
Full report (1 build for cc32xx)
|
…JSON in case element types are NOT as expected
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
PR #27635: Size comparison from 1465733 to 4935d29 Increases (1 build for cc32xx)
Decreases (1 build for cc32xx)
Full report (2 builds for cc32xx, mbed)
|
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
PR #27635: Size comparison from 1465733 to a06d865 Increases above 0.2%:
Increases (58 builds for bl602, bl702, bl702l, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
Decreases (39 builds for bl602, bl702, bl702l, cc32xx, cyw30739, esp32, k32w, linux, psoc6, qpg, telink)
Full report (60 builds for bl602, bl702, bl702l, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
…-chip#27635) * Json to Tlv and Tlv to Json Converters Implemented in CPP This implementation is equivalent to the Kotlin implementation in: src/controller/java/src/chip/jsontlv/ Note that NOT all TLV configurations are supported by the current implementation. Here is the list of limitations: - TLV Structure elements are expected to be sorted in a canonical tag order - TLV Lists are not supported - Multi-Dimensional TLV Arrays are not supported - All elements in an array MUST be of the same type - The top-level TLV element MUST be a single structure with AnonymousTag - The following tags are supported: - AnonymousTag are only used with TLV Array elements or a top-level structure. - ContextSpecificTag are used only with TLV Structure elements. - CommonProfileTag are used only with TLV Structure elements. - Infinity Float/Double values are not supported. Added README.md file that describing the format. Added unit tests for TLV to JSON, JSON to TLV, JSON to TLV back to JSON conversion cases. NOTE about the current implementation of the Tlv-to-Json converter in: src/lib/support/jsontlv/TlvJson.cpp I kept this implementation because it is currently used in a few places in the code for testing/logging purposes. As a follow up work item, this implementation should be replaced with the new one presented in this commit. * Update src/lib/support/jsontlv/JsonToTlv.cpp Co-authored-by: Robert Szewczyk <szewczyk@google.com> * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Robert Szewczyk <szewczyk@google.com> * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/JsonToTlv.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/JsonToTlv.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Addressed Review Comments * Restyled by clang-format * Restyled by prettier-markdown * Removed Debug Prints * Added Support for Float/Double Infinity Values Those values should be encoded as "Infinity" and "-Infinity" strings. * Restyled by clang-format * Restyled by prettier-markdown * Update src/lib/support/jsontlv/JsonToTlv.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Addressed Review Comments * Switch from CommonTag to ProfileTag with an implicit profile id * Documentation update * Restyle * Fix type of variable in unit test * Update src/lib/support/jsontlv/README.md Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/TlvJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Added more comments about kTemporaryImplicitProfileId not being actually used in stored values. Made the values consistent everywhere * Revert old code updates * Casing on json updated according to code review * Make the tlv element naming a bit more consistent, including invalid JSON in case element types are NOT as expected * Remove obsolete comment * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/lib/support/jsontlv/TlvToJson.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> --------- Co-authored-by: Robert Szewczyk <szewczyk@google.com> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Andrei Litvin <andy314@gmail.com> Co-authored-by: yunhanw-google <yunhanw@google.com>
JSON/TLV format with the following support:
{"123456:BOOL": true}
to represent "attribute 1234456 has value true" for app-internal storage that uses json keys for storing path IB (instead of separate structures)This implementation is intended to eventually be functional equivalent with the kotlin implementation in
src/controller/java/src/chip/jsontlv/, however full interop will be added as a followup due to changes in implicit profile ID encoding.
Existing requirements/limitations
Added README.md file that describing the format.
Added unit tests for TLV to JSON, JSON to TLV, JSON to TLV back to JSON conversion cases.
NOTE about the current implementation of the Tlv-to-Json converter in:
src/lib/support/jsontlv/TlvJson.cpp
I kept this implementation because it is currently used in a few places in the code for testing/logging purposes. As a follow up work item, this implementation should be replaced with the new one presented in this commit.(#27686)
Fixes: #27401