F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileDispatcherComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileDispatcherComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FileDispatcher component base class
5 // ======================================================================
6 
7 #ifndef Svc_FileDispatcherComponentAc_HPP
8 #define Svc_FileDispatcherComponentAc_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"
27 #include "Svc/Ping/PingPortAc.hpp"
32 
33 namespace Svc {
34 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
50  friend class FileDispatcherTester;
51 
52  protected:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
59  enum {
61  };
62 
64  enum {
67  };
68 
70  enum {
76  };
77 
79  enum {
82  };
83 
85  enum {
87  };
88 
90  enum {
93  };
94 
95  public:
96 
97  // ----------------------------------------------------------------------
98  // Component initialization
99  // ----------------------------------------------------------------------
100 
102  void init(
103  FwSizeType queueDepth,
104  FwEnumStoreType instance = 0
105  );
106 
107  public:
108 
109  // ----------------------------------------------------------------------
110  // Getters for special input ports
111  // ----------------------------------------------------------------------
112 
117  FwIndexType portNum
118  );
119 
120  public:
121 
122  // ----------------------------------------------------------------------
123  // Getters for typed input ports
124  // ----------------------------------------------------------------------
125 
130  FwIndexType portNum
131  );
132 
137  FwIndexType portNum
138  );
139 
140  public:
141 
142  // ----------------------------------------------------------------------
143  // Connect input ports to special output ports
144  // ----------------------------------------------------------------------
145 
148  FwIndexType portNum,
149  Fw::InputCmdRegPort* port
150  );
151 
154  FwIndexType portNum,
156  );
157 
160  FwIndexType portNum,
161  Fw::InputLogPort* port
162  );
163 
164 #if FW_ENABLE_TEXT_LOGGING == 1
165 
167  void set_logTextOut_OutputPort(
168  FwIndexType portNum,
169  Fw::InputLogTextPort* port
170  );
171 
172 #endif
173 
176  FwIndexType portNum,
177  Fw::InputTimePort* port
178  );
179 
180  public:
181 
182  // ----------------------------------------------------------------------
183  // Connect typed input ports to typed output ports
184  // ----------------------------------------------------------------------
185 
188  FwIndexType portNum,
190  );
191 
194  FwIndexType portNum,
195  Svc::InputPingPort* port
196  );
197 
198 #if FW_PORT_SERIALIZATION
199 
200  public:
201 
202  // ----------------------------------------------------------------------
203  // Connect serial input ports to special output ports
204  // ----------------------------------------------------------------------
205 
208  FwIndexType portNum,
209  Fw::InputSerializePort* port
210  );
211 
214  FwIndexType portNum,
215  Fw::InputSerializePort* port
216  );
217 
220  FwIndexType portNum,
221  Fw::InputSerializePort* port
222  );
223 
224 #if FW_ENABLE_TEXT_LOGGING == 1
225 
227  void set_logTextOut_OutputPort(
228  FwIndexType portNum,
229  Fw::InputSerializePort* port
230  );
231 
232 #endif
233 
236  FwIndexType portNum,
237  Fw::InputSerializePort* port
238  );
239 
240 #endif
241 
242 #if FW_PORT_SERIALIZATION
243 
244  public:
245 
246  // ----------------------------------------------------------------------
247  // Connect serial input ports to typed output ports
248  // ----------------------------------------------------------------------
249 
252  FwIndexType portNum,
253  Fw::InputSerializePort* port
254  );
255 
258  FwIndexType portNum,
259  Fw::InputSerializePort* port
260  );
261 
262 #endif
263 
264  public:
265 
266  // ----------------------------------------------------------------------
267  // Command registration
268  // ----------------------------------------------------------------------
269 
273  void regCommands();
274 
275  protected:
276 
277  // ----------------------------------------------------------------------
278  // Component construction and destruction
279  // ----------------------------------------------------------------------
280 
283  const char* compName = ""
284  );
285 
288 
289  protected:
290 
291  // ----------------------------------------------------------------------
292  // Getters for numbers of special input ports
293  // ----------------------------------------------------------------------
294 
299  return NUM_CMDIN_INPUT_PORTS;
300  }
301 
302  protected:
303 
304  // ----------------------------------------------------------------------
305  // Getters for numbers of typed input ports
306  // ----------------------------------------------------------------------
307 
313  }
314 
319  return NUM_PINGIN_INPUT_PORTS;
320  }
321 
322  protected:
323 
324  // ----------------------------------------------------------------------
325  // Getters for numbers of special output ports
326  // ----------------------------------------------------------------------
327 
333  }
334 
340  }
341 
347  }
348 
349 #if FW_ENABLE_TEXT_LOGGING == 1
350 
354  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
356  }
357 
358 #endif
359 
365  }
366 
367  protected:
368 
369  // ----------------------------------------------------------------------
370  // Getters for numbers of typed output ports
371  // ----------------------------------------------------------------------
372 
378  }
379 
385  }
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 
432  protected:
433 
434  // ----------------------------------------------------------------------
435  // Connection status queries for typed output ports
436  // ----------------------------------------------------------------------
437 
442  FwIndexType portNum
443  );
444 
449  FwIndexType portNum
450  );
451 
452  protected:
453 
454  // ----------------------------------------------------------------------
455  // Handlers to implement for typed input ports
456  // ----------------------------------------------------------------------
457 
459  virtual void fileAnnounceRecv_handler(
460  FwIndexType portNum,
461  Fw::StringBase& file_name
462  ) = 0;
463 
465  virtual void pingIn_handler(
466  FwIndexType portNum,
467  U32 key
468  ) = 0;
469 
470  protected:
471 
472  // ----------------------------------------------------------------------
473  // Port handler base-class functions for typed input ports
474  //
475  // Call these functions directly to bypass the corresponding ports
476  // ----------------------------------------------------------------------
477 
480  FwIndexType portNum,
481  Fw::StringBase& file_name
482  );
483 
485  void pingIn_handlerBase(
486  FwIndexType portNum,
487  U32 key
488  );
489 
490  protected:
491 
492  // ----------------------------------------------------------------------
493  // Pre-message hooks for typed async input ports
494  //
495  // Each of these functions is invoked just before processing a message
496  // on the corresponding port. By default, they do nothing. You can
497  // override them to provide specific pre-message behavior.
498  // ----------------------------------------------------------------------
499 
501  virtual void fileAnnounceRecv_preMsgHook(
502  FwIndexType portNum,
503  Fw::StringBase& file_name
504  );
505 
507  virtual void pingIn_preMsgHook(
508  FwIndexType portNum,
509  U32 key
510  );
511 
512  protected:
513 
514  // ----------------------------------------------------------------------
515  // Invocation functions for typed output ports
516  // ----------------------------------------------------------------------
517 
519  void fileDispatch_out(
520  FwIndexType portNum,
521  Fw::StringBase& file_name
522  );
523 
525  void pingOut_out(
526  FwIndexType portNum,
527  U32 key
528  );
529 
530  protected:
531 
532  // ----------------------------------------------------------------------
533  // Command response
534  // ----------------------------------------------------------------------
535 
537  void cmdResponse_out(
538  FwOpcodeType opCode,
539  U32 cmdSeq,
540  Fw::CmdResponse response
541  );
542 
543  protected:
544 
545  // ----------------------------------------------------------------------
546  // Command handlers to implement
547  // ----------------------------------------------------------------------
548 
550  virtual void ENABLE_DISPATCH_cmdHandler(
551  FwOpcodeType opCode,
552  U32 cmdSeq,
554  Fw::Enabled enable
555  ) = 0;
556 
557  protected:
558 
559  // ----------------------------------------------------------------------
560  // Command handler base-class functions
561  //
562  // Call these functions directly to bypass the command input port
563  // ----------------------------------------------------------------------
564 
567  FwOpcodeType opCode,
568  U32 cmdSeq,
569  Fw::CmdArgBuffer& args
570  );
571 
572  protected:
573 
574  // ----------------------------------------------------------------------
575  // Pre-message hooks for async commands
576  //
577  // Each of these functions is invoked just before processing the
578  // corresponding command. By default they do nothing. You can
579  // override them to provide specific pre-command behavior.
580  // ----------------------------------------------------------------------
581 
583  virtual void ENABLE_DISPATCH_preMsgHook(
584  FwOpcodeType opCode,
585  U32 cmdSeq
586  );
587 
588  protected:
589 
590  // ----------------------------------------------------------------------
591  // Event logging functions
592  // ----------------------------------------------------------------------
593 
597  Fw::Enabled enabled
598  ) const;
599 
602  const Fw::StringBase& file_name,
604  ) const;
605 
606  protected:
607 
608  // ----------------------------------------------------------------------
609  // Time
610  // ----------------------------------------------------------------------
611 
615  Fw::Time getTime() const;
616 
617  private:
618 
619  // ----------------------------------------------------------------------
620  // Message dispatch functions
621  // ----------------------------------------------------------------------
622 
624  virtual MsgDispatchStatus doDispatch();
625 
626  private:
627 
628  // ----------------------------------------------------------------------
629  // Calls for messages received on special input ports
630  // ----------------------------------------------------------------------
631 
633  static void m_p_cmdIn_in(
634  Fw::PassiveComponentBase* callComp,
635  FwIndexType portNum,
636  FwOpcodeType opCode,
637  U32 cmdSeq,
638  Fw::CmdArgBuffer& args
639  );
640 
641  private:
642 
643  // ----------------------------------------------------------------------
644  // Calls for messages received on typed input ports
645  // ----------------------------------------------------------------------
646 
648  static void m_p_fileAnnounceRecv_in(
649  Fw::PassiveComponentBase* callComp,
650  FwIndexType portNum,
651  Fw::StringBase& file_name
652  );
653 
655  static void m_p_pingIn_in(
656  Fw::PassiveComponentBase* callComp,
657  FwIndexType portNum,
658  U32 key
659  );
660 
661  private:
662 
663  // ----------------------------------------------------------------------
664  // Special input ports
665  // ----------------------------------------------------------------------
666 
668  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
669 
670  private:
671 
672  // ----------------------------------------------------------------------
673  // Typed input ports
674  // ----------------------------------------------------------------------
675 
677  Svc::InputFileAnnouncePort m_fileAnnounceRecv_InputPort[NUM_FILEANNOUNCERECV_INPUT_PORTS];
678 
680  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
681 
682  private:
683 
684  // ----------------------------------------------------------------------
685  // Special output ports
686  // ----------------------------------------------------------------------
687 
689  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
690 
692  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
693 
695  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
696 
697 #if FW_ENABLE_TEXT_LOGGING == 1
698 
700  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
701 
702 #endif
703 
705  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
706 
707  private:
708 
709  // ----------------------------------------------------------------------
710  // Typed output ports
711  // ----------------------------------------------------------------------
712 
715 
717  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
718 
719  };
720 
721 }
722 
723 #endif
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
FwIdType FwOpcodeType
The type of a command opcode.
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
PlatformSizeType FwSizeType
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
I32 FwEnumStoreType
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
friend class FileDispatcherTester
Friend class tester implementation to support white-box testing.
void fileAnnounceRecv_handlerBase(FwIndexType portNum, Fw::StringBase &file_name)
Handler base-class function for input port fileAnnounceRecv.
FileDispatcherComponentBase(const char *compName="")
Construct FileDispatcherComponentBase object.
Enum representing a command response.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
virtual void fileAnnounceRecv_handler(FwIndexType portNum, Fw::StringBase &file_name)=0
Handler for input port fileAnnounceRecv.
void log_ACTIVITY_HI_FileDispatchState(Svc::FileDispatcherCfg::FileDispatchPort file_type, Fw::Enabled enabled) const
Log event FileDispatchState.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
bool isConnected_fileDispatch_OutputPort(FwIndexType portNum)
virtual void ENABLE_DISPATCH_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command ENABLE_DISPATCH.
void init()
Object initializer.
Definition: ObjBase.cpp:24
void regCommands()
Register commands with the Command Dispatcher.
static constexpr FwIndexType getNum_fileDispatch_OutputPorts()
void fileDispatch_out(FwIndexType portNum, Fw::StringBase &file_name)
Invoke output port fileDispatch.
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_pingIn_InputPorts()
virtual void ENABLE_DISPATCH_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::FileDispatcherCfg::FileDispatchPort file_type, Fw::Enabled enable)=0
Handler for command ENABLE_DISPATCH.
static constexpr FwIndexType getNum_cmdIn_InputPorts()
friend class FileDispatcherTesterBase
Friend class tester to support autocoded test harness.
void ENABLE_DISPATCH_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Base-class handler function for command ENABLE_DISPATCH.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
virtual void fileAnnounceRecv_preMsgHook(FwIndexType portNum, Fw::StringBase &file_name)
Pre-message hook for async input port fileAnnounceRecv.
Enabled and disabled states.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void set_fileDispatch_OutputPort(FwIndexType portNum, Svc::InputFileDispatchPort *port)
Connect port to fileDispatch[portNum].
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Svc::InputFileAnnouncePort * get_fileAnnounceRecv_InputPort(FwIndexType portNum)
virtual ~FileDispatcherComponentBase()
Destroy FileDispatcherComponentBase object.
PlatformIndexType FwIndexType
Auto-generated base for FileDispatcher component.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
RateGroupDivider component implementation.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
static constexpr FwIndexType getNum_pingOut_OutputPorts()
void log_ACTIVITY_HI_FileDispatched(const Fw::StringBase &file_name, Svc::FileDispatcherCfg::FileDispatchPort file_type) const
Log event FileDispatched.
static constexpr FwIndexType getNum_fileAnnounceRecv_InputPorts()
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)