CORDET Framework - C2 Implementation
CrFwInFactory.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 /* Include configuration files */
21 #include "CrFwInFactoryUserPar.h"
22 #include "CrFwCmpData.h"
23 /* Include framework files */
24 #include "CrFwConstants.h"
26 #include "OutCmp/CrFwOutCmp.h"
27 #include "BaseCmp/CrFwBaseCmp.h"
28 #include "BaseCmp/CrFwInitProc.h"
29 #include "BaseCmp/CrFwResetProc.h"
31 #include "Pckt/CrFwPckt.h"
32 #include "InCmd/CrFwInCmd.h"
33 #include "InRep/CrFwInRep.h"
36 #include "CrFwInFactory.h"
37 /* Include FW Profile files */
38 #include "FwPrConfig.h"
39 #include "FwPrDCreate.h"
40 #include "FwSmConfig.h"
41 #include "FwSmCore.h"
42 #include "FwSmDCreate.h"
43 #include "FwPrCore.h"
44 
47 
50 
53 
56 
59 
62 
65 
68 
71 
74 
77 
80 
83 
86 
92 
98 
101 
104 
106 static FwSmDesc_t inFactory;
107 
110 
121 static void InFactoryInitAction(FwPrDesc_t initPr);
122 
138 static void InFactoryConfigAction(FwPrDesc_t initPr);
139 
148 static void InFactoryShutdownAction(FwSmDesc_t smDesc);
149 
150 /* ------------------------------------------------------------------------------------ */
151 FwSmDesc_t CrFwInFactoryMake() {
152  FwPrDesc_t resetPr, execPr, initPr;
153 
154  if (inFactory != NULL) {
155  return inFactory;
156  }
157 
158  /* Extend the Base Component */
159  inFactory = FwSmCreateDer(CrFwBaseCmpMake());
160 
161  /* Create the Reset Procedure for the InFactory Component */
162  resetPr = FwPrCreateDer(CrFwCmpGetResetProc());
163  FwPrOverrideAction(resetPr, &CrFwBaseCmpDefConfigAction, &InFactoryConfigAction);
164 
165  /* Create the Initialization Procedure for the InFactory Component */
166  initPr = FwPrCreateDer(CrFwCmpGetInitProc());
167  FwPrOverrideAction(initPr, &CrFwBaseCmpDefInitAction, &InFactoryInitAction);
168 
169  /* Override the Shutdown Action for the InFactory Component */
171 
172  /* Get the Dummy Execution Procedure for the InFactory Component */
173  execPr = CrFwBaseCmpGetDummyExecProc();
174 
175  /* Initialize the data for the requested SM */
176  inFactoryData.outcome = 1;
177  inFactoryData.initProc = initPr;
178  inFactoryData.resetProc = resetPr;
179  inFactoryData.execProc = execPr;
180  inFactoryData.instanceId = 0;
181  inFactoryData.typeId = CR_FW_INFACTORY_TYPE;
182 
183  /* Attach the data to the InFactory state machine and to its procedures. */
184  FwSmSetData(inFactory, &inFactoryData);
185  FwPrSetData(inFactoryData.initProc, &inFactoryData);
186  FwPrSetData(inFactoryData.resetProc, &inFactoryData);
187 
188  /* Start the InFactory */
189  FwSmStart(inFactory);
190 
191  return inFactory;
192 }
193 
194 /* ------------------------------------------------------------------------------------ */
196  CrFwInFactoryPoolIndex_t j, k, freePos;
197  CrFwCmdRepKindIndex_t kindIndex;
198  CrFwCmdRepKindKey_t targetKey;
199  CrFwServType_t type;
200  CrFwServSubType_t subType;
201  CrFwDiscriminant_t discriminant;
202 
203  if (nextInCmdFreePos == CR_FW_INFACTORY_MAX_NOF_INCMD) { /* All positions are occupied */
205  return NULL;
206  }
207 
208  type = CrFwPcktGetServType(pckt);
209  subType = CrFwPcktGetServSubType(pckt);
210  discriminant = CrFwPcktGetDiscriminant(pckt);
213  if (kindIndex == CR_FW_INCMD_NKINDS) {
215  return NULL;
216  }
217  freePos = nextInCmdFreePos;
218 
219  inCmdData[freePos].instanceId = CrFwPcktGetCmdRepId(pckt);
220 
221  inCmdCmpSpecificData[freePos].abortAction = inCmdKindDesc[kindIndex].abortAction;
222  inCmdCmpSpecificData[freePos].startAction = inCmdKindDesc[kindIndex].startAction;
223  inCmdCmpSpecificData[freePos].progressAction = inCmdKindDesc[kindIndex].progressAction;
224  inCmdCmpSpecificData[freePos].terminationAction = inCmdKindDesc[kindIndex].terminationAction;
225  inCmdCmpSpecificData[freePos].isReady = inCmdKindDesc[kindIndex].isReady;
226  inCmdCmpSpecificData[freePos].isValid = inCmdKindDesc[kindIndex].isValid;
227  inCmdCmpSpecificData[freePos].factoryPoolIndex = freePos;
228  inCmdCmpSpecificData[freePos].progressStepId = 0;
229  inCmdCmpSpecificData[freePos].isProgressActionCompleted = 1;
230  inCmdCmpSpecificData[freePos].nOfProgressFailure = 0;
231  inCmdCmpSpecificData[freePos].pckt = pckt;
232 
233  /* Reset the InCommand */
234  CrFwCmpReset(inCmd[freePos]);
235 
237  inCmdInUse[freePos] = 1;
238 
239  /* Find the next free position in the pool of pre-allocated InCommand instances */
240  k = (CrFwInFactoryPoolIndex_t)(freePos + 1);
241  for (j=0; j<(CR_FW_INFACTORY_MAX_NOF_INCMD-1); j++) {
243  k = 0;
244  if (inCmdInUse[k] == 0) {
245  nextInCmdFreePos = k;
246  return (inCmd[freePos]); /* Next free position has been found */
247  }
248  k = (CrFwInFactoryPoolIndex_t)(k + 1);
249  }
250 
251  nextInCmdFreePos = CR_FW_INFACTORY_MAX_NOF_INCMD; /* There are no free positions left */
252  return (inCmd[freePos]);
253 }
254 
255 /* ------------------------------------------------------------------------------------ */
257  CrFwInFactoryPoolIndex_t j, k, freePos;
258  CrFwCmdRepKindIndex_t kindIndex;
259  CrFwCmdRepKindKey_t targetKey;
260  CrFwServType_t type;
261  CrFwServSubType_t subType;
262  CrFwDiscriminant_t discriminant;
263 
264  if (nextInRepFreePos == CR_FW_INFACTORY_MAX_NOF_INREP) { /* All positions are occupied */
266  return NULL;
267  }
268 
269  type = CrFwPcktGetServType(pckt);
270  subType = CrFwPcktGetServSubType(pckt);
271  discriminant = CrFwPcktGetDiscriminant(pckt);
274  if (kindIndex == CR_FW_INREP_NKINDS) {
276  return NULL;
277  }
278  freePos = nextInRepFreePos;
279 
280  inRepCmpSpecificData[freePos].updateAction = inRepKindDesc[kindIndex].updateAction;
281  inRepCmpSpecificData[freePos].isValid = inRepKindDesc[kindIndex].isValid;
282  inRepCmpSpecificData[freePos].factoryPoolIndex = freePos;
283  inRepCmpSpecificData[freePos].pckt = pckt;
284  inRepData[freePos].instanceId = CrFwPcktGetCmdRepId(pckt);
285 
286  /* Reset the InReport */
287  CrFwCmpReset(inRep[freePos]);
288 
290  inRepInUse[freePos] = 1;
291 
292  /* Find the next free position in the pool of pre-allocated InReport/InCommand instances */
293  k = (CrFwInFactoryPoolIndex_t)(freePos + 1);
294  for (j=0; j<(CR_FW_INFACTORY_MAX_NOF_INREP-1); j++) {
296  k = 0;
297  if (inRepInUse[k] == 0) {
298  nextInRepFreePos = k;
299  return (inRep[freePos]); /* Next free position has been found */
300  }
301  k = (CrFwInFactoryPoolIndex_t)(k + 1);
302  }
303 
304  nextInRepFreePos = CR_FW_INFACTORY_MAX_NOF_INREP; /* There are no free positions left */
305  return (inRep[freePos]);
306 }
307 
308 /* ------------------------------------------------------------------------------------ */
309 void CrFwInFactoryReleaseInCmd(FwSmDesc_t inCmdInstance) {
310  CrFwCmpData_t* inCmdInstanceData = (CrFwCmpData_t*)FwSmGetData(inCmdInstance);
311  CrFwInCmdData_t* cmpSpecificData = (CrFwInCmdData_t*)(inCmdInstanceData->cmpSpecificData);
312  CrFwInFactoryPoolIndex_t posToBeFreed;
313 
314  posToBeFreed = cmpSpecificData->factoryPoolIndex;
315 
316  if (inCmdInUse[posToBeFreed] == 1) {
317  inCmdInUse[posToBeFreed] = 0;
319  nextInCmdFreePos = posToBeFreed;
320  CrFwPcktRelease(inCmdCmpSpecificData[posToBeFreed].pckt);
321  inCmdCmpSpecificData[posToBeFreed].pckt = NULL;
322  return;
323  }
325 
326  return;
327 }
328 
329 /* ------------------------------------------------------------------------------------ */
330 void CrFwInFactoryReleaseInRep(FwSmDesc_t inRepInstance) {
331  CrFwCmpData_t* inRepInstanceData = (CrFwCmpData_t*)FwSmGetData(inRepInstance);
332  CrFwInRepData_t* cmpSpecificData = (CrFwInRepData_t*)(inRepInstanceData->cmpSpecificData);
333  CrFwInFactoryPoolIndex_t posToBeFreed;
334 
335  posToBeFreed = cmpSpecificData->factoryPoolIndex;
336 
337  if (inRepInUse[posToBeFreed] == 1) {
338  inRepInUse[posToBeFreed] = 0;
340  nextInRepFreePos = posToBeFreed;
341  CrFwPcktRelease(inRepCmpSpecificData[posToBeFreed].pckt);
342  inRepCmpSpecificData[posToBeFreed].pckt = NULL;
343  return;
344  }
346 
347  return;
348 }
349 
350 /* ------------------------------------------------------------------------------------ */
352  return nOfAllocatedInCmd;
353 }
354 
355 /* ------------------------------------------------------------------------------------ */
358 }
359 
360 /* ------------------------------------------------------------------------------------ */
362  return nOfAllocatedInRep;
363 }
364 
365 /* ------------------------------------------------------------------------------------ */
368 }
369 
370 /*------------------------------------------------------------------------------------*/
371 static void InFactoryInitAction(FwPrDesc_t initPr) {
372  CrFwCounterU2_t i;
374  FwPrDesc_t inCmdInitPr, inCmdResetPr, inCmdExecPr;
375  FwPrDesc_t inRepInitPr, inRepResetPr, inRepExecPr;
376  CRFW_UNUSED(initPr);
377 
378  /* Create the pre-allocated InCommands */
379  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INCMD; i++) {
380  /* Create the i-th InCommand as an extension of the Base OutComponent */
381  inCmd[i] = FwSmCreateDer(CrFwInCmdMakeBase());
382 
383  /* Create the Reset Procedure for the InCommand */
384  inCmdResetPr = FwPrCreateDer(CrFwCmpGetResetProc());
385  FwPrOverrideAction(inCmdResetPr, &CrFwBaseCmpDefConfigCheck, &CrFwInCmdConfigCheck);
386  inCmdData[i].resetProc = inCmdResetPr;
387 
388  /* Create the Initialization Procedure for the InCommand */
389  inCmdInitPr = FwPrCreateDer(CrFwCmpGetInitProc());
390  inCmdData[i].initProc = inCmdInitPr;
391 
392  /* Get the Execution Procedure for the InCommand */
393  inCmdExecPr = CrFwBaseCmpGetDummyExecProc();
394  inCmdData[i].execProc = inCmdExecPr;
395 
396  /* Set the component type */
397  inCmdData[i].typeId = CR_FW_INCOMMAND_TYPE;
398 
399  /* Set the pointer to the component-specific data */
400  inCmdData[i].cmpSpecificData = &inCmdCmpSpecificData[i];
401 
402  /* Attach the data to the InCommand state machine and to its procedures. */
403  FwSmSetData(inCmd[i], &inCmdData[i]);
404  FwSmSetData(FwSmGetEmbSm(inCmd[i], CR_FW_BASE_STATE_CONFIGURED), &inCmdData[i]);
405  FwPrSetData(inCmdData[i].initProc, &inCmdData[i]);
406  FwPrSetData(inCmdData[i].resetProc, &inCmdData[i]);
407 
408  /* Start and initialize the InCommand */
409  FwSmStart(inCmd[i]);
410  CrFwCmpInit(inCmd[i]);
411  }
412 
413  /* Initialize the array holding the keys of the InCommand kinds */
414  for (j=0; j<CR_FW_INCMD_NKINDS; j++)
416  inCmdKindDesc[j].servSubType*CR_FW_MAX_DISCRIMINANT+inCmdKindDesc[j].discriminant);
417 
418  /* Create the pre-allocated InReports */
419  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INREP; i++) {
420  /* Create the i-th InReport as an extension of the Base OutComponent */
421  inRep[i] = FwSmCreateDer(CrFwBaseCmpMake());
422 
423  /* Create the Reset Procedure for the InReport */
424  inRepResetPr = FwPrCreateDer(CrFwCmpGetResetProc());
425  FwPrOverrideAction(inRepResetPr, &CrFwBaseCmpDefConfigCheck, &CrFwInRepConfigCheck);
426  inRepData[i].resetProc = inRepResetPr;
427 
428  /* Create the Initialization Procedure for the InReport */
429  inRepInitPr = FwPrCreateDer(CrFwCmpGetInitProc());
430  inRepData[i].initProc = inRepInitPr;
431 
432  /* Get the Execution Procedure for the InReport */
433  inRepExecPr = CrFwInRepExecProcMake();
434  inRepData[i].execProc = inRepExecPr;
435 
436  /* Set the component type */
437  inRepData[i].typeId = CR_FW_INREPORT_TYPE;
438 
439  /* Set the pointer to the component-specific data */
440  inRepData[i].cmpSpecificData = &inRepCmpSpecificData[i];
441 
442  /* Attach the data to the InReport state machine and to its procedures. */
443  FwSmSetData(inRep[i], &inRepData[i]);
444  FwPrSetData(inRepData[i].initProc, &inRepData[i]);
445  FwPrSetData(inRepData[i].resetProc, &inRepData[i]);
446  FwPrSetData(inRepData[i].execProc, &inRepData[i]);
447 
448  /* Start and initialize the InReport */
449  FwSmStart(inRep[i]);
450  CrFwCmpInit(inRep[i]);
451  }
452 
453  /* Initialize the array holding the keys of the InReport kinds */
454  for (j=0; j<CR_FW_INREP_NKINDS; j++)
456  inRepKindDesc[j].servSubType*CR_FW_MAX_DISCRIMINANT+inRepKindDesc[j].discriminant);
457 
458 }
459 
460 /*------------------------------------------------------------------------------------*/
461 static void InFactoryConfigAction(FwPrDesc_t initPr) {
462  CrFwCounterU2_t i;
463  CrFwCmpData_t* cmpData = (CrFwCmpData_t*)FwPrGetData(initPr);
464 
465  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INCMD; i++)
466  if (inCmdInUse[i] != 0) {
467  inCmdInUse[i] = 0;
468  CrFwPcktRelease(inCmdCmpSpecificData[i].pckt);
469  inCmdCmpSpecificData[i].pckt = NULL;
470  }
471 
472  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INREP; i++)
473  if (inRepInUse[i] == 1) {
474  inRepInUse[i] = 0;
475  CrFwPcktRelease(inRepCmpSpecificData[i].pckt);
476  inRepCmpSpecificData[i].pckt = NULL;
477  }
478 
479  nOfAllocatedInRep = 0;
481  nextInRepFreePos = 0;
482 
483  nOfAllocatedInCmd = 0;
485  nextInCmdFreePos = 0;
486 
487  cmpData->outcome = 1;
488 }
489 
490 /*------------------------------------------------------------------------------------*/
491 static void InFactoryShutdownAction(FwSmDesc_t smDesc) {
492  CrFwCounterU2_t i;
493  CRFW_UNUSED(smDesc);
494 
495  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INCMD; i++) {
496  /* Release memory allocated to InCommand Initialization Procedure */
497  FwPrReleaseDer(inCmdData[i].initProc);
498  /* Release memory allocated to InCommand Reset Procedure */
499  FwPrReleaseDer(inCmdData[i].resetProc);
500  /* Release memory allocated to InCommand */
501  FwSmReleaseDer(FwSmGetEmbSm(inCmd[i],CR_FW_BASE_STATE_CONFIGURED));
502  FwSmReleaseDer(inCmd[i]);
503  if (inCmdInUse[i] == 1) {
504  /* Mark all InCommand as not-in-use */
505  inCmdInUse[i] = 0;
506  /* Release packet associated to InCommand */
507  CrFwPcktRelease(inCmdCmpSpecificData[i].pckt);
508  }
509  }
510 
511  for (i=0; i<CR_FW_INFACTORY_MAX_NOF_INREP; i++) {
512  /* Release memory allocated to InReport Initialization Procedure */
513  FwPrReleaseDer(inRepData[i].initProc);
514  /* Release memory allocated to InReport Reset Procedure */
515  FwPrReleaseDer(inRepData[i].resetProc);
516  /* Release memory allocated to InReport Execution Procedure */
517  FwPrRelease(inRepData[i].execProc);
518  /* Release memory allocated to InReport */
519  FwSmReleaseDer(inRep[i]);
520  /* Mark all InReports as not-in-use */
521  if (inRepInUse[i] == 1) {
522  inRepInUse[i] = 0;
523  /* Release packet associated to InRepor */
524  CrFwPcktRelease(inRepCmpSpecificData[i].pckt);
525  }
526  }
527 
528  nOfAllocatedInRep = 0;
529  nOfAllocatedInCmd = 0;
530 }
531 
532 
533 
534 
535 
536 
537 
538 
539 
540 
541 
CrFwInFactoryPoolIndex_t factoryPoolIndex
Index of the position in the pool of pre-allocated InReports in the InFactory to which the InComponen...
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
static CrFwCmdRepKindKey_t inCmdKindKey[CR_FW_INCMD_NKINDS]
Array holding the keys of the InCommand kinds.
Definition: CrFwInFactory.c:46
#define CR_FW_INREP_INIT_KIND_DESC
Definition of the incoming report kinds supported by an application.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
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
Execution Procedure for the InReport Component.
FwSmDesc_t CrFwInCmdMakeBase()
Return the base InCommand from which all other InCommands are derived.
Definition: CrFwInCmd.c:110
A framework function was called with an illegal type/sub-type/discriminant triplet for an InCommand...
void CrFwCmpInit(FwSmDesc_t smDesc)
Initialize a framework component.
Definition: CrFwBaseCmp.c:112
FwPrDesc_t CrFwCmpGetResetProc()
Retrieve the singleton instance of the CRP.
Definition: CrFwResetProc.c:45
static CrFwInFactoryPoolIndex_t nOfAllocatedInRep
The number of currently allocated InReports.
Definition: CrFwInFactory.c:85
Definition of the Framework Component Data (FCD) Type.
void CrFwInCmdConfigCheck(FwPrDesc_t prDesc)
Configuration check for an InCommand.
Definition: CrFwInCmd.c:175
CrFwInRepValidityCheck_t isValid
The pointer to the function implementing the Validity Check Operation.
CrFwInCmdTerminationAction_t terminationAction
The pointer to the function implementing the Termination Action Operation.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:29
unsigned char CrFwInFactoryPoolIndex_t
Type for the index in the pool of pre-allocated incoming components in the InFactory (see CrFwInFacto...
void CrFwSetAppErrCode(CrFwAppErrCode_t errCode)
Set the value of the application error code (see CrFwGetAppErrCode).
#define CR_FW_INREPORT_TYPE
Type identifier for the InReport component.
static void InFactoryConfigAction(FwPrDesc_t initPr)
Configuration action for InFactory.
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
CrFwDiscriminant_t discriminant
The discriminant value (or zero if no discriminant for this type/sub-type)
CrFwServType_t CrFwPcktGetServType(CrFwPckt_t pckt)
Return the service type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:291
static FwSmDesc_t inFactory
The singleton instance of the InFactory.
User-modifiable parameters for the InFactory component (see CrFwInFactory.h).
CrFwServType_t servType
The service type.
#define CR_FW_INFACTORY_MAX_NOF_INREP
The maximum number of InReports which may be allocated at any one time.
void CrFwBaseCmpDefConfigCheck(FwPrDesc_t prDesc)
Function which performs the default Configuration Check of the CRP.
Definition: CrFwResetProc.c:33
static CrFwBool_t inRepInUse[CR_FW_INFACTORY_MAX_NOF_INREP]
The in-use status of each pre-allocated InReport instance.
Definition: CrFwInFactory.c:76
CrFwPckt_t pckt
Packet holding the InCommand.
static CrFwCmpData_t inFactoryData
The data for the InFactory singleton.
void CrFwInRepConfigCheck(FwPrDesc_t prDesc)
Configuration check for an InReport.
Definition: CrFwInRep.c:103
Type for the data describing an InReport.
Interface for creating and accessing a report or command packet.
void CrFwBaseCmpDefShutdownAction(FwSmDesc_t smDesc)
Function which performs the Shutdown Action for the Base State Machine.
Definition: CrFwBaseCmp.c:217
CrFwInCmdReadyCheck_t isReady
The pointer to the function implementing the Ready Check Operation.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
A framework function was called with an illegal type/sub-type/discriminant triplet for an InReport...
Allocation request for an InReport has failed (see CrFwInFactoryMakeInRep).
FwPrDesc_t resetProc
The Component Reset Procedure (CRP) (see CrFwResetProc.h).
Definition: CrFwCmpData.h:97
InCommand kind descriptor type.
CrFwCmdRepKindIndex_t CrFwFindCmdRepKindIndex(CrFwCmdRepKindKey_t *cmdRepKindArray, CrFwCmdRepKindIndex_t length, CrFwCmdRepKindKey_t targetKey)
Convenience function to retrieve the index of an array where a certain target value is located...
static CrFwInRepKindDesc_t inRepKindDesc[CR_FW_INREP_NKINDS]
Array of InReport service descriptors.
Definition: CrFwInFactory.c:55
Dummy Component Execution Procedure (CEP) for the Base Component.
CrFwPckt_t pckt
Packet holding the InReport.
Header file to define all invariant publicly available constants and types for the CORDET Framework...
void CrFwPcktRelease(CrFwPckt_t pckt)
Release function for command or report packets.
Definition: CrFwPckt.c:156
Definition of the InRegistry Component.
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
CrFwInstanceId_t instanceId
The instance identifier of the framework component.
Definition: CrFwCmpData.h:81
CrFwInCmdAbortAction_t abortAction
The pointer to the function implementing the Abort Action Operation.
void CrFwBaseCmpDefInitAction(FwPrDesc_t prDesc)
Function which performs the default Initialization Action of the CIP.
Definition: CrFwInitProc.c:42
CrFwServType_t servType
The service type.
#define CR_FW_INFACTORY_TYPE
Type identifier for the InFactory component.
unsigned int CrFwCmdRepKindKey_t
Type for the component kind key in CrFwInFactory.c and CrFwOutFactory.c.
An InReport release request has encountered an error (see CrFwInFactoryReleaseInRep).
CrFwInCmdReadyCheck_t isReady
Function which implements the Ready Check for the InCommand.
CrFwInCmdProgressAction_t progressAction
The pointer to the function implementing the Progress Action Operation.
unsigned short CrFwCmdRepKindIndex_t
Type for the index of a command or report kind.
static CrFwInCmdData_t inCmdCmpSpecificData[CR_FW_INFACTORY_MAX_NOF_INCMD]
The component-specific data for the pre-allocated InCommand instances.
Definition: CrFwInFactory.c:67
#define CR_FW_INCMD_INIT_KIND_DESC
Definition of the incoming command kinds supported by an application.
static CrFwCmpData_t inRepData[CR_FW_INFACTORY_MAX_NOF_INREP]
The base data for the pre-allocated InReport instances.
Definition: CrFwInFactory.c:70
static CrFwInCmdKindDesc_t inCmdKindDesc[CR_FW_INCMD_NKINDS]
Array of InCommand service descriptors.
Definition: CrFwInFactory.c:52
CrFwInRepUpdateAction_t updateAction
Function which implements the Update Action for the InReport.
CrFwExecStepId_t nOfProgressFailure
Number of progress steps which failed.
Definition of the InReport Component of the framework.
CrFwInCmdValidityCheck_t isValid
The pointer to the function implementing the Validity Check Operation.
unsigned short CrFwCounterU2_t
Type used for unsigned integers with a "medium" range.
CrFwInCmdStartAction_t startAction
The pointer to the function implementing the Start Action Operation.
#define CR_FW_MAX_DISCRIMINANT
Maximum value of the discriminant attribute of InReports and InCommands.
CrFwBool_t isProgressActionCompleted
Flag indicating whether the progress action has been completed.
static CrFwInstanceId_t nOfAllocatedInRepSinceReset
The total number of InReports or InCommand allocated since the InFactory was reset.
static void InFactoryShutdownAction(FwSmDesc_t smDesc)
Shutdown action for InFactory.
CrFwDiscriminant_t CrFwPcktGetDiscriminant(CrFwPckt_t pckt)
Return the discriminant of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:273
static CrFwInFactoryPoolIndex_t nextInCmdFreePos
The index of the next free position in the pool of pre-allocated InCommands instances (a value of CR_...
Definition: CrFwInFactory.c:91
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Definition: CrFwCmpData.h:101
void CrFwBaseCmpDefConfigAction(FwPrDesc_t prDesc)
Function which performs the default Configuration Action of the CRP.
Definition: CrFwResetProc.c:39
Definition of the InFactory component.
InReport kind descriptor type.
static FwSmDesc_t inRep[CR_FW_INFACTORY_MAX_NOF_INREP]
The pre-allocated InReport instances.
Definition: CrFwInFactory.c:61
#define CR_FW_INCOMMAND_TYPE
Type identifier for the InCommand component.
Definition of the utility functions for the CORDET Framework.
static CrFwCmpData_t inCmdData[CR_FW_INFACTORY_MAX_NOF_INCMD]
The base data for the pre-allocated InCommand instances.
Definition: CrFwInFactory.c:64
FwPrDesc_t execProc
The Component Execution Procedure (CEP) (see CrFwBaseCmp.h).
Definition: CrFwCmpData.h:99
FwSmDesc_t CrFwBaseCmpMake()
Retrieve the singleton instance of the Base State Machine.
Definition: CrFwBaseCmp.c:77
#define CR_FW_MAX_SERV_SUBTYPE
Maximum value of the service sub-type attribute of InReports and InCommands.
CrFwProgressStepId_t progressStepId
The progress step identifier.
void CrFwCmpReset(FwSmDesc_t smDesc)
Reset a framework component.
Definition: CrFwBaseCmp.c:117
FwPrDesc_t CrFwBaseCmpGetDummyExecProc()
Retrieve the singleton instance of the Dummy CEP.
CrFwServSubType_t CrFwPcktGetServSubType(CrFwPckt_t pckt)
Return the service sub-type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:303
static CrFwBool_t inCmdInUse[CR_FW_INFACTORY_MAX_NOF_INCMD]
The in-use status of each pre-allocated InCommand instance.
Definition: CrFwInFactory.c:79
CrFwInFactoryPoolIndex_t CrFwInFactoryGetMaxNOfInCmd()
Return the maximum number of InCommands which may be allocated at any one time.
CrFwInCmdAbortAction_t abortAction
Function which implements the Abort Action for the InCommand.
static CrFwInstanceId_t nOfAllocatedInCmdSinceReset
The total number of InCommands or InCommand allocated since the InFactory was reset.
void CrFwInFactoryReleaseInRep(FwSmDesc_t inRepInstance)
Release function for an InReport.
CrFwInCmdValidityCheck_t isValid
Function which implements the Configuration Check for the InCommand.
Definition of Base Component.
static CrFwInFactoryPoolIndex_t nOfAllocatedInCmd
The number of currently allocated InCommands.
Definition: CrFwInFactory.c:82
FwSmDesc_t CrFwInFactoryMake()
Factory function for the singleton instance of the InFactory.
static CrFwInRepData_t inRepCmpSpecificData[CR_FW_INFACTORY_MAX_NOF_INREP]
The component-specific data for the pre-allocated InReport instances.
Definition: CrFwInFactory.c:73
void CrFwInFactoryReleaseInCmd(FwSmDesc_t inCmdInstance)
Release function for an InCommand.
CrFwInstanceId_t CrFwPcktGetCmdRepId(CrFwPckt_t pckt)
Return the command or report identifier of the command or report encapsulated in a packet...
Definition: CrFwPckt.c:339
Component Initialization Procedure (CIP) for the Base Component.
CrFwInCmdStartAction_t startAction
Function which implements the Start Action for the InCommand.
Definition of the OutComponent Component of the framework.
static CrFwInFactoryPoolIndex_t nextInRepFreePos
The index of the next free position in the pool of pre-allocated InReports instances (a value of CR_F...
Definition: CrFwInFactory.c:97
#define CR_FW_INCMD_NKINDS
The total number of kinds of incoming commands supported by the application.
#define CR_FW_INREP_NKINDS
The total number of kinds of incoming reports supported by the application.
FwSmDesc_t CrFwInFactoryMakeInRep(CrFwPckt_t pckt)
Make function for a component encapsulating an incoming report (InReport).
CrFwTypeId_t typeId
The type identifier of the framework component.
Definition: CrFwCmpData.h:83
static CrFwCmdRepKindKey_t inRepKindKey[CR_FW_INREP_NKINDS]
Array holding the keys of the InReport kinds.
Definition: CrFwInFactory.c:49
#define CR_FW_BASE_STATE_CONFIGURED
State identifier for state CONFIGURED in the Base State Machine.
Type for the data describing an InCommand.
CrFwInCmdProgressAction_t progressAction
Function which implements the Progress Action for the InCommand.
CrFwInFactoryPoolIndex_t CrFwInFactoryGetNOfAllocatedInCmd()
Return the number of InCommands which are currently allocated.
static void InFactoryInitAction(FwPrDesc_t initPr)
Initialization action for InFactory.
static FwSmDesc_t inCmd[CR_FW_INFACTORY_MAX_NOF_INCMD]
The pre-allocated InCommand instances.
Definition: CrFwInFactory.c:58
CrFwInCmdTerminationAction_t terminationAction
Function which implements the Termination Action for the InCommand.
CrFwServSubType_t servSubType
The service sub-type.
CrFwInFactoryPoolIndex_t CrFwInFactoryGetNOfAllocatedInRep()
Return the number of InReports which are currently allocated.
CrFwInRepValidityCheck_t isValid
Function which implements the Validity Check for the InReport.
CrFwServSubType_t servSubType
The service sub-type.
Allocation request for a packet for an InCommand has failed (see CrFwInFactoryMakeInCmd).
FwPrDesc_t CrFwInRepExecProcMake()
Create a new instance of the InReport Execution Procedure.
FwPrDesc_t CrFwCmpGetInitProc()
Retrieve the singleton instance of the CIP.
Definition: CrFwInitProc.c:48
unsigned char CrFwServType_t
Type used for the service type of a command or report.
FwSmDesc_t CrFwInFactoryMakeInCmd(CrFwPckt_t pckt)
Make function for a component encapsulating an incoming command (InCommand).
#define CR_FW_INFACTORY_MAX_NOF_INCMD
The maximum number of components representing an incoming command which may be allocated at any one t...
An InCommand release request has encountered an error (see CrFwInFactoryReleaseInCmd).
CrFwInFactoryPoolIndex_t factoryPoolIndex
Index of the position in the pool of pre-allocated InCommands in the InFactory to which the InCompone...
Component Reset Procedure (CRP) for the Base Component.
FwPrDesc_t initProc
The Component Initialization Procedure (CIP) (see CrFwInitProc.h).
Definition: CrFwCmpData.h:95
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
Definition of the InCommand Component of the framework.
CrFwDiscriminant_t discriminant
The discriminant value (or zero if no discriminant for this type/sub-type)
CrFwInFactoryPoolIndex_t CrFwInFactoryGetMaxNOfInRep()
Return the maximum number of InReports which may be allocated at any one time.
CrFwInRepUpdateAction_t updateAction
The pointer to the function implementing the Update Action Operation.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved