The <custom> layer represent any other protocol specific layer, functionality of which cannot be implemented using other provided layers. The code generator must allow injection of the externally implemented code of the layer functionality when generating code relevant to the transport framing.
<?xml version="1.0" encoding="UTF-8"?>
<schema endian="big" ...>
<frame name="ProtocolFrame">
<size name="Size">
...
</size>
<custom name="SomeCustomLayer">
<int name="SomeField" type="uint8" />
</custom>
<id name="Id">
...
</id>
<payload name="Data" />
</frame>
</schema>
The <value> layer has all the common properties as well as extra properties and elements described below.
In most cases the <custom> layer is used to replace one of the layers specified earlier, default implementation / definition of which doesn’t provide the necessary functionality. To provide the code generator with the purpose of the <custom> layer use semanticLayerType property.
<?xml version="1.0" encoding="UTF-8"?>
<schema endian="big" ...>
<frame name="ProtocolFrame">
<size name="Size">
...
</size>
<custom name="IdAndFlags" semanticLayerType="id">
<bitfield name="IdAndFlagsField">
<int name="Id" type="uint16" bitLength="12" />
<set name="Flags" bitLength="4">
...
</set>
</bitfield>
</custom>
<payload name="Data" />
</frame>
</schema>
The value of the semanticLayerType property is one of the supported layers covered in this chapter: payload, id, size, sync, checksum, value, and custom (default).
Such meta-information may help with the correct code generation and reduce amount of custom code injection (or eliminate it altogether).
The <checksum> layer requires specification of the
area on which the checksum is calculated.
It is performed using from or until properties. When <custom>
layer replaces <checksum> (by using semanticLayerType="checksum"
),
such area is specified using checksumFrom or checksumUntil properties.
<schema endian="big" ...>
<frame name="ProtocolFrame">
<size name="Size">
...
</size>
<id name="Id">
...
</id>
<payload name="Data" />
<custom name="Checksum" semanticLayerType="checksum" checksumFrom="Size">
<int name="ChecksumField" type="uint16" />
</custom>
</frame>
</schema>
Use properties table for future references.