F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SeqDispatcher.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SeqDispatcher.hpp
3 // \author zimri.leisher
4 // \brief hpp file for SeqDispatcher component implementation class
5 // ======================================================================
6 
7 #ifndef SeqDispatcher_HPP
8 #define SeqDispatcher_HPP
9 
10 #include "Fw/Types/StringBase.hpp"
15 
16 namespace Svc {
17 
19  public:
20  // ----------------------------------------------------------------------
21  // Construction, initialization, and destruction
22  // ----------------------------------------------------------------------
23 
26  SeqDispatcher(const char* const compName
27  );
28 
32 
33  protected:
35  void seqDoneIn_handler(FwIndexType portNum,
36  FwOpcodeType opCode,
37  U32 cmdSeq,
38  const Fw::CmdResponse& response
39  );
40 
42  void seqStartIn_handler(FwIndexType portNum,
43  const Fw::StringBase& fileName,
44  const Svc::SeqArgs& args
45  );
46 
48  void seqRunIn_handler(FwIndexType portNum,
49  const Fw::StringBase& fileName,
50  const Svc::SeqArgs& args
51  );
52 
53  private:
54  // number of sequences dispatched (successful or otherwise)
55  U32 m_dispatchedCount = 0;
56  // number of errors from dispatched sequences (CmdResponse::EXECUTION_ERROR)
57  U32 m_errorCount = 0;
58  // number of sequencers in state AVAILABLE
59  U32 m_sequencersAvailable = SeqDispatcherSequencerPorts;
60  // number of sequences canceled via the CANCEL_NAME command
61  U32 m_canceledCount = 0;
62 
63  struct DispatchEntry {
64  FwOpcodeType opCode;
65  U32 cmdSeq;
66  // store the state of each sequencer
68  // store the sequence currently running for each sequencer
69  Fw::String sequenceRunning = "<no seq>";
70  } m_entryTable[SeqDispatcherSequencerPorts];
71 
73  FwIndexType getNextAvailableSequencerIdx();
74 
75  void runSequence(FwIndexType sequencerIdx,
76  const Fw::ConstStringBase& fileName,
77  BlockState block,
78  const Svc::SeqArgs& args);
79 
80  // ----------------------------------------------------------------------
81  // Command handler implementations
82  // ----------------------------------------------------------------------
83 
86  void RUN_cmdHandler(const FwOpcodeType opCode,
87  const U32 cmdSeq,
88  const Fw::CmdStringArg& fileName,
89  const BlockState& block);
90 
93  void RUN_ARGS_cmdHandler(const FwOpcodeType opCode,
94  const U32 cmdSeq,
95  const Fw::CmdStringArg& fileName,
96  const BlockState& block,
97  const Svc::SeqArgs& buffer);
99  void LOG_STATUS_cmdHandler(const FwOpcodeType opCode,
100  const U32 cmdSeq);
102  void CANCEL_NAME_cmdHandler(const FwOpcodeType opCode,
105  const U32 cmdSeq,
106  const Fw::CmdStringArg& fileName);
108  void CANCEL_ALL_cmdHandler(const FwOpcodeType opCode,
113  const U32 cmdSeq);
114 };
115 
116 } // namespace Svc
117 
118 #endif
FwIdType FwOpcodeType
The type of a command opcode.
void seqDoneIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler for input port seqDoneIn.
Enum representing a command response.
Sequencer blocking state.
void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase &fileName, const Svc::SeqArgs &args)
Handler for input port seqRunIn.
void seqStartIn_handler(FwIndexType portNum, const Fw::StringBase &fileName, const Svc::SeqArgs &args)
Handler for input port seqStartIn.
SeqDispatcher(const char *const compName)
A read-only abstract superclass for StringBase.
PlatformIndexType FwIndexType
Auto-generated base for SeqDispatcher component.
RateGroupDivider component implementation.
Declares F Prime string base class.