NMEA2000 Library  0.1
Library to handle NMEA 2000 Communication written in C++
tN2kGroupFunctionHandlerForPGN126998 Class Reference

Default Group Function Handler for PGN 126998 - "Configuration Information". More...

#include <N2kGroupFunctionDefaultHandlers.h>

Inheritance diagram for tN2kGroupFunctionHandlerForPGN126998:
Collaboration diagram for tN2kGroupFunctionHandlerForPGN126998:

Public Member Functions

 tN2kGroupFunctionHandlerForPGN126998 (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 HandleCommand (const tN2kMsg &N2kMsg, uint8_t PrioritySetting, uint8_t NumberOfParameterPairs, int iDev)
 Handle response for command 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...
 
- 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...
 
tNMEA2000pNMEA2000
 NMEA2000 object in order to send messages to the bus
More...
 
bool Proprietary
 Flag, if the Parameter Group is proprietary
More...
 

Detailed Description

Default Group Function Handler for PGN 126998 - "Configuration Information".

Free-form alphanumeric fields describing the installation (e.g., starboard engine room location) of the device and installation notes (e.g., calibration data).

Note
This is not mandatory, but preferred

Definition at line 162 of file N2kGroupFunctionDefaultHandlers.h.

Constructor & Destructor Documentation

◆ tN2kGroupFunctionHandlerForPGN126998()

tN2kGroupFunctionHandlerForPGN126998::tN2kGroupFunctionHandlerForPGN126998 ( tNMEA2000 _pNMEA2000)
inline

Definition at line 171 of file N2kGroupFunctionDefaultHandlers.h.

Member Function Documentation

◆ HandleCommand()

bool tN2kGroupFunctionHandlerForPGN126998::HandleCommand ( const tN2kMsg N2kMsg,
uint8_t  PrioritySetting,
uint8_t  NumberOfParameterPairs,
int  iDev 
)
protectedvirtual

Handle response for command group function.

Default response is "not supported". If you support command group function for your transmit PGN, inherit default handler and override HandleCommand for it.

Handler must returns true, if it handled command, false otherwise.

See example of overrided handler on

Parameters
N2kMsgReference to command group function message (PGN 126208)
PrioritySettingPriority Setting
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
iDevIndex off the device in tNMEA2000::Devices
Return values
trueIf command was handled.
falseIf command was not handled.

Reimplemented from tN2kGroupFunctionHandler.

Definition at line 457 of file N2kGroupFunctionDefaultHandlers.cpp.

◆ HandleRequest()

bool tN2kGroupFunctionHandlerForPGN126998::HandleRequest ( const tN2kMsg N2kMsg,
uint32_t  TransmissionInterval,
uint16_t  TransmissionIntervalOffset,
uint8_t  NumberOfParameterPairs,
int  iDev 
)
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

Parameters
N2kMsgReference to request group function message (PGN 126208)
TransmissionIntervalTransmission interval [ms]
TransmissionIntervalOffsetOffset to the transmission interval [10ms]
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
iDevIndex off the device in tNMEA2000::Devices
Return values
trueIf request was handled.
falseIf request was not handled.

Reimplemented from tN2kGroupFunctionHandler.

Definition at line 372 of file N2kGroupFunctionDefaultHandlers.cpp.


The documentation for this class was generated from the following files: