CORDET Framework - C2 Implementation
CrPsTestOnBoardConnection.c
Go to the documentation of this file.
1 
22 
23 /* CrFramework includes */
24 #include "Pckt/CrFwPckt.h"
26 #include "OutCmp/CrFwOutCmp.h"
28 #include "CrFwCmpData.h"
29 
30 /* FwProfile includes */
31 #include "FwPrConfig.h"
32 #include "FwPrCore.h"
33 #include "FwSmConfig.h"
34 
35 #include <CrPsUtilitiesServTest.h>
38 #include <DataPool/CrPsDp.h>
40 
41 #include <stdlib.h>
42 
43 uint16_t timeOut_cnt; /*TODO which Type ??*/
44 
45 void CrPsTestOnBoardConnectionStartAction(FwSmDesc_t smDesc)
46 {
47  CrFwCmpData_t *cmpDataStart;
48  CrFwInCmdData_t *cmpSpecificData;
49  CrFwPckt_t inPckt;
50  CrPsApid_t appId;
51 
52  /* Run the procedure Start Action of OnBoardConnectCmd Command (see figure 13.1 in PP-DF-COR-003) */
53 
54  /* Get in packet */
55  cmpDataStart = (CrFwCmpData_t *) FwSmGetData(smDesc);
56  cmpSpecificData = (CrFwInCmdData_t *) cmpDataStart->cmpSpecificData;
57  inPckt = cmpSpecificData->pckt;
58 
59  /* set timeout counter to 0 */
60  timeOut_cnt = 0;
61 
62  /* TODO: not in specifications */
63  /* get Application ID */
64  appId = getOnBoardConnectCmdAppId(inPckt);
65 
66  /* store in data pool */
68 
69  /* Set prData of procedure */
70  /* initial setting of prData */
71  FwPrSetData(getPrDescServTestOnBoardConnStart(), smDesc);
72 
73  /* Run the procedure */
75 
76  return;
77 }
78 
79 /* ------------------------------------------------------------------------------------ */
81 {
82  CrFwCmpData_t *cmpDataPrgr;
83  CrFwInCmdData_t *cmpSpecificData;
84  CrFwPckt_t inPckt;
85  CrFwDestSrc_t srcId;
86  prDataPrgrAction_t *prDataPrgrActionPtr;
87 
88  /* Run the procedure Progress Action of OnBoardConnectCmd Command (see figure 13.2 in PP-DF-COR-003) */
89 
90  /* Get in packet */
91  cmpDataPrgr = (CrFwCmpData_t *) FwSmGetData(smDesc);
92  cmpSpecificData = (CrFwInCmdData_t *) cmpDataPrgr->cmpSpecificData;
93  inPckt = cmpSpecificData->pckt;
94 
95  /* Get the InCmd source and set it in the prData */
96  srcId = CrFwPcktGetSrc(inPckt);
97 
98  /* Set prData of procedure */
99  prDataPrgrActionPtr = FwPrGetData(getPrDescServTestOnBoardConnPrgr());
100  prDataPrgrActionPtr->source = srcId;
101  prDataPrgrActionPtr->stepId = timeOut_cnt;
102  FwPrSetData(getPrDescServTestOnBoardConnPrgr(), prDataPrgrActionPtr);
103 
104  /* Run the procedure */
106 
107  /* Get procedure parameters */
108  prDataPrgrActionPtr = FwPrGetData(getPrDescServTestOnBoardConnPrgr());
109 
110  /* Set the Outcome*/
111  cmpDataPrgr->outcome = prDataPrgrActionPtr->outcome;
112 
113  /* Increment timeout counter */
114  timeOut_cnt++;
115 
116  return;
117 }
118 
119 /* ------------------------------------------------------------------------------------ */
121 {
122  CrFwCmpData_t *inData;
123  prDataPrgrAction_t *prDataPrgrActionPtr;
124  uint16_t outcome;
125 
126  /* TODO: Set action outcome to 'success' if the (17,4) report was issued and to 'failure' otherwise */
127 
128  /* Get in data */
129  inData = (CrFwCmpData_t*)FwSmGetData(smDesc);
130 
131  /* Get procedure parameters */
132  prDataPrgrActionPtr = (prDataPrgrAction_t*) FwPrGetData(getPrDescServTestOnBoardConnPrgr());
133 
134  /* Get the Outcome*/
135  outcome = prDataPrgrActionPtr->outcome;
136 
137  if (outcome == 1)
138  {
139  inData->outcome = 1;
140  }
141  else if ((outcome == 0) || (outcome > 2))
142  {
143  inData->outcome = 0;
144  }
145 
146  return;
147 }
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.
CrFwDestSrc_t CrFwPcktGetSrc(CrFwPckt_t pckt)
Return the source of the command or report encapsulated in a packet.
FwPrDesc_t getPrDescServTestOnBoardConnPrgr()
Getter for TestOnBoardConnPrgr procedure descriptor.
Interface for accessing data pool items.
Definition of the OutFactory component.
CrFwPckt_t pckt
Packet holding the InCommand.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
Header file to define all service and packet identifiers.
FwPrDesc_t getPrDescServTestOnBoardConnStart()
Getter for TestOnBoardConnStart procedure descriptor.
Interface for creating and accessing a report or command packet.
uint16_t CrPsApid_t
Type used for the Application ID of a packet.
void CrPsTestOnBoardConnectionTerminationAction(FwSmDesc_t smDesc)
Termination Action of the Perform Connection Test in-coming command packet.
Declaration of the Perform Connection Test in-coming command packet.
Interface for accessing fields in packets of service "ServTest".
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Interface through which applications can initialize and execute framework PUS extension components...
void CrPsTestOnBoardConnectionStartAction(FwSmDesc_t smDesc)
Start action of the Perform Connection Test in-coming command packet.
void CrPsTestOnBoardConnectionProgressAction(FwSmDesc_t smDesc)
Progress action of the Perform Connection Test in-coming command packet.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
Definition of the OutComponent Component of the framework.
static void setDpOnBoardConnectDest(CrPsDestSrc_t OnBoardConnectDest)
Sets the value of the datapool item OnBoardConnectDest.
Type for the data describing an InCommand.
Interface for accessing data pool items.
Definition of the OutLoader component.
static CrPsApid_t getOnBoardConnectCmdAppId(void *p)
Get "AppId" from "OnBoardConnectCmd" packet.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved