Skip to content

CTF CCDD JSON file formats

twu edited this page Mar 25, 2022 · 3 revisions

Data structure definitions for CFS messages are provided by CCDD exports in JSON format at the path specified by the config field cfs:CCSDS_data_dir. CTF's sample CFS workspace uses JSON files exported by the CCDD tool. It is recommended to use the tool to generate your files, or you may write them manually following the same format. You may also implement your own CCSDS reader by extending the class plugins.ccsds_plugin.ccsds_interface.CCSDSInterface to consume other formats.

There are 6 types of JSON files handled by the default CCDD Export Reader, found in the sample workspace at ccdd/json/:

  • MID files map MID names to values for each target set. Named *_MIDS.json in the examples.
  • Alias files map CCDD type names to Python ctypes type names that are used internally. Named *_ALIASES.json in the examples.
  • Constant files map CCDD constants to literal values that can be used as macros. Named *_CONSTANTS.json in the examples.
  • Command files define data structures associated with a command MID and optionally command codes. Named *_CMD.json in the examples.
  • Telemetry files define data structures associated with a telemetry MID. Named *_TLM.json in the examples.
  • Data type files define data structures that can be referenced by name in command and telemetry files as a shortcut for manually created CCDD files. Below is an example of a data type extracted to its own file. In the sample workspace this structure is defined inline in auto_to_CMD.json. Note that the only differences in format are the generically named keys data-type and parameters as opposed to cc_data_type and cc_parameters when defined in a command file.
{
    "data_type": "TO_EnableOutputCmd_t",
    "parameters": [
        {
            "name": "cDestIp",
            "description": "",
            "array_size": "16",
            "data_type": "char",
            "bit_length": "0",
            "parameters": []
        },
        {
            "name": "usDestPort",
            "description": "",
            "array_size": "0",
            "data_type": "uint16",
            "bit_length": "0",
            "parameters": []
        },
        {
            "name": "usRouteMask",
            "description": "Route mask to enable",
            "array_size": "0",
            "data_type": "uint16",
            "bit_length": "0",
            "parameters": []
        },
        {
            "name": "iFileDesc",
            "description": "File descriptor of port to use",
            "array_size": "0",
            "data_type": "int32",
            "bit_length": "0",
            "parameters": []
        }
    ]
}

To use this data type, just omit cc_parameters or tlm_parameters from the MID structure and leave the name:

{
    "cmd_mid_name": "TO_CMD_MID",
    "cmd_description": "",
    "cmd_codes": [
        [...]
        {
            "cc_name": "TO_ENABLE_OUTPUT_CC",
            "cc_value": "2",
            "cc_description": "",
            "cc_data_type": "TO_EnableOutputCmd_t",
        },
Clone this wiki locally