CORDET Framework - C2 Implementation
CrPsCmd17s3StartFunc.c
Go to the documentation of this file.
1 
25 #include "CrPsCmd17s3StartCreate.h"
26 
28 #include "FwSmConstants.h"
29 #include "FwSmConfig.h"
30 #include "FwSmCore.h"
31 #include "FwPrDCreate.h"
32 #include "FwPrConfig.h"
33 #include "FwPrCore.h"
34 #include "FwPrConstants.h"
35 
36 /* Framework function definitions */
37 #include "Pckt/CrFwPckt.h"
39 #include "OutCmp/CrFwOutCmp.h"
41 #include "CrFwCmpData.h"
42 
43 #include <DataPool/CrPsDp.h>
45 
47 #include <Services/Test/InCmd/CrPsTestOnBoardConnection.h> /* for global handles */
48 
49 #include <CrPsRepErr.h>
50 #include <CrPsUtilitiesServTest.h>
51 
52 #include <stdlib.h>
53 #include <time.h>
54 
55 static FwSmDesc_t cmd;
56 
57 
58 /* ------------------------------------------------------------------------------------ */
59 /* Action for node N1. */
60 void CrPsTestOnBoardConnectionStartN1(FwPrDesc_t prDesc)
61 {
62  CrPsDestSrc_t areYouAliveSrc;
63 
64  CRFW_UNUSED(prDesc);
65 
66  /* Set areYouAliveSrc to zero */
67 
68  areYouAliveSrc = 0;
69  setDpAreYouAliveSrc(areYouAliveSrc);
70 
71  return;
72 }
73 
74 /* ------------------------------------------------------------------------------------ */
75 /* Action for node N2. */
76 void CrPsTestOnBoardConnectionStartN2(FwPrDesc_t prDesc)
77 {
78  CRFW_UNUSED(prDesc);
79  /* Retrieve an OutComponent of type (17,1) from the OutFactory */
80 
81  /* Create out component */
83 
84  return;
85 }
86 
87 /* ------------------------------------------------------------------------------------ */
88 /* Action for node N3. */
89 void CrPsTestOnBoardConnectionStartN3(FwPrDesc_t prDesc)
90 {
91  CrPsRepErrCode_t errCode;
92 
93  CRFW_UNUSED(prDesc);
94 
95  /* Generate error report OUTFACTORY_FAIL */
96 
97  errCode = crOutfactoryFail;
99 
100  return;
101 }
102 
103 /* ------------------------------------------------------------------------------------ */
104 /* Action for node N4. */
105 void CrPsTestOnBoardConnectionStartN4(FwPrDesc_t prDesc)
106 {
107  CrFwDestSrc_t destId;
108 
109  CRFW_UNUSED(prDesc);
110 
111  /* Configure (17,1) OutComponent */
112 
113  /* Get destination Id of target application */
115 
116  /* Set out component parameters */
117  CrFwOutCmpSetDest(cmd, destId);
118 
119  return;
120 }
121 
122 /* ------------------------------------------------------------------------------------ */
123 /* Action for node N5. */
124 void CrPsTestOnBoardConnectionStartN5(FwPrDesc_t prDesc)
125 {
126  CRFW_UNUSED(prDesc);
127 
128  /* Load OutComponent in OutLoader */
129 
131 
132  return;
133 }
134 
135 /* ------------------------------------------------------------------------------------ */
136 /* Action for node N7. */
137 void CrPsTestOnBoardConnectionStartN7(FwPrDesc_t prDesc)
138 {
139  FwSmDesc_t smDesc;
140  CrFwCmpData_t *cmpData;
141 
142  /* Set outcome of Start Action to 'success' */
143 
144  /* Get smDesc from InCmd */
145  smDesc = FwPrGetData(prDesc);
146 
147  /* Set outcome in InCmd prData to 'success' */
148  cmpData = (CrFwCmpData_t*) FwSmGetData(smDesc);
149  cmpData->outcome = 1;
150 
151  return;
152 }
153 
154 /* ------------------------------------------------------------------------------------ */
155 /* Action for node N8. */
156 void CrPsTestOnBoardConnectionStartN8(FwPrDesc_t prDesc)
157 {
158  FwSmDesc_t smDesc;
159  CrFwCmpData_t *cmpData;
160 
161  /* Set outcome of Start Action to 'failure' with failure code VER_REP_CR_FD */
162 
163  /* Get smDesc from InCmd */
164  smDesc = FwPrGetData(prDesc);
165 
166  /* Set outcome in InCmd prData to 'failure' (VER_REP_CR_FD) */
167  cmpData = (CrFwCmpData_t*) FwSmGetData(smDesc);
168  cmpData->outcome = VER_REP_CR_FD;
169 
170  return;
171 }
172 
173 /* ------------------------------------------------------------------------------------ */
174 /* Action for node N9. */
175 void CrPsTestOnBoardConnectionStartN9(FwPrDesc_t prDesc)
176 {
177  FwSmDesc_t rep;
178  prDataPrgrAction_t *prDataPrgrActionPtr;
179 
180  CRFW_UNUSED(prDesc);
181 
182  /* Retrieve an OutComponent of type (17,4) from the OutFactory */
183 
184  /* Create out component */
186 
187  /* Initialize and set prData of procedure */
188  prDataPrgrActionPtr = (prDataPrgrAction_t *)malloc(sizeof(prDataPrgrAction_t));
189  prDataPrgrActionPtr->smDesc = rep;
190  FwPrSetData(getPrDescServTestOnBoardConnPrgr(), prDataPrgrActionPtr);
191 
192  return;
193 }
194 
195 /* ------------------------------------------------------------------------------------ */
196 /* Action for node N10. */
197 void CrPsTestOnBoardConnectionStartN10(FwPrDesc_t prDesc)
198 {
199  CRFW_UNUSED(prDesc);
200 
201  /* Release (17,1) OutComponent */
203 
204  return;
205 }
206 
207 /* ------------------------------------------------------------------------------------ */
208 /**************/
209 /*** GUARDS ***/
210 /**************/
211 
212 /* Guard on the Control Flow from DECISION1 to N1. */
213 FwPrBool_t CrPsTestOnBoardConnectionStartG1(FwPrDesc_t prDesc)
214 {
215  CrFwCounterU4_t i, pos;
216  CrPsApid_t appId;
217  CrPsDestSrc_t destId;
218 
219  CRFW_UNUSED(prDesc);
220 
221  /* [ Identifier of target application is legal ] */
222 
223  /* get requested target application ID */
224  appId = getDpOnBoardConnectDest();
225 
226  /* get all target application IDs and check them */
227  for (i=0; i<10; i++)
228  {
229  pos = i;
230  destId = getDpOnBoardConnectDestLstItem(pos);
231  if (destId == appId)
232  return 1;
233  }
234 
235  return 0;
236 }
237 
238 /* ------------------------------------------------------------------------------------ */
239 /* Guard on the Control Flow from DECISION2 to N3. */
240 FwPrBool_t CrPsTestOnBoardConnectionStartG2(FwPrDesc_t prDesc)
241 {
242  CRFW_UNUSED(prDesc);
243 
244  /* [ OutFactory fails to generate OutComponent ] */
245 
246  if (cmd == NULL)
247  {
248  return 1;
249  }
250  else
251  {
252  return 0;
253  }
254 
255 }
256 
257 /* ------------------------------------------------------------------------------------ */
258 /* Guard on the Control Flow from DECISION3 to N4. */
259 FwPrBool_t CrPsTestOnBoardConnectionStartG3(FwPrDesc_t prDesc)
260 {
261  FwSmDesc_t rep;
262  prDataPrgrAction_t *prDataPrgrActionPtr;
263 
264  CRFW_UNUSED(prDesc);
265 
266  /* [ OutFactory returns OutComponent ] */
267 
268  prDataPrgrActionPtr = FwPrGetData(getPrDescServTestOnBoardConnPrgr());
269  rep = prDataPrgrActionPtr->smDesc;
270 
271  if (rep != NULL)
272  {
273  return 1;
274  }
275  else
276  {
277  return 0;
278  }
279 
280 }
Type for the Framework Component Data (FCD).
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
CrFwCounterU4_t i
CrPsCmd5EidStart function definitions.
FwPrDesc_t getPrDescServTestOnBoardConnPrgr()
Getter for TestOnBoardConnPrgr procedure descriptor.
void CrPsTestOnBoardConnectionStartN3(FwPrDesc_t prDesc)
Action for node N3.
void CrPsTestOnBoardConnectionStartN8(FwPrDesc_t prDesc)
Action for node N8.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
FwPrBool_t CrPsTestOnBoardConnectionStartG1(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION1 to N1.
void CrPsTestOnBoardConnectionStartN4(FwPrDesc_t prDesc)
Action for node N4.
Interface for accessing data pool items.
FwSmDesc_t rep
CrPsCmd3s9Prgr function definitions.
static CrPsDestSrc_t getDpOnBoardConnectDestLstItem(int i)
Gets the value of the i-th element in the datapool array OnBoardConnectDestLst.
Definition of the OutFactory component.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
#define CRPS_TEST_AREYOUALIVE_CONNECTION_CMD
Subtype identifier of the Test AreYouAlive Connection in-coming command packet.
Header file to define all service and packet identifiers.
Interface for creating and accessing a report or command packet.
uint16_t CrPsApid_t
Type used for the Application ID of a packet.
#define CRPS_TEST
Type identifier of the Test Service.
uint16_t CrPsDestSrc_t
Type used for the Destination or Source of a packet.
Declaration of the Perform Connection Test in-coming command packet.
static void setDpAreYouAliveSrc(CrPsDestSrc_t AreYouAliveSrc)
Sets the value of the datapool item AreYouAliveSrc.
static CrPsDestSrc_t getDpOnBoardConnectDest()
Gets the value of the datapool item OnBoardConnectDest.
Create one instance of the CrPsCmd17s3Start procedure.
void CrPsTestOnBoardConnectionStartN5(FwPrDesc_t prDesc)
Action for node N5.
void CrPsTestOnBoardConnectionStartN2(FwPrDesc_t prDesc)
Action for node N2.
void CrPsTestOnBoardConnectionStartN7(FwPrDesc_t prDesc)
Action for node N7.
void CrFwOutLoaderLoad(FwSmDesc_t outCmp)
Load an OutComponent into its OutManager.
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.
FwPrBool_t CrPsTestOnBoardConnectionStartG3(FwPrDesc_t prDesc)
Guard on the Control Flow from DECISION3 to N4.
Interface through which applications can initialize and execute framework PUS extension components...
void CrPsTestOnBoardConnectionStartN10(FwPrDesc_t prDesc)
Action for node N10.
static FwSmDesc_t cmd
CrPsCmd17s3Start function definitions.
FwPrBool_t CrPsTestOnBoardConnectionStartG2(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
void CrPsTestOnBoardConnectionStartN1(FwPrDesc_t prDesc)
Action for node N1.
Interface for reporting an error detected by a PUS Extension component.
void CrFwOutFactoryReleaseOutCmp(FwSmDesc_t outCmpInstance)
Release function for an OutComponent.
Definition of the OutComponent Component of the framework.
void CrFwOutCmpSetDest(FwSmDesc_t smDesc, CrFwDestSrc_t dest)
Set the destination of the OutComponent.
Definition: CrFwOutCmp.c:192
#define CRPS_TEST_ONBOARD_CONNECTION_REP
Subtype identifier of the Test On-Board Connection out-going report packet.
void CrPsTestOnBoardConnectionStartN9(FwPrDesc_t prDesc)
Action for node N9.
Interface for accessing data pool items.
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.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved