NMEA2000 Library
0.1
Library to handle NMEA 2000 Communication written in C++
|
tNMEA2000 device class definition. More...
#include <NMEA2000.h>
Classes | |
struct | tCANSendFrame |
Structure holds all the data needed for a valid CAN-Message. More... | |
struct | tConfigurationInformation |
Structure that holds the Configuration Information of this device. More... | |
class | tDevice |
This class represents a N2k device. More... | |
class | tDeviceInformation |
Class that holds all the device informations and several helper functions to that. More... | |
class | tInternalDevice |
This class represents an internal device. More... | |
class | tMsgHandler |
Message handler class. More... | |
struct | tProductInformation |
Structure that holds all the product information. More... | |
Public Types | |
enum | tDebugMode { dm_None , dm_ClearText , dm_Actisense } |
For debugging we have some cases for SendMsg. More... | |
enum | tForwardType { fwdt_Actisense , fwdt_Text } |
Type how to forward messages in listen mode. More... | |
enum | tN2kMode { N2km_ListenOnly , N2km_NodeOnly , N2km_ListenAndNode , N2km_SendOnly , N2km_ListenAndSend } |
System mode defines how the device will behave on the NMEA2000 bus. More... | |
Public Member Functions | |
tNMEA2000 () | |
Construct a new NMEA2000 object. More... | |
void | AddGroupFunctionHandler (tN2kGroupFunctionHandler *pGroupFunctionHandler) |
Add a message handler for incoming Group Function messages. More... | |
void | AttachMsgHandler (tMsgHandler *_MsgHandler) |
Attach a message handler for incoming N2kMessages. More... | |
void | DetachMsgHandler (tMsgHandler *_MsgHandler) |
Detach a message handler for incoming N2kMessages. More... | |
void | EnableForward (bool v=true) |
Enable message forwarding to stream. More... | |
void | ExtendFastPacketMessages (const unsigned long *_FastPacketMessages) |
Set the list of known Extended Fast Packet Messages. More... | |
void | ExtendReceiveMessages (const unsigned long *_ReceiveMessages, int iDev=0) |
Extend the list of Received Messages. More... | |
void | ExtendSingleFrameMessages (const unsigned long *_SingleFrameMessages) |
Set the list of known Extended Single Frame Messages. More... | |
void | ExtendTransmitMessages (const unsigned long *_TransmitMessages, int iDev=0) |
Extend the list of Transmitted Messages. More... | |
int | FindSourceDeviceIndex (unsigned char Source) const |
Finds a device on Devices by its source address. More... | |
unsigned char | GetCertificationLevel (int iDev=0) const |
Get the Certification Level of the device. More... | |
const tDeviceInformation | GetDeviceInformation (int iDev=0) |
Get the Device Information. More... | |
N2kStream * | GetForwardStream () const |
Read current Forward Stream object. More... | |
uint32_t | GetHeartbeatInterval (int iDev=0) |
Get the Heartbeat Interval of a device. More... | |
uint32_t | GetHeartbeatOffset (int iDev=0) |
Get the Heartbeat Offset of a device. More... | |
void | GetInstallationDescription1 (char *buf, size_t max_len) |
Get the Install Description 1 of this device. More... | |
void | GetInstallationDescription2 (char *buf, size_t max_len) |
Get the Install Description 2 of this device. More... | |
unsigned char | GetLoadEquivalency (int iDev=0) const |
Get the Load Equivalency of this device. More... | |
void | GetManufacturerInformation (char *buf, size_t max_len) |
Get the Manufacturer Information of this device. More... | |
void | GetModelID (char *buf, size_t max_len, int iDev=0) const |
Get the ModelID of the device. More... | |
void | GetModelSerialCode (char *buf, size_t max_len, int iDev=0) const |
Get the Model Serial of the device. More... | |
void | GetModelVersion (char *buf, size_t max_len, int iDev=0) const |
Get the Model Version of the device. More... | |
unsigned char | GetN2kSource (int DeviceIndex=0) const |
Read address for current device. More... | |
unsigned short | GetN2kVersion (int iDev=0) const |
Get the N2k standard version of the device. More... | |
unsigned short | GetProductCode (int iDev=0) const |
Get the Product Code of the device. More... | |
const tNMEA2000::tProductInformation * | GetProductInformation (int iDev, bool &IsProgMem) const |
Get the Product Information of the device. More... | |
void | GetSwCode (char *buf, size_t max_len, int iDev=0) const |
Get the Sw Code of the device. More... | |
bool | IsOpen () const |
Test is NMEA2000 open and running. More... | |
bool | IsTxPGN (unsigned long PGN, int iDev=0) |
Check if this message is a Transmit message of this device. More... | |
bool | Open () |
Open the CAN device. More... | |
void | ParseMessages () |
Parse all incoming Messages. More... | |
bool | ReadResetAddressChanged () |
Check if this device has changed its address. More... | |
bool | ReadResetDeviceInformationChanged () |
Check if this device has changed its DeviceInstances or SystemInstance. More... | |
bool | ReadResetInstallationDescriptionChanged () |
Check if this device has changed its Install Description. More... | |
void | RemoveGroupFunctionHandler (tN2kGroupFunctionHandler *pGroupFunctionHandler) |
Remove a message handler for incoming Group Function messages. More... | |
void | Restart () |
Restart the device. More... | |
bool | SendConfigurationInformation (int DeviceIndex=0) |
Send a Config Information message. More... | |
bool | SendConfigurationInformation (unsigned char Destination, int DeviceIndex, bool UseTP) |
Send a Config Information message. More... | |
void | SendHeartbeat (bool force=false) |
Send Heartbeat for all devices. More... | |
void | SendHeartbeat (int iDev) |
Send heartbeat for specific device. More... | |
void | SendIsoAddressClaim (unsigned char Destination=0xff, int DeviceIndex=0, unsigned long FromNow=0) |
Send an IsoAddressClaim message. More... | |
bool | SendMsg (const tN2kMsg &N2kMsg, int DeviceIndex=0) |
Send message to the NMEA2000 bus. More... | |
bool | SendProductInformation (int DeviceIndex=0) |
Send a Product Information message. More... | |
bool | SendProductInformation (unsigned char Destination, int DeviceIndex, bool UseTP) |
Send a Product Information message. More... | |
void | SendRxPGNList (unsigned char Destination, int DeviceIndex, bool UseTP=false) |
Send a list with all supported Receive messages. More... | |
void | SendTxPGNList (unsigned char Destination, int DeviceIndex, bool UseTP=false) |
Send a list with all supported Transmit messages. More... | |
void | SetConfigurationInformation (const char *ManufacturerInformation, const char *InstallationDescription1=0, const char *InstallationDescription2=0) |
Set the Configuration Information of this device. More... | |
void | SetDebugMode (tDebugMode _dbMode) |
Set the Debug Mode of the system. More... | |
void | SetDeviceCount (const uint8_t _DeviceCount) |
Set the count of devices library shows on bus. More... | |
void | SetDeviceInformation (unsigned long _UniqueNumber, unsigned char _DeviceFunction=0xff, unsigned char _DeviceClass=0xff, uint16_t _ManufacturerCode=0xffff, unsigned char _IndustryGroup=4, int iDev=0) |
Set the Device Information. See also NAME. More... | |
void | SetDeviceInformationInstances (uint8_t _DeviceInstanceLower=0xff, uint8_t _DeviceInstanceUpper=0xff, uint8_t _SystemInstance=0xff, int iDev=0) |
Set the Device Information Instances. More... | |
void | SetFastPacketMessages (const unsigned long *_FastPacketMessages) |
Set the list of known Fast Packet Messages. More... | |
void | SetForwardOnlyKnownMessages (bool v=true) |
Enable Only Known Messages for forwarding. More... | |
void | SetForwardOwnMessages (bool v=true) |
Enable Own Messages for forwarding. More... | |
void | SetForwardStream (N2kStream *_stream) |
Set the Forward Stream object. More... | |
void | SetForwardSystemMessages (bool v=true) |
Enable System Messages for forwarding. More... | |
void | SetForwardType (tForwardType fwdType) |
Set the Forward Streaming Type. More... | |
void | SetHandleOnlyKnownMessages (bool v=true) |
Set the Handle Only Known Messages. More... | |
void | SetHeartbeatInterval (unsigned long interval, bool SetAsDefault=true, int iDev=-1) __attribute__((deprecated)) |
Deprecated. Use function SetHeartbeatIntervalAndOffset. More... | |
void | SetHeartbeatIntervalAndOffset (uint32_t interval, uint32_t offset=0, int iDev=-1) |
Set the Heartbeat Interval and Offset for a device. More... | |
void | SetInstallationDescription1 (const char *InstallationDescription1) |
Set the Installation Description 1 of this device. More... | |
void | SetInstallationDescription2 (const char *InstallationDescription2) |
Set the Installation Description 2 of this device. More... | |
void | SetISORqstHandler (bool(*ISORequestHandler)(unsigned long RequestedPGN, unsigned char Requester, int DeviceIndex)) |
Set the message handler for incoming ISO Requests. More... | |
void | SetMode (tN2kMode _N2kMode, uint8_t _N2kSource=15) |
Set the library mode and start source address. More... | |
void | SetMsgHandler (void(*_MsgHandler)(const tN2kMsg &N2kMsg)) |
Set the message handler for incoming NMEA2000 messages. More... | |
void | SetN2kCANMsgBufSize (const uint8_t _MaxN2kCANMsgs) |
Set incoming CAN message (tNMEA2000::N2kCANMsgBuf) buffer size. More... | |
virtual void | SetN2kCANReceiveFrameBufSize (const uint16_t _MaxCANReceiveFrames) |
Set CAN receive frame buffer size. More... | |
virtual void | SetN2kCANSendFrameBufSize (const uint16_t _MaxCANSendFrames) |
Set CAN send frame buffer size. More... | |
void | SetN2kSource (unsigned char _iAddr, int _iDev=0) |
Set source for the given device. More... | |
void | SetOnOpen (void(*_OnOpen)()) |
Set OnOpen callback function. More... | |
void | SetProductInformation (const char *_ModelSerialCode, unsigned short _ProductCode=0xffff, const char *_ModelID=0, const char *_SwCode=0, const char *_ModelVersion=0, unsigned char _LoadEquivalency=0xff, unsigned short _N2kVersion=0xffff, unsigned char _CertificationLevel=0xff, int iDev=0) |
Set the Product Information of this device. More... | |
void | SetProductInformation (const tProductInformation *_ProductInformation, int iDev=0) |
Set the Product Information of this device. More... | |
void | SetProgmemConfigurationInformation (const char *ManufacturerInformation, const char *InstallationDescription1=0, const char *InstallationDescription2=0) |
Set the Configuration Information located on PROGMEM. More... | |
void | SetSingleFrameMessages (const unsigned long *_SingleFrameMessages) |
Set the list of known Single Frame Messages. More... | |
Static Public Member Functions | |
static void | ClearCharBuf (size_t MaxLen, char *buf) |
Clears a char array buffer with 0s. More... | |
static void | ClearSetCharBuf (const char *str, size_t MaxLen, char *buf) |
Setting up a clean Char Buffer. More... | |
static bool | IsBroadcast (unsigned char Source) |
Checks if the given Address is a broadcast address. More... | |
static bool | IsProprietaryMessage (unsigned long PGN) |
Check if the given PGN is proprietary. More... | |
template<typename T > | |
static T | N2kMax (T a, T b) |
Delivers Max out of A an B. More... | |
template<typename T > | |
static T | N2kMin (T a, T b) |
Delivers Min out of A an B. More... | |
static void | SetCharBuf (const char *str, size_t MaxLen, char *buf) |
Setting up a Char Buffer. More... | |
Protected Types | |
enum | tOpenState { os_None , os_OpenCAN , os_WaitOpen , os_Open } |
Library open state. More... | |
Protected Member Functions | |
virtual bool | CANGetFrame (unsigned long &id, unsigned char &len, unsigned char *buf)=0 |
Abstract class for reading frame from driver class. More... | |
virtual bool | CANOpen ()=0 |
Abstract class for initializing and opening CAN interface. More... | |
virtual bool | CANSendFrame (unsigned long id, unsigned char len, const unsigned char *buf, bool wait_sent=true)=0 |
Abstract class for sending a CAN Frame. More... | |
bool | CheckKnownMessage (unsigned long PGN, bool &SystemMessage, bool &FastPacket) |
Check if this Message is known to the system. More... | |
void | CopyProgmemConfigurationInformationToLocal () |
Copy Configuration Information to local memory. More... | |
void | EndSendTPMessage (int iDev) |
Ends sending of ISO-TP message. More... | |
void | FindFreeCANMsgIndex (unsigned long PGN, unsigned char Source, unsigned char Destination, bool TPMsg, uint8_t &MsgIndex) |
Find index for free space for a message on N2kCANMsgBuf. More... | |
bool | ForwardEnabled () const |
Is message forwarding enabled. More... | |
void | ForwardMessage (const tN2kCANMsg &N2kCanMsg) |
Forwards a N2k message. More... | |
void | ForwardMessage (const tN2kMsg &N2kMsg) |
Forwards a N2k message. More... | |
bool | ForwardOnlyKnownMessages () const |
Is forwarding enabled for known messages only. More... | |
bool | ForwardOwnMessages () const |
Is forwarding enabled for own messages. More... | |
bool | ForwardSystemMessages () const |
Is forwarding enabled for system messages. More... | |
size_t | GetFastPacketTxPGNCount (int iDev) |
Get the Fast Packet Tx PGN Count. More... | |
void | GetNextAddress (int DeviceIndex, bool RestartAtEnd=false) |
Get the next free address for the device. More... | |
tCANSendFrame * | GetNextFreeCANSendFrame () |
Get the Next Free CAN Frame from CANSendFrameBuf. More... | |
int | GetSequenceCounter (unsigned long PGN, int iDev) |
Get the Sequence Counter for the PGN. More... | |
void | HandleCommandedAddress (const tN2kMsg &N2kMsg) |
Handles if we get commanded to set a new address. More... | |
void | HandleCommandedAddress (uint64_t CommandedName, unsigned char NewAddress, int iDev) |
Handles if we get commanded to set a new address. More... | |
void | HandleGroupFunction (const tN2kMsg &N2kMsg) |
Handles a Group Function. More... | |
void | HandleISOAddressClaim (const tN2kMsg &N2kMsg) |
Handles an IsoAddressClaim. More... | |
void | HandleISORequest (const tN2kMsg &N2kMsg) |
Handles an ISO Request. More... | |
bool | HandleOnlyKnownMessages () const |
Is handle only known messages enabled. More... | |
bool | HandleReceivedMessage (unsigned char Destination) |
Should received message be handled depending on the destination of the received message. More... | |
bool | HandleReceivedSystemMessage (int MsgIndex) |
Handles a received system message. More... | |
bool | HasAllTPDTSent (int iDev) |
Check if all data bytes of the multi packet message has been send successful. More... | |
virtual void | InitCANFrameBuffers () |
Initialize CAN Frame buffers. More... | |
void | InitDevices () |
Initialize all devices. More... | |
bool | IsActiveNode () |
Returns if this node is active on the bus. More... | |
bool | IsAddressClaimStarted (int iDev) |
Checks if the IsoAddressClaim is already started. More... | |
bool | IsFastPacket (const tN2kMsg &N2kMsg) |
Check if this PNG is a fast packet message. More... | |
bool | IsFastPacketPGN (unsigned long PGN) |
Check if this PNG is a fast packet message. More... | |
bool | IsInitialized () |
Determines if the CAN BUS is already initialized. More... | |
bool | IsMySource (unsigned char Source) |
Checks if the source belongs to a device on Devices. More... | |
bool | IsReadyToSend () const |
Checks if the device is ready to start address claiming. More... | |
bool | IsValidDevice (int iDev) const |
Checks if the device index on Devices is valid. More... | |
void | RespondGroupFunction (const tN2kMsg &N2kMsg, tN2kGroupFunctionCode GroupFunctionCode, unsigned long PGNForGroupFunction, int iDev) |
Respond to an Group Function. More... | |
void | RespondISORequest (const tN2kMsg &N2kMsg, unsigned long RequestedPGN, int iDev) |
Respond to an ISO request. More... | |
void | RunMessageHandlers (const tN2kMsg &N2kMsg) |
Run all message handlers. More... | |
bool | SendFrame (unsigned long id, unsigned char len, const unsigned char *buf, bool wait_sent=true) |
Sends a single CAN frame. More... | |
bool | SendFrames () |
Sends pending all frames. More... | |
void | SendPendingInformation () |
Send ISO AddressClaim, Product Information and Config Information. More... | |
void | SendPendingTPMessage (int iDev) |
Send pending ISO-TP Messages. More... | |
void | SendTPCM_Abort (unsigned long PGN, unsigned char Destination, int iDev, unsigned char AbortCode) |
Send ISO Transport Protocol message Abort. More... | |
bool | SendTPCM_BAM (int iDev) |
Send ISO Transport Protocol message BAM. More... | |
void | SendTPCM_CTS (unsigned long PGN, unsigned char Destination, int iDev, unsigned char nPackets, unsigned char NextPacketNumber) |
Send ISO Transport Protocol message CTS. More... | |
void | SendTPCM_EndAck (unsigned long PGN, unsigned char Destination, int iDev, uint16_t nBytes, unsigned char nPackets) |
Send ISO Transport Protocol message End Acknowledge. More... | |
bool | SendTPCM_RTS (int iDev) |
Send ISO Transport Protocol message RTS. More... | |
bool | SendTPDT (int iDev) |
Send ISO Transport Protocol data packet. More... | |
uint8_t | SetN2kCANBufMsg (unsigned long canId, unsigned char len, unsigned char *buf) |
Function handles received CAN frame and adds it to tN2kCANMsg. More... | |
void | StartAddressClaim () |
Starting the ISO Address Claim for all devices. More... | |
void | StartAddressClaim (int iDev) |
Starting the ISO Address Claim for a device. More... | |
bool | StartSendTPMessage (const tN2kMsg &msg, int iDev) |
Start sending an ISO-TP message. More... | |
bool | TestHandleTPMessage (unsigned long PGN, unsigned char Source, unsigned char Destination, unsigned char len, unsigned char *buf, uint8_t &MsgIndex) |
ISO Transport Protocol handlers for multi packet support. More... | |
Protected Attributes | |
bool | AddressChanged |
Flag that the address has changed. More... | |
tCANSendFrame * | CANSendFrameBuf |
Buffer for library send out CAN frames. More... | |
uint16_t | CANSendFrameBufferRead |
Next write index for the library CAN send frame buffer. More... | |
uint16_t | CANSendFrameBufferWrite |
Next read index for the library CAN send frame buffer. More... | |
tConfigurationInformation | ConfigurationInformation |
Configuration Information of the device. More... | |
tDebugMode | dbMode |
Attribute that holds the actual Debug Mode (default = md_none) More... | |
int | DeviceCount |
Number of devices. More... | |
bool | DeviceInformationChanged |
Flag that the device information has changed. More... | |
tInternalDevice * | Devices |
Pointer to a buffer for all internal devices. More... | |
const unsigned long * | FastPacketMessages [N2kMessageGroups] |
unsigned int | ForwardMode |
Actual message forward operation mode (default = all messages - also system and own) More... | |
N2kStream * | ForwardStream |
Actual stream to be used for forward messaging. More... | |
tForwardType | ForwardType |
Actual message forward type (default = fwdt_Actisense) More... | |
bool | InstallationDescriptionChanged |
Flag the Installation description has changed. More... | |
bool(* | ISORqstHandler )(unsigned long RequestedPGN, unsigned char Requester, int DeviceIndex) |
Handler callbacks for 'ISORequest' messages. More... | |
char * | LocalConfigurationInformationData |
Pointer to a buffer for local Configuration Information. More... | |
uint16_t | MaxCANReceiveFrames |
Max number received CAN messages that can go to the buffer. More... | |
uint16_t | MaxCANSendFrames |
Size of CANSendFrameBuf or before initialization requested total frame buffering size. More... | |
uint8_t | MaxN2kCANMsgs |
Size of N2kCANMsgBuf receiving message buffer. More... | |
void(* | MsgHandler )(const tN2kMsg &N2kMsg) |
Handler callbacks for normal messages. More... | |
tMsgHandler * | MsgHandlers |
Pointer to a buffer for Message Handlers. More... | |
tN2kCANMsg * | N2kCANMsgBuf |
Buffer for receiving messages. More... | |
tN2kMode | N2kMode |
Actual operation mode of this device (default = N2km_ListenOnly) More... | |
void(* | OnOpen )() |
Callback function, which will be called when library start bus communication. More... | |
tN2kScheduler | OpenScheduler |
tOpenState | OpenState |
tN2kGroupFunctionHandler * | pGroupFunctionHandlers |
Pointer to Buffer for GRoup Function Handlers. More... | |
const unsigned long * | SingleFrameMessages [N2kMessageGroups] |
Static Protected Attributes | |
static const int | FwdModeBit_EnableForward = BIT(0) |
Forward mode bit: -> If set, forward is enabled. More... | |
static const int | FwdModeBit_OnlyKnownMessages = BIT(2) |
Forward mode bit: -> Only known messages will be forwarded. System messages will be forwarded according its own bit. More... | |
static const int | FwdModeBit_OwnMessages = BIT(3) |
Forward mode bit: -> Forward also all messages, what this device will send. More... | |
static const int | FwdModeBit_SystemMessages = BIT(1) |
Forward mode bit: -> System messages will be forwarded. More... | |
static const int | HandleModeBit_OnlyKnownMessages = BIT(4) |
Forward mode bit: -> Only known messages will be handled. More... | |
tNMEA2000 device class definition.
With tNMEA2000 class you can easily communicate with NMEA2000 bus. Library can be used for any kind of NMEA2000 bus device needs from bus traffic listener to complex MFD system.
As default library simply reads all messages from bus and forwards them to defined forward stream (e.g., Serial) in Actisense format. Using N2km_ListenAndNode mode, one can make NMEA2000 compatible devices and even NMEA2000 certified devices by implementing all NMEA2000 certification requirements. Simple example is bus device, which provides some sensor like temperature, battery or engine information to the bus to be shown or MFD.
Class can be used just for reading bus data. More common is to use it as bus device (also called node). For bus device mode you provide required basic information about device to class, which then takes care of informing other devices on the bus in standard way. For other message handling class provides callback methods and method to send messages.
Each device on NMEA2000 bus will have own source address on range 0-251. Class takes care of address claiming (also called dynamic addressing) without any developer interaction. Class also provides multi device support, if that is necessary.
Definition at line 137 of file NMEA2000.h.
For debugging we have some cases for SendMsg.
Enumerator | |
---|---|
dm_None | Directs data to CAN bus |
dm_ClearText | Directs sent data to serial in clear text format |
dm_Actisense | Directs sent data to serial as Actisense format. |
Definition at line 718 of file NMEA2000.h.
Type how to forward messages in listen mode.
Definition at line 664 of file NMEA2000.h.
enum tNMEA2000::tN2kMode |
System mode defines how the device will behave on the NMEA2000 bus.
Enumerator | |
---|---|
N2km_ListenOnly | Default mode. Listen bus and if message forwarding has been enabled forwards messages to defined stream in Actisense format. You can not send any data to the bus. See example DataDisplay.ino. |
N2km_NodeOnly | In this mode device acts as active bus device like display, RPM or temperature monitor. Remember to set right device information first. Messages will not be forwarded. Look example TemperatureMonitor.ino. |
N2km_ListenAndNode | Mode is as N2km_NodeOnly plus you can control message forwarding. |
N2km_SendOnly | Only for message sending. Device will not inform itself to the bus. Messages will not be forwarded to the stream. |
N2km_ListenAndSend | Listen bus and forwards messages to given forward stream in Actisense format. Messages can be send. Device will not inform itself to the bus. This is mode is usable e.g., with NMEA Simulator http://www.kave.fi/Apps/. |
Definition at line 683 of file NMEA2000.h.
|
protected |
Library open state.
Open state is internal library open state used to avoid any blocking call.
Definition at line 751 of file NMEA2000.h.
tNMEA2000::tNMEA2000 | ( | ) |
Construct a new NMEA2000 object.
Initialize all the attributes of the class
Definition at line 660 of file NMEA2000.cpp.
void tNMEA2000::AddGroupFunctionHandler | ( | tN2kGroupFunctionHandler * | pGroupFunctionHandler | ) |
Add a message handler for incoming Group Function messages.
pGroupFunctionHandler | Message handler for group functions, see tN2kGroupFunctionHandler |
Definition at line 2708 of file NMEA2000.cpp.
void tNMEA2000::AttachMsgHandler | ( | tMsgHandler * | _MsgHandler | ) |
Attach a message handler for incoming N2kMessages.
tNMEA2000::SetMsgHandler allows you to define only one handler to your system. If you like to do it by using classes, I prefer to use AttachMsgHandler. In this way you can e.g. define own class for each PGN and attach/detach them within your program.
Example NMEA2000ToNMEA0183 uses AttachMsgHandler. Due to logic it still has single class and so handles all PGNs.
_MsgHandler | Message handler |
Definition at line 2643 of file NMEA2000.cpp.
|
protectedpure virtual |
Abstract class for reading frame from driver class.
Driver writer must override this function for specific CAN interface. Currently there are driver classes like NMEA2000_Teensyx, NMEA2000_teensy, NMEA2000_esp32, NMEA2000_due, NMEA2000_mcp, NMEA2000_avr, NMEA2000_mbed and NMEA2000_socketCAN.
true | New frame read from buffer. |
false | Nothing read. |
|
protectedpure virtual |
Abstract class for initializing and opening CAN interface.
Driver writer must override this function for specific CAN interface. Currently there are driver classes like NMEA2000_Teensyx, NMEA2000_teensy, NMEA2000_esp32, NMEA2000_due, NMEA2000_mcp, NMEA2000_avr, NMEA2000_mbed and NMEA2000_socketCAN.
true | Initialize and open success |
false | Initialize or open failed. |
|
protectedpure virtual |
Abstract class for sending a CAN Frame.
Driver writer must override this function for specific CAN interface. Currently there are driver classes like NMEA2000_Teensyx, NMEA2000_teensy, NMEA2000_esp32, NMEA2000_due, NMEA2000_mcp, NMEA2000_avr, NMEA2000_mbed and NMEA2000_socketCAN.
id | ID of the CAN frame |
len | length of payload for the message |
buf | buffer with the payload |
wait_sent | Has the message to wait before sending |
true | Success |
false | there is no space in the queue |
|
protected |
Check if this Message is known to the system.
Determines whether this message is known to the system, either by being a default, mandatory or system message or this specific message which is listed in SingleFrameMessages \ FastPacketMessages.
PGN | PGN to be checked |
SystemMessage | Flag system message |
FastPacket | Flag fast packet |
true | |
false |
Definition at line 1579 of file NMEA2000.cpp.
|
static |
Clears a char array buffer with 0s.
MaxLen | Max length of the buffer |
buf | Pointer to the buffer |
Definition at line 637 of file NMEA2000.cpp.
|
static |
Setting up a clean Char Buffer.
This functions clears an existing buffer using ClearCharBuf, copies the a string to the char buffer and terminates it with 0.
str | String |
MaxLen | Max length of the buffer |
buf | Pointer to the buffer |
Definition at line 654 of file NMEA2000.cpp.
|
protected |
Copy Configuration Information to local memory.
Definition at line 1022 of file NMEA2000.cpp.
void tNMEA2000::DetachMsgHandler | ( | tMsgHandler * | _MsgHandler | ) |
Detach a message handler for incoming N2kMessages.
With DetachMsgHandler you can remove your handler from the handler stack. This is useful, if you do not want to handle some messages anymore.
_MsgHandler | Message handler |
Definition at line 2668 of file NMEA2000.cpp.
|
inline |
Enable message forwarding to stream.
Set true as default. With this you can control if bus messages will be forwarded to forward stream.
v | Enable, default = true |
Definition at line 2900 of file NMEA2000.h.
|
protected |
Ends sending of ISO-TP message.
iDev | index of the device on Devices |
Definition at line 1949 of file NMEA2000.cpp.
void tNMEA2000::ExtendFastPacketMessages | ( | const unsigned long * | _FastPacketMessages | ) |
Set the list of known Extended Fast Packet Messages.
Call these if you wish to extent list of fast packet messages. Pointers must be in PROGMEM
As a default library has a list of known messages. With this function user can extent default list of fast packet messages.
_FastPacketMessages | Buffer holding extended fast packet messages |
Definition at line 1158 of file NMEA2000.cpp.
void tNMEA2000::ExtendReceiveMessages | ( | const unsigned long * | _ReceiveMessages, |
int | iDev = 0 |
||
) |
Extend the list of Received Messages.
Define list of extra PGNs, what your system will handle. System messages will be automatically included.
Pointers must be in PROGMEM.
Library responds automatically to PGN 126464 request about transmit or receive messages. With this function you extend library list of messages your device own logic listens.
This has only effect for device modes tNMEA2000::N2km_NodeOnly and tNMEA2000::N2km_ListenAndNode.
_ReceiveMessages | Buffer holding list of extra PGNs device will handle. |
iDev | index of the device on Devices |
Definition at line 1170 of file NMEA2000.cpp.
void tNMEA2000::ExtendSingleFrameMessages | ( | const unsigned long * | _SingleFrameMessages | ) |
Set the list of known Extended Single Frame Messages.
Call these if you wish to add own list of supported message packets. Pointers must be in PROGMEM
As a default library has a list of known messages. With this function user can add own list of known single frame messages.
Known single frame message lists has only effect if you limit handling with tNMEA2000::HandleOnlyKnownMessages or use message forwarding and limit it with tNMEA2000::SetForwardOnlyKnownMessages
_SingleFrameMessages | Buffer holding single frame messages |
Definition at line 1153 of file NMEA2000.cpp.
void tNMEA2000::ExtendTransmitMessages | ( | const unsigned long * | _TransmitMessages, |
int | iDev = 0 |
||
) |
Extend the list of Transmitted Messages.
Define list of extra PGNs, what your system will transmit. System messages will be automatically included. Pointers must be in PROGMEM
Library responds automatically to PGN 126464 request about transmit or receive messages. With this function you extend library list of messages your device own logic sends.
This has only effect for device modes tNMEA2000::N2km_NodeOnly and tNMEA2000::N2km_ListenAndNode.
_TransmitMessages | Buffer holding list of extra PGNs device will transmit. |
iDev | index of the device on Devices |
Definition at line 1163 of file NMEA2000.cpp.
|
protected |
Find index for free space for a message on N2kCANMsgBuf.
This functions searches for free space at N2kCANMsgBuf. If there is free space in buffer or there is a message with the same, source, PGN and destination at the buffer the corresponding Index is returned. If this is not the case, the Index of the oldest message inside the buffer is returned.
PGN | PNG for the message |
Source | Source address of the message |
Destination | Destination of the message |
TPMsg | Message is Multi Packet message |
MsgIndex | Index |
Definition at line 1634 of file NMEA2000.cpp.
int tNMEA2000::FindSourceDeviceIndex | ( | unsigned char | Source | ) | const |
Finds a device on Devices by its source address.
Source | Source address of the device |
Definition at line 2062 of file NMEA2000.cpp.
|
inlineprotected |
Is message forwarding enabled.
Checks if forwarding i enabled and the node is not N2km_SendOnly
true | |
false |
Definition at line 1520 of file NMEA2000.h.
|
protected |
Forwards a N2k message.
This function forwards a n2k message according to the forward type ForwardType( tForwardType) to the correct ForwardStream.
N2kCanMsg | N2k CAN message object, see tN2kCANMsg |
Definition at line 2092 of file NMEA2000.cpp.
|
protected |
Forwards a N2k message.
This function forwards a n2k message according to the forward type ForwardType( tForwardType) to the correct ForwardStream.
N2kMsg | N2k message object |
Definition at line 2078 of file NMEA2000.cpp.
|
inlineprotected |
Is forwarding enabled for known messages only.
true | |
false |
Definition at line 1536 of file NMEA2000.h.
|
inlineprotected |
Is forwarding enabled for own messages.
true | |
false |
Definition at line 1544 of file NMEA2000.h.
|
inlineprotected |
Is forwarding enabled for system messages.
true | |
false |
Definition at line 1528 of file NMEA2000.h.
unsigned char tNMEA2000::GetCertificationLevel | ( | int | iDev = 0 | ) | const |
Get the Certification Level of the device.
iDev | index of the device on Devices |
Definition at line 994 of file NMEA2000.cpp.
|
inline |
Get the Device Information.
With this function you can read current device information. Normally device information contains what you have set during initializing with tNMEA2000::SetDeviceInformation and tNMEA2000::SetDeviceInformationInstances functions.
iDev | index of the device on Devices |
Definition at line 2386 of file NMEA2000.h.
|
protected |
Get the Fast Packet Tx PGN Count.
iDev | index of the device on Devices |
Definition at line 813 of file NMEA2000.cpp.
|
inline |
Read current Forward Stream object.
Definition at line 2610 of file NMEA2000.h.
|
inline |
Get the Heartbeat Interval of a device.
Heartbeat interval may be changed by e.g. MFD by group function. I have not yet found should changed value be saved for next startup or not.
iDev | index of the device on Devices |
uint_32 | Device heartbeat interval in ms |
Definition at line 2513 of file NMEA2000.h.
|
inline |
Get the Heartbeat Offset of a device.
Heartbeat Offset may be changed by e.g. MFD by group function. I have not yet found should changed value be saved for next startup or not.
iDev | index of the device on Devices |
uint_32 | Device heartbeat Offset in ms |
Definition at line 2524 of file NMEA2000.h.
void tNMEA2000::GetInstallationDescription1 | ( | char * | buf, |
size_t | max_len | ||
) |
Get the Install Description 1 of this device.
buf | Buffer in memory for the description |
max_len | Max size of the buffer |
Definition at line 1056 of file NMEA2000.cpp.
void tNMEA2000::GetInstallationDescription2 | ( | char * | buf, |
size_t | max_len | ||
) |
Get the Install Description 2 of this device.
buf | Buffer in memory for the description |
max_len | Max size of the buffer |
Definition at line 1065 of file NMEA2000.cpp.
unsigned char tNMEA2000::GetLoadEquivalency | ( | int | iDev = 0 | ) | const |
Get the Load Equivalency of this device.
A Load Equivalence Number express the amount of current that is drawn from an NMEA 2000 network. 1 equals to 50mA. If a device draws 151mA of current from the network, then its LEN is 4
iDev | index of the device on Devices |
Definition at line 1008 of file NMEA2000.cpp.
void tNMEA2000::GetManufacturerInformation | ( | char * | buf, |
size_t | max_len | ||
) |
Get the Manufacturer Information of this device.
buf | Buffer in memory for the description |
max_len | Max size of the buffer |
Definition at line 1074 of file NMEA2000.cpp.
void tNMEA2000::GetModelID | ( | char * | buf, |
size_t | max_len, | ||
int | iDev = 0 |
||
) | const |
Get the ModelID of the device.
buf | Buffer to hold the information |
max_len | Maximum size of the buffer |
iDev | index of the device on Devices |
Definition at line 930 of file NMEA2000.cpp.
void tNMEA2000::GetModelSerialCode | ( | char * | buf, |
size_t | max_len, | ||
int | iDev = 0 |
||
) | const |
Get the Model Serial of the device.
buf | Buffer to hold the information |
max_len | Maximum size of the buffer |
iDev | index of the device on Devices |
Definition at line 978 of file NMEA2000.cpp.
void tNMEA2000::GetModelVersion | ( | char * | buf, |
size_t | max_len, | ||
int | iDev = 0 |
||
) | const |
Get the Model Version of the device.
buf | Buffer to hold the information |
max_len | Maximum size of the buffer |
iDev | index of the device on Devices |
Definition at line 962 of file NMEA2000.cpp.
|
inline |
Read address for current device.
With this function you can get you device current source address on the N2k bus.
DeviceIndex | index of the device on Devices |
Definition at line 2827 of file NMEA2000.h.
unsigned short tNMEA2000::GetN2kVersion | ( | int | iDev = 0 | ) | const |
Get the N2k standard version of the device.
iDev | index of the device on Devices |
Definition at line 902 of file NMEA2000.cpp.
|
protected |
Get the next free address for the device.
DeviceIndex | index of the device on Devices |
RestartAtEnd | Restart the search from the beginning if the search for the free source has reached N2kNullCanBusAddress |
Definition at line 2512 of file NMEA2000.cpp.
|
protected |
Get the Next Free CAN Frame from CANSendFrameBuf.
Definition at line 1417 of file NMEA2000.cpp.
unsigned short tNMEA2000::GetProductCode | ( | int | iDev = 0 | ) | const |
Get the Product Code of the device.
iDev | index of the device on Devices |
Definition at line 916 of file NMEA2000.cpp.
const tNMEA2000::tProductInformation * tNMEA2000::GetProductInformation | ( | int | iDev, |
bool & | IsProgMem | ||
) | const |
Get the Product Information of the device.
iDev | index of the device on Devices |
IsProgMem | Program memory has been used for the data |
Definition at line 891 of file NMEA2000.cpp.
|
protected |
Get the Sequence Counter for the PGN.
PGN | PGN |
iDev | index of the device on Devices |
Definition at line 831 of file NMEA2000.cpp.
void tNMEA2000::GetSwCode | ( | char * | buf, |
size_t | max_len, | ||
int | iDev = 0 |
||
) | const |
Get the Sw Code of the device.
buf | Buffer to hold the information |
max_len | Maximum size of the buffer |
iDev | index of the device on Devices |
Definition at line 946 of file NMEA2000.cpp.
|
protected |
Handles if we get commanded to set a new address.
N2kMsg | Reference to a N2kMsg Object |
Definition at line 2467 of file NMEA2000.cpp.
|
protected |
Handles if we get commanded to set a new address.
CommandedName | Device name that have been commanded to set new address |
NewAddress | new address for the device |
iDev | index of the device on Devices |
Definition at line 2455 of file NMEA2000.cpp.
|
protected |
Handles a Group Function.
Document https://web.archive.org/web/20170609033039/http://www.nmea.org/Assets/20140109%20nmea-2000-corrigendum-tc201401031%20pgn%20126208.pdf defines that systems should respond to NMEA Request/Command/Acknowledge group function PGN 126208. On the document it is not clear can request be send as broadcast, so we handle it, if we can.
N2kMsg | Reference to a N2kMsg Object |
Definition at line 2375 of file NMEA2000.cpp.
|
protected |
Handles an IsoAddressClaim.
N2kMsg | Reference to a N2kMsg Object |
Definition at line 2430 of file NMEA2000.cpp.
|
protected |
Handles an ISO Request.
The function determines if the request is for us (Broadcast message or device in our list) and responds to the request.
N2kMsg | Reference to a N2kMsg Object |
Definition at line 2333 of file NMEA2000.cpp.
|
inlineprotected |
Is handle only known messages enabled.
true | |
false |
Definition at line 1552 of file NMEA2000.h.
|
inlineprotected |
Should received message be handled depending on the destination of the received message.
Destination | Destination of the received message |
true | |
false |
Definition at line 1572 of file NMEA2000.h.
|
protected |
Handles a received system message.
If the node is not N2km_SendOnly or N2km_ListenAndSend this function chooses the correct handler for the given system message.
MsgIndex | Message Index on N2kCANMsgBuf |
true | message was handled |
false |
Definition at line 2543 of file NMEA2000.cpp.
|
protected |
Check if all data bytes of the multi packet message has been send successful.
iDev | index of the device on Devices |
true | |
false |
Definition at line 1781 of file NMEA2000.cpp.
|
protectedvirtual |
Initialize CAN Frame buffers.
This will be called on tNMEA2000::Open() before any other initialization.
Driver writer must inherit this for low level driver class and create driver internal send and receive buffers according requested MaxCANSendFrames and MaxCANReceiveFrames sizes. Driver class can handle completely send and receive buffers or after buffers has been initialized set MaxCANSendFrames for size of library buffer and call tNMEA2000::InitCANFrameBuffers();
Inherited function can also override requested MaxCANSendFrames and MaxCANReceiveFrames in case they are set e.g., too small or too large.
See e.g., tNMEA2000_Teensyx::InitCANFrameBuffers() on NMEA2000_teensyx.cpp.
Definition at line 1188 of file NMEA2000.cpp.
|
protected |
Initialize all devices.
This function initializes the array Devices with the size of DeviceCount and sets default device information.
Default Device Info is:
Definition at line 710 of file NMEA2000.cpp.
|
inlineprotected |
Returns if this node is active on the bus.
true | if ( N2km_NodeOnly or N2km_ListenAndNode) |
false |
Definition at line 1584 of file NMEA2000.h.
|
protected |
Checks if the IsoAddressClaim is already started.
iDev | index of the device on Devices |
true | |
false |
Definition at line 2414 of file NMEA2000.cpp.
|
inlinestatic |
Checks if the given Address is a broadcast address.
Source | Source address |
true | Source is broadcast address |
false | Source is not broadcast address |
Definition at line 2990 of file NMEA2000.h.
|
protected |
Check if this PNG is a fast packet message.
Determines if this given PGN belongs to a fast packet message by checking if a corresponding message is listed on FastPacketMessages[]
N2kMsg | Reference to a N2kMsg Object |
true | |
false |
Definition at line 1572 of file NMEA2000.cpp.
|
protected |
Check if this PNG is a fast packet message.
Determines if this given PGN belongs to a fast packet message by checking if a corresponding message is listed on FastPacketMessages[]
PGN | PGN to be checked |
true | |
false |
Definition at line 1552 of file NMEA2000.cpp.
|
inlineprotected |
Determines if the CAN BUS is already initialized.
true | |
false |
Definition at line 1234 of file NMEA2000.h.
|
protected |
Checks if the source belongs to a device on Devices.
Source | Source address |
true | |
false |
Definition at line 2073 of file NMEA2000.cpp.
|
inline |
Test is NMEA2000 open and running.
true | |
false |
Definition at line 2634 of file NMEA2000.h.
|
static |
Check if the given PGN is proprietary.
PGNs that are proprietary by definition: 61184, 65280 - 65535, 126720, 130816 - 131071
PGN | PGN to be checked |
true | -> for PGNs:
|
false |
Definition at line 583 of file NMEA2000.cpp.
|
inlineprotected |
Checks if the device is ready to start address claiming.
true | |
false |
Definition at line 1601 of file NMEA2000.h.
bool tNMEA2000::IsTxPGN | ( | unsigned long | PGN, |
int | iDev = 0 |
||
) |
Check if this message is a Transmit message of this device.
PGN | PGN to be checked |
iDev | index of the device on Devices |
true | |
false |
Definition at line 875 of file NMEA2000.cpp.
|
inlineprotected |
Checks if the device index on Devices is valid.
iDev | index of the device on Devices |
true | |
false |
Definition at line 1593 of file NMEA2000.h.
|
inlinestatic |
Delivers Max out of A an B.
As max and min are not available on all systems, so use own definition.
T | Datatype |
a | Value A |
b | Value B |
Definition at line 193 of file NMEA2000.h.
|
inlinestatic |
Delivers Min out of A an B.
As max and min are not available on all systems, so use own definition.
T | Datatype |
a | Value A |
b | Value B |
Definition at line 205 of file NMEA2000.h.
bool tNMEA2000::Open | ( | ) |
Open the CAN device.
You can call this on Setup(). It will be called anyway automatically by first call of tNMEA2000::ParseMessages(). When system is finally opened, OnOpen callback will be executed. See tNMEA2000::SetOnOpen
true | |
false |
Definition at line 1200 of file NMEA2000.cpp.
void tNMEA2000::ParseMessages | ( | ) |
Parse all incoming Messages.
You have to call this periodically on loop() to handle N2k messages, otherwise tNMEA2000 object will not work at all.
With NMEA2000 library you should use only nonblocking calls/libraries in your loop. Any library you use, should work asynchronously and not cause long delays on loop. Randomly caused 10-40 ms delays are acceptable. E.g., simple ADC conversion may block loop for 300 ms, which you will then see by other device dropping your device from the list.
See example TemperatureMonitor.ino.
Definition at line 2577 of file NMEA2000.cpp.
bool tNMEA2000::ReadResetAddressChanged | ( | ) |
Check if this device has changed its address.
With this function you can check has your device address you initiated with SetMode been changed after last call.
When you call this, tNMEA2000::AddressChanged will be reset. Anyway, if system for some reason needs to change its address again, tNMEA2000::AddressChanged will be set. So you can e.g. in every 10 min check has address changed and if it has, save it.
true | Some device source address changed. Read new values and save them. |
false | Nothing changed, no further actions required. |
Definition at line 2496 of file NMEA2000.cpp.
bool tNMEA2000::ReadResetDeviceInformationChanged | ( | ) |
Check if this device has changed its DeviceInstances or SystemInstance.
With this function you can check has your device device instances or system instances changed.
true | Some device information changed. Read new values and save them. |
false | Nothing changed, no further actions required. |
Definition at line 2504 of file NMEA2000.cpp.
bool tNMEA2000::ReadResetInstallationDescriptionChanged | ( | ) |
Check if this device has changed its Install Description.
true | Installation description changed. Read new values and save them. |
false | Nothing changed, no further actions required. |
Definition at line 1083 of file NMEA2000.cpp.
void tNMEA2000::RemoveGroupFunctionHandler | ( | tN2kGroupFunctionHandler * | pGroupFunctionHandler | ) |
Remove a message handler for incoming Group Function messages.
pGroupFunctionHandler | Message handler for group functions, see tN2kGroupFunctionHandler |
Definition at line 2690 of file NMEA2000.cpp.
|
protected |
Respond to an Group Function.
Document https://web.archive.org/web/20170609033039/http://www.nmea.org/Assets/20140109%20nmea-2000-corrigendum-tc201401031%20pgn%20126208.pdf defines that systems should respond to NMEA Request/Command/Acknowledge group function PGN 126208. Here we first call callback and if that will not handle function, we use default handler.
N2kMsg | Reference to a N2kMsg Object |
GroupFunctionCode | |
PGNForGroupFunction | |
iDev | index of the device on Devices |
Definition at line 2353 of file NMEA2000.cpp.
|
protected |
Respond to an ISO request.
If there is now IsoAdressClaim procedure started for this device, we respond for the requested PGN with sending IsoAddressClaim, Tx/Rx PGN lists, Product- / Config information or an user defined ISORqstHandler.
If non of this fits the RequestedPGN, we directly respond to the requester NAK. ( SetN2kPGNISOAcknowledgement)
N2kMsg | Reference to a N2kMsg Object |
RequestedPGN | Requested PGN |
iDev | index of the device on Devices |
Definition at line 2297 of file NMEA2000.cpp.
void tNMEA2000::Restart | ( | ) |
Restart the device.
This is preliminary function for e.g. battery powered or devices, which may go to sleep or of the bus in any way. Function is under development.
Definition at line 1264 of file NMEA2000.cpp.
|
protected |
Run all message handlers.
N2kMsg | Reference to a N2kMsg Object |
Definition at line 2620 of file NMEA2000.cpp.
bool tNMEA2000::SendConfigurationInformation | ( | int | DeviceIndex = 0 | ) |
Send a Config Information message.
This is automatically used by class. You only need to use this, if you want to write your own behavior for providing config information.
DeviceIndex | index of the device on Devices |
true | Success |
false |
Definition at line 2260 of file NMEA2000.cpp.
bool tNMEA2000::SendConfigurationInformation | ( | unsigned char | Destination, |
int | DeviceIndex, | ||
bool | UseTP | ||
) |
Send a Config Information message.
This is automatically used by class. You only need to use this, if you want to write your own behavior for providing config information.
Destination | Destination address |
DeviceIndex | index of the device on Devices |
UseTP | use multi packet message |
true | Success |
false |
Definition at line 2264 of file NMEA2000.cpp.
|
protected |
Sends a single CAN frame.
This function sends a CAN Message to the buffer, if we can not sent frame immediately via CANSendFrame()
id | {type} |
len | {type} |
buf | {type} |
wait_sent | {type} |
true | success |
false | failed |
Definition at line 1335 of file NMEA2000.cpp.
|
protected |
Sends pending all frames.
true | Success |
false | Message could not be sent. |
Definition at line 1318 of file NMEA2000.cpp.
void tNMEA2000::SendHeartbeat | ( | bool | force = false | ) |
Send Heartbeat for all devices.
Library will automatically send heartbeat, if interval is >0. You can also manually send it any time or force sent, if interval=0;
force | True will send Heartbeat immediately, default = false |
Definition at line 1396 of file NMEA2000.cpp.
void tNMEA2000::SendHeartbeat | ( | int | iDev | ) |
Send heartbeat for specific device.
Library will automatically send heartbeat, if interval is >0. You can also manually send it any time or force sent, if interval=0;
iDev | index of the device on Devices |
Definition at line 1388 of file NMEA2000.cpp.
void tNMEA2000::SendIsoAddressClaim | ( | unsigned char | Destination = 0xff , |
int | DeviceIndex = 0 , |
||
unsigned long | FromNow = 0 |
||
) |
Send an IsoAddressClaim message.
This is automatically used by class. You only need to use this, if you want to write your own behavior for address claiming.
Destination | Destination address for the message |
DeviceIndex | index of the device on Devices |
FromNow | optional time delay from now in ms |
Definition at line 2097 of file NMEA2000.cpp.
bool tNMEA2000::SendMsg | ( | const tN2kMsg & | N2kMsg, |
int | DeviceIndex = 0 |
||
) |
Send message to the NMEA2000 bus.
Call this to send message to NMEA2000 bus. Before calling SendMsg() you have to prepare tN2kMsg type of message e.g. by using PGN specific function in N2kMessages.h.
The function returns true, if the message was sent or buffered successfully, otherwise it return false. SendMsg may fail, if there is not room for message frames on sending buffer, device is not yet open or not ready to send.
If you sent single frame message time to time, it will normally go directly to CAN controller sent "mailbox", where controller sends it as soon as it gets time from bus. Sending fastpacket message will always buffer at least other than first frame. Internally sent buffer is devided to driver buffer and library buffer. Driver buffer will empty by interrupt and library buffer on call to SendMsg or ParseMessages, which moves frames to driver buffer. To have reliable sending, you need a sending buffer, which is large enough for your device needs. See tNMEA2000::SetN2kCANSendFrameBufSize.
See example TemperatureMonitor.ino.
N2kMsg | Reference to a N2kMsg Object |
DeviceIndex | index of the device on Devices Setting DeviceIndex to -1 forces library to use source address of N2kMsg instead of device source address. This is useful with e.g., passthrough gateway devices. |
true | Message sent or buffered successfully. |
false | Open has not finished. Address claiming has not finished. There is no more room on send buffer, which may be caused by too small send buffer or CAN controller can not sent messages bus. |
Definition at line 1450 of file NMEA2000.cpp.
|
protected |
Send ISO AddressClaim, Product Information and Config Information.
Currently Product Information and Configuration Information will we pended on ISO request. This is because specially for broadcasted response it may take a while, when higher priority devices sends their response.
Definition at line 1431 of file NMEA2000.cpp.
|
protected |
Send pending ISO-TP Messages.
iDev | index of the device on Devices |
Definition at line 1956 of file NMEA2000.cpp.
bool tNMEA2000::SendProductInformation | ( | int | DeviceIndex = 0 | ) |
Send a Product Information message.
This is automatically used by class. You only need to use this, if you want to write your own behavior for providing product information.
DeviceIndex | index of the device on Devices |
true | Success |
false |
Definition at line 2218 of file NMEA2000.cpp.
bool tNMEA2000::SendProductInformation | ( | unsigned char | Destination, |
int | DeviceIndex, | ||
bool | UseTP | ||
) |
Send a Product Information message.
This is automatically used by class. You only need to use this, if you want to write your own behavior for providing product information.
Destination | Destination address |
DeviceIndex | index of the device on Devices |
UseTP | use multi packet message |
true | Success |
false |
Definition at line 2222 of file NMEA2000.cpp.
void tNMEA2000::SendRxPGNList | ( | unsigned char | Destination, |
int | DeviceIndex, | ||
bool | UseTP = false |
||
) |
Send a list with all supported Receive messages.
This function sends a PGN 126464 message consisting of all messages supported by this device for reception.
Destination | Destination address |
DeviceIndex | index of the device on Devices |
UseTP | use multi packet message, default = false |
Definition at line 2161 of file NMEA2000.cpp.
|
protected |
Send ISO Transport Protocol message Abort.
PGN | PGN |
Destination | Destination address |
iDev | index of the device on Devices |
AbortCode | Abort Code |
Definition at line 1742 of file NMEA2000.cpp.
|
protected |
Send ISO Transport Protocol message BAM.
This is used for Broadcast messages
iDev | index of the device on Devices |
true | |
false |
Definition at line 1668 of file NMEA2000.cpp.
|
protected |
Send ISO Transport Protocol message CTS.
PGN | PGN |
Destination | Destination address |
iDev | index of the device on Devices |
nPackets | Number of packets |
NextPacketNumber | Number of the next packet |
Definition at line 1707 of file NMEA2000.cpp.
|
protected |
Send ISO Transport Protocol message End Acknowledge.
PGN | PGN |
Destination | Destination address |
iDev | index of the device on Devices |
nBytes | Number of bytes |
nPackets | Number of packets |
Definition at line 1725 of file NMEA2000.cpp.
|
protected |
Send ISO Transport Protocol message RTS.
iDev | index of the device on Devices |
true | |
false |
Definition at line 1687 of file NMEA2000.cpp.
|
protected |
Send ISO Transport Protocol data packet.
iDev | index of the device on Devices |
true | Message was send successful |
false |
Definition at line 1762 of file NMEA2000.cpp.
void tNMEA2000::SendTxPGNList | ( | unsigned char | Destination, |
int | DeviceIndex, | ||
bool | UseTP = false |
||
) |
Send a list with all supported Transmit messages.
This function sends a PGN 126464 message consisting of all messages supported by this device for transmission.
Destination | Destination address |
DeviceIndex | index of the device on Devices |
UseTP | use multi packet message, default = false |
Definition at line 2128 of file NMEA2000.cpp.
|
static |
Setting up a Char Buffer.
This functions copies the a to the char buffer and terminates it with 0.
str | String |
MaxLen | Max length of the buffer |
buf | Pointer to the buffer |
Definition at line 644 of file NMEA2000.cpp.
void tNMEA2000::SetConfigurationInformation | ( | const char * | ManufacturerInformation, |
const char * | InstallationDescription1 = 0 , |
||
const char * | InstallationDescription2 = 0 |
||
) |
Set the Configuration Information of this device.
With this function you can set configuration information for your device.
Configuration information contains some extra information about device installation and manufacturer. Some MFD shows it, some does not. NMEA Reader can show configuration information. InstallationDescription1 and InstallationDescription2 can be changed as default during runtime by NMEA 2000 group function commands. That can be done e.g. with NMEA Reader.
ManufacturerInformation | Buffer for Manufacturer information. Use e.g., company name and web address. |
InstallationDescription1 | Buffer for Installation Description 1. Installation Description 1 and 2 may be used by device installer e.g., for location of physical device to help to find it. To handle externally updated Installation Description you should listen changes of them. See tNMEA2000::ReadResetInstallationDescriptionChanged |
InstallationDescription2 | Buffer for Installation Description 2. |
Definition at line 764 of file NMEA2000.cpp.
void tNMEA2000::SetDebugMode | ( | tDebugMode | _dbMode | ) |
Set the Debug Mode of the system.
If you do not have physical N2k bus connection and you like to test your board without even CAN controller, you can use this function.
_dbMode | Debug mode, see tNMEA2000::tDebugMode |
Definition at line 1547 of file NMEA2000.cpp.
void tNMEA2000::SetDeviceCount | ( | const uint8_t | _DeviceCount | ) |
Set the count of devices library shows on bus.
With this function you can enable multi device support. As default there is only one device.
_DeviceCount | Maximum number of devices that can be hold in Devices |
Definition at line 704 of file NMEA2000.cpp.
void tNMEA2000::SetDeviceInformation | ( | unsigned long | _UniqueNumber, |
unsigned char | _DeviceFunction = 0xff , |
||
unsigned char | _DeviceClass = 0xff , |
||
uint16_t | _ManufacturerCode = 0xffff , |
||
unsigned char | _IndustryGroup = 4 , |
||
int | iDev = 0 |
||
) |
Set the Device Information. See also NAME.
If you use device modes tNMEA2000::N2km_NodeOnly or tNMEA2000::N2km_ListenAndNode, it is critical that you set this information.
Device information will be used to choose right address for your device (also called node) on the bus. Each device must have an own address. Library will do this automatically, so it is enough that you call this function on setup to define your device.
For keeping defaults use 0xffff/0xff for int/char values and null ptr for pointers.
I just decided to use number one below maximum for ManufacturerCode as Open Source devices - this is not any number given by NMEA.
_UniqueNumber | Default=1. 21 bit resolution, max 2097151. Each device from same manufacturer should have unique number. |
_DeviceFunction | Default=130, PC Gateway. See codes on https://web.archive.org/web/20190531120557/https://www.nmea.org/Assets/20120726%20nmea%202000%20class%20&%20function%20codes%20v%202.00.pdf |
_DeviceClass | Default=25, Inter/Intranetwork Device. See codes on https://web.archive.org/web/20190531120557/https://www.nmea.org/Assets/20120726%20nmea%202000%20class%20&%20function%20codes%20v%202.00.pdf |
_ManufacturerCode | Default=2046. Maximum 2046. See the list of codes on https://web.archive.org/web/20190529161431/http://www.nmea.org/Assets/20121020%20nmea%202000%20registration%20list.pdf |
_IndustryGroup | Default=4, Marine. |
iDev | index of the device on Devices |
Definition at line 1093 of file NMEA2000.cpp.
void tNMEA2000::SetDeviceInformationInstances | ( | uint8_t | _DeviceInstanceLower = 0xff , |
uint8_t | _DeviceInstanceUpper = 0xff , |
||
uint8_t | _SystemInstance = 0xff , |
||
int | iDev = 0 |
||
) |
Set the Device Information Instances.
With this function you can set device instance lower, device instance upper and system instance values.
For certified devices there is requirement that device instances can be externally changed. Library handles that as default, but developer has to take care that changed instances will be saved and restored on devices start.
_DeviceInstanceLower | 0xff means no change |
_DeviceInstanceUpper | |
_SystemInstance | |
iDev | index of the device on Devices |
Definition at line 1110 of file NMEA2000.cpp.
void tNMEA2000::SetFastPacketMessages | ( | const unsigned long * | _FastPacketMessages | ) |
Set the list of known Fast Packet Messages.
Call these if you wish to override the default message packets supported. Pointers must be in PROGMEM
As a default library has a list of known messages. With this function user can override default list of fast packet messages. Build in default list contains all fastpackets found from open information.
_FastPacketMessages | Buffer holding fast packet messages |
Definition at line 1148 of file NMEA2000.cpp.
|
inline |
Enable Only Known Messages for forwarding.
Set false as default. With this you can control if unknown messages will be forwarded to forward stream. If you set this true, all unknown message will not be forwarded to the stream.
v | Enable, default = false |
Definition at line 2936 of file NMEA2000.h.
|
inline |
Enable Own Messages for forwarding.
Set true as default. With this you can control if messages your device sends to bus will be forwarded to forward stream.
v | Enable, default = true |
Definition at line 2948 of file NMEA2000.h.
|
inline |
Set the Forward Stream object.
As default, forward stream has been set to null. For e.g. Arduino Due you can set it to SerialUSB, so you can use Serial for other things. You can of coarse use any stream available on your device.
See example ActisenseListenerSender.ino.
_stream | Stream to be used for message forwarding |
Definition at line 2603 of file NMEA2000.h.
|
inline |
Enable System Messages for forwarding.
Set true as default. With this you can control if system messages like address claiming, device information will be forwarded to forward stream. If you set this false, system messages will not be forwarded to the stream.
v | Enable, default = true |
Definition at line 2914 of file NMEA2000.h.
|
inline |
Set the Forward Streaming Type.
With this function user can set how messages will be forwarded to the stream. Possible values are:
fwdType | Format type see tNMEA2000::tForwardType, default = fwdt_Actisense |
Definition at line 2591 of file NMEA2000.h.
|
inline |
Set the Handle Only Known Messages.
Set false as default. With this you can control if unknown messages will be handled at all. Known messages are listed on library.
v | Enable, default = false |
Definition at line 2966 of file NMEA2000.h.
void tNMEA2000::SetHeartbeatInterval | ( | unsigned long | interval, |
bool | SetAsDefault = true , |
||
int | iDev = -1 |
||
) |
Deprecated. Use function SetHeartbeatIntervalAndOffset.
Definition at line 1383 of file NMEA2000.cpp.
void tNMEA2000::SetHeartbeatIntervalAndOffset | ( | uint32_t | interval, |
uint32_t | offset = 0 , |
||
int | iDev = -1 |
||
) |
Set the Heartbeat Interval and Offset for a device.
Library will automatically start heartbeat with default interval 60 s and offset 10 s.
According to document NMEA Heartbeat Corrigendum all NMEA devices shall transmit heartbeat PGN 126993. With this function you can set transmission interval in ms (range 1000-655320ms , default 60000). Set interval 0 to disable heartbeat
Function allows to set interval over 60 s or 0 to disable sending for test purposes.
interval | Heartbeat Interval in ms. 0xffffffff=keep current, 0xfffffffe=restore default |
offset | Heartbeat Offset in ms. 0xffffffff=keep current, 0xfffffffe=restore default |
iDev | Index of the device on Devices or -1 to set for all. |
Definition at line 1356 of file NMEA2000.cpp.
void tNMEA2000::SetInstallationDescription1 | ( | const char * | InstallationDescription1 | ) |
Set the Installation Description 1 of this device.
This is automatically used by class. You only need to use this, if you want to write your own behavior.
InstallationDescription1 | Description |
Definition at line 1037 of file NMEA2000.cpp.
void tNMEA2000::SetInstallationDescription2 | ( | const char * | InstallationDescription2 | ) |
Set the Installation Description 2 of this device.
This is automatically used by class. You only need to use this, if you want to write your own behavior.
InstallationDescription2 | Description |
Definition at line 1047 of file NMEA2000.cpp.
void tNMEA2000::SetISORqstHandler | ( | bool(*)(unsigned long RequestedPGN, unsigned char Requester, int DeviceIndex) | ISORequestHandler | ) |
Set the message handler for incoming ISO Requests.
Devices on N2k bus may request PGN from your device. Certified devices should respond to requests to any transmit PGN listed. Write your own request handler and set it with this function.
The handler will be called by tNMEA2000::ParseMessages, if there is ISO request.
ISORequestHandler | Message handler |
Definition at line 2684 of file NMEA2000.cpp.
void tNMEA2000::SetMode | ( | tN2kMode | _N2kMode, |
uint8_t | _N2kSource = 15 |
||
) |
Set the library mode and start source address.
With SetMode you can define how your node acts on N2k bus and set start source address. Source address setting has effect only on modes N2km_NodeOnly and N2km_ListenAndNode.
NMEA2000 standard requires that once your device has been connected to the bus, it uses last used address on next start. Due to address claiming, your device may change its source address, when you add new devices to the bus. So you should save last used address to e.g. EEPROM and on setup use it as parameter for SetMode. You can check if your address you set originally by SetMode has changed by using function tNMEA2000::ReadResetAddressChanged() and you can read current address by function tNMEA2000::GetN2kSource().
_N2kMode | Mode for this node, see tN2kMode |
_N2kSource | Source address for this node |
Definition at line 1177 of file NMEA2000.cpp.
void tNMEA2000::SetMsgHandler | ( | void(*)(const tN2kMsg &N2kMsg) | _MsgHandler | ) |
Set the message handler for incoming NMEA2000 messages.
If you want to do something with messages read from N2k bus, easiest is to set message handler, which will be then called by ParseMessages for each new message.
If you have LCD display on your device and you want to show e.g., fluid level on it, create message handler, parse fluid level messages and draw value to display.
See example DataDisplay.ino or DataDisplay2.ino
_MsgHandler | Old style - callback function pointer |
Definition at line 2638 of file NMEA2000.cpp.
|
protected |
Function handles received CAN frame and adds it to tN2kCANMsg.
This function returns Index to a ready tN2kCANMsg on buffer N2kCANMsgBuf (max MaxN2kCANMsgs), if we skipped the frame or message is not ready (fast packet or ISO Multi-Packet)
canId | ID of CAN message |
len | length of payload |
buf | buffer for payload of message |
Definition at line 1977 of file NMEA2000.cpp.
|
inline |
Set incoming CAN message (tNMEA2000::N2kCANMsgBuf) buffer size.
With this function you can set size of buffer, where system builds incoming messages. The default size is 5 messages. Some messages are just single frame messages and they will be read in and handled immediately on call to ParseMessages. NMEA2000 fast packet message contains several frames sent sequentially. Anyway there can be other message frames between fast packet message frames, so these messages will be buffered and saved until all frames has been received. NMEA2000 requires that device should be able to read 2 concurrent fast packet and 2 ISO TP message. Since also single frame message requires one buffer slot buffer default size has been set to 5.
If buffer size is too small, there is risk that all fast packet messages will not be handled. Even your own logic does not listen any fast packet messages, internal logic listens group functions PGN 126208, which may contain important requests library should respond. If library does not respond to all required requests, there is risk that other devices drops your device information.
Since ISO TP messages are rarely used, with buffer size 5 library can handle 4 concurrent fast packet messages. Due to priorities this is enough in most cases. If bus has lot of devices sending fast packets and you have enough memory on MCU, you can increase buffer size. Buffer size 10 should be enough even on heavy traffic.
Function has to be called before communication opens. See tNMEA2000::Open().
Do not mix this with tNMEA2000::SetN2kCANReceiveFrameBufSize(), which has different meaning.
_MaxN2kCANMsgs | Number of CAN messages that can be stored in tNMEA2000::N2kCANMsgBuf |
Definition at line 1816 of file NMEA2000.h.
|
inlinevirtual |
Set CAN receive frame buffer size.
Some CAN drivers allows interrupted receive frame buffering. You can set receive buffer size with this function. If you use this function, call it once before tNMEA2000::Open();
Driver may override your setting, if you set too small or too large buffer size. This is driver dependent behaviour.
_MaxCANReceiveFrames | {type} |
Definition at line 1870 of file NMEA2000.h.
|
inlinevirtual |
Set CAN send frame buffer size.
With this function you can set size of buffer, where system saves frames of messages to be sent. Given buffer size will be devided to driver buffer and library buffer. Driver buffer will empty by driver interrupt and library buffer by call to SendMsg or ParseMessages, which moves frames to driver buffer. If driver can handle large buffer, library buffer will be set to minimum.
When sending long messages like ProductInformation or GNSS data, there may not be enough buffers for successfully send data. This depends of your hw and device source. Device source has effect due to priority of getting sending time. If your data is critical, use buffer size, which is large enough (default 40 frames).
E.g. Product information takes totally 134 bytes. This needs 20 frames. If you also send GNSS 47 bytes=7 frames. If you want to be sure that both will be sent on any situation, you need at least 27 frame buffer size.
If you use this function, call it once before tNMEA2000::Open() and before any device related function like tNMEA2000::SetProductInformation. If you call it later, function has no effect.
Driver may override your setting, if you set too small or too large buffer size. This is driver dependent behaviour.
_MaxCANSendFrames | Maximum number of CAN frames that can be buffered in tNMEA2000::CANSendFrameBuf |
Definition at line 1853 of file NMEA2000.h.
void tNMEA2000::SetN2kSource | ( | unsigned char | _iAddr, |
int | _iDev = 0 |
||
) |
Set source for the given device.
With this function you can set you device source address on the N2k bus. This is meant to be use for multi device on basic configuration to restore source address changed by address claiming.
This function has to be called after tNMEA2000::SetMode() and before tNMEA2000::Open()
_iAddr | Address of the device |
_iDev | index of the device on Devices |
Definition at line 2488 of file NMEA2000.cpp.
void tNMEA2000::SetOnOpen | ( | void(*)() | _OnOpen | ) |
Set OnOpen callback function.
OnOpen will be called, when communication really opens and starts initial address claiming. You can use this to init your message sending to synchronize them with e.g., heartbeat.
Definition at line 2633 of file NMEA2000.cpp.
void tNMEA2000::SetProductInformation | ( | const char * | _ModelSerialCode, |
unsigned short | _ProductCode = 0xffff , |
||
const char * | _ModelID = 0 , |
||
const char * | _SwCode = 0 , |
||
const char * | _ModelVersion = 0 , |
||
unsigned char | _LoadEquivalency = 0xff , |
||
unsigned short | _N2kVersion = 0xffff , |
||
unsigned char | _CertificationLevel = 0xff , |
||
int | iDev = 0 |
||
) |
Set the Product Information of this device.
With this function you define how your device will show up for other devices on NMEA2000 bus.
Define your product information. Defaults will be set on initialization. For keeping defaults use 0xffff/0xff for int/char values and null ptr for pointers. LoadEquivalency is multiplication of 50 mA, what your device will take power from NMEA2000 bus. E.g. for Arduino only it can be 1 (=50mA). If your device does not take power from bus, set this to 0.
If you use device modes tNMEA2000::N2km_ListenOnly, tNMEA2000::N2km_ListenAndSend or N2km_SendOnly, function does not have effect.
_ModelSerialCode | Default="00000001". Max 32 chars. Manufacturer's Model serial code |
_ProductCode | Default=666. Manufacturer's product code. For certified devices this number will be given by NMEA organization. |
_ModelID | Default="Arduino N2k->PC". Max 33 chars. Manufacturer's Model ID |
_SwCode | Default="1.0.0.0". Max 40 chars. Manufacturer's software version code |
_ModelVersion | Default="1.0.0". Max 24 chars. Manufacturer's Model version |
_LoadEquivalency | Default=1. x * 50 mA |
_N2kVersion | Default=2101 |
_CertificationLevel | Default=1 |
iDev | index of the device on Devices |
Definition at line 745 of file NMEA2000.cpp.
void tNMEA2000::SetProductInformation | ( | const tProductInformation * | _ProductInformation, |
int | iDev = 0 |
||
) |
Set the Product Information of this device.
Call this if you want to save RAM and you have defined tProductInformation to PROGMEM as in example BatteryMonitor.ino
_ProductInformation | Product information, see tProductInformation |
iDev | index of the device on Devices |
Definition at line 736 of file NMEA2000.cpp.
void tNMEA2000::SetProgmemConfigurationInformation | ( | const char * | ManufacturerInformation, |
const char * | InstallationDescription1 = 0 , |
||
const char * | InstallationDescription2 = 0 |
||
) |
Set the Configuration Information located on PROGMEM.
With this function you can set configuration information, which will be saved on device program memory. See example BatteryMonitor.ino.
This function is useful only on MCUs with very small RAM. By using PROGMEM, installation description can not be changed by group function.
As default system has build in configuration information on progmem. If you do not want to have configuration information at all, you can disable it by calling SetConfigurationInformation(0);
ManufacturerInformation | Buffer for Manufacturer information |
InstallationDescription1 | Buffer for Installation Description 1 |
InstallationDescription2 | Buffer for Installation Description 2 |
Definition at line 802 of file NMEA2000.cpp.
void tNMEA2000::SetSingleFrameMessages | ( | const unsigned long * | _SingleFrameMessages | ) |
Set the list of known Single Frame Messages.
Call these if you wish to override the default message packets supported. Pointers must be in PROGMEM
As a default library has a list of known messages. With this function user can override default list of single frame messages.
Known single frame message lists has only effect if you limit handling with tNMEA2000::HandleOnlyKnownMessages or use message forwarding and limit it with tNMEA2000::SetForwardOnlyKnownMessages
_SingleFrameMessages | Buffer holding single frame messages |
Definition at line 1143 of file NMEA2000.cpp.
|
protected |
Starting the ISO Address Claim for all devices.
Definition at line 2406 of file NMEA2000.cpp.
|
protected |
Starting the ISO Address Claim for a device.
iDev | index of the device on Devices |
Definition at line 2393 of file NMEA2000.cpp.
|
protected |
Start sending an ISO-TP message.
msg | Reference to a N2kMsg Object |
iDev | index of the device on Devices |
true | |
false |
Definition at line 1926 of file NMEA2000.cpp.
|
protected |
ISO Transport Protocol handlers for multi packet support.
PGN | PGN |
Source | Source address |
Destination | Destination address |
len | length of the data payload |
buf | pointer to a byte buffer for the |
MsgIndex | MsgIndex for N2kCANMsgBuf |
true | |
false |
Definition at line 1786 of file NMEA2000.cpp.
|
protected |
Flag that the address has changed.
Definition at line 970 of file NMEA2000.h.
|
protected |
Buffer for library send out CAN frames.
CANSendFrameBuf is library internal buffer for frames waiting for sending. If CanSendFrame() can not send or buffer frame to driver buffer, frame will be stored to this buffer and its sending will be tried again on next SendMsg() or ParseMessages() call.
Inherited driver class can split size of MaxCANSendFrames to driver buffer and library buffer. Inherited class can even disable library buffer.
Definition at line 1035 of file NMEA2000.h.
|
protected |
Next write index for the library CAN send frame buffer.
Definition at line 1055 of file NMEA2000.h.
|
protected |
Next read index for the library CAN send frame buffer.
Definition at line 1052 of file NMEA2000.h.
|
protected |
Configuration Information of the device.
Definition at line 983 of file NMEA2000.h.
|
protected |
Attribute that holds the actual Debug Mode (default = md_none)
Definition at line 950 of file NMEA2000.h.
|
protected |
Number of devices.
Definition at line 977 of file NMEA2000.h.
|
protected |
Flag that the device information has changed.
Definition at line 972 of file NMEA2000.h.
|
protected |
Pointer to a buffer for all internal devices.
Definition at line 975 of file NMEA2000.h.
|
protected |
Definition at line 986 of file NMEA2000.h.
|
protected |
Actual message forward operation mode (default = all messages - also system and own)
Definition at line 959 of file NMEA2000.h.
|
protected |
Actual stream to be used for forward messaging.
Definition at line 961 of file NMEA2000.h.
|
protected |
Actual message forward type (default = fwdt_Actisense)
Definition at line 956 of file NMEA2000.h.
|
staticprotected |
Forward mode bit: -> If set, forward is enabled.
Definition at line 936 of file NMEA2000.h.
|
staticprotected |
Forward mode bit: -> Only known messages will be forwarded. System messages will be forwarded according its own bit.
Definition at line 941 of file NMEA2000.h.
|
staticprotected |
Forward mode bit: -> Forward also all messages, what this device will send.
Definition at line 944 of file NMEA2000.h.
|
staticprotected |
Forward mode bit: -> System messages will be forwarded.
Definition at line 938 of file NMEA2000.h.
|
staticprotected |
Forward mode bit: -> Only known messages will be handled.
Definition at line 946 of file NMEA2000.h.
|
protected |
Flag the Installation description has changed.
Definition at line 1746 of file NMEA2000.h.
|
protected |
Handler callbacks for 'ISORequest' messages.
Definition at line 1079 of file NMEA2000.h.
|
protected |
Pointer to a buffer for local Configuration Information.
Definition at line 981 of file NMEA2000.h.
|
protected |
Max number received CAN messages that can go to the buffer.
Definition at line 1061 of file NMEA2000.h.
|
protected |
Size of CANSendFrameBuf or before initialization requested total frame buffering size.
Member has two function. On setup program can request tNMEA2000::SetN2kCANSendFrameBufSize, which will be saved to this member. Inherited tNMEA2000::InitCANFrameBuffers can split size to driver buffer and library buffer.
Definition at line 1049 of file NMEA2000.h.
|
protected |
Size of N2kCANMsgBuf receiving message buffer.
Definition at line 1021 of file NMEA2000.h.
|
protected |
Handler callbacks for normal messages.
Definition at line 1077 of file NMEA2000.h.
|
protected |
Pointer to a buffer for Message Handlers.
Definition at line 963 of file NMEA2000.h.
|
protected |
Buffer for receiving messages.
Definition at line 1015 of file NMEA2000.h.
|
protected |
Actual operation mode of this device (default = N2km_ListenOnly)
Definition at line 954 of file NMEA2000.h.
|
protected |
Callback function, which will be called when library start bus communication.
OnOpen Will be called when library starts bus communication. At open library first starts address claiming and after it has been accepted, other communication can start. OnOpen can be used e.g., for message timing synchronization so that every time device starts messages will have same sent offset. See also SetOnOpen().
Definition at line 1074 of file NMEA2000.h.
|
protected |
Open the Scheduler
Definition at line 966 of file NMEA2000.h.
|
protected |
State of the ....
Definition at line 968 of file NMEA2000.h.
|
protected |
Pointer to Buffer for GRoup Function Handlers.
Definition at line 1083 of file NMEA2000.h.
|
protected |
Definition at line 985 of file NMEA2000.h.