Class MavlinkSchemaBuilder
Describes a message this build does not type, one field at a time.
public sealed class MavlinkSchemaBuilder : IDisposable
- Inheritance
-
MavlinkSchemaBuilder
- Implements
- Inherited Members
Remarks
Fields are added in the order the message definition lists them;
Build() puts them in wire order and derives the CRC_EXTRA seed
from the result, so a caller transcribes a definition as it reads.
Constructors
MavlinkSchemaBuilder(uint, string)
Starts describing a message.
public MavlinkSchemaBuilder(uint msgid, string name)
Parameters
msgiduintThe message id on the wire.
namestringThe message name, which the seed derivation folds in, so it must match the dialect exactly.
Methods
Build()
Puts the declared fields in wire order and finishes the shape.
public MavlinkSchema Build()
Returns
- MavlinkSchema
The finished schema.
Exceptions
- PamojaException
Two fields share a name, the fields do not fit a MAVLink payload, or the shape has already been built.
Dispose()
Releases a builder that was never built.
public void Dispose()
Extension(string, MavlinkFieldType, byte)
Adds a MAVLink 2 extension field, in declared order.
public MavlinkSchemaBuilder Extension(string name, MavlinkFieldType fieldType, byte arrayLen = 0)
Parameters
namestringThe field name.
fieldTypeMavlinkFieldTypeThe field's type.
arrayLenbyteThe element count for an array, or
0for a scalar.
Returns
- MavlinkSchemaBuilder
This builder, so calls chain.
Remarks
Extensions keep their declared order, stay out of the seed, and read as zero from a frame sent by a peer that predates them.
Exceptions
- PamojaException
The shape has already been built.
Field(string, MavlinkFieldType, byte)
Adds a base field, in the order the definition declares it.
public MavlinkSchemaBuilder Field(string name, MavlinkFieldType fieldType, byte arrayLen = 0)
Parameters
namestringThe field name.
fieldTypeMavlinkFieldTypeThe field's type.
arrayLenbyteThe element count for an array, or
0for a scalar.
Returns
- MavlinkSchemaBuilder
This builder, so calls chain.
Exceptions
- PamojaException
The shape has already been built.