@@ -149,8 +149,7 @@ inline SilKit::Core::MessageBuffer& operator<<(SilKit::Core::MessageBuffer& buff
149149 << nodeParams.pMacroInitialOffsetB << nodeParams.pMicroInitialOffsetA << nodeParams.pMicroInitialOffsetB
150150 << nodeParams.pMicroPerCycle << nodeParams.pOffsetCorrectionOut << nodeParams.pOffsetCorrectionStart
151151 << nodeParams.pRateCorrectionOut << nodeParams.pWakeupChannel << nodeParams.pWakeupPattern
152- << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick << nodeParams.pSecondKeySlotId
153- << nodeParams.pTwoKeySlotMode ;
152+ << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick ;
154153 return buffer;
155154}
156155
@@ -164,10 +163,6 @@ inline SilKit::Core::MessageBuffer& operator>>(SilKit::Core::MessageBuffer& buff
164163 >> nodeParams.pMicroPerCycle >> nodeParams.pOffsetCorrectionOut >> nodeParams.pOffsetCorrectionStart
165164 >> nodeParams.pRateCorrectionOut >> nodeParams.pWakeupChannel >> nodeParams.pWakeupPattern
166165 >> nodeParams.pdMicrotick >> nodeParams.pSamplesPerMicrotick ;
167- if (buffer.RemainingBytesLeft () > 0 )
168- {
169- buffer >> nodeParams.pSecondKeySlotId >> nodeParams.pTwoKeySlotMode ;
170- }
171166 return buffer;
172167}
173168
@@ -189,12 +184,22 @@ inline SilKit::Core::MessageBuffer& operator<<(SilKit::Core::MessageBuffer& buff
189184 const FlexrayControllerConfig& config)
190185{
191186 buffer << config.clusterParams << config.nodeParams << config.bufferConfigs ;
187+ // Support for struct FlexrayControllerConfig version 2:
188+ // ensure that the pSecondKeySlotId and pTwoKeySlotMode are also serialized after the bufferConfigs
189+ // otherwise we will confuse the buffer deserialization of the bufferConfigs
190+ buffer << config.nodeParams .pSecondKeySlotId << config.nodeParams .pTwoKeySlotMode ;
192191 return buffer;
193192}
194193
195194inline SilKit::Core::MessageBuffer& operator >>(SilKit::Core::MessageBuffer& buffer, FlexrayControllerConfig& config)
196195{
197196 buffer >> config.clusterParams >> config.nodeParams >> config.bufferConfigs ;
197+ // Support for struct FlexrayControllerConfig version 2:
198+ // the pSecondKeySlotId and pTwoKeySlotMode were added after the bufferConfigs
199+ if (buffer.RemainingBytesLeft () > 0 )
200+ {
201+ buffer >> config.nodeParams .pSecondKeySlotId >> config.nodeParams .pTwoKeySlotMode ;
202+ }
198203 return buffer;
199204}
200205
0 commit comments