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

Default Group Function Handler for PGN 60928 - "ISO Address Claim". More...

#include <N2kGroupFunctionDefaultHandlers.h>

Inheritance diagram for tN2kGroupFunctionHandlerForPGN60928:
Collaboration diagram for tN2kGroupFunctionHandlerForPGN60928:

Public Member Functions

 tN2kGroupFunctionHandlerForPGN60928 (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 60928 - "ISO Address Claim".

For requirements for handling Group function request for PGN 60928 - "ISO Address Claim"

Note
This handler is mandatory for NMEA 2000 certified devices.

This network management message is used to claim a network address and to respond with device information (NAME) requested by the ISO Request or Complex Request Group Function. This PGN contains several fields that are Request Parameters that can be used to control the expected response to requests for this PGN.

[See document] (https://web.archive.org/web/20150910070107/http://www.nmea.org/Assets/20140710%20nmea-2000-060928%20iso%20address%20claim%20pgn%20corrigendum.pdf)

Definition at line 63 of file N2kGroupFunctionDefaultHandlers.h.

Constructor & Destructor Documentation

◆ tN2kGroupFunctionHandlerForPGN60928()

tN2kGroupFunctionHandlerForPGN60928::tN2kGroupFunctionHandlerForPGN60928 ( tNMEA2000 _pNMEA2000)
inline

Definition at line 72 of file N2kGroupFunctionDefaultHandlers.h.

Member Function Documentation

◆ HandleCommand()

bool tN2kGroupFunctionHandlerForPGN60928::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 136 of file N2kGroupFunctionDefaultHandlers.cpp.

◆ HandleRequest()

bool tN2kGroupFunctionHandlerForPGN60928::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 44 of file N2kGroupFunctionDefaultHandlers.cpp.


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