raw

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package raw defines owned observations from NMEA 2000 transport adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction string

Direction identifies how an observation crossed its Adapter.

const (
	DirectionUnknown     Direction = "unknown"
	DirectionReceived    Direction = "received"
	DirectionTransmitted Direction = "transmitted"
)

type Kind

type Kind string

Kind identifies the layer represented by an Observation.

const (
	KindFrame       Kind = "frame"
	KindMessage     Kind = "message"
	KindDecodeError Kind = "decode_error"
)

type Observation

type Observation struct {
	Kind Kind `json:"kind"`

	// Timestamp is the best source timestamp available. ReceivedAt is always
	// the host receipt time. When a gateway exposes only a relative clock,
	// TransportTimestamp preserves it without pretending it is wall time.
	Timestamp             time.Time     `json:"timestamp"`
	ReceivedAt            time.Time     `json:"receivedAt"`
	TransportTimestamp    time.Duration `json:"transportTimestamp,omitempty"`
	HasTransportTimestamp bool          `json:"hasTransportTimestamp,omitempty"`

	AdapterID string    `json:"adapterId"`
	NetworkID string    `json:"networkId"`
	Direction Direction `json:"direction"`

	Frame *can.Frame `json:"frame,omitempty"`

	PGN         uint32 `json:"pgn,omitempty"`
	Priority    uint8  `json:"priority,omitempty"`
	Source      uint8  `json:"source,omitempty"`
	Destination *uint8 `json:"destination,omitempty"`
	Payload     []byte `json:"payload,omitempty"`
	Error       string `json:"error,omitempty"`
}

Observation is an owned raw record from a transport Adapter or decode pipeline. Frame observations retain the classical CAN frame; message observations retain an assembled PGN payload; decode-error observations retain the same payload and a stable error string.

func (Observation) Clone

func (o Observation) Clone() Observation

Clone returns a fully owned copy safe for another goroutine or caller to retain and mutate.

Jump to

Keyboard shortcuts

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