CORDET Framework - C2 Implementation
CrPsHkDisableCmd.c
Go to the documentation of this file.
1 
22 #include "CrPsHkDisableCmd.h"
23 
24 /* CrFramework includes */
25 #include <Pckt/CrFwPckt.h>
27 #include <OutCmp/CrFwOutCmp.h>
29 #include <CrFwCmpData.h>
30 
31 /* FwProfile includes */
32 #include "FwSmConstants.h"
33 #include "FwSmConfig.h"
34 #include "FwSmCore.h"
35 #include "FwPrDCreate.h"
36 #include "FwPrConfig.h"
37 #include "FwPrCore.h"
38 #include "FwPrConstants.h"
39 
40 #include <CrPsUserConstants.h>
41 #include <CrPsUtilitiesServHk.h>
42 #include <DataPool/CrPsDpServHk.h>
46 
47 
48 /* ------------------------------------------------------------------------------------ */
49 void CrPsHkDisableCmdStartAction(FwSmDesc_t smDesc)
50 {
51  CrFwCmpData_t *cmpData;
52  CrFwInCmdData_t *cmpSpecificData;
53  CrFwPckt_t pckt;
55  CrPsSid_t sid[HK_N_REP_DEF+1];
56  CrFwCounterU4_t nmbN;
57  CrFwCounterU4_t k;
58 
59  /* Run the procedure Start Action of Multi-SID Command of figure 9.3 */
60 
61  /* Get in data */
62  cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
63  cmpSpecificData = (CrFwInCmdData_t *) cmpData->cmpSpecificData;
64  pckt = cmpSpecificData->pckt;
65 
66  /* Get number N of OneShot requests */
67  nmbN = getHkDisableCmdN(pckt);
68 
69  for (k=0; k<nmbN; k++)
70  {
71  sid[k] = getHkDisableCmdRepStrucIdItem(pckt, k+1);
72  }
73  sid[k] = 0;
74 
75  /* Set prData of procedure */
76  /* initial setting of prData */
77  prData.smDesc = smDesc;
78  prData.sidPtr = sid;
79  FwPrSetData(getPrDescMultiSidCmdStart(), &prData);
80 
81  FwPrRun(getPrDescMultiSidCmdStart());
82 
83  cmpData = (CrFwCmpData_t*) FwSmGetData(smDesc);
84 
85  return;
86 }
87 
88 /* ------------------------------------------------------------------------------------ */
89 void CrPsHkDisableCmdProgressAction(FwSmDesc_t smDesc)
90 {
91  CrPsSid_t sid[HK_N_REP_DEF+1];
92  CrPsSid_t rdlSid, rdlSlot;
93  CrFwBool_t isEnabled;
94  CrFwCounterU4_t nmbN;
95  CrFwCounterU4_t k;
96  CrFwCmpData_t *cmpData;
97  CrFwInCmdData_t *cmpSpecificData;
98  CrFwPckt_t pckt;
99 
100  /* Set to false the enable flag of the entries in the RDL corresponding to the SIDs which have been
101  * identified as valid by the Start Action and then set the action outcome to ’completed’ */
102 
103  /* Get in data */
104  cmpData = (CrFwCmpData_t*)FwSmGetData(smDesc);
105  cmpSpecificData = (CrFwInCmdData_t *) cmpData->cmpSpecificData;
106  pckt = cmpSpecificData->pckt;
107 
108  /* Get number N of OneShot requests */
109  nmbN = getHkDisableCmdN(pckt);
110 
111  for (k=0; k<nmbN; k++)
112  {
113  sid[k] = getHkDisableCmdRepStrucIdItem(pckt, k+1);
114 
115  /* look for the slot */
116  for (rdlSlot = 0; rdlSlot < HK_N_REP_DEF; rdlSlot++)
117  {
118  rdlSid = getDpsidItem(rdlSlot);
119 
120  if (sid[k] == rdlSid)
121  break;
122  }
123 
124  isEnabled = 0;
125  setDpisEnabledItem(rdlSlot, isEnabled);
126  }
127 
128  cmpData->outcome = 1;
129 
130  return;
131 }
132 
133 /* ------------------------------------------------------------------------------------ */
134 void CrPsHkDisableCmdTerminationAction(FwSmDesc_t smDesc)
135 {
136  CrFwCmpData_t* inData;
137 
138  /* Set action outcome to 'success' */
139 
140  /* Get in data */
141  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
142 
143  inData->outcome = 1;
144 
145  return;
146 }
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.
Interface for accessing data pool items.
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.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
CrPsSid_t getHkDisableCmdRepStrucIdItem(void *p, CrFwCounterU4_t N)
Get "RepStrucId" from "HkDisableCmd" packet.
void CrPsHkDisableCmdProgressAction(FwSmDesc_t smDesc)
Progress action of the Command (3,6) to Disable Periodic Generation of a Housekeeping Report Structur...
static CrPsSid_t getDpsidItem(int i)
Gets the value of the i-th element in the datapool array sid.
Definition: CrPsDpServHk.h:289
Command (3,6) to Disable Periodic Generation of a Housekeeping Report Structure.
static void setDpisEnabledItem(int i, CrPsFlag_t isEnabled)
Sets the value of the i-th element in the datapool array isEnabled.
Definition: CrPsDpServHk.h:240
auxiliary Interface for accessing fields in packets of service "ServHk".
void * cmpSpecificData
Derived data which are specific to each type of framework component.
FwPrDesc_t getPrDescMultiSidCmdStart()
Getter for MultiSidCmdStart procedure descriptor.
void CrPsHkDisableCmdStartAction(FwSmDesc_t smDesc)
Start action of the Command (3,6) to Disable Periodic Generation of a Housekeeping Report Structure i...
void CrPsHkDisableCmdTerminationAction(FwSmDesc_t smDesc)
Termination Action of the DCommand (3,6) to Disable Periodic Generation of a Housekeeping Report Stru...
#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
static CrFwCounterU4_t getHkDisableCmdN(void *p)
Get "N" from "HkDisableCmd" packet.
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