NMEA2000 Library  0.1
Library to handle NMEA 2000 Communication written in C++
N2kCANMsg.h
Go to the documentation of this file.
1/*
2 * N2kCANMsg.h
3 * Copyright (c) 2015-2024 Timo Lappalainen, Kave Oy, www.kave.fi
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21*/
22
23/*************************************************************************/
30#ifndef _tN2kCANMsg_H_
31#define _tN2kCANMsg_H_
32#include "N2kMsg.h"
33
34/************************************************************************/
42{
43public:
44 /************************************************************************/
49 : Ready(false),FreeMsg(true),SystemMessage(false), KnownMessage(false)
50#if !defined(N2K_NO_ISO_MULTI_PACKET_SUPPORT)
51 ,TPRequireCTS(false), TPMaxPackets(0)
52#endif
53 {
54 N2kMsg.Clear();
55 }
60 bool Ready;
62 bool FreeMsg;
67#if !defined(N2K_NO_ISO_MULTI_PACKET_SUPPORT)
69 unsigned char TPRequireCTS;
71 unsigned char TPMaxPackets;
72#endif
75 unsigned char LastFrame; //
77 unsigned char CopiedLen;
78
79public:
80 /************************************************************************/
86 void FreeMessage() {
87 FreeMsg=true; Ready=false; SystemMessage=false;
88#if !defined(N2K_NO_ISO_MULTI_PACKET_SUPPORT)
89 TPMaxPackets=0; TPRequireCTS=false;
90#endif
92 }
93};
94
95#endif
This File contains the class tN2kMsg and all necessary functions to handle a NMEA2000 Message.
Class used internally on tNMEA2000 to handle incoming NMEA2000 messages.
Definition: N2kCANMsg.h:42
unsigned char TPMaxPackets
=0 not TP message. >0 number of packets can be received
Definition: N2kCANMsg.h:71
bool KnownMessage
Message is already known
Definition: N2kCANMsg.h:66
bool Ready
Message ready for handling?
Definition: N2kCANMsg.h:60
tN2kMsg N2kMsg
Reference to a N2kMsg Object, Output: NMEA2000 message ready to be send.
Definition: N2kCANMsg.h:58
bool SystemMessage
Message is a system message.
Definition: N2kCANMsg.h:64
void FreeMessage()
Free the message.
Definition: N2kCANMsg.h:86
unsigned char TPRequireCTS
=0 no, n=after each n frames
Definition: N2kCANMsg.h:69
unsigned char LastFrame
Last received frame sequence number on fast packets or multi packet
Definition: N2kCANMsg.h:75
bool FreeMsg
Message is free for fill up
Definition: N2kCANMsg.h:62
unsigned char CopiedLen
Length of copied bytes.
Definition: N2kCANMsg.h:77
tN2kCANMsg()
Constructor of class tN2kCANMsg.
Definition: N2kCANMsg.h:48
This class contains all the data of an NMEA2000 message.
Definition: N2kMsg.h:656
unsigned char Source
Source of the NMEA2000 message.
Definition: N2kMsg.h:669
virtual void Clear()
Clears the content of the N2kMsg object The method sets the PGN, DataLen and MsgTime to zero.
Definition: N2kMsg.cpp:94