transceiver

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: 7 Imported by: 0

Documentation

Overview

Package transceiver implements a Mavlink transceiver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	// the reader from which frames will be read.
	Reader io.Reader
	// the writer to which frames will be written.
	Writer io.Writer

	// (optional) the dialect which contains the messages that will be encoded and decoded.
	// If not provided, messages are decoded in the MessageRaw struct.
	DialectDE *dialect.DecEncoder

	// (optional) the secret key used to validate incoming frames.
	// Non-signed frames are discarded. This feature requires v2 frames.
	InKey *frame.V2Key

	// Mavlink version used to encode messages. See Version
	// for the available options.
	OutVersion Version
	// the system id, added to every outgoing frame and used to identify this
	// node in the network.
	OutSystemID byte
	// (optional) the component id, added to every outgoing frame, defaults to 1.
	OutComponentID byte
	// (optional) the value to insert into the signature link id.
	// This feature requires v2 frames.
	OutSignatureLinkID byte
	// (optional) the secret key used to sign outgoing frames.
	// This feature requires v2 frames.
	OutKey *frame.V2Key
}

Conf configures a Transceiver.

type Error

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

Error is the error returned in case of non-fatal parsing errors.

func (*Error) Error

func (e *Error) Error() string

type Transceiver

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

Transceiver is a low-level Mavlink encoder and decoder that works with a Reader and a Writer.

func New

func New(conf Conf) (*Transceiver, error)

New allocates a Transceiver, a low level frame encoder and decoder. See Conf for the options.

func (*Transceiver) Read

func (p *Transceiver) Read() (frame.Frame, error)

Read reads a Frame from the reader. It must not be called by multiple routines in parallel.

func (*Transceiver) WriteFrame

func (p *Transceiver) WriteFrame(fr frame.Frame) error

WriteFrame writes a Frame into the writer. It must not be called by multiple routines in parallel. This function is intended only for routing pre-existing frames to other nodes, since all frame fields must be filled manually.

func (*Transceiver) WriteMessage

func (p *Transceiver) WriteMessage(m msg.Message) error

WriteMessage writes a Message into the writer. It must not be called by multiple routines in parallel.

type Version

type Version int

Version is a Mavlink version.

const (
	// V1 is Mavlink 1.0
	V1 Version = 1

	// V2 is Mavlink 2.0
	V2 Version = 2
)

func (Version) String

func (v Version) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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