CORDET Framework - C2 Implementation
tests/CrFwInStreamStub.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 #include "CrFwRepErrStub.h"
21 #include "CrFwInStreamStub.h"
22 /* Include FW Profile files */
23 #include "FwSmConstants.h"
24 #include "FwSmConfig.h"
25 #include "FwSmCore.h"
26 #include "FwPrConfig.h"
27 #include "FwPrCore.h"
28 #include "FwPrConstants.h"
29 /* Include configuration files */
30 #include "CrFwInStreamUserPar.h"
31 #include "CrFwCmpData.h"
32 /* Include framework files */
33 #include "InStream/CrFwInStream.h"
34 #include "BaseCmp/CrFwBaseCmp.h"
35 #include "Pckt/CrFwPckt.h"
36 #include "CrFwTime.h"
37 #include "CrFwRepErr.h"
39 
42 
45 
47 static CrFwDestSrc_t dest = 0;
48 
51 
54 
57 
60 
63 
65 static CrFwBool_t ackAcc = 0;
66 
68 static CrFwBool_t ackStr = 0;
69 
71 static CrFwBool_t ackPrg = 0;
72 
74 static CrFwBool_t ackTrm = 0;
75 
78 
80 static CrFwBool_t checkFlag = 1;
81 
84 
87 
88 /* ---------------------------------------------------------------------------------------------*/
90  CrFwPckt_t pckt;
91  (void)(src);
92 
93  if (pcktCollectCnt == 0)
94  return NULL;
95 
97  pcktSeqCnt++;
101  CrFwPcktSetDest(pckt, dest);
108 
109  return pckt;
110 }
111 
112 /* ---------------------------------------------------------------------------------------------*/
114  (void)(src);
115  return (pcktCollectCnt != 0);
116 }
117 
118 /* ---------------------------------------------------------------------------------------------*/
119 void CrFwInStreamStubDummyCheck(FwPrDesc_t prDesc) {
120  CrFwCmpData_t* inStreamData = (CrFwCmpData_t*)FwPrGetData(prDesc);
121  inStreamData->outcome = (CrFwOutcome_t)checkFlag;
122 }
123 
124 /* ---------------------------------------------------------------------------------------------*/
125 void CrFwInStreamStubInitAction(FwPrDesc_t prDesc) {
126  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwPrGetData(prDesc);
127  CrFwInStreamData_t* cmpSpecificData = (CrFwInStreamData_t*)inStreamBaseData->cmpSpecificData;
128  if (cmpSpecificData->seqCnt == NULL)
130  inStreamBaseData->outcome = (CrFwOutcome_t)actionFlag;
131 }
132 
133 /* ---------------------------------------------------------------------------------------------*/
134 void CrFwInStreamStubConfigAction(FwPrDesc_t prDesc) {
135  CrFwCmpData_t* inStreamData = (CrFwCmpData_t*)FwPrGetData(prDesc);
137  inStreamData->outcome = (CrFwOutcome_t)actionFlag;
138 }
139 
140 /* ---------------------------------------------------------------------------------------------*/
141 void CrFwInStreamStubShutdown(FwSmDesc_t smDesc) {
142  shutdownCnt++;
144 }
145 
146 /* ---------------------------------------------------------------------------------------------*/
148  checkFlag = flag;
149 }
150 
151 /* ---------------------------------------------------------------------------------------------*/
153  actionFlag = flag;
154 }
155 
156 /* ---------------------------------------------------------------------------------------------*/
158  pcktCollectCnt = cnt;
159 }
160 
161 /* ---------------------------------------------------------------------------------------------*/
163  pcktSeqCnt = cnt;
164 }
165 
166 /* ---------------------------------------------------------------------------------------------*/
168  pcktGroup = group;
169 }
170 
171 /* ---------------------------------------------------------------------------------------------*/
173  dest = d;
174 }
175 
176 /* ---------------------------------------------------------------------------------------------*/
178  cmdRepId = id;
179 }
180 
181 /* ---------------------------------------------------------------------------------------------*/
183  cmdRepType = type;
184 }
185 
186 /* ---------------------------------------------------------------------------------------------*/
188  ackAcc = acc;
189  ackStr = str;
190  ackPrg = prg;
191  ackTrm = trm;
192 }
193 
194 /* ---------------------------------------------------------------------------------------------*/
196  CrFwDiscriminant_t d) {
197  servType = sType;
198  servSubType = sSubType;
199  disc = d;
200 }
201 
202 /* ---------------------------------------------------------------------------------------------*/
204  return shutdownCnt;
205 }
void CrFwInStreamStubSetPcktAckLevel(CrFwBool_t acc, CrFwBool_t str, CrFwBool_t prg, CrFwBool_t trm)
Set the value of the acknowledge level of the next packet collected (see CrFwInStreamStubPcktCollect)...
Type for the Framework Component Data (FCD).
Interface through which framework components access the current time.
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
void CrFwInStreamStubShutdown(FwSmDesc_t smDesc)
Stub function implementing the shutdown operation for an InStream (see CrFwInStream.h).
static CrFwServSubType_t servSubType
Service sub-type.
void CrFwInStreamStubConfigAction(FwPrDesc_t prDesc)
Dummy implementation of a configuration action.
void CrFwPcktSetServType(CrFwPckt_t pckt, CrFwServType_t servType)
Set the service type of the command or report encapsulated in a packet.
static CrFwCmpData_t inStreamData[CR_FW_NOF_INSTREAM]
The data structures for the InStream State Machines and their Procedures.
Definition: CrFwInStream.c:82
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
void CrFwInStreamStubSetCheckFlag(CrFwBool_t flag)
Set the value of the check flag which determines the outcome of the dummy check of CrFwInStreamStubDu...
static CrFwCounterU1_t pcktCollectCnt
Number of packets currently waiting to be collected from the middleware.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
CrFwCmdRepType_t
Enumerated type for command and reports.
Definition: CrFwConstants.h:39
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
void CrFwPcktSetCmdRepId(CrFwPckt_t pckt, CrFwInstanceId_t id)
Set the command or report identifier in the command or report encapsulated in a packet.
Type for the data describing an InStream.
Interface for creating and accessing a report or command packet.
Definition of the InStream component.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
CrFwSeqCnt_t * seqCnt
Array holding sequence counters for the groups associated to the InStream.
unsigned char CrFwServType_t
Type used for the service type of a command or report.
void CrFwInStreamStubInitAction(FwPrDesc_t prDesc)
Dummy implementation of an initialization action.
void CrFwPcktSetCmdRepType(CrFwPckt_t pckt, CrFwCmdRepType_t type)
Set the type of a packet (either a command packet or a report packet).
CrFwPckt_t CrFwInStreamStubPcktCollect(CrFwDestSrc_t src)
Stub function implementing the packet collect operation for the InStream (see CrFwInStream.h).
void CrFwPcktSetSeqCnt(CrFwPckt_t pckt, CrFwSeqCnt_t seqCnt)
Set the sequence counter of the command or report encapsulated in a packet.
Command type.
Definition: CrFwConstants.h:41
Interface for reporting an error detected by a framework component.
void CrFwInStreamDefInitAction(FwPrDesc_t prDesc)
Default initialization action for an InStream.
Definition: CrFwInStream.c:312
void CrFwInStreamStubSetPcktCmdRepType(CrFwCmdRepType_t type)
Set the type (command or report) of the next packet collected (see CrFwInStreamStubPcktCollect).
static CrFwBool_t ackPrg
Acknowledge level for progress.
void CrFwPcktSetGroup(CrFwPckt_t pckt, CrFwGroup_t group)
Set the group of the command/report encapsulated in a packet.
static CrFwBool_t ackTrm
Acknowledge level for termination.
static CrFwDiscriminant_t disc
Discriminant.
CrFwBool_t CrFwInStreamStubIsPcktAvail(CrFwDestSrc_t src)
Stub function implementing the packet available check operation for the InStream (see CrFwInStream...
static CrFwBool_t ackAcc
Acknowledge level for acceptance.
CrFwCounterU1_t CrFwInStreamStubGetShutdownCnt()
Get the value of the shutdown counter (see CrFwInStreamStubShutdown).
void * cmpSpecificData
Derived data which are specific to each type of framework component.
void CrFwPcktSetAckLevel(CrFwPckt_t pckt, CrFwBool_t accept, CrFwBool_t start, CrFwBool_t progress, CrFwBool_t term)
Set the acknowledge level for the command encapsulated in a packet.
CrFwPcktLength_t CrFwPcktGetMaxLength()
Return the maximum length of a packet in number of bytes.
Definition of the utility functions for the CORDET Framework.
void CrFwPcktSetServSubType(CrFwPckt_t pckt, CrFwServSubType_t servSubType)
Set the service sub-type of the command or report encapsulated in a packet.
static CrFwBool_t actionFlag
Outcome of dummy action.
unsigned char CrFwOutcome_t
Type used for the outcome of a check (see CrFwCmpData).
void CrFwInStreamDefShutdownAction(FwSmDesc_t smDesc)
Default shutdown action for an InStream.
Definition: CrFwInStream.c:301
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
static CrFwServType_t servType
Service type.
static CrFwDestSrc_t dest
Destination.
void CrFwInStreamStubSetPcktType(CrFwServType_t sType, CrFwServSubType_t sSubType, CrFwDiscriminant_t d)
Set the value of the service type, sub-type and discriminant of the next packet collected (see CrFwIn...
void CrFwPcktSetDest(CrFwPckt_t pckt, CrFwDestSrc_t dest)
Set the destination of the command or report encapsulated in a packet.
void CrFwInStreamStubSetPcktCollectionCnt(CrFwCounterU1_t cnt)
Set the value of the packet collection counter which defines the number of packets available at the m...
void CrFwInStreamStubSetPcktSeqCnt(CrFwSeqCnt_t cnt)
Set the value of the sequence counter of the next packet collected (see CrFwInStreamStubPcktCollect)...
Definition of Base Component.
void CrFwInStreamStubSetPcktDest(CrFwDestSrc_t d)
Set the value of the destination of the next packet collected (see CrFwInStreamStubPcktCollect).
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
void CrFwInStreamStubSetPcktCmdRepId(CrFwInstanceId_t id)
Set the value of the command or report identifier of the next packet collected (see CrFwInStreamStubP...
void CrFwInStreamStubSetActionFlag(CrFwBool_t flag)
Set the value of the action flag which determines the outcome of the initialization or configuration ...
void CrFwInStreamStubSetPcktGroup(CrFwGroup_t group)
Set the value of the group of the next packet collected (see CrFwInStreamStubPcktCollect).
void CrFwInStreamStubDummyCheck(FwPrDesc_t prDesc)
Dummy implementation of an initialization or configuration check.
static CrFwBool_t ackStr
Acknowledge level for start.
void CrFwInStreamDefConfigAction(FwPrDesc_t prDesc)
Default configuration action for an InStream.
Definition: CrFwInStream.c:288
static CrFwInstanceId_t cmdRepId
Command or Report Identifier.
static CrFwSeqCnt_t pcktSeqCnt
Sequence counter.
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
static CrFwBool_t checkFlag
Outcome of dummy check.
static CrFwGroup_t pcktGroup
group
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
void CrFwPcktSetDiscriminant(CrFwPckt_t pckt, CrFwDiscriminant_t discriminant)
Set the discriminant of the command or report encapsulated in a packet.
static CrFwCounterU1_t shutdownCnt
Counter incremented by stub Shutdown Operation.
static CrFwCmdRepType_t cmdRepType
Destination.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved