Skip to main content

decode

Function decode 

Source
pub fn decode(input: &[u8], headers: Headers) -> Result<ItsMessage<'_>, String>
Expand description

Decodes an ASN.1 message with headers. Supported encoding rules are UPER, JER, and XER. JSON and XML strings are expected as UTF-8 slices.

§Params

  • input: binary input containing the ITS message
  • headers: indicate which headers are present in the binary input. GeoNetworking and transport headers will be decoded and returned, other headers will be skipped.

§Notes

CDD 2.2.1 has changed the capitalization of the messageId and stationId data fields compared to CDD 1.3.1. This didn’t change the UPER encoding and therefore hasn’t lead to a new protocol version in the ITS PDU header, but changes the XER and JER encodings. There’s a fallback in place to handle XER or JER-encoded DENM, IVIM, MAPEM, SPATEM, SREM and SSEM messages which were encoded using the old CDD.

§Errors

Throws string error on decoding errors.