You can now use Python and our V2X ASN.1 API to easily convert binary V2X messages to text - whether JSON or XML - and vice versa.* *

Our V2X API is a C++ API, but the latest update provides a Python wrapper that can be used to convert V2X ASN.1-encoded data. There are three classes, each with methods for converting between binary (unaligned PER) and text (JSON or XML), in either direction.  The classes are:

  • For SAE J2735 DSRC (Dedicated Short Range Communications):
    • MessageFrame
  • For ETSI ITS:
    • CAM (Cooperative Awareness Message), ETSI EN 302 637-2
    • DENM (Decentralized Environmental Notification Message), ETSI EN 302 637-3

The API kit includes a sample Python program that handles things like using files for input/output and working with hexadecimal representations of the binary data, but at the end of the day, the conversion itself is simple, using one of the following function calls:

  • binary to JSON: buf = cls.to_json(inp_data, len(inp_data))
  • binary to XML: buf = cls.to_xml(inp_data, len(inp_data))
  • JSON to binary: buf = cls.from_json(inp_data)
  • XML to binary: cls.from_xml(inp_data)

(where cls is one of the provided classes: MessageFrame, CAM, or DENM.)

Download our V2X ASN.1 API and give it try!  Be sure to choose one of the 64-bit downloads, as the Python wrapper is not available for 32-bit systems.  Full documentation for the API is available on our website and included in the download.


Published

Category

V2X

Tags