beast

package
v0.0.0-...-1aeb11e Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package beast provides objects and methods for decoding and managing raw Mode-S Beast format frames.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoData = errNoData

ErrNoData is returned when the frame does not contain the data necessary to return the requested information.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// Setting StripEscape to true will remove the extra escape
	// character from 0x1a values in the data passed to the
	// BinaryUnmarshaler by Decode.
	StripEscape bool
	// contains filtered or unexported fields
}

Decoder reads a Beast stream and stores individual frames. It must be created with NewDecoder().

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a Decoder which reads from r.

func (*Decoder) Decode

func (d *Decoder) Decode(f encoding.BinaryUnmarshaler) error

Decode reads the next Beast frame from the input source and stores it in f. The data passed to f remains valid only until the next call to Decode().

type Frame

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

Frame is a Beast format message. A Frame is safe to reuse by calling UnmarshalBinary with new data.

func (*Frame) Bytes

func (f *Frame) Bytes() []byte

Bytes returns the stored frame data. Escaped 0x1a values in the data are stripped before storing. To obtain the frame in the escaped wire format, use MarshalBinary.

The returned slice remains valid until the next call to UnmarshalBinary. Modifying the returned slice directly may impact future Frame method calls.

func (*Frame) MarshalBinary

func (f *Frame) MarshalBinary() ([]byte, error)

MarshalBinary returns a Beast message.

func (*Frame) ModeAC

func (f *Frame) ModeAC() ([]byte, error)

ModeAC returns the Mode AC data in a type 1 frame.

The returned slice remains valid until the next call to UnmarshalBinary. Modifying the returned slice directly may impact future Frame method calls.

func (*Frame) ModeS

func (f *Frame) ModeS() ([]byte, error)

ModeS returns the Mode S data in a type 2 or 3 frame.

The returned slice remains valid until the next call to UnmarshalBinary. Modifying the returned slice directly may impact future Frame method calls.

func (*Frame) Signal

func (f *Frame) Signal() (uint8, error)

Signal returns the signal level.

func (*Frame) Timestamp

func (f *Frame) Timestamp() (time.Duration, error)

Timestamp returns the MLAT timestamp as a time.Duration.

func (*Frame) Type

func (f *Frame) Type() (byte, error)

Type returns the frame type byte.

func (*Frame) UnmarshalBinary

func (f *Frame) UnmarshalBinary(data []byte) error

UnmarshalBinary stores a Beast message.

Directories

Path Synopsis
Package internal contains mock objects for testing.
Package internal contains mock objects for testing.

Jump to

Keyboard shortcuts

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