Skip to main content

Module mavlink_schema

Module mavlink_schema 

Source
Expand description

The C ABI for MAVLink message shapes: reading and writing a message by field name.

mavlink carries any message’s bytes, which is enough to move traffic but leaves the caller hand-packing payloads against a message definition. This is the layer above: a schema states a message’s fields, and a message reads and writes them by name, so a caller works in custom_mode and lat rather than byte offsets.

Two sources of shape are supported and behave identically. Every message the engine types is published, so pamoja_mavlink_schema_for_id resolves the common dialect with nothing to declare. A message from ArduPilot’s dialect, PX4’s, or a vendor’s private one is described through PamojaMavlinkSchemaBuilder, which puts the fields in wire order and derives the CRC_EXTRA seed, so a caller transcribes a definition as it reads.

Structs§

PamojaMavlinkFieldInfo
One field of a message shape, as read back from a schema.
PamojaMavlinkMessage
A message being written or read field by field against a schema.
PamojaMavlinkSchema
The shape of one message: its id, name, seed, and fields.
PamojaMavlinkSchemaBuilder
Describes a message this build does not type, one field at a time.

Constants§

PAMOJA_MAVLINK_FIELD_CHAR
A char field; an array of these carries text.
PAMOJA_MAVLINK_FIELD_DOUBLE
A double field.
PAMOJA_MAVLINK_FIELD_FLOAT
A float field.
PAMOJA_MAVLINK_FIELD_INT8
An int8_t field.
PAMOJA_MAVLINK_FIELD_INT16
An int16_t field.
PAMOJA_MAVLINK_FIELD_INT32
An int32_t field.
PAMOJA_MAVLINK_FIELD_INT64
An int64_t field.
PAMOJA_MAVLINK_FIELD_UINT8
A uint8_t field.
PAMOJA_MAVLINK_FIELD_UINT16
A uint16_t field.
PAMOJA_MAVLINK_FIELD_UINT32
A uint32_t field.
PAMOJA_MAVLINK_FIELD_UINT64
A uint64_t field.

Functions§

pamoja_mavlink_dialect_add_schema
Adds a schema’s message to a dialect table, so frames carrying it check.
pamoja_mavlink_message_decode
Reads a message out of a frame payload.
pamoja_mavlink_message_free
Releases a message.
pamoja_mavlink_message_get_bytes
Copies the raw bytes of a byte-wide array field out.
pamoja_mavlink_message_get_float
Reads a floating-point field.
pamoja_mavlink_message_get_int
Reads a field as a signed integer.
pamoja_mavlink_message_get_number
Reads a field as a double, whatever its type.
pamoja_mavlink_message_get_uint
Reads a field as an unsigned integer.
pamoja_mavlink_message_new
Creates a message with every field zero.
pamoja_mavlink_message_payload
Returns a pointer to a message’s payload bytes.
pamoja_mavlink_message_set_bytes
Writes the raw bytes of a byte-wide array field, zero-padding the rest.
pamoja_mavlink_message_set_float
Writes a floating-point field.
pamoja_mavlink_message_set_int
Writes a signed integer into a field.
pamoja_mavlink_message_set_number
Writes a double into a field, converting it to the field’s type.
pamoja_mavlink_message_set_uint
Writes an unsigned integer into a field.
pamoja_mavlink_message_to_frame
Builds a v2 frame carrying a message.
pamoja_mavlink_schema_at
Returns the shape of the message at a position in the built-in registry.
pamoja_mavlink_schema_builder_build
Puts the declared fields in wire order and finishes the shape.
pamoja_mavlink_schema_builder_extension
Adds a MAVLink 2 extension field, in the order the definition declares it.
pamoja_mavlink_schema_builder_field
Adds a base field, in the order the definition declares it.
pamoja_mavlink_schema_builder_free
Releases a builder that was never built.
pamoja_mavlink_schema_builder_new
Starts describing a message.
pamoja_mavlink_schema_count
Returns how many messages this build types.
pamoja_mavlink_schema_crc_extra
Returns the CRC_EXTRA seed a schema implies.
pamoja_mavlink_schema_field
Describes one field of a message.
pamoja_mavlink_schema_field_count
Returns how many fields a message has.
pamoja_mavlink_schema_for_id
Returns the shape of a message the engine types, by id.
pamoja_mavlink_schema_for_name
Returns the shape of a message the engine types, by name.
pamoja_mavlink_schema_free
Releases a schema.
pamoja_mavlink_schema_id
Returns the id of the message a schema describes.
pamoja_mavlink_schema_name
Returns the name of the message a schema describes.
pamoja_mavlink_schema_wire_len
Returns the length of the message on the wire, extensions included.