Documentation
¶
Overview ¶
Package filter provides a BPF-inspired expression language for filtering decoded NMEA 2000 frames by field values.
Expressions support boolean logic (&&, ||, !), comparison operators (==, !=, <, >, <=, >=), and dotted field access for lookup sub-fields.
Example expressions:
"pgn == 130310 && water_temperature < 280" "register.name == \"State of Charge\"" "pgn == 61184 || pgn == 130310"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EvalContext ¶
type EvalContext struct {
PGN uint32
Src uint8
Dst uint8
Prio uint8
Decoded any // decoded PGN struct, nil if unavailable
Lookups map[string]string // from LookupFields(), nil if unavailable
}
EvalContext provides the data a filter expression is evaluated against.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a compiled display filter expression.
func Compile ¶
Compile parses and compiles a filter expression string. Returns an error if the expression is syntactically invalid.
func (*Filter) Match ¶
func (f *Filter) Match(ctx *EvalContext) bool
Match evaluates the filter against the given context.
func (*Filter) NeedsDecode ¶
NeedsDecode returns true if the expression references decoded fields (anything other than pgn, src, dst, prio).