57#define StartOfText 0x02
59#define MsgTypeN2kData 0x93
60#define MsgTypeN2kRequest 0x94
71 uint8_t CheckSum = (uint8_t)((
byteSum == 0) ? 0 : (256 -
byteSum));
116 bool ContinueLoopAvailable=
true;
118 while ((NewByte =
ReadStream->
peek()) != -1 && !result && ContinueLoopAvailable) {
176 ContinueLoopAvailable=ReadOut ||
Handling();
#define MsgTypeN2kRequest
File contains declaration for tActisenseReader class for reading Actisense format messages from strea...
#define MAX_STREAM_MSG_BUF_LEN
Maximum length of the stream message buffer.
uint32_t GetBuf4ByteUInt(int &index, const unsigned char *buf)
Extracts 4 bytes out of the given buffer and converts it to an integer value.
uint32_t GetBuf3ByteUInt(int &index, const unsigned char *buf)
Extracts 3 bytes out of the given buffer and converts it to an integer value.
The file contains function and classes for best timing performance.
virtual int peek()=0
reads a byte from the file without advancing to the next one
virtual int read()=0
reads characters from an incoming stream to the buffer
bool EscapeReceived
Escape character has been received.
bool Handling() const
Indicates if still message handling is needed.
bool GetMessageFromStream(tN2kMsg &N2kMsg, bool ReadOut=true)
Read Actisense formatted NMEA2000 message from stream.
tActisenseReader()
Constructor for the class Initialize all class attributes and clear the buffer.
int byteSum
Sum of all bytes is used as kind of check sum.
bool IsStart(char ch)
Checks if character is start of Actisense format.
void ParseMessages()
Parse messages from stream.
unsigned char DefaultSource
Default source of the N2k message.
bool AddByteToBuffer(char NewByte)
Adds a new Byte to the buffer.
void ClearBuffer()
Clears the buffer.
unsigned char MsgBuf[MAX_STREAM_MSG_BUF_LEN]
Buffer for incoming messages from stream.
int MsgWritePos
Current write position inside the buffer.
bool CheckMessage(tN2kMsg &N2kMsg)
Checks is Actisense message read from stream valid and builds tN2kMsg message from it.
bool MsgIsComing
A Message is coming.
bool StartOfTextReceived
Start of text has been received.
void(* MsgHandler)(const tN2kMsg &N2kMsg)
N2kStream * ReadStream
Stream to read from.
This class contains all the data of an NMEA2000 message.
unsigned char Data[MaxDataLen]
Byte array which carries all the data of the NMEA2000 message.
unsigned char Source
Source of the NMEA2000 message.
static const int MaxDataLen
Maximum number of bytes that can be stored in the data buffer With fast packet the first frame can ha...
unsigned char Priority
Priority of the NMEA2000 message.
virtual void Clear()
Clears the content of the N2kMsg object The method sets the PGN, DataLen and MsgTime to zero.
unsigned long MsgTime
timestamp (ms since start [max 49days]) of the NMEA2000 message
int DataLen
Number of bytes already stored in tN2kMsg::Data of this message.
unsigned long PGN
Parameter Group Number (PGN) of the NMEA2000 message.
unsigned char Destination
Destination of the NMEA2000 message.