F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FprimeRouterComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FprimeRouterComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FprimeRouter component base class
5 // ======================================================================
6 
7 #ifndef Svc_FprimeRouterComponentAc_HPP
8 #define Svc_FprimeRouterComponentAc_HPP
9 
10 #include <atomic>
11 
14 #include "Fw/Com/ComPortAc.hpp"
16 #include "Fw/FPrimeBasicTypes.hpp"
17 #include "Fw/Log/LogPortAc.hpp"
18 #include "Fw/Log/LogString.hpp"
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #if !FW_DIRECT_PORT_CALLS
25 #endif
26 #include "Fw/Time/TimePortAc.hpp"
27 #include "Os/Mutex.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
45  friend class FprimeRouterTesterBase;
47  friend class FprimeRouterTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
60  };
61 
63  enum {
67  };
68 
70  enum {
75  };
76 
78  enum {
88  };
91 
92  public:
93 
94  // ----------------------------------------------------------------------
95  // Component initialization
96  // ----------------------------------------------------------------------
97 
99  void init(
100  FwEnumStoreType instance = 0
101  );
102 
103 #if !FW_DIRECT_PORT_CALLS
104 
105  public:
106 
107  // ----------------------------------------------------------------------
108  // Getters for typed input ports
109  // ----------------------------------------------------------------------
110 
115  FwIndexType portNum
116  );
117 
122  FwIndexType portNum
123  );
124 
129  FwIndexType portNum
130  );
131 
132 #endif
133 
134 #if !FW_DIRECT_PORT_CALLS
135 
136  public:
137 
138  // ----------------------------------------------------------------------
139  // Connect input ports to special output ports
140  // ----------------------------------------------------------------------
141 
144  FwIndexType portNum,
145  Fw::InputLogPort* port
146  );
147 
148 #if FW_ENABLE_TEXT_LOGGING == 1
149 
151  void set_logTextOut_OutputPort(
152  FwIndexType portNum,
153  Fw::InputLogTextPort* port
154  );
155 
156 #endif
157 
160  FwIndexType portNum,
161  Fw::InputTimePort* port
162  );
163 
164 #endif
165 
166 #if !FW_DIRECT_PORT_CALLS
167 
168  public:
169 
170  // ----------------------------------------------------------------------
171  // Connect typed input ports to typed output ports
172  // ----------------------------------------------------------------------
173 
176  FwIndexType portNum,
177  Fw::InputComPort* port
178  );
179 
182  FwIndexType portNum,
184  );
185 
188  FwIndexType portNum,
190  );
191 
194  FwIndexType portNum,
196  );
197 
198 #endif
199 
200 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
201 
202  public:
203 
204  // ----------------------------------------------------------------------
205  // Connect serial input ports to special output ports
206  // ----------------------------------------------------------------------
207 
210  FwIndexType portNum,
211  Fw::InputSerializePort* port
212  );
213 
214 #if FW_ENABLE_TEXT_LOGGING == 1
215 
217  void set_logTextOut_OutputPort(
218  FwIndexType portNum,
219  Fw::InputSerializePort* port
220  );
221 
222 #endif
223 
226  FwIndexType portNum,
227  Fw::InputSerializePort* port
228  );
229 
230 #endif
231 
232 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
233 
234  public:
235 
236  // ----------------------------------------------------------------------
237  // Connect serial input ports to typed output ports
238  // ----------------------------------------------------------------------
239 
242  FwIndexType portNum,
243  Fw::InputSerializePort* port
244  );
245 
248  FwIndexType portNum,
249  Fw::InputSerializePort* port
250  );
251 
254  FwIndexType portNum,
255  Fw::InputSerializePort* port
256  );
257 
260  FwIndexType portNum,
261  Fw::InputSerializePort* port
262  );
263 
264 #endif
265 
266  protected:
267 
268  // ----------------------------------------------------------------------
269  // Component construction and destruction
270  // ----------------------------------------------------------------------
271 
274  const char* compName = ""
275  );
276 
278  virtual ~FprimeRouterComponentBase();
279 
280  protected:
281 
282  // ----------------------------------------------------------------------
283  // Getters for numbers of typed input ports
284  // ----------------------------------------------------------------------
285 
291  }
292 
297  return NUM_DATAIN_INPUT_PORTS;
298  }
299 
305  }
306 
307  protected:
308 
309  // ----------------------------------------------------------------------
310  // Getters for numbers of special output ports
311  // ----------------------------------------------------------------------
312 
318  }
319 
320 #if FW_ENABLE_TEXT_LOGGING == 1
321 
325  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
327  }
328 
329 #endif
330 
336  }
337 
338  protected:
339 
340  // ----------------------------------------------------------------------
341  // Getters for numbers of typed output ports
342  // ----------------------------------------------------------------------
343 
349  }
350 
356  }
357 
363  }
364 
370  }
371 
372  protected:
373 
374  // ----------------------------------------------------------------------
375  // Connection status queries for special output ports
376  // ----------------------------------------------------------------------
377 
382  FwIndexType portNum
383  ) const;
384 
385 #if FW_ENABLE_TEXT_LOGGING == 1
386 
390  bool isConnected_logTextOut_OutputPort(
391  FwIndexType portNum
392  ) const;
393 
394 #endif
395 
400  FwIndexType portNum
401  ) const;
402 
403  protected:
404 
405  // ----------------------------------------------------------------------
406  // Connection status queries for typed output ports
407  // ----------------------------------------------------------------------
408 
413  FwIndexType portNum
414  ) const;
415 
420  FwIndexType portNum
421  ) const;
422 
427  FwIndexType portNum
428  ) const;
429 
434  FwIndexType portNum
435  ) const;
436 
437  protected:
438 
439  // ----------------------------------------------------------------------
440  // Handlers to implement for typed input ports
441  // ----------------------------------------------------------------------
442 
444  virtual void cmdResponseIn_handler(
445  FwIndexType portNum,
446  FwOpcodeType opCode,
447  U32 cmdSeq,
448  const Fw::CmdResponse& response
449  ) = 0;
450 
452  virtual void dataIn_handler(
453  FwIndexType portNum,
454  Fw::Buffer& data,
455  const ComCfg::FrameContext& context
456  ) = 0;
457 
459  virtual void fileBufferReturnIn_handler(
460  FwIndexType portNum,
461  Fw::Buffer& fwBuffer
462  ) = 0;
463 
464 #if FW_DIRECT_PORT_CALLS
465  public:
466 #else
467  protected:
468 #endif
469 
470  // ----------------------------------------------------------------------
471  // Port handler base-class functions for typed input ports
472  //
473  // Call these functions directly to bypass the corresponding ports
474  // ----------------------------------------------------------------------
475 
478  FwIndexType portNum,
479  FwOpcodeType opCode,
480  U32 cmdSeq,
481  const Fw::CmdResponse& response
482  );
483 
485  void dataIn_handlerBase(
486  FwIndexType portNum,
487  Fw::Buffer& data,
488  const ComCfg::FrameContext& context
489  );
490 
493  FwIndexType portNum,
494  Fw::Buffer& fwBuffer
495  );
496 
497  protected:
498 
499  // ----------------------------------------------------------------------
500  // Invocation functions for typed output ports
501  // ----------------------------------------------------------------------
502 
504  void commandOut_out(
505  FwIndexType portNum,
506  Fw::ComBuffer& data,
507  U32 context
508  ) const;
509 
511  void dataReturnOut_out(
512  FwIndexType portNum,
513  Fw::Buffer& data,
514  const ComCfg::FrameContext& context
515  ) const;
516 
518  void fileOut_out(
519  FwIndexType portNum,
520  Fw::Buffer& fwBuffer
521  ) const;
522 
524  void unknownDataOut_out(
525  FwIndexType portNum,
526  Fw::Buffer& data,
527  const ComCfg::FrameContext& context
528  ) const;
529 
530  protected:
531 
532  // ----------------------------------------------------------------------
533  // Event logging functions
534  // ----------------------------------------------------------------------
535 
540  U32 status
541  ) const;
542 
547  U32 status
548  ) const;
549 
556 
563 
570 
571  protected:
572 
573  // ----------------------------------------------------------------------
574  // Time
575  // ----------------------------------------------------------------------
576 
580  Fw::Time getTime() const;
581 
582  protected:
583 
584  // ----------------------------------------------------------------------
585  // Mutex operations for guarded ports
586  //
587  // You can override these operations to provide more sophisticated
588  // synchronization
589  // ----------------------------------------------------------------------
590 
592  virtual void lock();
593 
595  virtual void unLock();
596 
597  private:
598 
599  // ----------------------------------------------------------------------
600  // Calls for messages received on typed input ports
601  // ----------------------------------------------------------------------
602 
604  static void m_p_cmdResponseIn_in(
605  Fw::PassiveComponentBase* callComp,
606  FwIndexType portNum,
607  FwOpcodeType opCode,
608  U32 cmdSeq,
609  const Fw::CmdResponse& response
610  );
611 
613  static void m_p_dataIn_in(
614  Fw::PassiveComponentBase* callComp,
615  FwIndexType portNum,
616  Fw::Buffer& data,
617  const ComCfg::FrameContext& context
618  );
619 
621  static void m_p_fileBufferReturnIn_in(
622  Fw::PassiveComponentBase* callComp,
623  FwIndexType portNum,
624  Fw::Buffer& fwBuffer
625  );
626 
627  private:
628 
629  // ----------------------------------------------------------------------
630  // Invocation functions for special output ports
631  // ----------------------------------------------------------------------
632 
634  void logOut_out(
635  FwIndexType portNum,
636  FwEventIdType id,
637  Fw::Time& timeTag,
638  const Fw::LogSeverity& severity,
639  Fw::LogBuffer& args
640  ) const;
641 
642 #if FW_ENABLE_TEXT_LOGGING
643 
645  void logTextOut_out(
646  FwIndexType portNum,
647  FwEventIdType id,
648  Fw::Time& timeTag,
649  const Fw::LogSeverity& severity,
650  Fw::TextLogString& text
651  ) const;
652 
653 #endif
654 
656  void timeCaller_out(
657  FwIndexType portNum,
658  Fw::Time& time
659  ) const;
660 
661 #if !FW_DIRECT_PORT_CALLS
662 
663  private:
664 
665  // ----------------------------------------------------------------------
666  // Typed input ports
667  // ----------------------------------------------------------------------
668 
670  Fw::InputCmdResponsePort m_cmdResponseIn_InputPort[NUM_CMDRESPONSEIN_INPUT_PORTS];
671 
674 
676  Fw::InputBufferSendPort m_fileBufferReturnIn_InputPort[NUM_FILEBUFFERRETURNIN_INPUT_PORTS];
677 
678 #endif
679 
680 #if !FW_DIRECT_PORT_CALLS
681 
682  private:
683 
684  // ----------------------------------------------------------------------
685  // Special output ports
686  // ----------------------------------------------------------------------
687 
689  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
690 
691 #if FW_ENABLE_TEXT_LOGGING == 1
692 
694  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
695 
696 #endif
697 
699  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
700 
701 #endif
702 
703 #if !FW_DIRECT_PORT_CALLS
704 
705  private:
706 
707  // ----------------------------------------------------------------------
708  // Typed output ports
709  // ----------------------------------------------------------------------
710 
712  Fw::OutputComPort m_commandOut_OutputPort[NUM_COMMANDOUT_OUTPUT_PORTS];
713 
716 
719 
722 
723 #endif
724 
725  private:
726 
727  // ----------------------------------------------------------------------
728  // Mutexes
729  // ----------------------------------------------------------------------
730 
732  Os::Mutex m_guardedPortMutex;
733 
734  };
735 
736 }
737 
738 #endif
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
friend class FprimeRouterTester
Friend class tester implementation to support white-box testing.
static constexpr FwIndexType getNum_dataIn_InputPorts()
virtual ~FprimeRouterComponentBase()
Destroy FprimeRouterComponentBase object.
static constexpr FwIndexType getNum_fileBufferReturnIn_InputPorts()
FwIdType FwOpcodeType
The type of a command opcode.
An error occurred while deserializing a packet.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void fileBufferReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port fileBufferReturnIn.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
void unknownDataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port unknownDataOut.
I32 FwEnumStoreType
friend class FprimeRouterTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_commandOut_OutputPort(FwIndexType portNum) const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
FprimeRouterComponentBase(const char *compName="")
Construct FprimeRouterComponentBase object.
virtual void lock()
Lock the guarded mutex.
static constexpr FwIndexType getNum_unknownDataOut_OutputPorts()
An error occurred while serializing a com buffer.
void fileOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port fileOut.
Enum representing a command response.
void commandOut_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context) const
Invoke output port commandOut.
Fw::InputCmdResponsePort * get_cmdResponseIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_commandOut_OutputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIdType FwEventIdType
The type of an event identifier.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
virtual void unLock()
Unlock the guarded mutex.
Fw::InputBufferSendPort * get_fileBufferReturnIn_InputPort(FwIndexType portNum)
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void cmdResponseIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port cmdResponseIn.
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
Auto-generated base for FprimeRouter component.
Enum representing event severity.
void set_fileOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to fileOut[portNum].
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_fileOut_OutputPorts()
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void set_unknownDataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to unknownDataOut[portNum].
bool isConnected_unknownDataOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_cmdResponseIn_InputPorts()
PlatformIndexType FwIndexType
void log_WARNING_HI_DeserializationError(U32 status) const
void log_WARNING_HI_SerializationError(U32 status) const
Type used to pass context info between components during framing/deframing.
bool isConnected_fileOut_OutputPort(FwIndexType portNum) const
RateGroupDivider component implementation.
void set_commandOut_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to commandOut[portNum].
virtual void cmdResponseIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port cmdResponseIn.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
virtual void fileBufferReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port fileBufferReturnIn.