msg

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package msg contains the Message definition and utilities to encode and decode messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecEncoder

type DecEncoder struct {
	// contains filtered or unexported fields
}

DecEncoder is an object that allows to decode and encode a Message.

func NewDecEncoder

func NewDecEncoder(msg Message) (*DecEncoder, error)

NewDecEncoder allocates a DecEncoder.

func (*DecEncoder) CRCExtra

func (mde *DecEncoder) CRCExtra() byte

CRCExtra returns the message CRC extra.

func (*DecEncoder) Decode

func (mde *DecEncoder) Decode(buf []byte, isV2 bool) (Message, error)

Decode decodes a Message.

func (*DecEncoder) Encode

func (mde *DecEncoder) Encode(msg Message, isV2 bool) ([]byte, error)

Encode encodes a message.

type Message

type Message interface {
	GetID() uint32
}

Message is the interface that must be implemented by all Mavlink messages. Furthermore, any message must be labeled "MessageNameOfMessage".

type MessageRaw

type MessageRaw struct {
	ID      uint32
	Content []byte
}

MessageRaw is a special struct that contains an unencoded message. It is used:

* as intermediate step in the encoding/decoding process

* when the parser receives an unknown message

func (*MessageRaw) GetID

func (m *MessageRaw) GetID() uint32

GetID implements the Message interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL