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)(nofSrc);
92  (void)(srcs);
93 
94  if (pcktCollectCnt == 0)
95  return NULL;
96 
98  pcktSeqCnt++;
102  CrFwPcktSetDest(pckt, dest);
109 
110  return pckt;
111 }
112 
113 /* ---------------------------------------------------------------------------------------------*/
115  (void)(nofSrc);
116  (void)(srcs);
117  return (pcktCollectCnt != 0);
118 }
119 
120 /* ---------------------------------------------------------------------------------------------*/
121 void CrFwInStreamStubDummyCheck(FwPrDesc_t prDesc) {
122  CrFwCmpData_t* inStreamData = (CrFwCmpData_t*)FwPrGetData(prDesc);
124 }
125 
126 /* ---------------------------------------------------------------------------------------------*/
127 void CrFwInStreamStubInitAction(FwPrDesc_t prDesc) {
128  CrFwCmpData_t* inStreamBaseData = (CrFwCmpData_t*)FwPrGetData(prDesc);
129  CrFwInstanceId_t inStreamId = inStreamBaseData->instanceId;
130  if (CrFwInStreamGetNOfSrc(CrFwInStreamMake(inStreamId)) == 0)
132  inStreamBaseData->outcome = (CrFwOutcome_t)actionFlag;
133 }
134 
135 /* ---------------------------------------------------------------------------------------------*/
136 void CrFwInStreamStubConfigAction(FwPrDesc_t prDesc) {
137  CrFwCmpData_t* inStreamData = (CrFwCmpData_t*)FwPrGetData(prDesc);
140 }
141 
142 /* ---------------------------------------------------------------------------------------------*/
143 void CrFwInStreamStubShutdown(FwSmDesc_t smDesc) {
144  shutdownCnt++;
146 }
147 
148 /* ---------------------------------------------------------------------------------------------*/
150  checkFlag = flag;
151 }
152 
153 /* ---------------------------------------------------------------------------------------------*/
155  actionFlag = flag;
156 }
157 
158 /* ---------------------------------------------------------------------------------------------*/
160  pcktCollectCnt = cnt;
161 }
162 
163 /* ---------------------------------------------------------------------------------------------*/
165  pcktSeqCnt = cnt;
166 }
167 
168 /* ---------------------------------------------------------------------------------------------*/
170  pcktGroup = group;
171 }
172 
173 /* ---------------------------------------------------------------------------------------------*/
175  dest = d;
176 }
177 
178 /* ---------------------------------------------------------------------------------------------*/
180  cmdRepId = id;
181 }
182 
183 /* ---------------------------------------------------------------------------------------------*/
185  cmdRepType = type;
186 }
187 
188 /* ---------------------------------------------------------------------------------------------*/
190  ackAcc = acc;
191  ackStr = str;
192  ackPrg = prg;
193  ackTrm = trm;
194 }
195 
196 /* ---------------------------------------------------------------------------------------------*/
198  CrFwDiscriminant_t d) {
199  servType = sType;
200  servSubType = sSubType;
201  disc = d;
202 }
203 
204 /* ---------------------------------------------------------------------------------------------*/
206  return shutdownCnt;
207 }
Definition of Base Component.
Definition of the Framework Component Data (FCD) Type.
CrFwCmdRepType_t
Enumerated type for command and reports.
Definition: CrFwConstants.h:41
@ crCmdType
Command type.
Definition: CrFwConstants.h:43
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:38
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:32
void CrFwInStreamDefInitAction(FwPrDesc_t prDesc)
Default initialization action for an InStream.
Definition: CrFwInStream.c:324
CrFwCounterU1_t CrFwInStreamGetNOfSrc(FwSmDesc_t smDesc)
Get the number of packet sources of the argument InStream.
Definition: CrFwInStream.c:236
void CrFwInStreamDefConfigAction(FwPrDesc_t prDesc)
Default configuration action for an InStream.
Definition: CrFwInStream.c:298
static CrFwCmpData_t inStreamData[CR_FW_NOF_INSTREAM]
The data structures for the InStream State Machines and their Procedures.
Definition: CrFwInStream.c:89
void CrFwInStreamDefShutdownAction(FwSmDesc_t smDesc)
Default shutdown action for an InStream.
Definition: CrFwInStream.c:311
FwSmDesc_t CrFwInStreamMake(CrFwInstanceId_t i)
Factory function to retrieve the i-th InStream State Machine instance.
Definition: CrFwInStream.c:128
Definition of the InStream component.
void CrFwInStreamStubSetPcktDest(CrFwDestSrc_t d)
Set the value of the destination of the next packet collected (see CrFwInStreamStubPcktCollect).
static CrFwBool_t ackTrm
Acknowledge level for termination.
static CrFwDestSrc_t dest
Destination.
void CrFwInStreamStubInitAction(FwPrDesc_t prDesc)
Dummy implementation of an initialization action.
void CrFwInStreamStubSetPcktSeqCnt(CrFwSeqCnt_t cnt)
Set the value of the sequence counter of the next packet collected (see CrFwInStreamStubPcktCollect).
void CrFwInStreamStubShutdown(FwSmDesc_t smDesc)
Stub function implementing the shutdown operation for an InStream (see CrFwInStream....
static CrFwSeqCnt_t pcktSeqCnt
Sequence counter
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 checkFlag
Outcome of dummy check.
static CrFwBool_t actionFlag
Outcome of dummy action.
static CrFwBool_t ackStr
Acknowledge level for start.
static CrFwCmdRepType_t cmdRepType
Destination.
void CrFwInStreamStubSetActionFlag(CrFwBool_t flag)
Set the value of the action flag which determines the outcome of the initialization or configuration ...
CrFwPckt_t CrFwInStreamStubPcktCollect(CrFwDestSrc_t nofSrc, CrFwDestSrc_t *srcs)
Stub function implementing the packet collect operation for the InStream (see CrFwInStream....
static CrFwDiscriminant_t disc
Discriminant.
void CrFwInStreamStubSetPcktCollectionCnt(CrFwCounterU1_t cnt)
Set the value of the packet collection counter which defines the number of packets available at the m...
static CrFwBool_t ackAcc
Acknowledge level for acceptance.
static CrFwInstanceId_t cmdRepId
Command or Report Identifier.
static CrFwCounterU1_t pcktCollectCnt
Number of packets currently waiting to be collected from the middleware.
void CrFwInStreamStubSetPcktCmdRepId(CrFwInstanceId_t id)
Set the value of the command or report identifier of the next packet collected (see CrFwInStreamStubP...
void CrFwInStreamStubSetPcktCmdRepType(CrFwCmdRepType_t type)
Set the type (command or report) of the next packet collected (see CrFwInStreamStubPcktCollect).
void CrFwInStreamStubSetPcktGroup(CrFwGroup_t group)
Set the value of the group of the next packet collected (see CrFwInStreamStubPcktCollect).
static CrFwBool_t ackPrg
Acknowledge level for progress.
void CrFwInStreamStubDummyCheck(FwPrDesc_t prDesc)
Dummy implementation of an initialization or configuration check.
void CrFwInStreamStubConfigAction(FwPrDesc_t prDesc)
Dummy implementation of a configuration action.
CrFwBool_t CrFwInStreamStubIsPcktAvail(CrFwDestSrc_t nofSrc, CrFwDestSrc_t *srcs)
Stub function implementing the packet available check operation for the InStream (see CrFwInStream....
static CrFwCounterU1_t shutdownCnt
Counter incremented by stub Shutdown Operation.
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...
CrFwCounterU1_t CrFwInStreamStubGetShutdownCnt()
Get the value of the shutdown counter (see CrFwInStreamStubShutdown).
static CrFwServType_t servType
Service type.
void CrFwInStreamStubSetCheckFlag(CrFwBool_t flag)
Set the value of the check flag which determines the outcome of the dummy check of CrFwInStreamStubDu...
static CrFwGroup_t pcktGroup
group
static CrFwServSubType_t servSubType
Service sub-type.
Interface for the InStream stub.
User-modifiable parameters for the InStream components (see CrFwInStream.h).
Interface for creating and accessing a report or command packet.
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:327
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:363
void CrFwPcktSetSeqCnt(CrFwPckt_t pckt, CrFwSeqCnt_t seqCnt)
Set the sequence counter of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:247
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:235
void CrFwPcktSetDiscriminant(CrFwPckt_t pckt, CrFwDiscriminant_t discriminant)
Set the discriminant of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:309
void CrFwPcktSetServType(CrFwPckt_t pckt, CrFwServType_t servType)
Set the service type of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:315
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:375
CrFwPcktLength_t CrFwPcktGetMaxLength()
Return the maximum length of a packet in number of bytes.
Definition: CrFwPckt.c:219
void CrFwPcktSetDest(CrFwPckt_t pckt, CrFwDestSrc_t dest)
Set the destination of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:339
void CrFwPcktSetGroup(CrFwPckt_t pckt, CrFwGroup_t group)
Set the group of the command/report encapsulated in a packet.
Definition: CrFwPckt.c:422
CrFwPckt_t CrFwPcktMake(CrFwPcktLength_t pcktLength)
Make function for command or report packets.
Definition: CrFwPckt.c:147
Interface for reporting an error detected by a framework component.
The CORDET Framework defines an interface for generating error reports (see CrFwRepErr....
Interface through which framework components access the current time.
unsigned char CrFwOutcome_t
Type used for the outcome of a check (see CrFwCmpData).
unsigned int CrFwSeqCnt_t
Type used for the sequence counter of commands or reports.
unsigned char CrFwServType_t
Type used for the service type of a command or report.
unsigned char CrFwDestSrc_t
Type used for the command or report destination and source.
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
unsigned char CrFwGroup_t
Type used for the destination or source group of a packet.
unsigned short CrFwInstanceId_t
Type used for instance identifiers.
unsigned char CrFwServSubType_t
Type used for the command or report sub-type.
Definition of the utility functions for the CORDET Framework.
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
CrFwInstanceId_t instanceId
The instance identifier of the framework component.
Definition: CrFwCmpData.h:81
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
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved