CORDET Framework - C2 Implementation
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 }
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
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.
Definition: CrFwPckt.c:345
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
Interface through which framework components access the current time.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
CrFwOutcome_t outcome
The outcome of an action or check executed by a state machine or by one of its procedures.
Definition: CrFwCmpData.h:93
static CrFwBool_t ackAcc
Acknowledge level for acceptance.
void CrFwPcktSetGroup(CrFwPckt_t pckt, CrFwGroup_t group)
Set the group of the command/report encapsulated in a packet.
Definition: CrFwPckt.c:392
Definition of the Framework Component Data (FCD) Type.
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 * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
Definition: CrFwPckt.c:129
CrFwCmdRepType_t
Enumerated type for command and reports.
Definition: CrFwConstants.h:41
static CrFwCounterU1_t pcktCollectCnt
Number of packets currently waiting to be collected from the middleware.
Type for the data describing an InStream.
Interface for creating and accessing a report or command packet.
Definition of the InStream component.
void CrFwInStreamStubConfigAction(FwPrDesc_t prDesc)
Dummy implementation of a configuration action.
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
void CrFwInStreamStubSetPcktCollectionCnt(CrFwCounterU1_t cnt)
Set the value of the packet collection counter which defines the number of packets available at the m...
static CrFwServSubType_t servSubType
Service sub-type.
CrFwSeqCnt_t * seqCnt
Array holding sequence counters for the groups associated to the InStream.
void CrFwPcktSetDest(CrFwPckt_t pckt, CrFwDestSrc_t dest)
Set the destination of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:309
void CrFwPcktSetCmdRepId(CrFwPckt_t pckt, CrFwInstanceId_t id)
Set the command or report identifier in the command or report encapsulated in a packet.
Definition: CrFwPckt.c:333
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
CrFwCounterU1_t CrFwInStreamStubGetShutdownCnt()
Get the value of the shutdown counter (see CrFwInStreamStubShutdown).
void CrFwInStreamStubSetPcktSeqCnt(CrFwSeqCnt_t cnt)
Set the value of the sequence counter of the next packet collected (see CrFwInStreamStubPcktCollect)...
CrFwBool_t CrFwInStreamStubIsPcktAvail(CrFwDestSrc_t src)
Stub function implementing the packet available check operation for the InStream (see CrFwInStream...
unsigned char CrFwOutcome_t
Type used for the outcome of a check (see CrFwCmpData).
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
Command type.
Definition: CrFwConstants.h:43
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 CrFwInStreamStubSetPcktDest(CrFwDestSrc_t d)
Set the value of the destination of the next packet collected (see CrFwInStreamStubPcktCollect).
static CrFwDiscriminant_t disc
Discriminant.
void CrFwPcktSetCmdRepType(CrFwPckt_t pckt, CrFwCmdRepType_t type)
Set the type of a packet (either a command packet or a report packet).
Definition: CrFwPckt.c:217
void CrFwInStreamStubDummyCheck(FwPrDesc_t prDesc)
Dummy implementation of an initialization or configuration check.
static CrFwBool_t ackPrg
Acknowledge level for progress.
void CrFwPcktSetServSubType(CrFwPckt_t pckt, CrFwServSubType_t servSubType)
Set the service sub-type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:297
void CrFwInStreamStubSetPcktGroup(CrFwGroup_t group)
Set the value of the group of the next packet collected (see CrFwInStreamStubPcktCollect).
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 * cmpSpecificData
Derived data which are specific to each type of framework component.
Definition: CrFwCmpData.h:101
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)...
static CrFwBool_t actionFlag
Outcome of dummy action.
static CrFwCounterU1_t shutdownCnt
Counter incremented by stub Shutdown Operation.
Definition of the utility functions for the CORDET Framework.
CrFwPcktLength_t CrFwPcktGetMaxLength()
Return the maximum length of a packet in number of bytes.
Definition: CrFwPckt.c:201
static CrFwInstanceId_t cmdRepId
Command or Report Identifier.
static CrFwBool_t ackStr
Acknowledge level for start.
void CrFwInStreamDefShutdownAction(FwSmDesc_t smDesc)
Default shutdown action for an InStream.
Definition: CrFwInStream.c:301
Interface for the InStream stub.
static CrFwBool_t ackTrm
Acknowledge level for termination.
void CrFwPcktSetServType(CrFwPckt_t pckt, CrFwServType_t servType)
Set the service type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:285
void CrFwInStreamStubInitAction(FwPrDesc_t prDesc)
Dummy implementation of an initialization action.
Definition of Base Component.
static CrFwDestSrc_t dest
Destination.
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr.h).
CrFwPckt_t CrFwInStreamStubPcktCollect(CrFwDestSrc_t src)
Stub function implementing the packet collect operation for the InStream (see CrFwInStream.h).
void CrFwInStreamStubSetPcktCmdRepType(CrFwCmdRepType_t type)
Set the type (command or report) of the next packet collected (see CrFwInStreamStubPcktCollect).
static CrFwBool_t checkFlag
Outcome of dummy check.
static CrFwGroup_t pcktGroup
group
void CrFwInStreamDefConfigAction(FwPrDesc_t prDesc)
Default configuration action for an InStream.
Definition: CrFwInStream.c:288
void CrFwInStreamStubSetActionFlag(CrFwBool_t flag)
Set the value of the action flag which determines the outcome of the initialization or configuration ...
static CrFwServType_t servType
Service type.
static CrFwSeqCnt_t pcktSeqCnt
Sequence counter.
void CrFwInStreamStubShutdown(FwSmDesc_t smDesc)
Stub function implementing the shutdown operation for an 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.
Definition: CrFwPckt.c:229
void CrFwInStreamStubSetPcktCmdRepId(CrFwInstanceId_t id)
Set the value of the command or report identifier of the next packet collected (see CrFwInStreamStubP...
void CrFwInStreamStubSetCheckFlag(CrFwBool_t flag)
Set the value of the check flag which determines the outcome of the dummy check of CrFwInStreamStubDu...
static CrFwCmdRepType_t cmdRepType
Destination.
User-modifiable parameters for the InStream components (see CrFwInStream.h).
void CrFwPcktSetDiscriminant(CrFwPckt_t pckt, CrFwDiscriminant_t discriminant)
Set the discriminant of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:279
unsigned char CrFwServType_t
Type used for the service type of a command or report.
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved