Documentation
¶
Overview ¶
Package beast provides objects and methods for decoding and managing raw Mode-S Beast format frames.
Index ¶
- Variables
- func TicksToTimestamp(ticks int64) time.Duration
- func TimestampToTicks(d time.Duration) int64
- type Decoder
- type Frame
- func (f *Frame) Bytes() []byte
- func (f *Frame) MarshalBinary() ([]byte, error)
- func (f *Frame) ModeAC() ([]byte, error)
- func (f *Frame) ModeS() ([]byte, error)
- func (f *Frame) Signal() (uint8, error)
- func (f *Frame) Timestamp() (time.Duration, error)
- func (f *Frame) TimestampTicks() (int64, error)
- func (f *Frame) Type() (byte, error)
- func (f *Frame) UnmarshalBinary(data []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrNoData = errNoData
ErrNoData is returned when the frame does not contain the data necessary to return the requested information.
Functions ¶
func TicksToTimestamp ¶
TicksToTimestamp converts 12MHz ticks to a time.Duration.
func TimestampToTicks ¶
TimestampToTicks converts a time.Duration to 12MHz ticks.
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 ¶
NewDecoder returns a Decoder which reads from r.
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 NewFrame ¶
NewFrame constructs a Frame from individual components. The frame type is inferred from the payload length:
- 2 bytes → type 0x31 (Mode A/C)
- 7 bytes → type 0x32 (Mode S short)
- 14 bytes → type 0x33 (Mode S long)
func (*Frame) Bytes ¶
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 ¶
MarshalBinary returns a Beast message.
func (*Frame) ModeAC ¶
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 ¶
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) TimestampTicks ¶
TimestampTicks returns the raw MLAT timestamp in 12MHz ticks.
func (*Frame) UnmarshalBinary ¶
UnmarshalBinary stores a Beast message.