It would be beneficial if software callbacks could be associated to the successful decoding of CHOICE or OPTIONAL components of a composite SEQUENCE, so to automate subsequent post decoding actions.
Given for example the CHOICE construct TC-Payload in ASN.1 modeled as:
TC-Payload ::= CHOICE
{
tc-2-1 TC-2-1-DistributeOnOffDeviceCommands,
tc-3-5 TC-3-5-EnableThePeriodicGenerationOfHousekeepingParameterReports,
tc-3-6 TC-3-6-DisableThePeriodicGenerationOfHousekeepingParameterReport,
}
The corresponding ACN grammar would support a post-decoding-callback attribute as follows:
TC-Payload <MessageType.ServiceType-ID:serviceType-ID, MessageType.MessageSubtype-ID:messageSubtype-ID> [align-to-next byte]
{
tc-2-1 [present-when serviceType-ID==2 messageSubtype-ID==1 post-decoding-callback Callbacks.TC_2_1_Callback],
tc-3-5 [present-when serviceType-ID==3 messageSubtype-ID==5 post-decoding-callback Callbacks.TC_3_5_Callback],
tc-3-6 [present-when serviceType-ID==3 messageSubtype-ID==6 post-decoding-callback Callbacks.TC_3_6_Callback],
}
The callbacks should be executed by the generated decoder code if appropriate and only after complete and successful decoding of the complete data packet (with valid length and checksum)
Currently, the ASN1SCC supports similar attributes post-encoding-function and post-decoding-validator. However:
- These attributes can only be applied to the root level of a SEQUENCE (code generation errors will occur otherwise)
- They serve specific goals (populate/validate length and checksum fields)
- The
post-decode-callback is therefore invoked almost at the end of -- and not after -- successful decoding (it is part of the decoding process itself, not a follow-up action).
It would be beneficial if software callbacks could be associated to the successful decoding of CHOICE or OPTIONAL components of a composite SEQUENCE, so to automate subsequent post decoding actions.
Given for example the CHOICE construct TC-Payload in ASN.1 modeled as:
The corresponding ACN grammar would support a
post-decoding-callbackattribute as follows:The callbacks should be executed by the generated decoder code if appropriate and only after complete and successful decoding of the complete data packet (with valid length and checksum)
Currently, the ASN1SCC supports similar attributes
post-encoding-functionandpost-decoding-validator. However:post-decode-callbackis therefore invoked almost at the end of -- and not after -- successful decoding (it is part of the decoding process itself, not a follow-up action).