F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SeqDispatcherComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SeqDispatcherComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for SeqDispatcher component base class
5 // ======================================================================
6 
7 #ifndef Svc_SeqDispatcherComponentAc_HPP
8 #define Svc_SeqDispatcherComponentAc_HPP
9 
10 #include <atomic>
11 
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.hpp"
17 #include "Fw/FPrimeBasicTypes.hpp"
18 #include "Fw/Log/LogPortAc.hpp"
19 #include "Fw/Log/LogString.hpp"
20 #if FW_ENABLE_TEXT_LOGGING == 1
21 #include "Fw/Log/LogTextPortAc.hpp"
22 #endif
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Fw/Tlm/TlmPortAc.hpp"
27 #include "Fw/Tlm/TlmString.hpp"
28 #include "Fw/Types/WaitEnumAc.hpp"
31 
32 namespace Svc {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
50 
51  PROTECTED:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
60  };
61 
63  enum {
67  };
68 
70  enum {
77  };
78 
80  enum {
82  };
83 
85  enum {
86  OPCODE_RUN = 0x0,
88  };
89 
91  enum {
98  };
99 
101  enum {
105  };
106 
107  public:
108 
109  // ----------------------------------------------------------------------
110  // Component initialization
111  // ----------------------------------------------------------------------
112 
114  void init(
115  FwSizeType queueDepth,
116  FwEnumStoreType instance = 0
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Getters for special input ports
123  // ----------------------------------------------------------------------
124 
129  FwIndexType portNum
130  );
131 
132  public:
133 
134  // ----------------------------------------------------------------------
135  // Getters for typed input ports
136  // ----------------------------------------------------------------------
137 
142  FwIndexType portNum
143  );
144 
149  FwIndexType portNum
150  );
151 
156  FwIndexType portNum
157  );
158 
159  public:
160 
161  // ----------------------------------------------------------------------
162  // Connect input ports to special output ports
163  // ----------------------------------------------------------------------
164 
167  FwIndexType portNum,
168  Fw::InputCmdRegPort* port
169  );
170 
173  FwIndexType portNum,
175  );
176 
179  FwIndexType portNum,
180  Fw::InputLogPort* port
181  );
182 
183 #if FW_ENABLE_TEXT_LOGGING == 1
184 
186  void set_logTextOut_OutputPort(
187  FwIndexType portNum,
188  Fw::InputLogTextPort* port
189  );
190 
191 #endif
192 
195  FwIndexType portNum,
196  Fw::InputTimePort* port
197  );
198 
201  FwIndexType portNum,
202  Fw::InputTlmPort* port
203  );
204 
205  public:
206 
207  // ----------------------------------------------------------------------
208  // Connect typed input ports to typed output ports
209  // ----------------------------------------------------------------------
210 
213  FwIndexType portNum,
215  );
216 
217 #if FW_PORT_SERIALIZATION
218 
219  public:
220 
221  // ----------------------------------------------------------------------
222  // Connect serial input ports to special output ports
223  // ----------------------------------------------------------------------
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
243 #if FW_ENABLE_TEXT_LOGGING == 1
244 
246  void set_logTextOut_OutputPort(
247  FwIndexType portNum,
248  Fw::InputSerializePort* port
249  );
250 
251 #endif
252 
255  FwIndexType portNum,
256  Fw::InputSerializePort* port
257  );
258 
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
265 #endif
266 
267 #if FW_PORT_SERIALIZATION
268 
269  public:
270 
271  // ----------------------------------------------------------------------
272  // Connect serial input ports to typed output ports
273  // ----------------------------------------------------------------------
274 
277  FwIndexType portNum,
278  Fw::InputSerializePort* port
279  );
280 
281 #endif
282 
283  public:
284 
285  // ----------------------------------------------------------------------
286  // Command registration
287  // ----------------------------------------------------------------------
288 
292  void regCommands();
293 
294  PROTECTED:
295 
296  // ----------------------------------------------------------------------
297  // Component construction and destruction
298  // ----------------------------------------------------------------------
299 
302  const char* compName = ""
303  );
304 
306  virtual ~SeqDispatcherComponentBase();
307 
308  PROTECTED:
309 
310  // ----------------------------------------------------------------------
311  // Getters for numbers of special input ports
312  // ----------------------------------------------------------------------
313 
318 
319  PROTECTED:
320 
321  // ----------------------------------------------------------------------
322  // Getters for numbers of typed input ports
323  // ----------------------------------------------------------------------
324 
329 
334 
339 
340  PROTECTED:
341 
342  // ----------------------------------------------------------------------
343  // Getters for numbers of special output ports
344  // ----------------------------------------------------------------------
345 
350 
355 
360 
361 #if FW_ENABLE_TEXT_LOGGING == 1
362 
366  FwIndexType getNum_logTextOut_OutputPorts() const;
367 
368 #endif
369 
374 
379 
380  PROTECTED:
381 
382  // ----------------------------------------------------------------------
383  // Getters for numbers of typed output ports
384  // ----------------------------------------------------------------------
385 
390 
391  PROTECTED:
392 
393  // ----------------------------------------------------------------------
394  // Connection status queries for special output ports
395  // ----------------------------------------------------------------------
396 
401  FwIndexType portNum
402  );
403 
408  FwIndexType portNum
409  );
410 
415  FwIndexType portNum
416  );
417 
418 #if FW_ENABLE_TEXT_LOGGING == 1
419 
423  bool isConnected_logTextOut_OutputPort(
424  FwIndexType portNum
425  );
426 
427 #endif
428 
433  FwIndexType portNum
434  );
435 
440  FwIndexType portNum
441  );
442 
443  PROTECTED:
444 
445  // ----------------------------------------------------------------------
446  // Connection status queries for typed output ports
447  // ----------------------------------------------------------------------
448 
453  FwIndexType portNum
454  );
455 
456  PROTECTED:
457 
458  // ----------------------------------------------------------------------
459  // Handlers to implement for typed input ports
460  // ----------------------------------------------------------------------
461 
463  virtual void seqDoneIn_handler(
464  FwIndexType portNum,
465  FwOpcodeType opCode,
466  U32 cmdSeq,
467  const Fw::CmdResponse& response
468  ) = 0;
469 
471  virtual void seqRunIn_handler(
472  FwIndexType portNum,
473  const Fw::StringBase& filename
474  ) = 0;
475 
477  virtual void seqStartIn_handler(
478  FwIndexType portNum,
479  const Fw::StringBase& filename
480  ) = 0;
481 
482  PROTECTED:
483 
484  // ----------------------------------------------------------------------
485  // Port handler base-class functions for typed input ports
486  //
487  // Call these functions directly to bypass the corresponding ports
488  // ----------------------------------------------------------------------
489 
492  FwIndexType portNum,
493  FwOpcodeType opCode,
494  U32 cmdSeq,
495  const Fw::CmdResponse& response
496  );
497 
500  FwIndexType portNum,
501  const Fw::StringBase& filename
502  );
503 
506  FwIndexType portNum,
507  const Fw::StringBase& filename
508  );
509 
510  PROTECTED:
511 
512  // ----------------------------------------------------------------------
513  // Pre-message hooks for typed async input ports
514  //
515  // Each of these functions is invoked just before processing a message
516  // on the corresponding port. By default, they do nothing. You can
517  // override them to provide specific pre-message behavior.
518  // ----------------------------------------------------------------------
519 
521  virtual void seqDoneIn_preMsgHook(
522  FwIndexType portNum,
523  FwOpcodeType opCode,
524  U32 cmdSeq,
525  const Fw::CmdResponse& response
526  );
527 
529  virtual void seqRunIn_preMsgHook(
530  FwIndexType portNum,
531  const Fw::StringBase& filename
532  );
533 
535  virtual void seqStartIn_preMsgHook(
536  FwIndexType portNum,
537  const Fw::StringBase& filename
538  );
539 
540  PROTECTED:
541 
542  // ----------------------------------------------------------------------
543  // Invocation functions for typed output ports
544  // ----------------------------------------------------------------------
545 
547  void seqRunOut_out(
548  FwIndexType portNum,
549  const Fw::StringBase& filename
550  );
551 
552  PROTECTED:
553 
554  // ----------------------------------------------------------------------
555  // Command response
556  // ----------------------------------------------------------------------
557 
559  void cmdResponse_out(
560  FwOpcodeType opCode,
561  U32 cmdSeq,
562  Fw::CmdResponse response
563  );
564 
565  PROTECTED:
566 
567  // ----------------------------------------------------------------------
568  // Command handlers to implement
569  // ----------------------------------------------------------------------
570 
574  virtual void RUN_cmdHandler(
575  FwOpcodeType opCode,
576  U32 cmdSeq,
577  const Fw::CmdStringArg& fileName,
578  Fw::Wait block
579  ) = 0;
580 
584  virtual void LOG_STATUS_cmdHandler(
585  FwOpcodeType opCode,
586  U32 cmdSeq
587  ) = 0;
588 
589  PROTECTED:
590 
591  // ----------------------------------------------------------------------
592  // Command handler base-class functions
593  //
594  // Call these functions directly to bypass the command input port
595  // ----------------------------------------------------------------------
596 
600  void RUN_cmdHandlerBase(
601  FwOpcodeType opCode,
602  U32 cmdSeq,
603  Fw::CmdArgBuffer& args
604  );
605 
610  FwOpcodeType opCode,
611  U32 cmdSeq,
612  Fw::CmdArgBuffer& args
613  );
614 
615  PROTECTED:
616 
617  // ----------------------------------------------------------------------
618  // Pre-message hooks for async commands
619  //
620  // Each of these functions is invoked just before processing the
621  // corresponding command. By default they do nothing. You can
622  // override them to provide specific pre-command behavior.
623  // ----------------------------------------------------------------------
624 
626  virtual void RUN_preMsgHook(
627  FwOpcodeType opCode,
628  U32 cmdSeq
629  );
630 
632  virtual void LOG_STATUS_preMsgHook(
633  FwOpcodeType opCode,
634  U32 cmdSeq
635  );
636 
637  PROTECTED:
638 
639  // ----------------------------------------------------------------------
640  // Event logging functions
641  // ----------------------------------------------------------------------
642 
644  void log_WARNING_HI_InvalidSequencer(U16 idx) const;
645 
648 
650  void log_WARNING_LO_UnknownSequenceFinished(U16 idx) const;
651 
654  U16 idx,
655  const Fw::StringBase& newSequence,
656  const Fw::StringBase& sequenceInInternalState
657  ) const;
658 
661  U16 idx,
662  const Fw::StringBase& newSequence
663  ) const;
664 
667  U16 idx,
669  const Fw::StringBase& filename
670  ) const;
671 
672  PROTECTED:
673 
674  // ----------------------------------------------------------------------
675  // Telemetry write functions
676  // ----------------------------------------------------------------------
677 
682  U32 arg,
683  Fw::Time _tlmTime = Fw::Time()
684  ) const;
685 
691  void tlmWrite_errorCount(
692  U32 arg,
693  Fw::Time _tlmTime = Fw::Time()
694  ) const;
695 
700  U32 arg,
701  Fw::Time _tlmTime = Fw::Time()
702  ) const;
703 
704  PROTECTED:
705 
706  // ----------------------------------------------------------------------
707  // Time
708  // ----------------------------------------------------------------------
709 
713  Fw::Time getTime() const;
714 
715  PRIVATE:
716 
717  // ----------------------------------------------------------------------
718  // Message dispatch functions
719  // ----------------------------------------------------------------------
720 
722  virtual MsgDispatchStatus doDispatch();
723 
724  PRIVATE:
725 
726  // ----------------------------------------------------------------------
727  // Calls for messages received on special input ports
728  // ----------------------------------------------------------------------
729 
731  static void m_p_cmdIn_in(
732  Fw::PassiveComponentBase* callComp,
733  FwIndexType portNum,
734  FwOpcodeType opCode,
735  U32 cmdSeq,
736  Fw::CmdArgBuffer& args
737  );
738 
739  PRIVATE:
740 
741  // ----------------------------------------------------------------------
742  // Calls for messages received on typed input ports
743  // ----------------------------------------------------------------------
744 
746  static void m_p_seqDoneIn_in(
747  Fw::PassiveComponentBase* callComp,
748  FwIndexType portNum,
749  FwOpcodeType opCode,
750  U32 cmdSeq,
751  const Fw::CmdResponse& response
752  );
753 
755  static void m_p_seqRunIn_in(
756  Fw::PassiveComponentBase* callComp,
757  FwIndexType portNum,
758  const Fw::StringBase& filename
759  );
760 
762  static void m_p_seqStartIn_in(
763  Fw::PassiveComponentBase* callComp,
764  FwIndexType portNum,
765  const Fw::StringBase& filename
766  );
767 
768  PRIVATE:
769 
770  // ----------------------------------------------------------------------
771  // Special input ports
772  // ----------------------------------------------------------------------
773 
775  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
776 
777  PRIVATE:
778 
779  // ----------------------------------------------------------------------
780  // Typed input ports
781  // ----------------------------------------------------------------------
782 
785 
787  Svc::InputCmdSeqInPort m_seqRunIn_InputPort[NUM_SEQRUNIN_INPUT_PORTS];
788 
790  Svc::InputCmdSeqInPort m_seqStartIn_InputPort[NUM_SEQSTARTIN_INPUT_PORTS];
791 
792  PRIVATE:
793 
794  // ----------------------------------------------------------------------
795  // Special output ports
796  // ----------------------------------------------------------------------
797 
799  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
800 
802  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
803 
805  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
806 
807 #if FW_ENABLE_TEXT_LOGGING == 1
808 
810  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
811 
812 #endif
813 
815  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
816 
818  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
819 
820  PRIVATE:
821 
822  // ----------------------------------------------------------------------
823  // Typed output ports
824  // ----------------------------------------------------------------------
825 
827  Svc::OutputCmdSeqInPort m_seqRunOut_OutputPort[NUM_SEQRUNOUT_OUTPUT_PORTS];
828 
829  };
830 
831 }
832 
833 #endif
Fw::InputCmdResponsePort * get_seqDoneIn_InputPort(FwIndexType portNum)
virtual void seqDoneIn_preMsgHook(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Pre-message hook for async input port seqDoneIn.
void tlmWrite_sequencersAvailable(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
Definition: Time.hpp:9
virtual void LOG_STATUS_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command LOG_STATUS.
void tlmWrite_errorCount(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void seqRunIn_handlerBase(FwIndexType portNum, const Fw::StringBase &filename)
Handler base-class function for input port seqRunIn.
PlatformSizeType FwSizeType
Svc::InputCmdSeqInPort * get_seqRunIn_InputPort(FwIndexType portNum)
I32 FwEnumStoreType
Wait or don&#39;t wait for something.
Definition: WaitEnumAc.hpp:17
virtual void RUN_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command RUN.
Svc::InputCmdSeqInPort * get_seqStartIn_InputPort(FwIndexType portNum)
friend class SeqDispatcherTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
Enum representing a command response.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void regCommands()
Register commands with the Command Dispatcher.
virtual void seqRunIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &filename)
Pre-message hook for async input port seqRunIn.
void seqDoneIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port seqDoneIn.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void RUN_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void init()
Object initializer.
Definition: ObjBase.cpp:26
virtual void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase &filename)=0
Handler for input port seqRunIn.
virtual void seqStartIn_handler(FwIndexType portNum, const Fw::StringBase &filename)=0
Handler for input port seqStartIn.
virtual void LOG_STATUS_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
Dispatches a sequence to the first available sequencer.
void log_WARNING_LO_UnknownSequenceFinished(U16 idx) const
Log event UnknownSequenceFinished.
virtual ~SeqDispatcherComponentBase()
Destroy SeqDispatcherComponentBase object.
void log_ACTIVITY_LO_LogSequencerStatus(U16 idx, Svc::SeqDispatcher_CmdSequencerState state, const Fw::StringBase &filename) const
Log event LogSequencerStatus.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
U32 FwOpcodeType
The type of a command opcode.
void set_seqRunOut_OutputPort(FwIndexType portNum, Svc::InputCmdSeqInPort *port)
Connect port to seqRunOut[portNum].
SeqDispatcherComponentBase(const char *compName="")
Construct SeqDispatcherComponentBase object.
virtual void RUN_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &fileName, Fw::Wait block)=0
void log_WARNING_LO_UnexpectedSequenceStarted(U16 idx, const Fw::StringBase &newSequence) const
Log event UnexpectedSequenceStarted.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
void log_WARNING_HI_NoAvailableSequencers() const
Log event NoAvailableSequencers.
void seqStartIn_handlerBase(FwIndexType portNum, const Fw::StringBase &filename)
Handler base-class function for input port seqStartIn.
void seqRunOut_out(FwIndexType portNum, const Fw::StringBase &filename)
Invoke output port seqRunOut.
bool isConnected_seqRunOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
friend class SeqDispatcherComponentBaseFriend
Friend class for white-box testing.
PlatformIndexType FwIndexType
Auto-generated base for SeqDispatcher component.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
virtual void seqDoneIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port seqDoneIn.
void LOG_STATUS_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Logs via Events the state of each connected command sequencer.
RateGroupDivider component implementation.
void log_WARNING_HI_InvalidSequencer(U16 idx) const
Log event InvalidSequencer.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void seqStartIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &filename)
Pre-message hook for async input port seqStartIn.
void log_WARNING_HI_ConflictingSequenceStarted(U16 idx, const Fw::StringBase &newSequence, const Fw::StringBase &sequenceInInternalState) const
Log event ConflictingSequenceStarted.
void tlmWrite_dispatchedCount(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].