Skip to content

DSDL Compound Types, Fields and Constants

TheLarsinator edited this page Jun 25, 2021 · 2 revisions

Compound Type

The DSDL parser outputs a dictionary with CompoundTypes as values. These objects hold all information about a .uavcan file, whether it is a message, service or a stand-alone datatype.

Properties

The Compound type has the following properties:

  • MessageType, ENUM, SERVICE or MESSAGE. Stand-alone datatypes are given the value MESSAGE
  • SubjectId, uint, The subject ID for the message or service. Is zero for stand-alone datatypes
  • Version, Tuple<int, int>, File version, extracted from the file name.
  • RequestFields, List, All fields found in the request part of the file.
  • ResponseFields, List, All fields found in the response part of the file.
  • RequestConstants, List, All constants found in the request part of the file.
  • ResponseConstants, List, All constants found in the response part of the file.

Field

A field represents a line in a dsdl file that are not comments or dividers/@ handles. ie:

 uint8 command

is a field.

Fields have two properties, a DSDL Type and a name. The DSDL type in the above example is uint8, while the name is "command"

DSDL Types

The dsdl type defines the datatype of the given field. There are 4 types:

  1. PrimitiveType - This is used for primitive types: int, uint, float and bool
  2. VoidType - This is used for voids
  3. CompoundType - This is used for stand-alone datatypes, and is a full dsdl file
  4. ArrayTypes - This is used for arrays, and contains another dsdl type to define the datatype of the array members

Constant

Constants are like fields, except that they have a value. As .NET does not support dynamic types very well, this implementation is rather experimental, using ExpandoObjects. The use of a Constant is not straightforward, casting a datatype to a dynamic. The easiest way to use it is through it's ToString method.

Clone this wiki locally