CORDET Framework - C2 Implementation
CrPsHkDeleteCmd.c
Go to the documentation of this file.
1 
22 #include "CrPsHkDeleteCmd.h"
23 
25 #include "CrFwConstants.h"
26 #include "Pckt/CrFwPckt.h"
28 #include "OutCmp/CrFwOutCmp.h"
30 #include "CrFwCmpData.h"
31 
33 #include "FwSmConstants.h"
34 #include "FwSmConfig.h"
35 #include "FwSmCore.h"
36 #include "FwPrDCreate.h"
37 #include "FwPrConfig.h"
38 #include "FwPrCore.h"
39 #include "FwPrConstants.h"
40 
41 #include <CrPsUtilitiesServHk.h>
42 #include <DataPool/CrPsDpServHk.h>
46 
47 
48 /* ------------------------------------------------------------------------------------ */
49 void CrPsHkDeleteCmdStartAction(FwSmDesc_t smDesc)
50 {
51  prDescCmd3s3Start_t prData;
52  unsigned char rdlSlotList[HK_N_REP_DEF];
53 
54  /* Run the procedure Start Action of HkDelete Command of figure 9.2 */
55 
56  /* Set prData of procedure */
57  /* initial setting of prData */
58  prData.smDesc = smDesc;
59  prData.rdlSlotListPtr = rdlSlotList;
60  FwPrSetData(getPrDescHkCmd3s3Start(), &prData);
61 
62  FwPrRun(getPrDescHkCmd3s3Start());
63 
64  return;
65 }
66 
67 /* ------------------------------------------------------------------------------------ */
68 void CrPsHkDeleteCmdProgressAction(FwSmDesc_t smDesc)
69 {
70  CrFwCmpData_t *cmpData;
71  CrFwInCmdData_t *cmpSpecificData;
72  CrFwPckt_t pckt;
73  CrFwCounterU4_t i, N;
74  CrPsSid_t rdlSid, rdlSlot;
75  CrPsSid_t sid;
76  CrFwBool_t isEnabled;
77 
78  /* Delete the entries in the RDL corresponding to the SIDs which have been identified as valid by the Start Action
79  and then set the action outcome to ’completed’ */
80 
81  /* Get in data */
82  cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
83  cmpSpecificData = (CrFwInCmdData_t *) cmpData->cmpSpecificData;
84  pckt = cmpSpecificData->pckt;
85 
86  /* Get N from inPckt */
87  N = (CrFwCounterU4_t)getHkDeleteCmdN(pckt);
88 
89  for (i=0; i<N; i++)
90  {
91  /* Get SID from inPckt */
92  sid = getHkDeleteCmdRepStrucIdItem(pckt, i+1);
93 
94  /* Check if SID is in the RDL */
95  /* look for the slot */
96  for (rdlSlot = 0; rdlSlot < HK_N_REP_DEF; rdlSlot++)
97  {
98  rdlSid = getDpsidItem(rdlSlot);
99 
100  if (sid == rdlSid)
101  break;
102  }
103 
104  if (rdlSlot < HK_N_REP_DEF)
105  {
106  /* Check if SID is enabled */
107  isEnabled = (CrFwBool_t)getDpisEnabledItem(rdlSlot);
108 
109  if (!isEnabled)
110  {
111  /* Delete the SID entry in the RDL */
112  setDpsidItem(rdlSlot, 0);
113  }
114  }
115 
116  }
117 
118  cmpData->outcome = 1;
119 
120  return;
121 }
122 
123 /* ------------------------------------------------------------------------------------ */
124 void CrPsHkDeleteCmdTerminationAction(FwSmDesc_t smDesc)
125 {
126  CrFwCmpData_t *inData;
127 
128  /* Set action outcome to 'success' */
129 
130  /* Get in data */
131  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
132 
133  inData->outcome = 1;
134 
135  return;
136 }
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.
Interface through which applications can initialize and execute framework PUS extension components...
Interface for accessing data pool items.
CrPsSid_t getHkDeleteCmdRepStrucIdItem(void *p, CrFwCounterU4_t N)
Get "RepStrucId" from "HkDeleteCmd" packet.
Definition of the OutFactory component.
CrFwPckt_t pckt
Packet holding the InCommand.
static CrPsFlag_t getDpisEnabledItem(int i)
Gets the value of the i-th element in the datapool array isEnabled.
Definition: CrPsDpServHk.h:229
Header file to define all service and packet identifiers.
Interface for creating and accessing a report or command packet.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
Header file to define all invariant publicly available constants and types for the CORDET Framework...
Command (3,3) to Delete a Housekeeping Report Structure.
static CrFwCounterU4_t getHkDeleteCmdN(void *p)
Get "N" from "HkDeleteCmd" packet.
static CrPsSid_t getDpsidItem(int i)
Gets the value of the i-th element in the datapool array sid.
Definition: CrPsDpServHk.h:289
static void setDpsidItem(int i, CrPsSid_t sid)
Sets the value of the i-th element in the datapool array sid.
Definition: CrPsDpServHk.h:300
auxiliary Interface for accessing fields in packets of service "ServHk".
void CrPsHkDeleteCmdStartAction(FwSmDesc_t smDesc)
CR Framework function definitions.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
FwPrDesc_t getPrDescHkCmd3s3Start()
Getter for HkCmd3s3Start procedure descriptor.
void CrPsHkDeleteCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,3) to Delete a Housekeeping Report Structure in-coming command pack...
void CrPsHkDeleteCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Command (3,3) to Delete a Housekeeping Report Structure in-coming command p...
#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.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
Definition of the OutComponent Component of the framework.
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