diff --git a/Source/Components/GAMs/MessageGAM/MessageGAM.cpp b/Source/Components/GAMs/MessageGAM/MessageGAM.cpp index d6cf0e85..0d58cb5d 100644 --- a/Source/Components/GAMs/MessageGAM/MessageGAM.cpp +++ b/Source/Components/GAMs/MessageGAM/MessageGAM.cpp @@ -83,6 +83,15 @@ bool MessageGAM::Initialise(StructuredDataI &data) { trigOnChange = (tempTrigOnChange != 0u); } } + if (ret) { + uint8 tempfirstTime; + if (!data.Read("FirstTime", tempfirstTime)) { + firstTime = true; + } + else { + firstTime = (tempfirstTime != 0u); + } + } return ret; } diff --git a/Source/Components/GAMs/MessageGAM/MessageGAM.h b/Source/Components/GAMs/MessageGAM/MessageGAM.h index af0cbc46..48312c23 100644 --- a/Source/Components/GAMs/MessageGAM/MessageGAM.h +++ b/Source/Components/GAMs/MessageGAM/MessageGAM.h @@ -56,6 +56,8 @@ namespace MARTe{ * that every state change (e.g. PrepareNextState) the GAM stores the current value to wait for a change happening in the future, by comparing * past value with current, during that specific state context. In other words, the GAM has to see and "edge" in the command value to trigger a message. * - TriggerOnChange disabled: the GAM does not need to see an edge in command value to trigger the message, even across state changes. + * - FirstTime: For the first execution of this GAM, regard previousValue as 0. This causes a trigger on change to be true even if this is the first iteration of the Message being + * executed. By disabling this it will ignore the first iteration if TriggerOnChange is enabled and subsequent iterations the previousValue will be what it started with. * As the GAM keeps track of sent messages and received replies, if the message sent as a consequence of a triggering event is still awaiting for a reply, no further message will * be sent until the reply acknowledgement. * Constraints:\n @@ -67,6 +69,7 @@ namespace MARTe{ * +GAM1 = { * Class = TriggerOnChangeGAM * TriggerOnChange = 1 //Defaults to 1 = true if not present. Allowed values 0 == false or disabled, != 0 == true or enabled (see above) + * FirstTime = 1 // Defaults to 1 = true if not present. Allowed values 0 == false or disabled, != 0 == true or enabled (see above) * +Events = { * Class = ReferenceContainer * +Event1 = {