CORDET Framework - C2 Implementation
CrFwInCmd.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 /* Include configuration files */
21 #include "CrFwCmpData.h"
22 /* Include framework files */
23 #include "CrFwConstants.h"
24 #include "CrFwRepErr.h"
27 #include "OutCmp/CrFwOutCmp.h"
28 #include "BaseCmp/CrFwBaseCmp.h"
29 #include "BaseCmp/CrFwInitProc.h"
30 #include "BaseCmp/CrFwResetProc.h"
33 #include "Pckt/CrFwPckt.h"
34 #include "CrFwRepInCmdOutcome.h"
35 /* Include FW Profile files */
36 #include "FwPrConfig.h"
37 #include "FwPrDCreate.h"
38 #include "FwSmConfig.h"
39 #include "FwSmDCreate.h"
40 #include "FwPrCore.h"
41 
43 static FwSmDesc_t baseInCmdSmDesc = NULL;
44 
49 static void DoAbortAction(FwSmDesc_t smDesc);
50 
55 static void DoProgressAction(FwSmDesc_t smDesc);
56 
61 static void DoStartAction(FwSmDesc_t smDesc);
62 
67 static void DoTerminationAction(FwSmDesc_t smDesc);
68 
74 static void ReportStartFailed(FwSmDesc_t smDesc);
75 
81 static void ReportTerminationFailed(FwSmDesc_t smDesc);
82 
87 static void ReportStartSuccess(FwSmDesc_t smDesc);
88 
93 static void ReportTerminationSuccess(FwSmDesc_t smDesc);
94 
100 static FwSmBool_t IsReady(FwSmDesc_t smDesc);
101 
107 static FwSmBool_t IsTerminationSuccess(FwSmDesc_t smDesc);
108 
109 /* --------------------------------------------------------------------------------- */
110 FwSmDesc_t CrFwInCmdMakeBase() {
111  FwSmCounterS1_t nOfStates = 4; /* Number of states */
112  FwSmCounterS1_t nOfChoicePseudoStates = 2; /* Number of choice pseudo-states */
113  FwSmCounterS1_t nOfTrans = 7; /* Number of transitions */
114  FwSmCounterS1_t nOfActions = 9; /* Number of actions */
115  FwSmCounterS1_t nOfGuards = 4; /* Number of guards */
116  FwSmCounterS1_t CPS_1 = 1; /* Identifier of first choice pseudo-state */
117  FwSmCounterS1_t CPS_2 = 2; /* Identifier of second choice pseudo-state */
118  FwSmDesc_t esm;
119 
120  if (baseInCmdSmDesc != NULL)
121  return baseInCmdSmDesc;
122 
123  /* Create and configure the base InCommand */
124 
125  /* Extend the Base Component */
126  baseInCmdSmDesc = FwSmCreateDer(CrFwBaseCmpMake());
127  /* Create the InCommand SM and then embed it in state CONFIGURED of the Base Component */
128  esm = FwSmCreate(nOfStates, nOfChoicePseudoStates, nOfTrans, nOfActions, nOfGuards);
129  FwSmAddState(esm, CR_FW_INCMD_STATE_ACCEPTED, 1, NULL, NULL, NULL, NULL);
130  FwSmAddState(esm, CR_FW_INCMD_STATE_PROGRESS, 1, &DoProgressAction, NULL, &DoProgressAction, NULL);
131  FwSmAddState(esm, CR_FW_INCMD_STATE_TERMINATED, 0, NULL, NULL, NULL, NULL);
132  FwSmAddState(esm, CR_FW_INCMD_STATE_ABORTED, 0, &DoAbortAction, NULL, NULL, NULL);
133  FwSmAddChoicePseudoState(esm, CPS_1, 2);
134  FwSmAddChoicePseudoState(esm, CPS_2, 2);
135  FwSmAddTransIpsToSta(esm, CR_FW_INCMD_STATE_ACCEPTED, NULL);
136  FwSmAddTransStaToCps(esm, FW_TR_EXECUTE, CR_FW_INCMD_STATE_ACCEPTED, CPS_1,
138  FwSmAddTransCpsToSta(esm, CPS_1, CR_FW_INCMD_STATE_PROGRESS, &ReportStartSuccess, &CrFwIsSmOutcomeOne);
139  FwSmAddTransCpsToSta(esm, CPS_1, CR_FW_INCMD_STATE_ABORTED, &ReportStartFailed, NULL); /* Else Guard */
140  FwSmAddTransStaToCps(esm, CR_FW_INCMD_TR_TERMINATE, CR_FW_INCMD_STATE_PROGRESS, CPS_2,
142  FwSmAddTransCpsToSta(esm, CPS_2, CR_FW_INCMD_STATE_TERMINATED, &ReportTerminationSuccess, &IsTerminationSuccess);
143  FwSmAddTransCpsToSta(esm, CPS_2, CR_FW_INCMD_STATE_ABORTED, &ReportTerminationFailed, NULL); /* Else Guard */
144 
146  return baseInCmdSmDesc;
147 }
148 
149 /* --------------------------------------------------------------------------------- */
150 void CrFwInCmdTerminate(FwSmDesc_t smDesc) {
151  FwSmMakeTrans(smDesc, CR_FW_INCMD_TR_TERMINATE);
152 }
153 
154 /* --------------------------------------------------------------------------------- */
155 CrFwBool_t CrFwInCmdIsInAccepted(FwSmDesc_t smDesc) {
156  return (FwSmGetCurStateEmb(smDesc) == CR_FW_INCMD_STATE_ACCEPTED);
157 }
158 
159 /* --------------------------------------------------------------------------------- */
160 CrFwBool_t CrFwInCmdIsInProgress(FwSmDesc_t smDesc) {
161  return (FwSmGetCurStateEmb(smDesc) == CR_FW_INCMD_STATE_PROGRESS);
162 }
163 
164 /* --------------------------------------------------------------------------------- */
166  return (FwSmGetCurStateEmb(smDesc) == CR_FW_INCMD_STATE_TERMINATED);
167 }
168 
169 /* --------------------------------------------------------------------------------- */
170 CrFwBool_t CrFwInCmdIsInAborted(FwSmDesc_t smDesc) {
171  return (FwSmGetCurStateEmb(smDesc) == CR_FW_INCMD_STATE_ABORTED);
172 }
173 
174 /* --------------------------------------------------------------------------------- */
175 void CrFwInCmdConfigCheck(FwPrDesc_t prDesc) {
176  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwPrGetData(prDesc);
177  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
178 
179  if (cmpSpecificData->isValid(prDesc) == 1)
180  cmpData->outcome = 1;
181  else
182  cmpData->outcome = 0;
183 }
184 
185 /* --------------------------------------------------------------------------------- */
187  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
188  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
189  return cmpSpecificData->progressStepId;
190 }
191 
192 /* --------------------------------------------------------------------------------- */
193 void CrFwInCmdSetProgressStepId(FwSmDesc_t smDesc, CrFwProgressStepId_t stepId) {
194  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
195  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
196  cmpSpecificData->progressStepId = stepId;
197 }
198 
199 /* --------------------------------------------------------------------------------- */
201  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwPrGetData(prDesc);
202  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
203  return cmpSpecificData->pckt;
204 }
205 
206 /* --------------------------------------------------------------------------------- */
207 FwSmBool_t IsTerminationSuccess(FwSmDesc_t smDesc) {
208  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
209  if (cmpData->outcome == 1)
210  return 1;
211  return 0;
212 }
213 
214 /* --------------------------------------------------------------------------------- */
215 FwSmBool_t IsReady(FwSmDesc_t smDesc) {
216  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
217  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
218  return cmpSpecificData->isReady(smDesc);
219 }
220 
221 /* --------------------------------------------------------------------------------- */
222 void ReportTerminationFailed(FwSmDesc_t smDesc) {
223  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
224  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
225 
227  CrFwPcktGetServType(cmpSpecificData->pckt),
228  CrFwPcktGetServSubType(cmpSpecificData->pckt),
229  CrFwPcktGetDiscriminant(cmpSpecificData->pckt),
230  cmpData->outcome, smDesc);
231 }
232 
233 /* --------------------------------------------------------------------------------- */
234 void ReportStartFailed(FwSmDesc_t smDesc) {
235  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
236  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
237 
239  CrFwPcktGetServType(cmpSpecificData->pckt),
240  CrFwPcktGetServSubType(cmpSpecificData->pckt),
241  CrFwPcktGetDiscriminant(cmpSpecificData->pckt),
242  cmpData->outcome, smDesc);
243 }
244 
245 /* --------------------------------------------------------------------------------- */
246 void ReportStartSuccess(FwSmDesc_t smDesc) {
247  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
248  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
249 
250  if (CrFwPcktIsStartAck(cmpSpecificData->pckt) == 1)
252  CrFwPcktGetServType(cmpSpecificData->pckt),
253  CrFwPcktGetServSubType(cmpSpecificData->pckt),
254  CrFwPcktGetDiscriminant(cmpSpecificData->pckt),
255  cmpData->outcome, smDesc);
256 }
257 
258 /* --------------------------------------------------------------------------------- */
259 void ReportTerminationSuccess(FwSmDesc_t smDesc) {
260  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
261  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
262 
263  if (CrFwPcktIsTermAck(cmpSpecificData->pckt) == 1)
265  CrFwPcktGetServType(cmpSpecificData->pckt),
266  CrFwPcktGetServSubType(cmpSpecificData->pckt),
267  CrFwPcktGetDiscriminant(cmpSpecificData->pckt),
268  cmpData->outcome, smDesc);
269 }
270 
271 /* --------------------------------------------------------------------------------- */
272 static void DoAbortAction(FwSmDesc_t smDesc) {
273  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
274  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
275  cmpSpecificData->abortAction(smDesc);
276 }
277 
278 /* --------------------------------------------------------------------------------- */
279 static void DoProgressAction(FwSmDesc_t smDesc) {
280  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
281  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
282  CrFwProgressStepId_t prevStep;
283 
284  prevStep = cmpSpecificData->progressStepId;
285  cmpSpecificData->progressAction(smDesc);
286  if (cmpData->outcome != 1) {
288  CrFwPcktGetServType(cmpSpecificData->pckt),
289  CrFwPcktGetServSubType(cmpSpecificData->pckt),
290  CrFwPcktGetDiscriminant(cmpSpecificData->pckt),
291  cmpData->outcome, smDesc);
292  cmpSpecificData->nOfProgressFailure++; /* Increment counter of progress failures */
293  return; /* Execution step has failed */
294  }
295 
296  if (cmpSpecificData->progressStepId != prevStep)
297  if (CrFwPcktIsProgressAck(cmpSpecificData->pckt) == 1) {
299  CrFwPcktGetServType(cmpSpecificData->pckt),
300  CrFwPcktGetServSubType(cmpSpecificData->pckt),
301  CrFwPcktGetDiscriminant(cmpSpecificData->pckt),
302  cmpData->outcome, smDesc);
303  return; /* Progress step has succeeded */
304  }
305 }
306 
307 /* --------------------------------------------------------------------------------- */
308 static void DoStartAction(FwSmDesc_t smDesc) {
309  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
310  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
311 
312  cmpSpecificData->startAction(smDesc);
313 }
314 
315 /* --------------------------------------------------------------------------------- */
316 static void DoTerminationAction(FwSmDesc_t smDesc) {
317  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
318  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
319 
320  cmpSpecificData->terminationAction(smDesc);
321 }
322 
323 /* --------------------------------------------------------------------------------- */
324 CrFwDestSrc_t CrFwInCmdGetSrc(FwSmDesc_t smDesc) {
325  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
326  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
327  return CrFwPcktGetSrc(cmpSpecificData->pckt);
328 }
329 
330 /* --------------------------------------------------------------------------------- */
331 CrFwGroup_t CrFwInCmdGetGroup(FwSmDesc_t smDesc) {
332  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
333  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
334  return CrFwPcktGetGroup(cmpSpecificData->pckt);
335 }
336 
337 /* --------------------------------------------------------------------------------- */
339  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
340  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
341  return CrFwPcktGetServType(cmpSpecificData->pckt);
342 }
343 
344 /* --------------------------------------------------------------------------------- */
346  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
347  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
348  return CrFwPcktGetServSubType(cmpSpecificData->pckt);
349 }
350 
351 /* --------------------------------------------------------------------------------- */
353  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
354  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
355  return CrFwPcktGetDiscriminant(cmpSpecificData->pckt);
356 }
357 
358 /* --------------------------------------------------------------------------------- */
359 CrFwBool_t CrFwInCmdIsAcceptAck(FwSmDesc_t smDesc) {
360  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
361  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
362  return CrFwPcktIsAcceptAck(cmpSpecificData->pckt);
363 }
364 
365 /* --------------------------------------------------------------------------------- */
366 CrFwBool_t CrFwInCmdIsStartAck(FwSmDesc_t smDesc) {
367  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
368  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
369  return CrFwPcktIsStartAck(cmpSpecificData->pckt);
370 }
371 
372 /* --------------------------------------------------------------------------------- */
373 CrFwBool_t CrFwInCmdIsProgressAck(FwSmDesc_t smDesc) {
374  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
375  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
376  return CrFwPcktIsProgressAck(cmpSpecificData->pckt);
377 }
378 
379 /* --------------------------------------------------------------------------------- */
380 CrFwBool_t CrFwInCmdIsTermAck(FwSmDesc_t smDesc) {
381  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
382  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
383  return CrFwPcktIsTermAck(cmpSpecificData->pckt);
384 }
385 
386 /* --------------------------------------------------------------------------------- */
387 CrFwSeqCnt_t CrFwInCmdGetSeqCnt(FwSmDesc_t smDesc) {
388  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
389  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
390  return CrFwPcktGetSeqCnt(cmpSpecificData->pckt);
391 }
392 
393 /* --------------------------------------------------------------------------------- */
394 CrFwPckt_t CrFwInCmdGetParStart(FwSmDesc_t smDesc) {
395  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
396  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
397  return CrFwPcktGetParStart(cmpSpecificData->pckt);
398 }
399 
400 /* --------------------------------------------------------------------------------- */
402  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
403  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
404  return CrFwPcktGetParLength(cmpSpecificData->pckt);
405 }
406 
407 /* --------------------------------------------------------------------------------- */
408 CrFwPckt_t CrFwInCmdGetPckt(FwSmDesc_t smDesc) {
409  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
410  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
411  return cmpSpecificData->pckt;
412 }
413 
414 /* --------------------------------------------------------------------------------- */
416  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
417  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
418  return cmpSpecificData->isProgressActionCompleted;
419 }
420 
421 /* --------------------------------------------------------------------------------- */
422 void CrFwInCmdSetProgressActionCompleted(FwSmDesc_t smDesc, CrFwBool_t progressActionCompleted) {
423  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
424  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
425  cmpSpecificData->isProgressActionCompleted = progressActionCompleted;
426 }
427 
428 /* --------------------------------------------------------------------------------- */
430  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
431  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(cmpData->cmpSpecificData);
432  return cmpSpecificData->nOfProgressFailure;
433 }
434 
435 /* --------------------------------------------------------------------------------- */
437  CrFwCmpData_t* cmpData = FwPrGetData(prDesc);
439  CrFwPckt_t pckt = inCmdData->pckt;
440  return (CrFwPcktGetCrc(pckt) == CrFwPcktComputeCrc(pckt));
441 }
442 
FwSmDesc_t CrFwBaseCmpMake()
Retrieve the singleton instance of the Base State Machine.
Definition: CrFwBaseCmp.c:77
Definition of Base Component.
Definition of the Framework Component Data (FCD) Type.
Header file to define all invariant publicly available constants and types for the CORDET Framework.
#define CR_FW_INCMD_STATE_ABORTED
State identifier for state ABORTED in the InCommand State Machine.
#define CR_FW_INCMD_TR_TERMINATE
Identifier for transition command "Terminate" in the InCommand State Machine.
#define CR_FW_INCMD_STATE_ACCEPTED
State identifier for state ACCEPTED in the InCommand State Machine.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
#define CR_FW_BASE_STATE_CONFIGURED
State identifier for state CONFIGURED in the Base State Machine.
#define CR_FW_INCMD_STATE_PROGRESS
State identifier for state PROGRESS in the InCommand State Machine.
#define CR_FW_INCMD_STATE_TERMINATED
State identifier for state TERMINATED in the InCommand State Machine.
Dummy Component Execution Procedure (CEP) for the Base Component.
CrFwBool_t CrFwInCmdIsStartAck(FwSmDesc_t smDesc)
Return the acknowledge level for command start for the command encapsulated in the InCommand.
Definition: CrFwInCmd.c:366
CrFwPckt_t CrFwInCmdGetPcktFromPrDesc(FwPrDesc_t prDesc)
Convenience function to extract the InCommand's packet from the descriptor of the InCommand's reset p...
Definition: CrFwInCmd.c:200
CrFwBool_t CrFwInCmdDefValidityCheck(FwPrDesc_t prDesc)
Default implementation of the validity check of an InCommand.
Definition: CrFwInCmd.c:436
CrFwBool_t CrFwInCmdIsInAccepted(FwSmDesc_t smDesc)
Return true if the argument InCommand is in state ACCEPTED.
Definition: CrFwInCmd.c:155
CrFwBool_t CrFwInCmdIsProgressAck(FwSmDesc_t smDesc)
Return the acknowledge level for command progress for the command encapsulated in the InCommand.
Definition: CrFwInCmd.c:373
CrFwDiscriminant_t CrFwInCmdGetDiscriminant(FwSmDesc_t smDesc)
Return the discriminant of the InCommand.
Definition: CrFwInCmd.c:352
static void ReportTerminationFailed(FwSmDesc_t smDesc)
Transition action on the transition from CPS2 to ABORTED which reports the failure of the Termination...
Definition: CrFwInCmd.c:222
CrFwPckt_t CrFwInCmdGetParStart(FwSmDesc_t smDesc)
Return the start address of the parameter area of the InCommand.
Definition: CrFwInCmd.c:394
static void DoStartAction(FwSmDesc_t smDesc)
Transition action on the transition from ACCEPTED to CPS1.
Definition: CrFwInCmd.c:308
static FwSmDesc_t baseInCmdSmDesc
Base OutComponent from which all other InCommands are derived.
Definition: CrFwInCmd.c:43
CrFwProgressStepId_t CrFwInCmdGetNOfProgressFailure(FwSmDesc_t smDesc)
Return the number of progress step failures.
Definition: CrFwInCmd.c:429
static void ReportStartFailed(FwSmDesc_t smDesc)
Transition action on the transition from CPS1 to ABORTED which reports the failure of the Start Actio...
Definition: CrFwInCmd.c:234
void CrFwInCmdTerminate(FwSmDesc_t smDesc)
Send command Terminate to the argument InCommand.
Definition: CrFwInCmd.c:150
CrFwBool_t CrFwInCmdIsInProgress(FwSmDesc_t smDesc)
Return true if the argument InCommand is in state PROGRESS.
Definition: CrFwInCmd.c:160
CrFwServType_t CrFwInCmdGetServType(FwSmDesc_t smDesc)
Return the type of the InCommand.
Definition: CrFwInCmd.c:338
void CrFwInCmdConfigCheck(FwPrDesc_t prDesc)
Configuration check for an InCommand.
Definition: CrFwInCmd.c:175
CrFwDestSrc_t CrFwInCmdGetSrc(FwSmDesc_t smDesc)
Return the source of the InCommand.
Definition: CrFwInCmd.c:324
FwSmDesc_t CrFwInCmdMakeBase()
Return the base InCommand from which all other InCommands are derived.
Definition: CrFwInCmd.c:110
static void DoProgressAction(FwSmDesc_t smDesc)
Entry and do action in state PROGRESS.
Definition: CrFwInCmd.c:279
CrFwGroup_t CrFwInCmdGetGroup(FwSmDesc_t smDesc)
Return the group of the InCommand.
Definition: CrFwInCmd.c:331
static void ReportTerminationSuccess(FwSmDesc_t smDesc)
Transition action on the transition from CPS2 to TERMINATED.
Definition: CrFwInCmd.c:259
CrFwBool_t CrFwInCmdIsInAborted(FwSmDesc_t smDesc)
Return true if the argument InCommand is in state ABORTED.
Definition: CrFwInCmd.c:170
static void DoTerminationAction(FwSmDesc_t smDesc)
Transition action on the transition from PROGRESS to CPS2.
Definition: CrFwInCmd.c:316
CrFwBool_t CrFwInCmdIsProgressActionCompleted(FwSmDesc_t smDesc)
Return the Completion Outcome of the progress action.
Definition: CrFwInCmd.c:415
CrFwBool_t CrFwInCmdIsTermAck(FwSmDesc_t smDesc)
Return the acknowledge level for command termination for the command encapsulated in the InCommand.
Definition: CrFwInCmd.c:380
void CrFwInCmdSetProgressActionCompleted(FwSmDesc_t smDesc, CrFwBool_t progressActionCompleted)
Set the Completion Outcome of the progress action.
Definition: CrFwInCmd.c:422
CrFwPcktLength_t CrFwInCmdGetParLength(FwSmDesc_t smDesc)
Return the length in bytes of the parameter area of the InCommand.
Definition: CrFwInCmd.c:401
static FwSmBool_t IsReady(FwSmDesc_t smDesc)
Guard on the transition from ACCEPTED to CPS1.
Definition: CrFwInCmd.c:215
CrFwSeqCnt_t CrFwInCmdGetSeqCnt(FwSmDesc_t smDesc)
Return the sequence counter of the InCommand.
Definition: CrFwInCmd.c:387
static FwSmBool_t IsTerminationSuccess(FwSmDesc_t smDesc)
Guard on the transition from CPS2 to TERMINATED.
Definition: CrFwInCmd.c:207
CrFwPckt_t CrFwInCmdGetPckt(FwSmDesc_t smDesc)
Return the pointer to the packet which holds the InCommand.
Definition: CrFwInCmd.c:408
void CrFwInCmdSetProgressStepId(FwSmDesc_t smDesc, CrFwProgressStepId_t stepId)
Set the progress step identifier of the InCommand.
Definition: CrFwInCmd.c:193
CrFwProgressStepId_t CrFwInCmdGetProgressStepId(FwSmDesc_t smDesc)
Return the progress step identifier of the InCommand.
Definition: CrFwInCmd.c:186
static void DoAbortAction(FwSmDesc_t smDesc)
Entry action in state ABORTED.
Definition: CrFwInCmd.c:272
CrFwBool_t CrFwInCmdIsAcceptAck(FwSmDesc_t smDesc)
Return the acknowledge level for command acceptance for the command encapsulated in the InCommand.
Definition: CrFwInCmd.c:359
static void ReportStartSuccess(FwSmDesc_t smDesc)
Transition action on the transition from CPS1 to PROGRESS.
Definition: CrFwInCmd.c:246
CrFwBool_t CrFwInCmdIsInTerminated(FwSmDesc_t smDesc)
Return true if the argument InCommand is in state TERMINATED.
Definition: CrFwInCmd.c:165
CrFwServType_t CrFwInCmdGetServSubType(FwSmDesc_t smDesc)
Return the sub-type of the InCommand.
Definition: CrFwInCmd.c:345
static CrFwCmpData_t inCmdData[CR_FW_INFACTORY_MAX_NOF_INCMD]
The base data for the pre-allocated InCommand instances.
Definition: CrFwInFactory.c:64
Component Initialization Procedure (CIP) for the Base Component.
Definition of the OutComponent Component of the framework.
Definition of the OutFactory component.
Definition of the OutStream component.
Interface for creating and accessing a report or command packet.
CrFwPckt_t CrFwPcktGetParStart(CrFwPckt_t pckt)
Return the start address of the packet's parameter area.
Definition: CrFwPckt.c:412
CrFwSeqCnt_t CrFwPcktGetSeqCnt(CrFwPckt_t pckt)
Return the sequence counter of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:241
CrFwBool_t CrFwPcktIsProgressAck(CrFwPckt_t pckt)
Return the acknowledge level for command progress for the command encapsulated in the packet.
Definition: CrFwPckt.c:400
CrFwBool_t CrFwPcktIsTermAck(CrFwPckt_t pckt)
Return the acknowledge level for command termination for the command encapsulated in the packet.
Definition: CrFwPckt.c:406
CrFwCrc_t CrFwPcktComputeCrc(CrFwPckt_t pckt)
Compute the CRC in the command or report encapsulated in a packet.
Definition: CrFwPckt.c:277
CrFwPcktLength_t CrFwPcktGetParLength(CrFwPckt_t pckt)
Return the length in bytes of the packet's parameter area.
Definition: CrFwPckt.c:417
CrFwDestSrc_t CrFwPcktGetSrc(CrFwPckt_t pckt)
Return the source of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:357
CrFwServSubType_t CrFwPcktGetServSubType(CrFwPckt_t pckt)
Return the service sub-type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:333
CrFwBool_t CrFwPcktIsAcceptAck(CrFwPckt_t pckt)
Return the acknowledge level for command acceptance for the command encapsulated in the packet.
Definition: CrFwPckt.c:388
CrFwGroup_t CrFwPcktGetGroup(CrFwPckt_t pckt)
Return the group of the command/report encapsulated in a packet.
Definition: CrFwPckt.c:428
CrFwBool_t CrFwPcktIsStartAck(CrFwPckt_t pckt)
Return the acknowledge level for command start for the command encapsulated in the packet.
Definition: CrFwPckt.c:394
CrFwCrc_t CrFwPcktGetCrc(CrFwPckt_t pckt)
Return the CRC of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:293
CrFwDiscriminant_t CrFwPcktGetDiscriminant(CrFwPckt_t pckt)
Return the discriminant of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:303
CrFwServType_t CrFwPcktGetServType(CrFwPckt_t pckt)
Return the service type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:321
Interface for reporting an error detected by a framework component.
Interface for reporting the outcome of the processing of an InCommand.
void CrFwRepInCmdOutcome(CrFwRepInCmdOutcome_t outcome, CrFwInstanceId_t instanceId, CrFwServType_t servType, CrFwServSubType_t servSubType, CrFwDiscriminant_t disc, CrFwOutcome_t failCode, FwSmDesc_t inCmd)
Report the outcome of the processing of an InCommand.
@ crCmdAckTrmSucc
Termination success.
@ crCmdAckPrgSucc
Progress success.
@ crCmdAckTrmFail
Termination failure.
@ crCmdAckPrgFail
Progress failure.
@ crCmdAckStrSucc
Start success.
@ crCmdAckStrFail
Start failure.
Component Reset Procedure (CRP) for the Base Component.
unsigned short CrFwProgressStepId_t
Type for the Progress Step Identifier of an InCommand.
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
unsigned char CrFwServType_t
Type used for the service type of a command or report.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
unsigned short int CrFwPcktLength_t
Type for the packet length.
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
FwSmBool_t CrFwIsSmOutcomeOne(FwSmDesc_t smDesc)
Convenience function to check whether the outcome of the last check or action is equal to 1 ("true").
Definition of the utility functions for the CORDET Framework.
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
CrFwInstanceId_t instanceId
The instance identifier of the framework component.
Definition: CrFwCmpData.h:81
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
Definition: CrFwCmpData.h:93
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Definition: CrFwCmpData.h:101
Type for the data describing an InCommand.
CrFwInCmdValidityCheck_t isValid
Function which implements the Configuration Check for the InCommand.
CrFwProgressStepId_t progressStepId
The progress step identifier.
CrFwPckt_t pckt
Packet holding the InCommand.
CrFwExecStepId_t nOfProgressFailure
Number of progress steps which failed.
CrFwInCmdTerminationAction_t terminationAction
Function which implements the Termination Action for the InCommand.
CrFwInCmdAbortAction_t abortAction
Function which implements the Abort Action for the InCommand.
CrFwInCmdProgressAction_t progressAction
Function which implements the Progress Action for the InCommand.
CrFwInCmdReadyCheck_t isReady
Function which implements the Ready Check for the InCommand.
CrFwBool_t isProgressActionCompleted
Flag indicating whether the progress action has been completed.
CrFwInCmdStartAction_t startAction
Function which implements the Start Action for the InCommand.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved