Documentation ¶
Overview ¶
Package canadapter implements the adapter interface for n2k endpoints.
Index ¶
Constants ¶
const MaxFrameNum = 31
MaxFrameNum is the maximum frame number in a multipart NMEA message.
Variables ¶
This section is empty.
Functions ¶
func CanFrameFromRaw ¶
CanFrameFromRaw parses an input string into a can.Frame.
func CanIdFromData ¶
CanIdFromData returns an encoded ID from its inputs.
func NewPacketInfo ¶
func NewPacketInfo(message *can.Frame) pgn.MessageInfo
NewPacketInfo instantiates a new Packet from a canbus Frame and surrounding context.
Types ¶
type CANAdapter ¶ added in v0.0.2
type CANAdapter struct {
// contains filtered or unexported fields
}
CANAdapter instances read canbus frames from its input and outputs complete Packets.
func NewCANAdapter ¶ added in v0.0.2
func NewCANAdapter(log *logrus.Logger) *CANAdapter
NewCANAdapter instantiates a new CanAdapter
func (*CANAdapter) HandleMessage ¶ added in v0.0.2
func (c *CANAdapter) HandleMessage(message adapter.Message)
HandleMessage is how you tell CanAdapter to start processing a new message into a packet
func (*CANAdapter) SetOutput ¶ added in v0.0.2
func (c *CANAdapter) SetOutput(ph PacketHandler)
SetOutput assigns a handler for any ready packets
type MultiBuilder ¶
type MultiBuilder struct {
// contains filtered or unexported fields
}
MultiBuilder assembles a sequence of packets into a comple Packet. Manages the list of sequences used to combine multipacket PGNs Instantiated by PGNBuilder Uses sequence to do the work we track sequences separately for each nmea source sequence ids are 0-7, so each source|PGN can have 8 sequences in simultaneous transmission sequences map[sourceid]map[pgn]map[SeqId]sequence
func NewMultiBuilder ¶
func NewMultiBuilder(log *logrus.Logger) *MultiBuilder
NewMultiBuilder creates a new instance.
func (*MultiBuilder) Add ¶
func (m *MultiBuilder) Add(p *pkt.Packet)
Add method adds a packet to a (new or existing) sequence. if the sequence (and resulting packet) is now complete, delete the sequence.
func (*MultiBuilder) SeqFor ¶
func (m *MultiBuilder) SeqFor(p *pkt.Packet) *sequence
SeqFor method returns the sequence for the specified packet, creating it it needed.
type PacketHandler ¶ added in v0.0.2
PacketHandler is an interface for the output handler for a CANAdapter