-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix VehicleEventFlaga Jackknife Event Extension #42
Fix VehicleEventFlaga Jackknife Event Extension #42
Conversation
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.
This looks good to me!
Here’s what I did:
- Verified that unit tests passed using the checked-in
2024.tar.gz
file. - Generated a new
2024.tar.gz
file using J2735 2024 files, and no errors appeared when applying patches. - Verified that unit tests passed with the newly generated
2024.tar.gz
file.
However, I have one point of confusion: The description states,
"The PER-visible size constraint struct in VehicleEventFlags.c was changed from [...] to [...]."
But I don’t see this constraint struct in the checked-in override file for VehicleEventFlags.c
.
Is the description still accurate?
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.
Looks good to me!
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.
Nice! Good to get better 2024 support.
This PR fixes an issue with the "eventJackKnife" field that was added to the VehicleEventFlags BIT STRING in the 2024 revision of the J2735 specification.
The original issue was described here: usdot-asn1c Issue #2
The extension was removed in a previous PR #37 as a workaround to prevent incorrect UPER encoding/decoding code from being generated with the extension present. This PR restores the extension in the ASN.1, and instead edits the generated C code to ensure that the UPER encoding is correct with the extension present.
The correct encoding for BIT STRING extensions was determined by referring to the text of the UPER standard, and by experimenting with the encoding using the open source Erlang ASN.1 compiler as described in detail here:
asn1c-extensible-bitstring-example - the-erlang-asn1-compiler-produces-the-correct-uper-encoding.
Then the asn1c compiler was tested by compiling the
VehicleEventFlags
PDU by itself within a test rig, and comparing the UPER with the reference from the Erlang compiler. It was discovered that the asn1c-generated code already has the ability to generate UPER for BIT STRINGs with extensions with a simple adjustment to the PER-visible size constraint, meaning that there is just a bug in how asn1c translates size constraint extensions to it's internal representation. The bug was worked around by editing the generated code,VehicleEventFlags.c
.As a further test, the publicly available J2735 (2016) validation site here: https://webapp2.connectedvcs.com/validator/ which uses the commercial OSS ASN.1 compiler, was used to verify that UPER generated with the BIT STRING with the extension is backwards compatible with the 2016 specification, and that the OSS-generated codec understands the same UPER for BIT STRING extensions as the Erlang and asn1c compilers.
Details on the code changed.
The PER-visible size constraint struct in
VehicleEventFlags.c
was changed from:to:
That struct represents the size constraint for the extension root only, and the original generated code erroneously includes the extension size constraint in it. That change was enough to cause the correct UPER to be encoded.
The
VehicleEventFlags_constraint
method was left as-is with this check:so that the extended size (14) will still be included in constraint checks.
Tests
Unit tests for encoding and decoding the
VehicleEventFlags
PDU were added, and a decode test for a BSM with the "jackKnife" event was added totests.cpp
. The tests were run in Docker.