CORDET Framework - C2 Implementation
CrFwOutStreamStub.c
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 #include <assert.h>
21 #include "CrFwOutStreamStub.h"
22 #include "CrFwRepErrStub.h"
23 /* Include configuration files */
24 #include "CrFwOutStreamUserPar.h"
25 #include "CrFwCmpData.h"
26 /* Include FW Profile files */
27 #include "FwSmConstants.h"
28 #include "FwSmConfig.h"
29 #include "FwSmCore.h"
30 #include "FwPrConfig.h"
31 #include "FwPrCore.h"
32 #include "FwPrConstants.h"
33 /* Include framework files */
35 #include "BaseCmp/CrFwBaseCmp.h"
37 #include "Pckt/CrFwPckt.h"
38 #include "CrFwTime.h"
39 #include "CrFwRepErr.h"
40 
43 
49 
52 
54 static CrFwBool_t checkFlag = 1;
55 
58 
61 
63 #define CR_FW_OUTSTREAM_STUB_MEM_LEN 100
64 
67 
70 
71 /* ---------------------------------------------------------------------------------------------*/
73  (void)(pckt);
74  if (pcktHandOverFlag == 1) {
76  seqCnt[pos] = CrFwPcktGetSeqCnt(pckt);
77  typeCnt[pos] = CrFwPcktGetTypeCnt(pckt);
79  }
81  return pcktHandOverFlag;
82 }
83 
84 /* ---------------------------------------------------------------------------------------------*/
86  return pcktHandOverCnt;
87 }
88 
90  return pcktHandOverSuccCnt;
91 }
92 
93 /* ---------------------------------------------------------------------------------------------*/
95  return shutdownCnt;
96 }
97 
98 /* ---------------------------------------------------------------------------------------------*/
100  pcktHandOverFlag = flag;
101 }
102 
103 /* ---------------------------------------------------------------------------------------------*/
104 void CrFwOutStreamStubDummyCheck(FwPrDesc_t prDesc) {
105  CrFwCmpData_t* outStreamData = (CrFwCmpData_t*)FwPrGetData(prDesc);
107 }
108 
109 /* ---------------------------------------------------------------------------------------------*/
111  checkFlag = flag;
112 }
113 
114 /* ---------------------------------------------------------------------------------------------*/
115 void CrFwOutStreamStubInitAction(FwPrDesc_t prDesc) {
116  CrFwCmpData_t* outStreamBaseData = (CrFwCmpData_t*)FwPrGetData(prDesc);
118  outStreamBaseData->outcome = (CrFwOutcome_t)actionFlag;
119 }
120 
121 /* ---------------------------------------------------------------------------------------------*/
122 void CrFwOutStreamStubConfigAction(FwPrDesc_t prDesc) {
123  CrFwCmpData_t* outStreamData = (CrFwCmpData_t*)FwPrGetData(prDesc);
126 }
127 
128 /* ---------------------------------------------------------------------------------------------*/
130  actionFlag = flag;
131 }
132 
133 /* ---------------------------------------------------------------------------------------------*/
134 void CrFwOutStreamStubShutdown(FwSmDesc_t smDesc) {
135  shutdownCnt++;
137 }
138 
139 /* ---------------------------------------------------------------------------------------------*/
141  assert(n<=CR_FW_OUTSTREAM_STUB_MEM_LEN);
142  return seqCnt[n-1];
143 }
144 
145 /* ---------------------------------------------------------------------------------------------*/
147  assert(n<=CR_FW_OUTSTREAM_STUB_MEM_LEN);
148  return typeCnt[n-1];
149 }
Definition of Base Component.
Definition of the Framework Component Data (FCD) Type.
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 CrFwOutStreamDefConfigAction(FwPrDesc_t prDesc)
Default configuration action for an OutStream.
void CrFwOutStreamDefInitAction(FwPrDesc_t prDesc)
Default initialization action for an OutStream.
void CrFwOutStreamDefShutdownAction(FwSmDesc_t smDesc)
Default shutdown action for an OutStream.
static CrFwCmpData_t outStreamData[CR_FW_NOF_OUTSTREAM]
The base data structures for the OutStream State Machines and their Procedures.
Definition of the OutStream component.
static CrFwTypeCnt_t typeCnt[CR_FW_OUTSTREAM_STUB_MEM_LEN]
Type counters of most recently received packets.
CrFwCounterU1_t CrFwOutStreamStubGetHandoverSuccCnt()
Return the value of the handover successful counter which is incremented by the packet handover funct...
static CrFwSeqCnt_t seqCnt[CR_FW_OUTSTREAM_STUB_MEM_LEN]
Sequence counters of most recently received packets.
static CrFwBool_t pcktHandOverFlag
Return value of the packet hand-over operation.
void CrFwOutStreamStubConfigAction(FwPrDesc_t prDesc)
Dummy implementation of a configuration action for an OutStream.
CrFwCounterU1_t CrFwOutStreamStubGetHandoverCnt()
Return the value of the handover counter which is incremented by the packet handover function in CrFw...
static CrFwBool_t checkFlag
Outcome of dummy check.
void CrFwOutStreamStubShutdown(FwSmDesc_t smDesc)
Stub function implementing the shutdown operation for an OutStream.
static CrFwBool_t actionFlag
Outcome of dummy action.
CrFwSeqCnt_t CrFwOutStreamStubGetTypeCnt(CrFwCounterU1_t n)
Return the type counter of the n-th packet to have been handed over to the OutStream Stub.
CrFwBool_t CrFwOutStreamStubPcktHandover(CrFwPckt_t pckt)
Stub function implementing the hand-over operation for the OutStream.
CrFwSeqCnt_t CrFwOutStreamStubGetSeqCnt(CrFwCounterU1_t n)
Return the sequence counter of the n-th packet to have been handed over to the OutStream Stub.
void CrFwOutStreamStubInitAction(FwPrDesc_t prDesc)
Dummy implementation of a configuration action for an OutStream.
void CrFwOutStreamStubSetCheckFlag(CrFwBool_t flag)
Set the value of the check flag which determines the outcome of the dummy check of CrFwOutStreamStubD...
CrFwCounterU1_t CrFwOutStreamStubGetShutdownCnt()
Return the value of the shutdown counter which is incremented by the packet shutdown function in CrFw...
static CrFwCounterU1_t shutdownCnt
Counter incremented by stub Shutdown Operation.
static CrFwCounterU1_t pcktHandOverCnt
Counter incremented every time the packet hand-over operation is called.
void CrFwOutStreamStubSetActionFlag(CrFwBool_t flag)
Set the value of the action flag which determines the outcome of the initialization of configuration ...
void CrFwOutStreamStubDummyCheck(FwPrDesc_t prDesc)
Dummy implementation of an initialization or configuration check for an OutStream.
void CrFwOutStreamStubSetHandoverFlag(CrFwBool_t flag)
Set the value of the handover flag which determines the outcome of the packet handover in CrFwOutStre...
#define CR_FW_OUTSTREAM_STUB_MEM_LEN
Number of sequence and type counters kept in memory.
static CrFwCounterU1_t pcktHandOverSuccCnt
Counter incremented every time the packet hand-over operation is called and the packet handover is su...
Interface for the OutStream stub.
User-modifiable parameters for the OutStream components (see CrFwOutStream.h).
Interface for creating and accessing a report or command packet.
CrFwTypeCnt_t CrFwPcktGetTypeCnt(CrFwPckt_t pckt)
Return the type counter of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:253
CrFwSeqCnt_t CrFwPcktGetSeqCnt(CrFwPckt_t pckt)
Return the sequence counter of the command or report encapsulated in a packet.
Definition: CrFwPckt.c:241
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 CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
unsigned int CrFwTypeCnt_t
Type used for the type counter of commands or reports.
Definition of the utility functions for the CORDET Framework.
Type for the Framework Component Data (FCD).
Definition: CrFwCmpData.h:79
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