CORDET Framework - C2 Implementation
CrPsCmdPrgrSuccFunc.c
Go to the documentation of this file.
1 
25 #include "CrPsCmdPrgrSuccCreate.h"
26 
28 #include "FwPrConstants.h"
29 #include "FwPrDCreate.h"
30 #include "FwPrConfig.h"
31 #include "FwPrCore.h"
32 #include "FwSmConfig.h"
33 
34 #include "Pckt/CrFwPckt.h" /* --- interface to adaptation point CrFwPckt --- */
35 #include <CrFwCmpData.h>
38 #include <OutCmp/CrFwOutCmp.h>
39 
40 #include <CrPsRepErr.h>
45 
46 #include <stdlib.h>
47 #include <time.h>
48 
49 static FwSmDesc_t rep;
50 
51 
52 /* ----------------------------------------------------------------------------------------------------------------- */
53 
54 /* ------------------------------------------------------------------------------------ */
56 void CrPsCmdPrgrSuccN2(FwPrDesc_t prDesc)
57 {
58  CRFW_UNUSED(prDesc);
59 
60  /* Retrieve an OutComponent of type (1,5) from the OutFactory */
61 
62  /* Create out component */
64 
65  return;
66 }
67 
68 /* ------------------------------------------------------------------------------------ */
70 void CrPsCmdPrgrSuccN3(FwPrDesc_t prDesc)
71 {
72  CrPsRepErrCode_t errCode;
73 
74  CRFW_UNUSED(prDesc);
75 
76  /* Generate error report OUTFACTORY_FAIL */
77 
78  errCode = crOutfactoryFail;
80 
81  return;
82 }
83 
84 /* ------------------------------------------------------------------------------------ */
86 void CrPsCmdPrgrSuccN4(FwPrDesc_t prDesc)
87 {
88  CrFwDestSrc_t source;
89  CrFwCmpData_t *inData;
90  CrFwInCmdData_t *inSpecificData;
91  CrFwPckt_t inPckt;
92  FwSmDesc_t smDesc;
93  prData_t *prData;
94  CrFwCmpData_t *cmpDataStart;
95  CrFwOutCmpData_t *cmpSpecificData;
96  CrFwPckt_t pckt;
97  CrPsRid_t Rid;
98 
99  cmpDataStart = (CrFwCmpData_t *) FwSmGetData(rep);
100  cmpSpecificData = (CrFwOutCmpData_t *) cmpDataStart->cmpSpecificData;
101  pckt = cmpSpecificData->pckt;
102 
103  /* Configure report and load it in the OutLoader */
104 
105  /* Get procedure parameters */
106  prData = FwPrGetData(prDesc);
107 
108  smDesc = prData->smDesc;
109 
110  /* Get in packet */
111  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
112  inSpecificData = (CrFwInCmdData_t*)inData->cmpSpecificData;
113  inPckt = inSpecificData->pckt;
114 
115  /* set Packet request ID */
116  Rid = getPcktRid(inPckt);
117  setVerSuccessPrgrRepRid(pckt, Rid);
118 
119  /* Set stepId */
120  setVerSuccessPrgrRepStepId(pckt, (CrPsStepId_t)prData->ushortParam1);
121 
122  /* Set the destination of the report to the source of the in-coming packet */
123  source = CrFwPcktGetSrc(inPckt);
124  CrFwOutCmpSetDest(rep, source);
125 
126  /* Load report in the Outloader */
128 
129  return;
130 }
131 
132 /* ------------------------------------------------------------------------------------ */
133 /**************/
134 /*** GUARDS ***/
135 /**************/
136 
138 FwPrBool_t CrPsCmdPrgrSuccG1(FwPrDesc_t prDesc)
139 {
140  CRFW_UNUSED(prDesc);
141 
142  /* [ OutFactory fails to generate OutComponent ] */
143 
144  if (rep == NULL)
145  {
146  return 1;
147  }
148  else
149  {
150  return 0;
151  }
152 
153 }
154 
155 /* ----------------------------------------------------------------------------------------------------------------- */
156 
Type for the Framework Component Data (FCD).
CrFwDestSrc_t CrFwPcktGetSrc(CrFwPckt_t pckt)
Return the source of the command or report encapsulated in a packet.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
void CrPsCmdPrgrSuccN2(FwPrDesc_t prDesc)
Action for node N2.
static FwSmDesc_t rep
CrPsCmdPrgrSucc function definitions.
Definition of the OutFactory component.
Type for the data describing an OutComponent.
CrFwPckt_t pckt
Packet holding the InCommand.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
Header file to define all service and packet identifiers.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
Interface for creating and accessing a report or command packet.
Create one instance of the CrPsCmdPrgrSucc procedure.
static void setVerSuccessPrgrRepStepId(void *p, CrPsStepId_t StepId)
Set "StepId" in "VerSuccessPrgrRep" packet.
#define CRPS_REQVERIF_PROG_SUCC
Subtype identifier of the Request Verification Progress Successful out-going report packet...
uint32_t CrPsStepId_t
Type used for the Step ID of a packet.
void CrPsCmdPrgrSuccN4(FwPrDesc_t prDesc)
Action for node N4.
void CrFwOutLoaderLoad(FwSmDesc_t outCmp)
Load an OutComponent into its OutManager.
Interface for accessing fields in packets of service "ServReqVerif".
The Outfactory failed to make the component (see CrPsRepErr.h)
CrPsRepErrCode_t
Identifier for the errors reported through the error reporting interface of CrFwRepErr.h.
generic Interface for accessing fields in packets.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrPsCmdPrgrSuccN3(FwPrDesc_t prDesc)
Action for node N3.
FwPrBool_t CrPsCmdPrgrSuccG1(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION2 to N3.
void CrPsRepErr(CrPsRepErrCode_t errCode, CrFwServType_t repType, CrFwServSubType_t repSubType, CrFwDiscriminant_t repDiscriminant)
Report an error which has no parameters attached to it.
Definition: CrPsRepErr.c:37
Interface for reporting an error detected by a PUS Extension component.
void setVerSuccessPrgrRepRid(void *p, CrPsRid_t Rid)
Set "RequestId" in a "VerSuccessPrgrRep" packet.
auxiliary Interface for accessing fields in packets of service "ServReqVerif".
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
Definition of the OutComponent Component of the framework.
static CrPsRid_t getPcktRid(void *p)
Getter for the RequestId from a packet.
Definition: CrPsPkt.h:1067
void CrFwOutCmpSetDest(FwSmDesc_t smDesc, CrFwDestSrc_t dest)
Set the destination of the OutComponent.
Definition: CrFwOutCmp.c:192
Type for the data describing an InCommand.
Definition of the OutLoader component.
FwSmDesc_t CrFwOutFactoryMakeOutCmp(CrFwServType_t type, CrFwServSubType_t subType, CrFwDiscriminant_t discriminant, CrFwPcktLength_t length)
Make function for an OutComponent.
#define CRPS_REQVERIF
Type identifier of the Request Verification Service.
Definition: CrPsConstants.h:80
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved