YAML code generation
For unpacking bitfields in Fontus Acoustic Messages (FAM) we use a YAML based code generation approach. This allows us to define the bitfields in a human-readable format and automatically generate the corresponding C++ code for handling these bitfields.
To ensure the bit field get and set functions are accurate according to the latest version of the Fontus bit definitions we make updating the bitfield defined in a Fontus Acoustic Message (FAM) as easy as possible.
By generating C++ code from a YAML file of FAM bitfields upon every build, adding a new Message to the bitfield handling code is as straight forward as updating the YAML
The following snippet is an example of some YAML file configurations
ReleaseRequest:
- Type:
- size: 6 # The Type bitfield is always six bits, this is true for all fontus acoustic message
value: 2 # This FAM message has default value of 2, this value must be unique to each FAM
- Device_ID:
- size: 24
- Reserved_bits_22:
- size: 22
- CRC:
- size: 12
ReleaseReport:
- Type:
- size: 6
value: 3 # This FAM message has default value of 3, this value must be unique to each FAM
- Device_ID:
- size: 12
- Activation_status:
- size: 6
- Reserved_bits_28:
- size: 28
- CRC:
- size: 12
// ReleaseRequest Table
const BitstreamParameter ReleaseRequest[] = {
{"Type", 58, 6},
{"Device_ID", 34, 24},
{"Reserved_bits_22", 12, 22},
{"CRC", 0, 12},
};
// ReleaseReport Table
const BitstreamParameter ReleaseReport[] = {
{"Type", 58, 6},
{"Device_ID", 46, 12},
{"Activation_status", 40, 6},
{"Reserved_bits_28", 12, 28},
{"CRC", 0, 12},
};
get("releasereport",uint64 *status)