Documentation
¶
Overview ¶
Package msg defines the canonical message envelope that flows through queues, HTTP wire formats, and CEL filters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecodeInfo ¶
type Envelope ¶
type Envelope struct {
Seq int64 `json:"id,omitempty"`
ConnectorID string `json:"connector,omitempty"`
PGN uint32 `json:"pgn"`
Source uint8 `json:"source"`
Dest uint8 `json:"dest"`
Priority uint8 `json:"priority"`
Timestamp time.Time `json:"timestamp"`
ObservedAt time.Time `json:"observed_at"`
Ingress string `json:"ingress,omitempty"`
OriginIngress string `json:"origin_ingress,omitempty"`
DeviceName *uint64 `json:"device_name,omitempty"`
DeviceNameHex string `json:"device_name_hex,omitempty"`
PGNName string `json:"pgn_name,omitempty"`
Variant string `json:"variant,omitempty"`
Transport string `json:"transport,omitempty"`
ManufacturerCode *uint16 `json:"manufacturer_code,omitempty"`
Decode DecodeInfo `json:"decode"`
Physical map[string]n2kcatalog.PhysicalField `json:"physical,omitempty"`
Payload json.RawMessage `json:"payload"`
Raw []byte `json:"raw,omitempty"`
// contains filtered or unexported fields
}
func FromPGN ¶
FromPGN converts a decoded n2k message into an Envelope. Known PGNs get their payload marshaled to JSON and Raw set to the canonical re-encoding; UnknownPGN keeps its original bytes and a null payload.
func (*Envelope) Info ¶
func (e *Envelope) Info() pgn.MessageInfo
Info rebuilds the MessageInfo for encoding this envelope back onto a CAN bus.
func (*Envelope) PayloadMap ¶
PayloadMap returns the payload as a map for CEL evaluation, decoded once and cached. Callers must treat the returned map as read-only — it is shared across all subscribers of this envelope.
Click to show internal directories.
Click to hide internal directories.