57#ifndef _N2kGroupFunction_H_
58#define _N2kGroupFunction_H_
66#if !defined(N2K_NO_GROUP_FUNCTION_SUPPORT)
68#define N2k_KEEP_TRANSMISSION_INTERVAL 0xffffffff
69#define N2k_RESTORE_TRANSMISSION_INTERVAL 0xfffffffe
70#define N2k_MAX_TRANSMISSION_INTERVAL 0xfffffff0
71#define N2k_MAX_TRANSMISSION_INTERVAL_OFFSET 0xfffc
279 if ( (FieldVal&Mask)!=MatchVal ) {
300 Match&=(strcmp(FieldVal,MatchVal)==0);
358 uint32_t TransmissionInterval,
359 uint16_t TransmissionIntervalOffset,
360 bool UseIntervalLimits=
false,
362 uint32_t IntervalMin=50,
363 bool UseOffsetLimits=
false,
394 uint32_t TransmissionInterval,
395 uint16_t TransmissionIntervalOffset,
396 uint8_t NumberOfParameterPairs,
419 virtual bool HandleCommand(
const tN2kMsg &N2kMsg, uint8_t PrioritySetting, uint8_t NumberOfParameterPairs,
int iDev);
445 uint8_t NumberOfParameterPairs,
473 uint16_t ManufacturerCode,
474 uint8_t IndustryGroup,
476 uint8_t NumberOfSelectionPairs,
477 uint8_t NumberOfParameterPairs,
520 uint16_t ManufacturerCode,
521 uint8_t IndustryGroup,
523 uint8_t NumberOfSelectionPairs,
524 uint8_t NumberOfParameterPairs,
610 unsigned long &PGNForGroupFunction);
628 uint32_t &TransmissionInterval,
629 uint16_t &TransmissionIntervalOffset,
630 uint8_t &NumberOfParameterPairs);
661 uint8_t &PrioritySetting,
662 uint8_t &NumberOfParameterPairs);
697 uint8_t &NumberOfParameterPairs);
733 uint16_t &ManufacturerCode,
734 uint8_t &IndustryGroup,
736 uint8_t &NumberOfSelectionPairs,
737 uint8_t &NumberOfParameterPairs,
762 uint16_t ManufacturerCode,
763 uint8_t IndustryGroup,
765 uint8_t NumberOfSelectionPairs,
766 uint8_t NumberOfParameterPairs,
791 uint16_t ManufacturerCode,
792 uint8_t IndustryGroup,
794 uint8_t NumberOfSelectionPairs,
795 uint8_t NumberOfParameterPairs,
817 uint8_t NumberOfParameterPairs=0);
860 uint8_t ParameterPairIndex,
885 uint8_t NumberOfParameterPairs=0,
#define N2k_MAX_TRANSMISSION_INTERVAL_OFFSET
tN2kGroupFunctionParameterErrorCode
Error Codes Command used by acknowledge group function.
@ N2kgfpec_TemporarilyUnableToComply
@ N2kgfpec_RequestOrCommandNotSupported
@ N2kgfpec_InvalidRequestOrCommandParameterField
@ N2kgfpec_ReadOrWriteIsNotSupported
@ N2kgfpec_RequestOrCommandParameterOutOfRange
tN2kGroupFunctionPGNErrorCode
PGN error code used by acknowledge group function.
@ N2kgfPGNec_PGNTemporarilyNotAvailable
@ N2kgfPGNec_AccessDenied
@ N2kgfPGNec_RequestOrCommandNotSupported
@ N2kgfPGNec_DefinerTagNotSupported
@ N2kgfPGNec_PGNNotSupported
@ N2kgfPGNec_ReadOrWriteNotSupported
tN2kGroupFunctionTransmissionOrPriorityErrorCode
Error codes Transmit interval used by acknowledge group function.
@ N2kgfTPec_TransmitIntervalIsLessThanMeasurementInterval
@ N2kgfTPec_TransmitIntervalOrPriorityNotSupported
@ N2kgfTPec_RequestNotSupported
tN2kGroupFunctionCode
FunctionCode for the group function.
#define N2k_MAX_TRANSMISSION_INTERVAL
This File contains the class tN2kMsg and all necessary functions to handle a NMEA2000 Message.
Specific compiler definition to adapt the library to your needs.
Base handler class for Group Functions.
static bool ParseRequestParams(const tN2kMsg &N2kMsg, uint32_t &TransmissionInterval, uint16_t &TransmissionIntervalOffset, uint8_t &NumberOfParameterPairs)
Parse parameters from request group function message.
static bool ParseCommandParams(const tN2kMsg &N2kMsg, uint8_t &PrioritySetting, uint8_t &NumberOfParameterPairs)
Parse parameters from command group function message.
virtual bool HandleAcknowledge(const tN2kMsg &N2kMsg, tN2kGroupFunctionPGNErrorCode PGNErrorCode, tN2kGroupFunctionTransmissionOrPriorityErrorCode TransmissionOrPriorityErrorCode, uint8_t NumberOfParameterPairs, int iDev)
Default handle function for acknowledge group function.
static bool ParseAcknowledgeParams(const tN2kMsg &N2kMsg, tN2kGroupFunctionPGNErrorCode &PGNErrorCode, tN2kGroupFunctionTransmissionOrPriorityErrorCode &TransmissionOrPriorityErrorCode, uint8_t &NumberOfParameterPairs)
Parse parameters from acknowledge group function message.
bool Proprietary
Flag, if the Parameter Group is proprietary
static bool StartParseRequestPairParameters(const tN2kMsg &N2kMsg, int &Index)
Get start Index of pair parameters from request group function message.
virtual bool HandleReadFieldsReply(const tN2kMsg &N2kMsg, int iDev)
Handle read fields reply group function.
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.
virtual bool Handle(const tN2kMsg &N2kMsg, tN2kGroupFunctionCode GroupFunctionCode, unsigned long PGNForGroupFunction, int iDev)
Handle group function message.
static bool Parse(const tN2kMsg &N2kMsg, tN2kGroupFunctionCode &GroupFunctionCode, unsigned long &PGNForGroupFunction)
Parse group function code and requested/commanded etc. PGN from group function message.
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.
tN2kGroupFunctionHandler(tNMEA2000 *_pNMEA2000, unsigned long _PGN)
Construct a new tN2kGroupFunctionHandler object.
static unsigned long GetPGNForGroupFunction(const tN2kMsg &N2kMsg)
Get requested/commanded etc. PGN from group function message.
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.
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.
virtual bool HandleWriteFieldsReply(const tN2kMsg &N2kMsg, int iDev)
Handle write fields reply group function.
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.
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.
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.
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.
tNMEA2000 * pNMEA2000
NMEA2000 object in order to send messages to the bus
static bool StartParseCommandPairParameters(const tN2kMsg &N2kMsg, int &Index)
Get start Index of pair parameters from command group function message.
static void ChangeTransmissionOrPriorityErrorCode(tN2kMsg &N2kMsg, tN2kGroupFunctionTransmissionOrPriorityErrorCode TransmissionOrPriorityErrorCode)
Change transmission interval or priority error code for acknowledge group function message.
unsigned long PGN
Parameter Group Number (PGN) of this Group Function.
virtual bool HandleCommand(const tN2kMsg &N2kMsg, uint8_t PrioritySetting, uint8_t NumberOfParameterPairs, int iDev)
Handle response for command group function.
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.
virtual bool HandleRequest(const tN2kMsg &N2kMsg, uint32_t TransmissionInterval, uint16_t TransmissionIntervalOffset, uint8_t NumberOfParameterPairs, int iDev)
Handle response for request group function.
static void AddAcknowledgeParameter(tN2kMsg &N2kMsg, uint8_t ParameterPairIndex, tN2kGroupFunctionParameterErrorCode ErrorCode=N2kgfpec_ReadOrWriteIsNotSupported)
Add parameter error code to acknowledge group function message.
static void ChangePNGErrorCode(tN2kMsg &N2kMsg, tN2kGroupFunctionPGNErrorCode PGNErrorCode)
Change the PGN error code for a acknowledge group function message.
static bool StartParseReadOrWriteParameters(const tN2kMsg &N2kMsg, bool Proprietary, int &Index)
Get start index of pair parameters on the read or write group function message.
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.
This class contains all the data of an NMEA2000 message.
tNMEA2000 device class definition.