Documentation ¶
Overview ¶
Package analyzer analyzes NMEA 2000 PGN messages
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RawFormats = []RawFormat{ RawFormatUnknown, RawFormatPlain, RawFormatFast, RawFormatPlainOrFast, RawFormatAirmar, RawFormatChetco, RawFormatGarminCSV1, RawFormatGarminCSV2, RawFormatYDWG02, RawFormatNavLink2, RawFormatActisenseN2KASCII, }
RawFormats is the list of all supported/known raw formats.
Functions ¶
func ParseMessageWithFormat ¶
ParseMessageWithFormat parses the given data into a message in the provided format.
func ParseRawMessageWithFormat ¶
func ParseRawMessageWithFormat(msgData []byte, format RawFormat) (*common.RawMessage, error)
ParseRawMessageWithFormat parses the given data into a raw message in the provided format.
Types ¶
type Analyzer ¶
type Analyzer struct { Config // contains filtered or unexported fields }
An Analyzer analyzes NMEA 2000 PGN messages.
func NewAnalyzer ¶
NewAnalyzer returns a new analyzer using the given config.
func (*Analyzer) ReadMessage ¶
ReadMessage returns the next message read or io.EOF.
func (*Analyzer) ReadRawMessage ¶
func (ana *Analyzer) ReadRawMessage() (*common.RawMessage, error)
ReadRawMessage returns the next raw message read or io.EOF.
type Config ¶
type Config struct { ShowRaw bool ShowData bool ShowBytes bool ShowJSON bool ShowJSONEmpty bool ShowJSONValue bool ShowVersion bool ShowGeo geoFormat OnlyPgn int64 OnlySrc int64 OnlyDst int64 ClockSrc int64 SelectedFormat RawFormat CamelCase *bool InFile io.Reader OutFile io.Writer OutErrFile io.Writer Logger *common.Logger // contains filtered or unexported fields }
Config is used to configure an Analyzer.
func NewConfigForCLI ¶
func NewConfigForCLI() *Config
NewConfigForCLI returns a config for use with a CLI.
func NewConfigForLibrary ¶
NewConfigForLibrary returns a config for use with a library.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
A Parser is used to parse NMEA messages one by one.
func NewParserWithFormat ¶
NewParserWithFormat returns a new parser that is expecting to read messages of the given format.
func (*Parser) ParseMessage ¶
ParseMessage parses the given data into a message.
func (*Parser) ParseRawMessage ¶
func (p *Parser) ParseRawMessage(msgData []byte) (*common.RawMessage, error)
ParseRawMessage parses the given data into a raw message.
type RawFormat ¶
type RawFormat string
RawFormat is the format that raw data is serialized into.
const ( RawFormatUnknown RawFormat = "UNKNOWN" RawFormatPlain RawFormat = "PLAIN" RawFormatFast RawFormat = "FAST" RawFormatPlainOrFast RawFormat = "PLAIN_OR_FAST" RawFormatAirmar RawFormat = "AIRMAR" RawFormatChetco RawFormat = "CHETCO" RawFormatGarminCSV1 RawFormat = "GARMIN_CSV1" RawFormatGarminCSV2 RawFormat = "GARMIN_CSV2" RawFormatYDWG02 RawFormat = "YDWG02" RawFormatActisenseN2KASCII RawFormat = "ACTISENSE_N2K_ASCII" )
All supported/known raw formats.
func ParseMessage ¶
ParseMessage parses the given data into a message. It will attempt to detect the format of the message.
func ParseRawMessage ¶
func ParseRawMessage(msgData []byte) (*common.RawMessage, RawFormat, error)
ParseRawMessage parses the given data into a raw message. It will attempt to detect the format of the message.