This field stores and abstracts away value of a text string. The <string> field has all the common properties as well as extra properties and elements described below.
In case the string value needs to be serialized using predefined fixed length, use length property to specify the required value.
Length Prefix
Many protocols prefix string with its length. The CommsDSL allows definition of such prefix using lengthPrefix child element, which must define prefix as <int> field.
In case the prefix field is defined as external field, CommsDSL allows usage of lengthPrefix as property, value of which contains name of the referenced field.
The CommsDSL also supports detached length prefix, when there are several other fields in the <message> or in the <bundle> between the length field and the <string>.
NOTE, the existence of $ prefix when specifying lengthPrefix value. It indicates that the referenced field is a sibling in the containing <message> or the <bundle> field.
The code generator is expected to take the existence of such detached prefix into account and generate correct code for various field operations (read, write, etc...).
Zero Termination Suffix
Some protocols may terminate strings with 0 (zero) byte. The CommsDSL support such cases with existence of zeroTermSuffixproperty with boolean value.
NOTE, that length, lengthPrefix and zeroTermSuffix properties are mutually exclusive, i.e. cannot be used together.