nmea2k

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ACTISENSE_BEM = 0x40000 // Actisense specific fake PGNs
View Source
const LEN_VARIABLE = 0
View Source
const MAX_RES_LOOKUP = 16
View Source
const RES_6BITASCII = -7
View Source
const RES_ASCII = -1
View Source
const RES_BINARY = -11
View Source
const RES_DATE = -4
View Source
const RES_DEGREES = 1e-4 * RadianToDegree
View Source
const RES_FLOAT = -14
View Source
const RES_INTEGER = -8
View Source
const RES_LATITUDE = -2
View Source
const RES_LAT_LONG = 1.0e-7
View Source
const RES_LAT_LONG_64 = 1.0e-16
View Source
const RES_LAT_LONG_PRECISION = 1e7
View Source
const RES_LONGITUDE = -3
View Source
const RES_LOOKUP = -9
View Source
const RES_LOOKUP2 = -10
View Source
const RES_MANUFACTURER = -12
View Source
const RES_NOTUSED = 0
View Source
const RES_PRESSURE = -15
View Source
const RES_ROTATION = 1e-3 / 32.0 * RadianToDegree
View Source
const RES_STRING = -13
View Source
const RES_STRINGLZ = -16
View Source
const RES_TEMPERATURE = -6
View Source
const RES_TIME = -5
View Source
const RadianToDegree = 180.0 / math.Pi

Variables

View Source
var PgnList = PgnArray{}/* 297 elements not displayed */

Functions

This section is empty.

Types

type CanBoatMessage

type CanBoatMessage struct {
	Timestamp   string                 `json:"timestamp"`
	Priority    uint8                  `json:"prio"`
	Source      uint8                  `json:"src"`
	Destination uint8                  `json:"dst"`
	Pgn         uint32                 `json:"pgn"`
	Fields      map[string]interface{} `json:"fields"`
}

type DataMap

type DataMap map[int]interface{}

func (DataMap) MarshalJSON

func (inVal DataMap) MarshalJSON() ([]byte, error)

type DecodeError

type DecodeError struct {
	Data  []byte
	Where string
}

func (*DecodeError) Error

func (e *DecodeError) Error() string

type Field

type Field struct {
	Name        string
	Size        uint32
	Resolution  float64
	Signed      bool
	Units       interface{}
	Description string
	SignalkPath string
	Offset      int32
}

type ParsedMessage

type ParsedMessage struct {
	Header RawMessage
	Index  int
	Data   DataMap
}

func FromCanBoat

func FromCanBoat(data string) (*ParsedMessage, error)

func ParsePacket

func ParsePacket(cmsg *can.RawMessage) (pgnParsed *ParsedMessage)

func (*ParsedMessage) JSON

func (msg *ParsedMessage) JSON() []byte

Pack a PGN into a JSON formatted byte array

func (*ParsedMessage) MsgPack

func (msg *ParsedMessage) MsgPack() []byte

Pack a PGN into a MsgPack formatted byte array

func (*ParsedMessage) Print

func (msg *ParsedMessage) Print(verbose bool) string

type Pgn

type Pgn struct {
	Description     string
	Category        string
	Pgn             uint32
	IsKnown         bool    // Are we pretty sure we've got all fields with correct definitions?
	Size            uint32  // (Minimal) size of this PGN. Helps to determine fast/single frame and initial malloc
	RepeatingFields uint32  // How many fields at the end repeat until the PGN is exhausted?
	FieldList       []Field // Fields in the PGN
}

func (*Pgn) FieldOffsets added in v1.1.1

func (p *Pgn) FieldOffsets(idx int32) (low_byte, high_byte, start_bit, bits uint32)

type PgnArray

type PgnArray []Pgn

func (PgnArray) First

func (pp PgnArray) First(id uint32) (int, Pgn)

func (PgnArray) Last

func (pp PgnArray) Last(id uint32) (int, Pgn)

type PgnLookup

type PgnLookup map[int]string

func (PgnLookup) MarshalJSON

func (inVal PgnLookup) MarshalJSON() ([]byte, error)

func (PgnLookup) MarshalXML

func (inVal PgnLookup) MarshalXML(e *xml.Encoder, start xml.StartElement) error

Placeholder until I have a chance to figure out XML encoding in Go

type PgnSubLookup added in v1.1.1

type PgnSubLookup map[int]PgnLookup

type RawMessage

type RawMessage struct {
	*can.RawMessage
}

func (*RawMessage) GetPgnDefinition

func (msg *RawMessage) GetPgnDefinition(pgn uint32) *Pgn

Jump to

Keyboard shortcuts

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