F´ Flight Software - C/C++ Documentation  devel
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 "FpConfig.hpp"
11 #include "Fw/Cmd/CmdPortAc.hpp"
12 #include "Fw/Cmd/CmdRegPortAc.hpp"
14 #include "Fw/Cmd/CmdString.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #if FW_ENABLE_TEXT_LOGGING == 1
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #endif
23 #include "Fw/Time/TimePortAc.hpp"
24 #include "Fw/Tlm/TlmPortAc.hpp"
25 #include "Fw/Tlm/TlmString.hpp"
26 #include "Fw/Types/WaitEnumAc.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
46 
47  PROTECTED:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
56  };
57 
59  enum {
63  };
64 
66  enum {
73  };
74 
76  enum {
78  };
79 
81  enum {
82  OPCODE_RUN = 0x0,
84  };
85 
87  enum {
94  };
95 
97  enum {
101  };
102 
103  public:
104 
105  // ----------------------------------------------------------------------
106  // Component initialization
107  // ----------------------------------------------------------------------
108 
110  void init(
111  FwSizeType queueDepth,
112  FwEnumStoreType instance = 0
113  );
114 
115  public:
116 
117  // ----------------------------------------------------------------------
118  // Getters for special input ports
119  // ----------------------------------------------------------------------
120 
125  FwIndexType portNum
126  );
127 
128  public:
129 
130  // ----------------------------------------------------------------------
131  // Getters for typed input ports
132  // ----------------------------------------------------------------------
133 
138  FwIndexType portNum
139  );
140 
145  FwIndexType portNum
146  );
147 
152  FwIndexType portNum
153  );
154 
155  public:
156 
157  // ----------------------------------------------------------------------
158  // Connect input ports to special output ports
159  // ----------------------------------------------------------------------
160 
163  FwIndexType portNum,
164  Fw::InputCmdRegPort* port
165  );
166 
169  FwIndexType portNum,
171  );
172 
175  FwIndexType portNum,
176  Fw::InputLogPort* port
177  );
178 
179 #if FW_ENABLE_TEXT_LOGGING == 1
180 
182  void set_logTextOut_OutputPort(
183  FwIndexType portNum,
184  Fw::InputLogTextPort* port
185  );
186 
187 #endif
188 
191  FwIndexType portNum,
192  Fw::InputTimePort* port
193  );
194 
197  FwIndexType portNum,
198  Fw::InputTlmPort* port
199  );
200 
201  public:
202 
203  // ----------------------------------------------------------------------
204  // Connect typed input ports to typed output ports
205  // ----------------------------------------------------------------------
206 
209  FwIndexType portNum,
211  );
212 
213 #if FW_PORT_SERIALIZATION
214 
215  public:
216 
217  // ----------------------------------------------------------------------
218  // Connect serial input ports to special output ports
219  // ----------------------------------------------------------------------
220 
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
235  FwIndexType portNum,
236  Fw::InputSerializePort* port
237  );
238 
239 #if FW_ENABLE_TEXT_LOGGING == 1
240 
242  void set_logTextOut_OutputPort(
243  FwIndexType portNum,
244  Fw::InputSerializePort* port
245  );
246 
247 #endif
248 
251  FwIndexType portNum,
252  Fw::InputSerializePort* port
253  );
254 
257  FwIndexType portNum,
258  Fw::InputSerializePort* port
259  );
260 
261 #endif
262 
263 #if FW_PORT_SERIALIZATION
264 
265  public:
266 
267  // ----------------------------------------------------------------------
268  // Connect serial input ports to typed output ports
269  // ----------------------------------------------------------------------
270 
273  FwIndexType portNum,
274  Fw::InputSerializePort* port
275  );
276 
277 #endif
278 
279  public:
280 
281  // ----------------------------------------------------------------------
282  // Command registration
283  // ----------------------------------------------------------------------
284 
288  void regCommands();
289 
290  PROTECTED:
291 
292  // ----------------------------------------------------------------------
293  // Component construction and destruction
294  // ----------------------------------------------------------------------
295 
298  const char* compName = ""
299  );
300 
302  virtual ~SeqDispatcherComponentBase();
303 
304  PROTECTED:
305 
306  // ----------------------------------------------------------------------
307  // Getters for numbers of special input ports
308  // ----------------------------------------------------------------------
309 
314 
315  PROTECTED:
316 
317  // ----------------------------------------------------------------------
318  // Getters for numbers of typed input ports
319  // ----------------------------------------------------------------------
320 
325 
330 
335 
336  PROTECTED:
337 
338  // ----------------------------------------------------------------------
339  // Getters for numbers of special output ports
340  // ----------------------------------------------------------------------
341 
346 
351 
356 
357 #if FW_ENABLE_TEXT_LOGGING == 1
358 
362  FwIndexType getNum_logTextOut_OutputPorts() const;
363 
364 #endif
365 
370 
375 
376  PROTECTED:
377 
378  // ----------------------------------------------------------------------
379  // Getters for numbers of typed output ports
380  // ----------------------------------------------------------------------
381 
386 
387  PROTECTED:
388 
389  // ----------------------------------------------------------------------
390  // Connection status queries for special output ports
391  // ----------------------------------------------------------------------
392 
397  FwIndexType portNum
398  );
399 
404  FwIndexType portNum
405  );
406 
411  FwIndexType portNum
412  );
413 
414 #if FW_ENABLE_TEXT_LOGGING == 1
415 
419  bool isConnected_logTextOut_OutputPort(
420  FwIndexType portNum
421  );
422 
423 #endif
424 
429  FwIndexType portNum
430  );
431 
436  FwIndexType portNum
437  );
438 
439  PROTECTED:
440 
441  // ----------------------------------------------------------------------
442  // Connection status queries for typed output ports
443  // ----------------------------------------------------------------------
444 
449  FwIndexType portNum
450  );
451 
452  PROTECTED:
453 
454  // ----------------------------------------------------------------------
455  // Handlers to implement for typed input ports
456  // ----------------------------------------------------------------------
457 
459  virtual void seqDoneIn_handler(
460  FwIndexType portNum,
461  FwOpcodeType opCode,
462  U32 cmdSeq,
463  const Fw::CmdResponse& response
464  ) = 0;
465 
467  virtual void seqRunIn_handler(
468  FwIndexType portNum,
469  const Fw::StringBase& filename
470  ) = 0;
471 
473  virtual void seqStartIn_handler(
474  FwIndexType portNum,
475  const Fw::StringBase& filename
476  ) = 0;
477 
478  PROTECTED:
479 
480  // ----------------------------------------------------------------------
481  // Port handler base-class functions for typed input ports
482  //
483  // Call these functions directly to bypass the corresponding ports
484  // ----------------------------------------------------------------------
485 
488  FwIndexType portNum,
489  FwOpcodeType opCode,
490  U32 cmdSeq,
491  const Fw::CmdResponse& response
492  );
493 
496  FwIndexType portNum,
497  const Fw::StringBase& filename
498  );
499 
502  FwIndexType portNum,
503  const Fw::StringBase& filename
504  );
505 
506  PROTECTED:
507 
508  // ----------------------------------------------------------------------
509  // Pre-message hooks for typed async input ports
510  //
511  // Each of these functions is invoked just before processing a message
512  // on the corresponding port. By default, they do nothing. You can
513  // override them to provide specific pre-message behavior.
514  // ----------------------------------------------------------------------
515 
517  virtual void seqDoneIn_preMsgHook(
518  FwIndexType portNum,
519  FwOpcodeType opCode,
520  U32 cmdSeq,
521  const Fw::CmdResponse& response
522  );
523 
525  virtual void seqRunIn_preMsgHook(
526  FwIndexType portNum,
527  const Fw::StringBase& filename
528  );
529 
531  virtual void seqStartIn_preMsgHook(
532  FwIndexType portNum,
533  const Fw::StringBase& filename
534  );
535 
536  PROTECTED:
537 
538  // ----------------------------------------------------------------------
539  // Invocation functions for typed output ports
540  // ----------------------------------------------------------------------
541 
543  void seqRunOut_out(
544  FwIndexType portNum,
545  const Fw::StringBase& filename
546  );
547 
548  PROTECTED:
549 
550  // ----------------------------------------------------------------------
551  // Command response
552  // ----------------------------------------------------------------------
553 
555  void cmdResponse_out(
556  FwOpcodeType opCode,
557  U32 cmdSeq,
558  Fw::CmdResponse response
559  );
560 
561  PROTECTED:
562 
563  // ----------------------------------------------------------------------
564  // Command handlers to implement
565  // ----------------------------------------------------------------------
566 
570  virtual void RUN_cmdHandler(
571  FwOpcodeType opCode,
572  U32 cmdSeq,
573  const Fw::CmdStringArg& fileName,
574  Fw::Wait block
575  ) = 0;
576 
580  virtual void LOG_STATUS_cmdHandler(
581  FwOpcodeType opCode,
582  U32 cmdSeq
583  ) = 0;
584 
585  PROTECTED:
586 
587  // ----------------------------------------------------------------------
588  // Command handler base-class functions
589  //
590  // Call these functions directly to bypass the command input port
591  // ----------------------------------------------------------------------
592 
596  void RUN_cmdHandlerBase(
597  FwOpcodeType opCode,
598  U32 cmdSeq,
599  Fw::CmdArgBuffer& args
600  );
601 
606  FwOpcodeType opCode,
607  U32 cmdSeq,
608  Fw::CmdArgBuffer& args
609  );
610 
611  PROTECTED:
612 
613  // ----------------------------------------------------------------------
614  // Pre-message hooks for async commands
615  //
616  // Each of these functions is invoked just before processing the
617  // corresponding command. By default they do nothing. You can
618  // override them to provide specific pre-command behavior.
619  // ----------------------------------------------------------------------
620 
622  virtual void RUN_preMsgHook(
623  FwOpcodeType opCode,
624  U32 cmdSeq
625  );
626 
628  virtual void LOG_STATUS_preMsgHook(
629  FwOpcodeType opCode,
630  U32 cmdSeq
631  );
632 
633  PROTECTED:
634 
635  // ----------------------------------------------------------------------
636  // Event logging functions
637  // ----------------------------------------------------------------------
638 
640  void log_WARNING_HI_InvalidSequencer(U16 idx);
641 
644 
647 
650  U16 idx,
651  const Fw::StringBase& newSequence,
652  const Fw::StringBase& sequenceInInternalState
653  );
654 
657  U16 idx,
658  const Fw::StringBase& newSequence
659  );
660 
663  U16 idx,
665  const Fw::StringBase& filename
666  );
667 
668  PROTECTED:
669 
670  // ----------------------------------------------------------------------
671  // Telemetry write functions
672  // ----------------------------------------------------------------------
673 
678  U32 arg,
679  Fw::Time _tlmTime = Fw::Time()
680  );
681 
687  void tlmWrite_errorCount(
688  U32 arg,
689  Fw::Time _tlmTime = Fw::Time()
690  );
691 
696  U32 arg,
697  Fw::Time _tlmTime = Fw::Time()
698  );
699 
700  PROTECTED:
701 
702  // ----------------------------------------------------------------------
703  // Time
704  // ----------------------------------------------------------------------
705 
709  Fw::Time getTime();
710 
711  PRIVATE:
712 
713  // ----------------------------------------------------------------------
714  // Message dispatch functions
715  // ----------------------------------------------------------------------
716 
718  virtual MsgDispatchStatus doDispatch();
719 
720  PRIVATE:
721 
722  // ----------------------------------------------------------------------
723  // Calls for messages received on special input ports
724  // ----------------------------------------------------------------------
725 
727  static void m_p_cmdIn_in(
728  Fw::PassiveComponentBase* callComp,
729  FwIndexType portNum,
730  FwOpcodeType opCode,
731  U32 cmdSeq,
732  Fw::CmdArgBuffer& args
733  );
734 
735  PRIVATE:
736 
737  // ----------------------------------------------------------------------
738  // Calls for messages received on typed input ports
739  // ----------------------------------------------------------------------
740 
742  static void m_p_seqDoneIn_in(
743  Fw::PassiveComponentBase* callComp,
744  FwIndexType portNum,
745  FwOpcodeType opCode,
746  U32 cmdSeq,
747  const Fw::CmdResponse& response
748  );
749 
751  static void m_p_seqRunIn_in(
752  Fw::PassiveComponentBase* callComp,
753  FwIndexType portNum,
754  const Fw::StringBase& filename
755  );
756 
758  static void m_p_seqStartIn_in(
759  Fw::PassiveComponentBase* callComp,
760  FwIndexType portNum,
761  const Fw::StringBase& filename
762  );
763 
764  PRIVATE:
765 
766  // ----------------------------------------------------------------------
767  // Special input ports
768  // ----------------------------------------------------------------------
769 
771  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
772 
773  PRIVATE:
774 
775  // ----------------------------------------------------------------------
776  // Typed input ports
777  // ----------------------------------------------------------------------
778 
781 
783  Svc::InputCmdSeqInPort m_seqRunIn_InputPort[NUM_SEQRUNIN_INPUT_PORTS];
784 
786  Svc::InputCmdSeqInPort m_seqStartIn_InputPort[NUM_SEQSTARTIN_INPUT_PORTS];
787 
788  PRIVATE:
789 
790  // ----------------------------------------------------------------------
791  // Special output ports
792  // ----------------------------------------------------------------------
793 
795  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
796 
798  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
799 
801  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
802 
803 #if FW_ENABLE_TEXT_LOGGING == 1
804 
806  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
807 
808 #endif
809 
811  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
812 
814  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
815 
816  PRIVATE:
817 
818  // ----------------------------------------------------------------------
819  // Typed output ports
820  // ----------------------------------------------------------------------
821 
823  Svc::OutputCmdSeqInPort m_seqRunOut_OutputPort[NUM_SEQRUNOUT_OUTPUT_PORTS];
824 
825  };
826 
827 }
828 
829 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
Wait or don't wait for something.
Definition: WaitEnumAc.hpp:19
Auto-generated base for SeqDispatcher component.
void log_WARNING_LO_UnexpectedSequenceStarted(U16 idx, const Fw::StringBase &newSequence)
Log event UnexpectedSequenceStarted.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
virtual void seqRunIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &filename)
Pre-message hook for async input port seqRunIn.
void tlmWrite_errorCount(U32 arg, Fw::Time _tlmTime=Fw::Time())
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void seqRunIn_handler(FwIndexType portNum, const Fw::StringBase &filename)=0
Handler for input port seqRunIn.
@ OPCODE_LOG_STATUS
Logs via Events the state of each connected command sequencer.
@ OPCODE_RUN
Dispatches a sequence to the first available sequencer.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
@ CHANNELID_ERRORCOUNT
Channel ID for errorCount.
@ CHANNELID_DISPATCHEDCOUNT
Channel ID for dispatchedCount.
@ CHANNELID_SEQUENCERSAVAILABLE
Channel ID for sequencersAvailable.
Fw::InputCmdResponsePort * get_seqDoneIn_InputPort(FwIndexType portNum)
Svc::InputCmdSeqInPort * get_seqRunIn_InputPort(FwIndexType portNum)
virtual void seqStartIn_handler(FwIndexType portNum, const Fw::StringBase &filename)=0
Handler for input port seqStartIn.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
void seqRunIn_handlerBase(FwIndexType portNum, const Fw::StringBase &filename)
Handler base-class function for input port seqRunIn.
Svc::InputCmdSeqInPort * get_seqStartIn_InputPort(FwIndexType portNum)
virtual void seqDoneIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port seqDoneIn.
virtual void RUN_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg &fileName, Fw::Wait block)=0
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
friend class SeqDispatcherComponentBaseFriend
Friend class for white-box testing.
void log_WARNING_HI_ConflictingSequenceStarted(U16 idx, const Fw::StringBase &newSequence, const Fw::StringBase &sequenceInInternalState)
Log event ConflictingSequenceStarted.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void seqStartIn_handlerBase(FwIndexType portNum, const Fw::StringBase &filename)
Handler base-class function for input port seqStartIn.
virtual void RUN_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command RUN.
void regCommands()
Register commands with the Command Dispatcher.
void tlmWrite_dispatchedCount(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_NoAvailableSequencers()
Log event NoAvailableSequencers.
void LOG_STATUS_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void log_ACTIVITY_LO_LogSequencerStatus(U16 idx, Svc::SeqDispatcher_CmdSequencerState state, const Fw::StringBase &filename)
Log event LogSequencerStatus.
virtual void LOG_STATUS_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command LOG_STATUS.
void RUN_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
bool isConnected_seqRunOut_OutputPort(FwIndexType portNum)
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
SeqDispatcherComponentBase(const char *compName="")
Construct SeqDispatcherComponentBase object.
void set_seqRunOut_OutputPort(FwIndexType portNum, Svc::InputCmdSeqInPort *port)
Connect port to seqRunOut[portNum].
virtual void LOG_STATUS_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void seqRunOut_out(FwIndexType portNum, const Fw::StringBase &filename)
Invoke output port seqRunOut.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
Fw::InputCmdPort * get_cmdIn_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 log_WARNING_LO_UnknownSequenceFinished(U16 idx)
Log event UnknownSequenceFinished.
void seqDoneIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port seqDoneIn.
virtual void seqStartIn_preMsgHook(FwIndexType portNum, const Fw::StringBase &filename)
Pre-message hook for async input port seqStartIn.
virtual ~SeqDispatcherComponentBase()
Destroy SeqDispatcherComponentBase object.
void tlmWrite_sequencersAvailable(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_InvalidSequencer(U16 idx)
Log event InvalidSequencer.