Documentation ¶
Index ¶
- Constants
- type BinaryFormatDevice
- type Config
- type EBLFormatDevice
- type N2kASCIIDevice
- type RawASCIIDevice
- func (d *RawASCIIDevice) Close() error
- func (d *RawASCIIDevice) Initialize() error
- func (d *RawASCIIDevice) ReadRawFrame(ctx context.Context) (nmea.RawFrame, error)
- func (d *RawASCIIDevice) ReadRawMessage(ctx context.Context) (nmea.RawMessage, error)
- func (d *RawASCIIDevice) WriteRawFrame(ctx context.Context, frame nmea.RawFrame) error
- func (d *RawASCIIDevice) WriteRawMessage(ctx context.Context, msg nmea.RawMessage) error
Constants ¶
const ( // STX start packet byte for Actisense parsed NMEA2000 packet STX = 0x02 // ETX end packet byte for Actisense parsed NMEA2000 packet ETX = 0x03 // DLE marker byte before start/end packet byte. Is sent before STX or ETX byte is sent (DLE+STX or DLE+ETX). Is escaped by sending double DLE+DLE characters. DLE = 0x10 // CanBoatFakePGNOffset is offset for PGNs that Actisense devices create for their own information. We add it to // parsed PGN and after that we can find match from Canboat PGN database with that CanBoatFakePGNOffset uint32 = 0x40000 )
const ( // SOH is start of data frame byte for Actisense BST-95 (EBL file created by Actisense W2K-1 device) SOH = 0x01 // NL is end of data frame byte NL = 0x0A // ESC is marker byte before start/end data frame byte. Is sent before SOH or NL byte is sent (ESC+SOH or ESC+NL). Is escaped by sending double ESC+ESC characters. ESC = 0x1b )
EBL log file format used by Actisense W2K-1. Probably called "CAN-Raw (BST-95) message format" NGT1 ebl files are probably in different format.
Example data frame from one EBL file: 1b 01 07 95 0e 28 9a 00 01 f8 09 3d 0d b3 22 48 32 59 0d 1b 0a
1b 01 <-- start of data frame (ESC+SOH)
07 95 <-- "95" is maybe frame type. Actisense EBL Reader v2.027 says "now has added support for the new CAN-Raw (BST-95) message format that is used for all data logging on Actisense W2K-1" 0e <-- lengths 14 bytes till end 28 9a <-- timestamp 39464 (hex 9A28) (little endian) 00 01 f8 09 <--- 0x09f80100 = src:0, dst:255, pgn:129025 (1f801), prio:2 (little endian) 3d 0d b3 22 48 32 59 0d <-- CAN payload (N2K endian rules), lat(32bit) 22b30d3d = 582159677, lon(32bit) 0d593248 = 223949384 1b 0a <-- end of data frame (ESC+LF)
Timestamp is offset from time found in first data frame in file Example: first frame in file: 1B 01 03 00 10 E7 A7 84 83 D9 01 1B 0A
03 <--- "03" maybe frame type 00 10 E7 A7 84 83 D9 01 <-- 8 byte little endian unsigned number,
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryFormatDevice ¶
type BinaryFormatDevice struct {
// contains filtered or unexported fields
}
BinaryFormatDevice is implementing Actisense device using binary formats (NGT1 and N2K binary)
func NewBinaryDevice ¶
func NewBinaryDevice(reader io.ReadWriter) *BinaryFormatDevice
NewBinaryDevice creates new instance of Actisense device using binary formats (NGT1 and N2K binary)
func NewBinaryDeviceWithConfig ¶
func NewBinaryDeviceWithConfig(reader io.ReadWriter, config Config) *BinaryFormatDevice
NewBinaryDeviceWithConfig creates new instance of Actisense device using binary formats (NGT1 and N2K binary) with given config
func (*BinaryFormatDevice) Close ¶
func (d *BinaryFormatDevice) Close() error
func (*BinaryFormatDevice) Initialize ¶
func (d *BinaryFormatDevice) Initialize() error
Initialize initializes connection to device. Otherwise BinaryFormatDevice will not send data.
Canboat notes: The following startup command reverse engineered from Actisense NMEAreader. It instructs the BinaryFormatDevice to clear its PGN message TX list, thus it starts sending all PGNs.
Actisense own documentation: Page 14: ACommsCommand_SetOperatingMode https://www.actisense.com/wp-content/uploads/2020/01/ActisenseComms-SDK-User-Manual-Issue-1.07-1.pdf
func (*BinaryFormatDevice) ReadRawMessage ¶
func (d *BinaryFormatDevice) ReadRawMessage(ctx context.Context) (nmea.RawMessage, error)
ReadRawMessage reads raw data and parses it to nmea.RawMessage. This method block until full RawMessage is read or an error occurs (including context related errors).
func (*BinaryFormatDevice) WriteRawMessage ¶
func (d *BinaryFormatDevice) WriteRawMessage(ctx context.Context, msg nmea.RawMessage) error
type Config ¶
type Config struct { // ReceiveDataTimeout is maximum duration reads from device can produce no data until we error out (idle). // // It is to limit amount of time reads can result no data. to timeout the connection when there is no // interaction in bus. This is different from for example serial device readTimeout which limits how much time Read // call blocks. We want to `Read` calls block small amount of time to be able to check if context was cancelled // during read but at the same time we want to be able to detect when there are no coming from bus for excessive // amount of time. ReceiveDataTimeout time.Duration // DebugLogRawMessageBytes instructs device to log all sent/received raw messages DebugLogRawMessageBytes bool // OutputActisenseMessages instructs device to output Actisense own messages OutputActisenseMessages bool // LogFunc callback to output/print debug/log statements LogFunc func(format string, a ...any) // IsN2KWriter instructs device to write/send messages to NMEA200 bus as N2K binary format (used by Actisense W2K-1) IsN2KWriter bool // FastPacketAssembler assembles fast-packet PGN frames to complete messages. // Optional: if set is used by devices/format that do not do packet assembly inside hardware (i.e. W2K-1 Raw ASCII format) FastPacketAssembler nmea.Assembler }
Config is configuration for Actisense NGT-1 device
type EBLFormatDevice ¶
type EBLFormatDevice struct {
// contains filtered or unexported fields
}
EBLFormatDevice is implementing Actisense EBL file format
func NewEBLFormatDevice ¶
func NewEBLFormatDevice(reader io.ReadWriter) *EBLFormatDevice
NewEBLFormatDevice creates new instance of Actisense device using binary formats (NGT1 and N2K binary)
func NewEBLFormatDeviceWithConfig ¶
func NewEBLFormatDeviceWithConfig(reader io.ReadWriter, config Config) *EBLFormatDevice
NewEBLFormatDeviceWithConfig creates new instance of Actisense device using binary formats (NGT1 and N2K binary) with given config
func (*EBLFormatDevice) Close ¶
func (d *EBLFormatDevice) Close() error
func (*EBLFormatDevice) Initialize ¶
func (d *EBLFormatDevice) Initialize() error
Initialize initializes connection to device. Otherwise BinaryFormatDevice will not send data.
func (*EBLFormatDevice) ReadRawMessage ¶
func (d *EBLFormatDevice) ReadRawMessage(ctx context.Context) (nmea.RawMessage, error)
ReadRawMessage reads raw data and parses it to nmea.RawMessage. This method block until full RawMessage is read or an error occurs (including context related errors).
func (*EBLFormatDevice) WriteRawMessage ¶
func (d *EBLFormatDevice) WriteRawMessage(ctx context.Context, msg nmea.RawMessage) error
type N2kASCIIDevice ¶
type N2kASCIIDevice struct {
// contains filtered or unexported fields
}
N2kASCIIDevice is implementing Actisense W2K-1 device capable of decoding NMEA 2000 Ascii format including fast-packet and multi-packet (ISO TP) messages
Note: is not go-routine safe
func NewN2kASCIIDevice ¶
func NewN2kASCIIDevice(reader io.ReadWriter, config Config) *N2kASCIIDevice
NewN2kASCIIDevice creates new instance of Actisense W2K-1 device capable of decoding NMEA 2000 Ascii format
func (*N2kASCIIDevice) Close ¶
func (d *N2kASCIIDevice) Close() error
func (*N2kASCIIDevice) Initialize ¶
func (d *N2kASCIIDevice) Initialize() error
func (*N2kASCIIDevice) ReadRawMessage ¶
func (d *N2kASCIIDevice) ReadRawMessage(ctx context.Context) (nmea.RawMessage, error)
func (*N2kASCIIDevice) WriteRawMessage ¶
func (d *N2kASCIIDevice) WriteRawMessage(ctx context.Context, msg nmea.RawMessage) error
type RawASCIIDevice ¶
type RawASCIIDevice struct {
// contains filtered or unexported fields
}
RawASCIIDevice is implementing Actisense W2K-1 device capable of decoding RAW Ascii format
func NewRawASCIIDevice ¶
func NewRawASCIIDevice(reader io.ReadWriter, config Config) *RawASCIIDevice
NewRawASCIIDevice creates new instance of Actisense W2K-1 device capable of decoding RAW Ascii format. RAW ASCII format is ordinary Canbus frame with 8 bytes of data so fast-packet and multi-packet (ISO TP) assembly must be done separately.
func (*RawASCIIDevice) Close ¶
func (d *RawASCIIDevice) Close() error
func (*RawASCIIDevice) Initialize ¶
func (d *RawASCIIDevice) Initialize() error
func (*RawASCIIDevice) ReadRawFrame ¶
func (d *RawASCIIDevice) ReadRawFrame(ctx context.Context) (nmea.RawFrame, error)
func (*RawASCIIDevice) ReadRawMessage ¶
func (d *RawASCIIDevice) ReadRawMessage(ctx context.Context) (nmea.RawMessage, error)
func (*RawASCIIDevice) WriteRawFrame ¶
func (d *RawASCIIDevice) WriteRawFrame(ctx context.Context, frame nmea.RawFrame) error
func (*RawASCIIDevice) WriteRawMessage ¶
func (d *RawASCIIDevice) WriteRawMessage(ctx context.Context, msg nmea.RawMessage) error