CORDET Framework - C2 Implementation
cordetfw/src/CrFwRepInCmdOutcome.c
1 
20 #include "CrFwRepInCmdOutcome.h"
21 
22 /* Include FW Profile Files*/
23 #include "FwSmConfig.h"
24 #include "FwPrConfig.h"
25 
26 /* Include Framework Files */
27 #include <CrFwConstants.h>
28 #include <Pckt/CrFwPckt.h>
31 #include <CrFwCmpData.h>
32 
33 /* Include PUS Extension Files*/
35 #include <CrPsUtilitiesServTest.h>
37 
38 /* Include Standard Files*/
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 
43 #define ACK_CREATE_FAIL 99
44 
45 
46 /*-----------------------------------------------------------------------------------------*/
48 {
49  CRFW_UNUSED(failCode);
50  CRFW_UNUSED(pckt);
51 
52  switch (outcome)
53  {
54  case crCmdAckCreFail:
55  printf("CrFwRepInCmdOutcomeCreFail: InCmd had invalid type or no more resources are available\n");
56  /*SendReqVerifAccFailRep(smDesc, ACK_CREATE_FAIL);*/ /* TODO: need smDesc */
57  break;
58 
59  default:
60  break;
61  }
62 
63  return;
64 }
65 
68 {
69  unsigned short stepIdentifier;
70  prDataPrgrAction_t* prDataPrgrAction;
71 
72  printf("########## CrFwRepInCmdOutcome: unexpected outcome report %d for InCommand %d,\n", outcome, instanceId);
73  printf(" service type %d, service sub-type %d, and discriminant %d\n", servType, servSubType, disc);
74  printf("\n>>>\n>>> Result with Code %d: \n", failCode);
75 
76  switch (outcome)
77  {
78  case crCmdAckAccFail:
79  printf ("########## CrFwRepInCmdOutcome: Acceptance Failed, Send TM(1,2)\n");
80  /* Send Request Verification Acceptance Failed out-going report */
81  SendReqVerifAccFailRep(inCmd, failCode);
82  break;
83  case crCmdAckAccSucc:
84  printf ("########## CrFwRepInCmdOutcome: Acceptance Success, Send TM(1,1)\n");
85  /* Send Request Verification Acceptance Successful out-going report */
87  break;
88  case crCmdAckStrFail:
89  printf ("########## CrFwRepInCmdOutcome: Start Failed, Send TM(1,4)\n");
90  /* Send Request Verification Start Failed out-going report */
92  break;
93  case crCmdAckStrSucc:
94  printf ("########## CrFwRepInCmdOutcome: Start Success, Send TM(1,3)\n");
95  /* Send Request Verification Start Successful out-going report */
97  break;
98  case crCmdAckPrgFail:
99  printf ("########## CrFwRepInCmdOutcome: Progress Failed, Send TM(1,6)\n");
100  /*TODO:*/
101  /* Get procedure parameters */
102  prDataPrgrAction = (prDataPrgrAction_t *)FwPrGetData(getPrDescServTestOnBoardConnPrgr());
103  stepIdentifier = prDataPrgrAction->stepId;
104  /* Send Request Verification Progress Failed out-going report */
105  SendReqVerifPrgrFailRep(inCmd, stepIdentifier, failCode);
106  break;
107  case crCmdAckPrgSucc:
108  printf ("########## CrFwRepInCmdOutcome: Progress Success, Send TM(1,5)\n");
109  /* Get procedure parameters */
110  prDataPrgrAction = (prDataPrgrAction_t *)FwPrGetData(getPrDescServTestOnBoardConnPrgr());
111  if (prDataPrgrAction != NULL)
112  {
113  stepIdentifier = prDataPrgrAction->stepId;
114  }
115  else
116  {
117  stepIdentifier = 1;
118  }
119  /* Send Request Verification Progress Successful out-going report */
120  SendReqVerifPrgrSuccRep(inCmd, stepIdentifier);
121  break;
122  case crCmdAckTrmFail:
123  printf ("########## CrFwRepInCmdOutcome: Termination Failed, Send TM(1,8)\n");
124  /* Send Request Verification Termination Failed out-going report */
126  break;
127  case crCmdAckTrmSucc:
128  printf ("########## CrFwRepInCmdOutcome: Termination Success, Send TM(1,7)\n");
129  /* Send Request Verification Termination Successful out-going report */
131  break;
132  default:
133  printf ("########## CrFwRepInCmdOutcome: unknown outcome\n");
134  break;
135  }
136 
137  switch (failCode)
138  {
139  case 0:
140  printf("########## failed ...");
141  break;
142  case 1:
143  printf("########## success/completed ...");
144  break;
145  case 2:
146  printf("########## continue ...");
147  break;
148  case 3:
149  printf("########## failed with cause: InCmd is not accepted\n>>> -> leads to action ...");
150  /*SendReqVerifCmdFailRep(inCmd, CRPS_REQVERIF_START_FAIL, failCode);*/
151  break;
152  case 4:
153  printf("########## failed with cause: InCmd can not processed successfully due to timeout\n>>> -> leads to action ...");
154  /*SendReqVerifPrgrFailRep(inCmd, 0, failCode);*/
155  break;
156  default:
157  printf("########## unknown\n>>> -> leads to action ...");
158  break;
159  }
160 
161  printf("\n>>>\n");
162 
163  return;
164 }
FwPrDesc_t getPrDescServTestOnBoardConnPrgr()
Getter for TestOnBoardConnPrgr procedure descriptor.
static CrFwServSubType_t servSubType
Service sub-type.
#define CRPS_REQVERIF_ACC_SUCC
Subtype identifier of the Request Verification Acceptance Successful out-going report packet...
Definition: CrPsConstants.h:85
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
#define CRPS_REQVERIF_START_SUCC
Subtype identifier of the Request Verification Start Successful out-going report packet.
Definition: CrPsConstants.h:95
void CrFwRepInCmdOutcomeCreFail(CrFwRepInCmdOutcome_t outcome, CrFwOutcome_t failCode, CrFwPckt_t pckt)
Report the a "creation failure" outcome for the processing of a packet carrying an InCommand...
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
Definition of the OutFactory component.
Header file to define all service and packet identifiers.
Acceptance failure.
Interface for creating and accessing a report or command packet.
unsigned char CrFwServType_t
Type used for the service type of a command or report.
Header file to define all invariant publicly available constants and types for the CORDET Framework...
Creation failure.
#define CRPS_REQVERIF_TERM_SUCC
Subtype identifier of the Request Verification Termination Successful out-going report packet...
Start failure.
void SendReqVerifAccSuccRep(FwSmDesc_t smDesc, uint16_t reqVerifAccSuccType)
Generate a Request Verification Acceptance/Start/Termination Successful out-going report...
static CrFwDiscriminant_t disc
Discriminant.
Acceptance success.
#define CRPS_REQVERIF_TERM_FAIL
Subtype identifier of the Request Verification Termination Failed out-going report packet...
Termination failure.
Interface through which applications can initialize and execute framework PUS extension components...
#define CRPS_REQVERIF_START_FAIL
Subtype identifier of the Request Verification Start Failed out-going report packet.
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.
unsigned char CrFwOutcome_t
Type used for the outcome of a check (see CrFwCmpData).
Interface for reporting the outcome of the processing of an InCommand.
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
static CrFwServType_t servType
Service type.
Termination success.
CrFwRepInCmdOutcome_t
Enumerated type for the outcome of the processing of an incoming command.
void SendReqVerifPrgrSuccRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier)
Generate a Request Verification Progress Successful out-going report.
void SendReqVerifPrgrFailRep(FwSmDesc_t smDesc, CrPsStepId_t stepIdentifier, CrPsFailCode_t FailureCode)
Generate a Request Verification Progress Failed out-going report.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
void SendReqVerifAccFailRep(FwSmDesc_t smDesc, CrPsFailCode_t FailureCode)
Generate a Request Verification Acceptance Failed out-going report.
Interface through which applications can initialize and execute framework PUS extension components...
Start success.
static FwSmDesc_t inCmd[CR_FW_INFACTORY_MAX_NOF_INCMD]
The pre-allocated InCommand instances.
Definition: CrFwInFactory.c:58
Progress success.
Definition of the OutLoader component.
Progress failure.
void SendReqVerifCmdFailRep(FwSmDesc_t smDesc, uint16_t reqVerifCmdFailType, CrPsFailCode_t FailureCode)
Generate a Request Verification Start/Termination Failed out-going report.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved