CORDET Framework - C2 Implementation
CrPsHkRepStructCmd.c
Go to the documentation of this file.
1 
22 #include "CrPsHkRepStructCmd.h"
23 
24 /* CrFramework includes */
25 #include <Pckt/CrFwPckt.h>
27 #include <OutCmp/CrFwOutCmp.h>
29 #include <CrFwCmpData.h>
30 
32 #include "FwPrConstants.h"
33 #include "FwPrDCreate.h"
34 #include "FwPrConfig.h"
35 #include "FwPrCore.h"
36 #include <FwSmConfig.h>
37 
38 #include <CrPsUtilitiesServHk.h>
39 #include <CrPsUserConstants.h>
43 
44 #include <stdlib.h>
45 
46 
47 /* ------------------------------------------------------------------------------------ */
48 void CrPsHkRepStructCmdStartAction(FwSmDesc_t smDesc)
49 {
50  CrFwCmpData_t *cmpData;
51  CrFwInCmdData_t *cmpSpecificData;
52  CrFwPckt_t pckt;
54  CrPsSid_t sid[HK_N_REP_DEF+1];
55  CrFwCounterU4_t nmbN;
56  CrFwCounterU4_t k;
57 
58  /* Run the procedure Start Action of Multi-SID Command of figure 9.3 */
59 
60  /* Get in data */
61  cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
62  cmpSpecificData = (CrFwInCmdData_t *) cmpData->cmpSpecificData;
63  pckt = cmpSpecificData->pckt;
64 
65  /* Get number N of HkRepStructCmd requests */
66  nmbN = getHkRepStructCmdN(pckt);
67 
68  for (k=0; k<nmbN; k++)
69  {
70  sid[k] = getHkRepStructCmdRepStrucIdItem(pckt, k+1);
71  }
72  sid[k] = 0;
73 
74  /* Set prData of procedure */
75  /* initial setting of prData */
76  prData.smDesc = smDesc;
77  prData.sidPtr = sid;
78  FwPrSetData(getPrDescMultiSidCmdStart(), &prData);
79 
80  FwPrRun(getPrDescMultiSidCmdStart());
81 
82  cmpData = (CrFwCmpData_t*) FwSmGetData(smDesc);
83 
84  return;
85 }
86 
87 /* ------------------------------------------------------------------------------------ */
88 void CrPsHkRepStructCmdProgressAction(FwSmDesc_t smDesc)
89 {
90  CrFwCmpData_t *cmpData;
91  CrFwInCmdData_t *cmpSpecificData;
92  CrFwPckt_t pckt;
93  prDescCmd3s9Prgr_t *prDataPtr;
94  CrPsSid_t sid[HK_N_REP_DEF+1];
95  CrFwCounterU4_t nmbN;
96  CrFwCounterU4_t k;
97 
98  /* Run the procedure Progress Action of Report Housekeeping Structure of figure 9.4 */
99 
100  /* Get in data */
101  cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
102  cmpSpecificData = (CrFwInCmdData_t *) cmpData->cmpSpecificData;
103  pckt = cmpSpecificData->pckt;
104 
105  /* Get number N of HkRepStructCmd requests */
106  nmbN = getHkRepStructCmdN(pckt);
107 
108  for (k=0; k<nmbN; k++)
109  {
110  sid[k] = getHkRepStructCmdRepStrucIdItem(pckt, k+1);
111  }
112  sid[k] = 0;
113 
114  /* Set prData of procedure */
115  /* initial setting of prData */
116  prDataPtr = (prDescCmd3s9Prgr_t *)malloc(sizeof(prDescCmd3s9Prgr_t));
117  prDataPtr->smDesc = smDesc;
118  prDataPtr->sidPtr = sid;
119  FwPrSetData(getPrDescCmd3s9Prgr(), prDataPtr);
120 
121  FwPrStart(getPrDescCmd3s9Prgr());
122  FwPrExecute(getPrDescCmd3s9Prgr());
123 
124  cmpData = (CrFwCmpData_t*) FwSmGetData(smDesc);
125 
126  return;
127 }
128 
129 /* ------------------------------------------------------------------------------------ */
130 void CrPsHkRepStructCmdTerminationAction(FwSmDesc_t smDesc)
131 {
132  CrFwCmpData_t *inData;
133  prDescCmd3s9Prgr_t *prDataPtr;
134  unsigned short outcome;
135 
136  /* Set action outcome to ’success’ if all valid SIDs in the command were successfully processed by the progress action;
137  =====
138  * set it to ’failure’ otherwise */
139 
140  /* Get in data */
141  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
142 
143  /* Get procedure parameters */
144  prDataPtr = (prDescCmd3s9Prgr_t*) FwPrGetData(getPrDescCmd3s9Prgr());
145 
146  /* Get the Outcome*/
147  outcome = prDataPtr->outcome;
148 
149  if (outcome == 1)
150  {
151  inData->outcome = 1;
152  }
153 
154 #if 0
155  else if ((outcome == 0) || (outcome > 2))
156  {
157  inData->outcome = 0;
158  }
159 #endif
160 
161  return;
162 }
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.
Interface through which applications can initialize and execute framework PUS extension components...
Header file to define all user-configurable constants and types for the IASW Application.
void CrPsHkRepStructCmdStartAction(FwSmDesc_t smDesc)
FW Profile function definitions.
Definition of the OutFactory component.
CrFwPckt_t pckt
Packet holding the InCommand.
Header file to define all service and packet identifiers.
Interface for creating and accessing a report or command packet.
auxiliary Interface for accessing fields in packets of service "ServHk".
void CrPsHkRepStructCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Command (3,9) to Report Structure of a Housekeeping Report in-coming comman...
FwPrDesc_t getPrDescCmd3s9Prgr()
Getter for Cmd3s9Prgr procedure descriptor.
CrPsSid_t getHkRepStructCmdRepStrucIdItem(void *p, CrFwCounterU4_t N)
Get "RepStrucId" from "HkRepStructCmd" packet.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
FwPrDesc_t getPrDescMultiSidCmdStart()
Getter for MultiSidCmdStart procedure descriptor.
static CrFwCounterU4_t getHkRepStructCmdN(void *p)
Get "N" from "HkRepStructCmd" packet.
#define HK_N_REP_DEF
Number of Report Definitions in the Report Definition List (maximum number of housekeeping/diagnostic...
uint8_t CrPsSid_t
Type used for the Parameter Report Structure ID of a packet.
void CrPsHkRepStructCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,9) to Report Structure of a Housekeeping Report in-coming command p...
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
Definition of the OutComponent Component of the framework.
Command (3,9) to Report Structure of a Housekeeping Report.
Interface for accessing fields in packets of service "ServHk".
Type for the data describing an InCommand.
Definition of the OutLoader component.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved