F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActiveLoggerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ActiveLoggerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ActiveLogger component base class
5 // ======================================================================
6 
7 #ifndef Svc_ActiveLoggerComponentAc_HPP
8 #define Svc_ActiveLoggerComponentAc_HPP
9 
10 #include <atomic>
11 
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.hpp"
16 #include "Fw/Com/ComPortAc.hpp"
18 #include "Fw/FPrimeBasicTypes.hpp"
19 #include "Fw/Log/LogBuffer.hpp"
20 #include "Fw/Log/LogPortAc.hpp"
22 #include "Fw/Log/LogString.hpp"
23 #if FW_ENABLE_TEXT_LOGGING == 1
24 #include "Fw/Log/LogTextPortAc.hpp"
25 #endif
28 #include "Fw/Time/Time.hpp"
29 #include "Fw/Time/TimePortAc.hpp"
34 #include "Svc/Ping/PingPortAc.hpp"
36 
37 namespace Svc {
38 
45  {
46 
47  // ----------------------------------------------------------------------
48  // Friend classes
49  // ----------------------------------------------------------------------
50 
54  friend class ActiveLoggerTesterBase;
55 
56  PROTECTED:
57 
58  // ----------------------------------------------------------------------
59  // Constants
60  // ----------------------------------------------------------------------
61 
63  enum {
65  };
66 
68  enum {
71  };
72 
74  enum {
80  };
81 
83  enum {
87  };
88 
90  enum {
94  };
95 
97  enum {
103  };
104 
105  public:
106 
107  // ----------------------------------------------------------------------
108  // Component initialization
109  // ----------------------------------------------------------------------
110 
112  void init(
113  FwSizeType queueDepth,
114  FwEnumStoreType instance = 0
115  );
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Getters for special input ports
121  // ----------------------------------------------------------------------
122 
127  FwIndexType portNum
128  );
129 
130  public:
131 
132  // ----------------------------------------------------------------------
133  // Getters for typed input ports
134  // ----------------------------------------------------------------------
135 
140  FwIndexType portNum
141  );
142 
147  FwIndexType portNum
148  );
149 
150  public:
151 
152  // ----------------------------------------------------------------------
153  // Connect input ports to special output ports
154  // ----------------------------------------------------------------------
155 
158  FwIndexType portNum,
159  Fw::InputCmdRegPort* port
160  );
161 
164  FwIndexType portNum,
166  );
167 
169  void set_Log_OutputPort(
170  FwIndexType portNum,
171  Fw::InputLogPort* port
172  );
173 
174 #if FW_ENABLE_TEXT_LOGGING == 1
175 
177  void set_LogText_OutputPort(
178  FwIndexType portNum,
179  Fw::InputLogTextPort* port
180  );
181 
182 #endif
183 
185  void set_Time_OutputPort(
186  FwIndexType portNum,
187  Fw::InputTimePort* port
188  );
189 
190  public:
191 
192  // ----------------------------------------------------------------------
193  // Connect typed input ports to typed output ports
194  // ----------------------------------------------------------------------
195 
198  FwIndexType portNum,
200  );
201 
204  FwIndexType portNum,
205  Fw::InputComPort* port
206  );
207 
210  FwIndexType portNum,
211  Svc::InputPingPort* port
212  );
213 
214 #if FW_PORT_SERIALIZATION
215 
216  public:
217 
218  // ----------------------------------------------------------------------
219  // Connect serial input ports to special output ports
220  // ----------------------------------------------------------------------
221 
224  FwIndexType portNum,
225  Fw::InputSerializePort* port
226  );
227 
230  FwIndexType portNum,
231  Fw::InputSerializePort* port
232  );
233 
235  void set_Log_OutputPort(
236  FwIndexType portNum,
237  Fw::InputSerializePort* port
238  );
239 
240 #if FW_ENABLE_TEXT_LOGGING == 1
241 
243  void set_LogText_OutputPort(
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
248 #endif
249 
251  void set_Time_OutputPort(
252  FwIndexType portNum,
253  Fw::InputSerializePort* port
254  );
255 
256 #endif
257 
258 #if FW_PORT_SERIALIZATION
259 
260  public:
261 
262  // ----------------------------------------------------------------------
263  // Connect serial input ports to typed output ports
264  // ----------------------------------------------------------------------
265 
268  FwIndexType portNum,
269  Fw::InputSerializePort* port
270  );
271 
274  FwIndexType portNum,
275  Fw::InputSerializePort* port
276  );
277 
280  FwIndexType portNum,
281  Fw::InputSerializePort* port
282  );
283 
284 #endif
285 
286  public:
287 
288  // ----------------------------------------------------------------------
289  // Command registration
290  // ----------------------------------------------------------------------
291 
295  void regCommands();
296 
297  PROTECTED:
298 
299  // ----------------------------------------------------------------------
300  // Component construction and destruction
301  // ----------------------------------------------------------------------
302 
305  const char* compName = ""
306  );
307 
309  virtual ~ActiveLoggerComponentBase();
310 
311  PROTECTED:
312 
313  // ----------------------------------------------------------------------
314  // Getters for numbers of special input ports
315  // ----------------------------------------------------------------------
316 
321 
322  PROTECTED:
323 
324  // ----------------------------------------------------------------------
325  // Getters for numbers of typed input ports
326  // ----------------------------------------------------------------------
327 
332 
337 
338  PROTECTED:
339 
340  // ----------------------------------------------------------------------
341  // Getters for numbers of special output ports
342  // ----------------------------------------------------------------------
343 
348 
353 
358 
359 #if FW_ENABLE_TEXT_LOGGING == 1
360 
364  FwIndexType getNum_LogText_OutputPorts() const;
365 
366 #endif
367 
372 
373  PROTECTED:
374 
375  // ----------------------------------------------------------------------
376  // Getters for numbers of typed output ports
377  // ----------------------------------------------------------------------
378 
383 
388 
393 
394  PROTECTED:
395 
396  // ----------------------------------------------------------------------
397  // Connection status queries for special output ports
398  // ----------------------------------------------------------------------
399 
404  FwIndexType portNum
405  );
406 
411  FwIndexType portNum
412  );
413 
418  FwIndexType portNum
419  );
420 
421 #if FW_ENABLE_TEXT_LOGGING == 1
422 
426  bool isConnected_LogText_OutputPort(
427  FwIndexType portNum
428  );
429 
430 #endif
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 
456  FwIndexType portNum
457  );
458 
463  FwIndexType portNum
464  );
465 
466  PROTECTED:
467 
468  // ----------------------------------------------------------------------
469  // Handlers to implement for typed input ports
470  // ----------------------------------------------------------------------
471 
473  virtual void LogRecv_handler(
474  FwIndexType portNum,
475  FwEventIdType id,
476  Fw::Time& timeTag,
477  const Fw::LogSeverity& severity,
478  Fw::LogBuffer& args
479  ) = 0;
480 
482  virtual void pingIn_handler(
483  FwIndexType portNum,
484  U32 key
485  ) = 0;
486 
487  PROTECTED:
488 
489  // ----------------------------------------------------------------------
490  // Port handler base-class functions for typed input ports
491  //
492  // Call these functions directly to bypass the corresponding ports
493  // ----------------------------------------------------------------------
494 
496  void LogRecv_handlerBase(
497  FwIndexType portNum,
498  FwEventIdType id,
499  Fw::Time& timeTag,
500  const Fw::LogSeverity& severity,
501  Fw::LogBuffer& args
502  );
503 
505  void pingIn_handlerBase(
506  FwIndexType portNum,
507  U32 key
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 pingIn_preMsgHook(
522  FwIndexType portNum,
523  U32 key
524  );
525 
526  PROTECTED:
527 
528  // ----------------------------------------------------------------------
529  // Invocation functions for typed output ports
530  // ----------------------------------------------------------------------
531 
533  void FatalAnnounce_out(
534  FwIndexType portNum,
535  FwEventIdType Id
536  );
537 
539  void PktSend_out(
540  FwIndexType portNum,
541  Fw::ComBuffer& data,
542  U32 context
543  );
544 
546  void pingOut_out(
547  FwIndexType portNum,
548  U32 key
549  );
550 
551  PROTECTED:
552 
553  // ----------------------------------------------------------------------
554  // Internal interface handlers
555  // ----------------------------------------------------------------------
556 
559  FwEventIdType id,
560  const Fw::Time& timeTag,
561  const Fw::LogSeverity& severity,
562  const Fw::LogBuffer& args
563  ) = 0;
564 
565  PROTECTED:
566 
567  // ----------------------------------------------------------------------
568  // Internal interface base-class functions
569  // ----------------------------------------------------------------------
570 
573  FwEventIdType id,
574  const Fw::Time& timeTag,
575  const Fw::LogSeverity& severity,
576  const Fw::LogBuffer& args
577  );
578 
579  PROTECTED:
580 
581  // ----------------------------------------------------------------------
582  // Command response
583  // ----------------------------------------------------------------------
584 
586  void cmdResponse_out(
587  FwOpcodeType opCode,
588  U32 cmdSeq,
589  Fw::CmdResponse response
590  );
591 
592  PROTECTED:
593 
594  // ----------------------------------------------------------------------
595  // Command handlers to implement
596  // ----------------------------------------------------------------------
597 
601  virtual void SET_EVENT_FILTER_cmdHandler(
602  FwOpcodeType opCode,
603  U32 cmdSeq,
605  Svc::ActiveLogger_Enabled filterEnabled
606  ) = 0;
607 
611  virtual void SET_ID_FILTER_cmdHandler(
612  FwOpcodeType opCode,
613  U32 cmdSeq,
614  U32 ID,
615  Svc::ActiveLogger_Enabled idFilterEnabled
616  ) = 0;
617 
621  virtual void DUMP_FILTER_STATE_cmdHandler(
622  FwOpcodeType opCode,
623  U32 cmdSeq
624  ) = 0;
625 
626  PROTECTED:
627 
628  // ----------------------------------------------------------------------
629  // Command handler base-class functions
630  //
631  // Call these functions directly to bypass the command input port
632  // ----------------------------------------------------------------------
633 
638  FwOpcodeType opCode,
639  U32 cmdSeq,
640  Fw::CmdArgBuffer& args
641  );
642 
647  FwOpcodeType opCode,
648  U32 cmdSeq,
649  Fw::CmdArgBuffer& args
650  );
651 
656  FwOpcodeType opCode,
657  U32 cmdSeq,
658  Fw::CmdArgBuffer& args
659  );
660 
661  PROTECTED:
662 
663  // ----------------------------------------------------------------------
664  // Pre-message hooks for async commands
665  //
666  // Each of these functions is invoked just before processing the
667  // corresponding command. By default they do nothing. You can
668  // override them to provide specific pre-command behavior.
669  // ----------------------------------------------------------------------
670 
672  virtual void SET_ID_FILTER_preMsgHook(
673  FwOpcodeType opCode,
674  U32 cmdSeq
675  );
676 
678  virtual void DUMP_FILTER_STATE_preMsgHook(
679  FwOpcodeType opCode,
680  U32 cmdSeq
681  );
682 
683  PROTECTED:
684 
685  // ----------------------------------------------------------------------
686  // Event logging functions
687  // ----------------------------------------------------------------------
688 
694  bool enabled
695  ) const;
696 
701  U32 ID
702  ) const;
703 
708  U32 ID
709  ) const;
710 
715  U32 ID
716  ) const;
717 
722  U32 ID
723  ) const;
724 
725  PROTECTED:
726 
727  // ----------------------------------------------------------------------
728  // Time
729  // ----------------------------------------------------------------------
730 
734  Fw::Time getTime() const;
735 
736  PRIVATE:
737 
738  // ----------------------------------------------------------------------
739  // Message dispatch functions
740  // ----------------------------------------------------------------------
741 
743  virtual MsgDispatchStatus doDispatch();
744 
745  PRIVATE:
746 
747  // ----------------------------------------------------------------------
748  // Calls for messages received on special input ports
749  // ----------------------------------------------------------------------
750 
752  static void m_p_CmdDisp_in(
753  Fw::PassiveComponentBase* callComp,
754  FwIndexType portNum,
755  FwOpcodeType opCode,
756  U32 cmdSeq,
757  Fw::CmdArgBuffer& args
758  );
759 
760  PRIVATE:
761 
762  // ----------------------------------------------------------------------
763  // Calls for messages received on typed input ports
764  // ----------------------------------------------------------------------
765 
767  static void m_p_LogRecv_in(
768  Fw::PassiveComponentBase* callComp,
769  FwIndexType portNum,
770  FwEventIdType id,
771  Fw::Time& timeTag,
772  const Fw::LogSeverity& severity,
773  Fw::LogBuffer& args
774  );
775 
777  static void m_p_pingIn_in(
778  Fw::PassiveComponentBase* callComp,
779  FwIndexType portNum,
780  U32 key
781  );
782 
783  PRIVATE:
784 
785  // ----------------------------------------------------------------------
786  // Special input ports
787  // ----------------------------------------------------------------------
788 
790  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
791 
792  PRIVATE:
793 
794  // ----------------------------------------------------------------------
795  // Typed input ports
796  // ----------------------------------------------------------------------
797 
799  Fw::InputLogPort m_LogRecv_InputPort[NUM_LOGRECV_INPUT_PORTS];
800 
802  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
803 
804  PRIVATE:
805 
806  // ----------------------------------------------------------------------
807  // Special output ports
808  // ----------------------------------------------------------------------
809 
811  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
812 
815 
817  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
818 
819 #if FW_ENABLE_TEXT_LOGGING == 1
820 
822  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
823 
824 #endif
825 
827  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
828 
829  PRIVATE:
830 
831  // ----------------------------------------------------------------------
832  // Typed output ports
833  // ----------------------------------------------------------------------
834 
836  Svc::OutputFatalEventPort m_FatalAnnounce_OutputPort[NUM_FATALANNOUNCE_OUTPUT_PORTS];
837 
839  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
840 
842  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
843 
844  };
845 
846 }
847 
848 #endif
Definition: Time.hpp:9
friend class ActiveLoggerComponentBaseFriend
Friend class for white-box testing.
PlatformSizeType FwSizeType
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
I32 FwEnumStoreType
void LogRecv_handlerBase(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Handler base-class function for input port LogRecv.
void FatalAnnounce_out(FwIndexType portNum, FwEventIdType Id)
Invoke output port FatalAnnounce.
virtual ~ActiveLoggerComponentBase()
Destroy ActiveLoggerComponentBase object.
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
void SET_EVENT_FILTER_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void DUMP_FILTER_STATE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void loqQueue_internalInterfaceInvoke(FwEventIdType id, const Fw::Time &timeTag, const Fw::LogSeverity &severity, const Fw::LogBuffer &args)
Internal interface base-class function for loqQueue.
FwIndexType getNum_FatalAnnounce_OutputPorts() const
Auto-generated base for ActiveLogger component.
Enum representing a command response.
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum)
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void init()
Object initializer.
Definition: ObjBase.cpp:26
U32 FwEventIdType
The type of an event identifier.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Set filter for reporting events. Events are not stored in component.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
U32 FwOpcodeType
The type of a command opcode.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
ActiveLoggerComponentBase(const char *compName="")
Construct ActiveLoggerComponentBase object.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
virtual void loqQueue_internalInterfaceHandler(FwEventIdType id, const Fw::Time &timeTag, const Fw::LogSeverity &severity, const Fw::LogBuffer &args)=0
Internal interface handler for loqQueue.
virtual void SET_EVENT_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::ActiveLogger_FilterSeverity filterLevel, Svc::ActiveLogger_Enabled filterEnabled)=0
void log_ACTIVITY_LO_SEVERITY_FILTER_STATE(Svc::ActiveLogger_FilterSeverity severity, bool enabled) const
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void set_FatalAnnounce_OutputPort(FwIndexType portNum, Svc::InputFatalEventPort *port)
Connect port to FatalAnnounce[portNum].
Enum representing event severity.
virtual void LogRecv_handler(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)=0
Handler for input port LogRecv.
Fw::InputLogPort * get_LogRecv_InputPort(FwIndexType portNum)
virtual void DUMP_FILTER_STATE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command DUMP_FILTER_STATE.
virtual void SET_ID_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 ID, Svc::ActiveLogger_Enabled idFilterEnabled)=0
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void SET_ID_FILTER_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
PlatformIndexType FwIndexType
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
RateGroupDivider component implementation.
bool isConnected_Time_OutputPort(FwIndexType portNum)
Enabled and disabled state.
virtual void SET_ID_FILTER_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_ID_FILTER.
void regCommands()
Register commands with the Command Dispatcher.
bool isConnected_FatalAnnounce_OutputPort(FwIndexType portNum)
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
friend class ActiveLoggerTesterBase
Friend class tester to support autocoded test harness.
virtual void DUMP_FILTER_STATE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0