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

Base handler class for Group Functions. More...

#include <N2kGroupFunction.h>

Inheritance diagram for tN2kGroupFunctionHandler:
Collaboration diagram for tN2kGroupFunctionHandler:

Public Member Functions

 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...
 

Static Public Member Functions

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 Member Functions

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...
 

Protected Attributes

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...
 

Friends

class tNMEA2000
 

Detailed Description

Base handler class for Group Functions.

This class handles all functions which are needed to respond to group function messages. NMEA 2000 definition requires that devices should respond group function messages. This class is base class and works also as default handler, which simply responds “unsupported” for all group functions. To fulfill certification requirement developer should inherit this base class, write supported functions and register handler class to library with tNMEA2000::AddGroupFunctionHandler(). One can find examples for implementation from N2kGroupFunctionDefaultHandlers.h. See e.g., tN2kGroupFunctionHandlerForPGN126998.

Library has inherited default handlers for required system PGNs declared in N2kGroupFunctionDefaultHandlers.h . Those can be used as sample for other PGN group function handlers.

NMEA 2000 library calls each registered handler class until some responses to Handle call true, meaning that it handled request. After get true return library stops requesting handling for rest registered handler classes.

Note
If your device transmits several e.g., 130316, you must handle them with single inherited handler. This is because e.g., if some device request 130316 from your device without parameters, you can not return true, since then library does not handle others and you can not return false, since then at end library responses with default acknowledge group function with "unsupported".

Definition at line 260 of file N2kGroupFunction.h.

Constructor & Destructor Documentation

◆ tN2kGroupFunctionHandler()

tN2kGroupFunctionHandler::tN2kGroupFunctionHandler ( tNMEA2000 _pNMEA2000,
unsigned long  _PGN 
)

Construct a new tN2kGroupFunctionHandler object.

Parameters
_pNMEA2000Pointer to an NMEA2000 object, see tNMEA2000
_PGNParameter Group Number associated with this Group function

Definition at line 30 of file N2kGroupFunction.cpp.

Member Function Documentation

◆ AddAcknowledgeParameter()

void tN2kGroupFunctionHandler::AddAcknowledgeParameter ( tN2kMsg N2kMsg,
uint8_t  ParameterPairIndex,
tN2kGroupFunctionParameterErrorCode  ErrorCode = N2kgfpec_ReadOrWriteIsNotSupported 
)
static

Add parameter error code to acknowledge group function message.

This is a static function for adding parameter error code to prepared PGN 126208 acknowledge group function.

Parameters
N2kMsgInput: Prepared acknowledge group function message
Output: Acknowledge group function message with added parameter error code.
ParameterPairIndexIndex of the parameter pair
ErrorCodeError code to be added to the message

Definition at line 449 of file N2kGroupFunction.cpp.

◆ ChangePNGErrorCode()

void tN2kGroupFunctionHandler::ChangePNGErrorCode ( tN2kMsg N2kMsg,
tN2kGroupFunctionPGNErrorCode  PGNErrorCode 
)
static

Change the PGN error code for a acknowledge group function message.

This is a static function for changing PGN error code of prepared PGN 126208 acknowledge group function.

Parameters
N2kMsgInput: Prepared acknowledge group function message
Output: Acknowledge group function message with updated PGN error code.
PGNErrorCodePGN error code, see tN2kGroupFunctionPGNErrorCode

Definition at line 433 of file N2kGroupFunction.cpp.

◆ ChangeTransmissionOrPriorityErrorCode()

void tN2kGroupFunctionHandler::ChangeTransmissionOrPriorityErrorCode ( tN2kMsg N2kMsg,
tN2kGroupFunctionTransmissionOrPriorityErrorCode  TransmissionOrPriorityErrorCode 
)
static

Change transmission interval or priority error code for acknowledge group function message.

This is a static function for changing transmission interval or priority error code of prepared PGN 126208 acknowledge group function.

Parameters
N2kMsgInput: Prepared acknowledge group function message
Output: Acknowledge group function message with updated transmission interval or priority error code.
TransmissionOrPriorityErrorCodeTransmission interval or priority error code code, see tN2kGroupFunctionTransmissionOrPriorityErrorCode

Definition at line 441 of file N2kGroupFunction.cpp.

◆ GetPGNForGroupFunction()

unsigned long tN2kGroupFunctionHandler::GetPGNForGroupFunction ( const tN2kMsg N2kMsg)
static

Get requested/commanded etc. PGN from group function message.

This is a static function for PGN 126208 handling. The function reads PGN (as 3 bytes) from the group function message.

Parameters
N2kMsgReference to a N2kMsg Object. This message must be PGN 126208 group function message
Returns
unsigned long -> Requested/commanded etc. PGN for Group Function. If N2kMsg is not PGN 126208, result can be anything.

Definition at line 249 of file N2kGroupFunction.cpp.

◆ GetRequestGroupFunctionTransmissionOrPriorityErrorCode()

tN2kGroupFunctionTransmissionOrPriorityErrorCode tN2kGroupFunctionHandler::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 
)
protectedvirtual

Get request group function transmission or priority error code.

Function for resolving transmission or priority error code in tN2kGroupFunctionHandler::HandleRequest function according requested input and interval/offset limits requested PGN accepts. Function resolves only error code. If result is N2kgfTPec_Acknowledge you have to handle also possible change for interval/offset elsewhere on your inherited HandleRequest.

If you support changing for interval and/or offset for your PGN simply use function as is. If you need to set offset limits set UseIntervalLimits and/or UseOffsetLimits and provide limits. For special handling you can override function.

Note
On NMEA certification tests "C.3.13.2 Expanded Acknowledgment Message Timing" old tool does not know interval 0xFFFFFFFE=Restore Default Interval and so fails test. Use new test tool sw version or comment that out.

See example of using function on

Parameters
TransmissionIntervalInterval for Transmission
TransmissionIntervalOffsetOffset for Transmission Interval
UseIntervalLimitsUse the Interval limits
IntervalMaxMaximum Interval
IntervalMinMinimum Interval
UseOffsetLimitsUse Offset limits
OffsetMaxMaximum offset
Return values
N2kgfTPec_AcknowledgeBoth interval or offset are within limits or requested to keep current or restore default.
N2kgfTPec_TransmitIntervalOrPriorityNotSupportedFor other cases. HandleRequest should not change requested PGN interval or offset and should return acknowledge group function with error code.

Definition at line 108 of file N2kGroupFunction.cpp.

◆ Handle()

bool tN2kGroupFunctionHandler::Handle ( const tN2kMsg N2kMsg,
tN2kGroupFunctionCode  GroupFunctionCode,
unsigned long  PGNForGroupFunction,
int  iDev 
)
virtual

Handle group function message.

Function parses group function PGN 126208 and forwards handling to specific handler like HandleRequest. This simplifies code for user inherited tN2kGroupFunctionHandler class, since often it is enough just override HandleRequest and let other handlers use default response.

See also
Parameters
N2kMsgReference to a N2kMsg Object, This message is an Group function message
GroupFunctionCodeCode for Group Function, see tN2kGroupFunctionCode
PGNForGroupFunctionPGN for the Group function
iDevIndex off the device in tNMEA2000::Devices
Return values
trueGroup Function was handled properly
falseif (PGN!=PGNForGroupFunction && PGN!=0) or group function was not handled.

Definition at line 38 of file N2kGroupFunction.cpp.

◆ HandleAcknowledge()

bool tN2kGroupFunctionHandler::HandleAcknowledge ( const tN2kMsg N2kMsg,
tN2kGroupFunctionPGNErrorCode  PGNErrorCode,
tN2kGroupFunctionTransmissionOrPriorityErrorCode  TransmissionOrPriorityErrorCode,
uint8_t  NumberOfParameterPairs,
int  iDev 
)
protectedvirtual

Default handle function for acknowledge group function.

This function handles Acknowledge group function, which is response for Request, Command, ReadFields or WriteFields group function.

Note
As default, this simply returns true meaning that received acknowledge has been handled. So you need to override this, if your device will send one of group functions to other devices.
Parameters
N2kMsgReference to acknowledge group function message (PGN 126208)
PGNErrorCodePGN Error Code, see tN2kGroupFunctionPGNErrorCode
TransmissionOrPriorityErrorCodesee tN2kGroupFunctionTransmissionOrPriorityErrorCode
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
iDevIndex off the device in tNMEA2000::Devices
Return values
trueIf acknowledge was handled.
falseIf acknowledge was not handled.

Definition at line 189 of file N2kGroupFunction.cpp.

◆ HandleCommand()

bool tN2kGroupFunctionHandler::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 in tN2kGroupFunctionHandlerForPGN60928, and tN2kGroupFunctionHandlerForPGN126998.

Definition at line 170 of file N2kGroupFunction.cpp.

◆ HandleReadFields()

bool tN2kGroupFunctionHandler::HandleReadFields ( const tN2kMsg N2kMsg,
uint16_t  ManufacturerCode,
uint8_t  IndustryGroup,
uint8_t  UniqueID,
uint8_t  NumberOfSelectionPairs,
uint8_t  NumberOfParameterPairs,
int  iDev 
)
protectedvirtual

Handle response for read fields group function.

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

Handler must returns true, if it handled read fields, false otherwise.

Parameters
N2kMsgReference to read fields group function message (PGN 126208)
ManufacturerCodeManufacturer Code, This will be set to 0xffff for non-propprietary PNGs
IndustryGroupIndustry Group Code, This will be set to 0xff for non-propprietary PNGs
UniqueIDUnique ID for the device
NumberOfSelectionPairsNumber of Selection pairs contained inside the group function message
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
iDevIndex off the device in tNMEA2000::Devices
Return values
trueIf read fields was handled.
falseIf read fields was not handled.

Definition at line 199 of file N2kGroupFunction.cpp.

◆ HandleReadFieldsReply()

bool tN2kGroupFunctionHandler::HandleReadFieldsReply ( const tN2kMsg N2kMsg,
int  iDev 
)
protectedvirtual

Handle read fields reply group function.

Note
As default, this simply returns true meaning that received read fields reply has been handled. So you need to override this, if your device will send read fields group functions to other devices.
Parameters
N2kMsgReference to read fields reply group function message (PGN 126208)
iDevIndex off the device in tNMEA2000::Devices
Return values
trueIf read fields reply was handled.
falseIf read fields reply was not handled.

Definition at line 218 of file N2kGroupFunction.cpp.

◆ HandleRequest()

bool tN2kGroupFunctionHandler::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 in tN2kGroupFunctionHandlerForPGN60928, tN2kGroupFunctionHandlerForPGN126464, tN2kGroupFunctionHandlerForPGN126993, tN2kGroupFunctionHandlerForPGN126996, and tN2kGroupFunctionHandlerForPGN126998.

Definition at line 138 of file N2kGroupFunction.cpp.

◆ HandleWriteFields()

bool tN2kGroupFunctionHandler::HandleWriteFields ( const tN2kMsg N2kMsg,
uint16_t  ManufacturerCode,
uint8_t  IndustryGroup,
uint8_t  UniqueID,
uint8_t  NumberOfSelectionPairs,
uint8_t  NumberOfParameterPairs,
int  iDev 
)
protectedvirtual

Handle response for write fields group function.

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

Handler must returns true, if it handled write fields, false otherwise.

Parameters
N2kMsgReference to write fields group function message (PGN 126208)
ManufacturerCodeManufacturer Code, This will be set to 0xffff for non-propprietary PNGs
IndustryGroupIndustry Group Code, This will be set to 0xff for non-propprietary PNGs
UniqueIDUnique ID for the device
NumberOfSelectionPairsNumber of Selection pairs contained inside the group function message
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
iDevIndex off the device in tNMEA2000::Devices
Return values
trueIf write fields was handled.
falseIf write fields was not handled.

Definition at line 224 of file N2kGroupFunction.cpp.

◆ HandleWriteFieldsReply()

bool tN2kGroupFunctionHandler::HandleWriteFieldsReply ( const tN2kMsg N2kMsg,
int  iDev 
)
protectedvirtual

Handle write fields reply group function.

Note
As default, this simply returns true meaning that received write fields reply has been handled. So you need to override this, if your device will send write fields group functions to other devices.
Parameters
N2kMsgReference to write fields reply group function message (PGN 126208)
iDevIndex off the device in tNMEA2000::Devices
Return values
trueAlways

Definition at line 243 of file N2kGroupFunction.cpp.

◆ MatchRequestField() [1/2]

void tN2kGroupFunctionHandler::MatchRequestField ( const char *  FieldVal,
const char *  MatchVal,
bool &  Match,
tN2kGroupFunctionParameterErrorCode ErrorCode 
)
inline

Class to test does string field on group function match to PGN field value.

Some group functions contains filter fields which should match to requested/commanded PGN field. E.g., you may receive request group function globally addressed (255) with some group of field filters. Before you respond request all fields must match to your PGN. See example tN2kGroupFunctionHandlerForPGN126996::HandleRequest().

Parameters
FieldVal{type}
MatchVal{type}
Match{type}
ErrorCode{type}

Definition at line 298 of file N2kGroupFunction.h.

◆ MatchRequestField() [2/2]

template<typename T >
void tN2kGroupFunctionHandler::MatchRequestField ( FieldVal,
MatchVal,
Mask,
bool &  Match,
tN2kGroupFunctionParameterErrorCode ErrorCode 
)
inline

Template class to test does field on group function match to PGN field value.

Some group functions contains filter fields which should match to requested/commanded PGN field. E.g., you may receive request group function globally addressed (255) with some group of field filters. Before you respond request all fields must match to your PGN. See example tN2kGroupFunctionHandlerForPGN126996::HandleRequest().

Template Parameters
T
Parameters
FieldVal
MatchVal
Mask
Match
ErrorCode

Definition at line 277 of file N2kGroupFunction.h.

◆ Parse()

bool tN2kGroupFunctionHandler::Parse ( const tN2kMsg N2kMsg,
tN2kGroupFunctionCode GroupFunctionCode,
unsigned long &  PGNForGroupFunction 
)
static

Parse group function code and requested/commanded etc. PGN from group function message.

This is a static function for PGN 126208 handling.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
GroupFunctionCodeGroup Function Code, see tN2kGroupFunctionCode
PGNForGroupFunctionPGN for the Group function
Return values
true
falseif (N2kMsg.PGN!=126208L)

Definition at line 255 of file N2kGroupFunction.cpp.

◆ ParseAcknowledgeParams()

bool tN2kGroupFunctionHandler::ParseAcknowledgeParams ( const tN2kMsg N2kMsg,
tN2kGroupFunctionPGNErrorCode PGNErrorCode,
tN2kGroupFunctionTransmissionOrPriorityErrorCode TransmissionOrPriorityErrorCode,
uint8_t &  NumberOfParameterPairs 
)
static

Parse parameters from acknowledge group function message.

This is a static function for PGN 126208 handling.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
PGNErrorCodePGN error code, see tN2kGroupFunctionPGNErrorCode
TransmissionOrPriorityErrorCodeTransmission or Priority error code, see tN2kGroupFunctionTransmissionOrPriorityErrorCode
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
Return values
true
falseif (N2kMsg.PGN!=126208L)

Definition at line 313 of file N2kGroupFunction.cpp.

◆ ParseCommandParams()

bool tN2kGroupFunctionHandler::ParseCommandParams ( const tN2kMsg N2kMsg,
uint8_t &  PrioritySetting,
uint8_t &  NumberOfParameterPairs 
)
static

Parse parameters from command group function message.

This is a static function for PGN 126208 handling.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
PrioritySettingPriority setting
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
Return values
true
falseif (N2kMsg.PGN!=126208L)

Definition at line 293 of file N2kGroupFunction.cpp.

◆ ParseReadOrWriteParams()

bool tN2kGroupFunctionHandler::ParseReadOrWriteParams ( const tN2kMsg N2kMsg,
uint16_t &  ManufacturerCode,
uint8_t &  IndustryGroup,
uint8_t &  UniqueID,
uint8_t &  NumberOfSelectionPairs,
uint8_t &  NumberOfParameterPairs,
bool  Proprietary = false 
)
static

Parse parameters from read or write group function message.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
ManufacturerCodeManufacturer Code, This will be set to 0xffff for non-propprietary PNGs
IndustryGroupIndustry Group Code, This will be set to 0xff for non-propprietary PNGs
UniqueIDUnique ID for the device
NumberOfSelectionPairsNumber of Selection pairs contained inside the group function message
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
ProprietaryGroup function is proprietary
Return values
true
falseif (N2kMsg.PGN!=126208L)

Definition at line 342 of file N2kGroupFunction.cpp.

◆ ParseRequestParams()

bool tN2kGroupFunctionHandler::ParseRequestParams ( const tN2kMsg N2kMsg,
uint32_t &  TransmissionInterval,
uint16_t &  TransmissionIntervalOffset,
uint8_t &  NumberOfParameterPairs 
)
static

Parse parameters from request group function message.

This is a static function for PGN 126208 handling.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
TransmissionIntervalTransmission interval
TransmissionIntervalOffsetOffset to the transmission interval
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
Return values
true
falseif (N2kMsg.PGN!=126208L)

Definition at line 271 of file N2kGroupFunction.cpp.

◆ SendAcknowledge()

void tN2kGroupFunctionHandler::SendAcknowledge ( tNMEA2000 pNMEA2000,
unsigned char  Destination,
int  iDev,
unsigned long  PGN,
tN2kGroupFunctionPGNErrorCode  PGNErrorCode,
tN2kGroupFunctionTransmissionOrPriorityErrorCode  TransmissionOrPriorityErrorCode,
uint8_t  NumberOfParameterPairs = 0,
tN2kGroupFunctionParameterErrorCode  ParameterErrorCodeForAll = N2kgfpec_Acknowledge 
)
static

Send out an acknowledge group function message.

Function builds simple acknowledge group function message with given parameters. This is useful for sending response for no parameters or parameters with same error code.

Parameters
pNMEA2000NMEA2000 object
DestinationDestination source address
iDevIndex off the device in tNMEA2000::Devices
PGNPGN handled
PGNErrorCodePGN error code, see tN2kGroupFunctionPGNErrorCode
TransmissionOrPriorityErrorCodeTransmission or Priority error code, see tN2kGroupFunctionTransmissionOrPriorityErrorCode
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
ParameterErrorCodeForAllError code for all parameter sets, see tN2kGroupFunctionParameterErrorCode

Definition at line 461 of file N2kGroupFunction.cpp.

◆ SetStartAcknowledge()

void tN2kGroupFunctionHandler::SetStartAcknowledge ( tN2kMsg N2kMsg,
unsigned char  Destination,
unsigned long  PGN,
tN2kGroupFunctionPGNErrorCode  PGNErrorCode,
tN2kGroupFunctionTransmissionOrPriorityErrorCode  TransmissionOrPriorityErrorCode,
uint8_t  NumberOfParameterPairs = 0 
)
static

Setting up the group function message for Acknowledge.

This is a static function for setting up start of PGN 126208 acknowledge group function.

Parameters
N2kMsgInput: Reference to a N2kMsg Object
Output: Acknowledge group function message prepared with start parameters.
DestinationDestination source address
PGNPGN handled
PGNErrorCodePGN error code, see tN2kGroupFunctionPGNErrorCode
TransmissionOrPriorityErrorCodeTransmission or Priority error code, see tN2kGroupFunctionTransmissionOrPriorityErrorCode
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message

Definition at line 416 of file N2kGroupFunction.cpp.

◆ SetStartReadReply()

void tN2kGroupFunctionHandler::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 
)
static

Setup start parameters for read reply group function message.

This is a static function for PGN 126208 read fields group function handling.

Parameters
N2kMsgInput: Reference to a N2kMsg Object
Output: Read reply group function message prepared with start parameters.
DestinationDestination source address
PGNPGN handled
ManufacturerCodeManufacturer Code, This will be set to 0xffff for non-propprietary PNGs
IndustryGroupIndustry Group Code, This will be set to 0xff for non-propprietary PNGs
UniqueIDUnique ID for the device
NumberOfSelectionPairsNumber of Selection pairs contained inside the group function message
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
ProprietaryIs this a proprietary group function

Definition at line 388 of file N2kGroupFunction.cpp.

◆ SetStartWriteReply()

void tN2kGroupFunctionHandler::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 
)
static

Setup start parameters for write reply group function message.

This is a static function for PGN 126208 write fields group function handling.

Parameters
N2kMsgInput: Reference to a N2kMsg Object
Output: Write reply group function message prepared with start parameters.
DestinationDestination source address
PGNPGN handled
ManufacturerCodeManufacturer Code, This will be set to 0xffff for non-propprietary PNGs
IndustryGroupIndustry Group Code, This will be set to 0xff for non-propprietary PNGs
UniqueIDUnique ID for the device
NumberOfSelectionPairsNumber of Selection pairs contained inside the group function message
NumberOfParameterPairsNumber of parameter pairs contained inside the group function message
ProprietaryIs this a proprietary group function

Definition at line 402 of file N2kGroupFunction.cpp.

◆ StartParseCommandPairParameters()

bool tN2kGroupFunctionHandler::StartParseCommandPairParameters ( const tN2kMsg N2kMsg,
int &  Index 
)
static

Get start Index of pair parameters from command group function message.

This is a static function for PGN 126208 handling.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
IndexIndex where the Command Pair Parameters start
Return values
true
falseif (N2kMsg.PGN!=126208L)

Definition at line 305 of file N2kGroupFunction.cpp.

◆ StartParseReadOrWriteParameters()

bool tN2kGroupFunctionHandler::StartParseReadOrWriteParameters ( const tN2kMsg N2kMsg,
bool  Proprietary,
int &  Index 
)
static

Get start index of pair parameters on the read or write group function message.

This is a static function for PGN 126208 read or write fields group function handling.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
ProprietaryGroup function is proprietary
IndexIndex where the Command Pair Parameters start
Return values
true

Definition at line 330 of file N2kGroupFunction.cpp.

◆ StartParseRequestPairParameters()

bool tN2kGroupFunctionHandler::StartParseRequestPairParameters ( const tN2kMsg N2kMsg,
int &  Index 
)
static

Get start Index of pair parameters from request group function message.

This is a static function for PGN 126208 handling.

Parameters
N2kMsgReference to a N2kMsg Object. This message should be PGN 126208 group function message
IndexIndex where the Request Pair Parameters start
Return values
true
falseif (N2kMsg.PGN!=126208L)

Definition at line 285 of file N2kGroupFunction.cpp.

Friends And Related Function Documentation

◆ tNMEA2000

friend class tNMEA2000
friend

Definition at line 307 of file N2kGroupFunction.h.

Member Data Documentation

◆ PGN

unsigned long tN2kGroupFunctionHandler::PGN
protected

Parameter Group Number (PGN) of this Group Function.

Definition at line 311 of file N2kGroupFunction.h.

◆ pNMEA2000

tNMEA2000* tN2kGroupFunctionHandler::pNMEA2000
protected

NMEA2000 object in order to send messages to the bus

Definition at line 315 of file N2kGroupFunction.h.

◆ Proprietary

bool tN2kGroupFunctionHandler::Proprietary
protected

Flag, if the Parameter Group is proprietary

Definition at line 313 of file N2kGroupFunction.h.


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