ref Field
This field serves as reference (alias) to other fields. It can be used to avoid duplication of field definition for multiple messages.
<?xml version="1.0" encoding="UTF-8"? version="10">
<schema ...>
<fields>
<int name="SomeIntField" type="uint8" defaultValue="Special2">
<displayName value="Some Int Field" />
<special name="Special1" val="0" />
<special name="Special2" val="0xff" />
</int>
</fields>
<message name="Msg1" id="1">
<ref field="SomeIntField" />
...
</message>
<message name="Msg2" id="2">
<ref field="SomeIntField" name="RenamedIntField" />
</message>
</schema>
The <ref> field has all the common properties. It also copies name, displayName and semanticType properties from the referenced field and allows overriding them with new values. Note, that in the example above <ref> field defined as a member of Msg1 message hasn't provided any name value. It is allowed because it has taken a name of the referenced field (SomeIntField).
Referencing the Field
The only extra property the <ref> field has is field to specify a reference to other field.
Length in Bits
Since v2 of this specification it is allowed to use <ref> field as member of the <bitfield> field while referencing one of the allowed member types. In such case it is required to use bitLength property to specify length in bits.
<?xml version="1.0" encoding="UTF-8"?>
<schema name="MyProtocol" endian="big">
<fields>
<enum name="SomeEnum type="uint8">
<validValue name="V1" val="0" />
<validValue name="V2" val="1" />
<validValue name="V3" val="2" />
</enum>
<bitfield name="SomeBitfield">
<int name="SomeIntMember" type="uint8" bitLength="3" />
<set name="SomeSetMember" bitLength="3">
...
</set>
<ref field="SomeEnum" bitLength="2" />
</bitfield>
</fields>
</schema>
Use properties table for future references.
Last updated
Was this helpful?