NMEA2000 Library
0.1
Library to handle NMEA 2000 Communication written in C++
|
Default Group Function Handler for PGN 126993 - "Heartbeat". More...
#include <N2kGroupFunctionDefaultHandlers.h>
Public Member Functions | |
tN2kGroupFunctionHandlerForPGN126993 (tNMEA2000 *_pNMEA2000) | |
Public Member Functions inherited from tN2kGroupFunctionHandler | |
tN2kGroupFunctionHandler (tNMEA2000 *_pNMEA2000, unsigned long _PGN) | |
Construct a new tN2kGroupFunctionHandler object. More... | |
virtual bool | Handle (const tN2kMsg &N2kMsg, tN2kGroupFunctionCode GroupFunctionCode, unsigned long PGNForGroupFunction, int iDev) |
Handle group function message. More... | |
void | MatchRequestField (const char *FieldVal, const char *MatchVal, bool &Match, tN2kGroupFunctionParameterErrorCode &ErrorCode) |
Class to test does string field on group function match to PGN field value. More... | |
template<typename T > | |
void | MatchRequestField (T FieldVal, T MatchVal, T Mask, bool &Match, tN2kGroupFunctionParameterErrorCode &ErrorCode) |
Template class to test does field on group function match to PGN field value. More... | |
Protected Member Functions | |
virtual bool | HandleRequest (const tN2kMsg &N2kMsg, uint32_t TransmissionInterval, uint16_t TransmissionIntervalOffset, uint8_t NumberOfParameterPairs, int iDev) |
Handle response for request group function. More... | |
Protected Member Functions inherited from tN2kGroupFunctionHandler | |
virtual tN2kGroupFunctionTransmissionOrPriorityErrorCode | GetRequestGroupFunctionTransmissionOrPriorityErrorCode (uint32_t TransmissionInterval, uint16_t TransmissionIntervalOffset, bool UseIntervalLimits=false, uint32_t IntervalMax=N2k_MAX_TRANSMISSION_INTERVAL, uint32_t IntervalMin=50, bool UseOffsetLimits=false, uint16_t OffsetMax=N2k_MAX_TRANSMISSION_INTERVAL_OFFSET) |
Get request group function transmission or priority error code. More... | |
virtual bool | HandleAcknowledge (const tN2kMsg &N2kMsg, tN2kGroupFunctionPGNErrorCode PGNErrorCode, tN2kGroupFunctionTransmissionOrPriorityErrorCode TransmissionOrPriorityErrorCode, uint8_t NumberOfParameterPairs, int iDev) |
Default handle function for acknowledge group function. More... | |
virtual bool | HandleCommand (const tN2kMsg &N2kMsg, uint8_t PrioritySetting, uint8_t NumberOfParameterPairs, int iDev) |
Handle response for command group function. More... | |
virtual bool | HandleReadFields (const tN2kMsg &N2kMsg, uint16_t ManufacturerCode, uint8_t IndustryGroup, uint8_t UniqueID, uint8_t NumberOfSelectionPairs, uint8_t NumberOfParameterPairs, int iDev) |
Handle response for read fields group function. More... | |
virtual bool | HandleReadFieldsReply (const tN2kMsg &N2kMsg, int iDev) |
Handle read fields reply group function. More... | |
virtual bool | HandleRequest (const tN2kMsg &N2kMsg, uint32_t TransmissionInterval, uint16_t TransmissionIntervalOffset, uint8_t NumberOfParameterPairs, int iDev) |
Handle response for request group function. More... | |
virtual bool | HandleWriteFields (const tN2kMsg &N2kMsg, uint16_t ManufacturerCode, uint8_t IndustryGroup, uint8_t UniqueID, uint8_t NumberOfSelectionPairs, uint8_t NumberOfParameterPairs, int iDev) |
Handle response for write fields group function. More... | |
virtual bool | HandleWriteFieldsReply (const tN2kMsg &N2kMsg, int iDev) |
Handle write fields reply group function. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from tN2kGroupFunctionHandler | |
static void | AddAcknowledgeParameter (tN2kMsg &N2kMsg, uint8_t ParameterPairIndex, tN2kGroupFunctionParameterErrorCode ErrorCode=N2kgfpec_ReadOrWriteIsNotSupported) |
Add parameter error code to acknowledge group function message. More... | |
static void | ChangePNGErrorCode (tN2kMsg &N2kMsg, tN2kGroupFunctionPGNErrorCode PGNErrorCode) |
Change the PGN error code for a acknowledge group function message. More... | |
static void | ChangeTransmissionOrPriorityErrorCode (tN2kMsg &N2kMsg, tN2kGroupFunctionTransmissionOrPriorityErrorCode TransmissionOrPriorityErrorCode) |
Change transmission interval or priority error code for acknowledge group function message. More... | |
static unsigned long | GetPGNForGroupFunction (const tN2kMsg &N2kMsg) |
Get requested/commanded etc. PGN from group function message. More... | |
static bool | Parse (const tN2kMsg &N2kMsg, tN2kGroupFunctionCode &GroupFunctionCode, unsigned long &PGNForGroupFunction) |
Parse group function code and requested/commanded etc. PGN from group function message. More... | |
static bool | ParseAcknowledgeParams (const tN2kMsg &N2kMsg, tN2kGroupFunctionPGNErrorCode &PGNErrorCode, tN2kGroupFunctionTransmissionOrPriorityErrorCode &TransmissionOrPriorityErrorCode, uint8_t &NumberOfParameterPairs) |
Parse parameters from acknowledge group function message. More... | |
static bool | ParseCommandParams (const tN2kMsg &N2kMsg, uint8_t &PrioritySetting, uint8_t &NumberOfParameterPairs) |
Parse parameters from command group function message. More... | |
static bool | ParseReadOrWriteParams (const tN2kMsg &N2kMsg, uint16_t &ManufacturerCode, uint8_t &IndustryGroup, uint8_t &UniqueID, uint8_t &NumberOfSelectionPairs, uint8_t &NumberOfParameterPairs, bool Proprietary=false) |
Parse parameters from read or write group function message. More... | |
static bool | ParseRequestParams (const tN2kMsg &N2kMsg, uint32_t &TransmissionInterval, uint16_t &TransmissionIntervalOffset, uint8_t &NumberOfParameterPairs) |
Parse parameters from request group function message. More... | |
static void | SendAcknowledge (tNMEA2000 *pNMEA2000, unsigned char Destination, int iDev, unsigned long PGN, tN2kGroupFunctionPGNErrorCode PGNErrorCode, tN2kGroupFunctionTransmissionOrPriorityErrorCode TransmissionOrPriorityErrorCode, uint8_t NumberOfParameterPairs=0, tN2kGroupFunctionParameterErrorCode ParameterErrorCodeForAll=N2kgfpec_Acknowledge) |
Send out an acknowledge group function message. More... | |
static void | SetStartAcknowledge (tN2kMsg &N2kMsg, unsigned char Destination, unsigned long PGN, tN2kGroupFunctionPGNErrorCode PGNErrorCode, tN2kGroupFunctionTransmissionOrPriorityErrorCode TransmissionOrPriorityErrorCode, uint8_t NumberOfParameterPairs=0) |
Setting up the group function message for Acknowledge. More... | |
static void | SetStartReadReply (tN2kMsg &N2kMsg, unsigned char Destination, unsigned long PGN, uint16_t ManufacturerCode, uint8_t IndustryGroup, uint8_t UniqueID, uint8_t NumberOfSelectionPairs, uint8_t NumberOfParameterPairs, bool Proprietary) |
Setup start parameters for read reply group function message. More... | |
static void | SetStartWriteReply (tN2kMsg &N2kMsg, unsigned char Destination, unsigned long PGN, uint16_t ManufacturerCode, uint8_t IndustryGroup, uint8_t UniqueID, uint8_t NumberOfSelectionPairs, uint8_t NumberOfParameterPairs, bool Proprietary) |
Setup start parameters for write reply group function message. More... | |
static bool | StartParseCommandPairParameters (const tN2kMsg &N2kMsg, int &Index) |
Get start Index of pair parameters from command group function message. More... | |
static bool | StartParseReadOrWriteParameters (const tN2kMsg &N2kMsg, bool Proprietary, int &Index) |
Get start index of pair parameters on the read or write group function message. More... | |
static bool | StartParseRequestPairParameters (const tN2kMsg &N2kMsg, int &Index) |
Get start Index of pair parameters from request group function message. More... | |
Protected Attributes inherited from tN2kGroupFunctionHandler | |
unsigned long | PGN |
Parameter Group Number (PGN) of this Group Function. More... | |
tNMEA2000 * | pNMEA2000 |
NMEA2000 object in order to send messages to the bus More... | |
bool | Proprietary |
Flag, if the Parameter Group is proprietary More... | |
Default Group Function Handler for PGN 126993 - "Heartbeat".
This PGN shall be transmitted by all NMEA devices. Reception of this PGN confirms that a device is still present on the network. Reception of this PGN may also be used to maintain an address to NAME association table within the receiving device.
Definition at line 116 of file N2kGroupFunctionDefaultHandlers.h.
|
inline |
Definition at line 124 of file N2kGroupFunctionDefaultHandlers.h.
|
protectedvirtual |
Handle response for request group function.
Default response is "not supported". Certified devices must have inherited handler and respond for requests for all device transmit PGNs.
Use GetRequestGroupFunctionTransmissionOrPriorityErrorCode to get error code for transmission interval/offset request. If that returns N2kgfTPec_Acknowledge, modify your PGN transmission interval/offset according to request.
Handler must returns true, if it handled request, false otherwise.
See example of overrided handler on
N2kMsg | Reference to request group function message (PGN 126208) |
TransmissionInterval | Transmission interval [ms] |
TransmissionIntervalOffset | Offset to the transmission interval [10ms] |
NumberOfParameterPairs | Number of parameter pairs contained inside the group function message |
iDev | Index off the device in tNMEA2000::Devices |
true | If request was handled. |
false | If request was not handled. |
Reimplemented from tN2kGroupFunctionHandler.
Definition at line 504 of file N2kGroupFunctionDefaultHandlers.cpp.