F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ComLoggerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComLoggerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ComLogger component base class
5 // ======================================================================
6 
7 #ifndef Svc_ComLoggerComponentAc_HPP
8 #define Svc_ComLoggerComponentAc_HPP
9 
10 #include "FpConfig.hpp"
11 #include "Fw/Cmd/CmdPortAc.hpp"
12 #include "Fw/Cmd/CmdRegPortAc.hpp"
14 #include "Fw/Cmd/CmdString.hpp"
15 #include "Fw/Com/ComPortAc.hpp"
17 #include "Fw/Log/LogPortAc.hpp"
18 #include "Fw/Log/LogString.hpp"
19 #if FW_ENABLE_TEXT_LOGGING == 1
20 #include "Fw/Log/LogTextPortAc.hpp"
21 #endif
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Svc/Ping/PingPortAc.hpp"
26 
27 namespace Svc {
28 
35  {
36 
37  // ----------------------------------------------------------------------
38  // Friend classes
39  // ----------------------------------------------------------------------
40 
43 
44  PROTECTED:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
51  enum {
53  };
54 
56  enum {
59  };
60 
62  enum {
68  };
69 
71  enum {
73  };
74 
76  enum {
78  };
79 
81  enum {
87  };
88 
90  enum {
92  };
93 
94  public:
95 
96  // ----------------------------------------------------------------------
97  // Component initialization
98  // ----------------------------------------------------------------------
99 
101  void init(
102  FwSizeType queueDepth,
103  FwEnumStoreType instance = 0
104  );
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Getters for special input ports
110  // ----------------------------------------------------------------------
111 
116  FwIndexType portNum
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Getters for typed input ports
123  // ----------------------------------------------------------------------
124 
129  FwIndexType portNum
130  );
131 
136  FwIndexType portNum
137  );
138 
139  public:
140 
141  // ----------------------------------------------------------------------
142  // Connect input ports to special output ports
143  // ----------------------------------------------------------------------
144 
145 #if FW_ENABLE_TEXT_LOGGING == 1
146 
148  void set_LogText_OutputPort(
149  FwIndexType portNum,
150  Fw::InputLogTextPort* port
151  );
152 
153 #endif
154 
157  FwIndexType portNum,
158  Fw::InputCmdRegPort* port
159  );
160 
163  FwIndexType portNum,
165  );
166 
169  FwIndexType portNum,
170  Fw::InputLogPort* port
171  );
172 
175  FwIndexType portNum,
176  Fw::InputTimePort* port
177  );
178 
179  public:
180 
181  // ----------------------------------------------------------------------
182  // Connect typed input ports to typed output ports
183  // ----------------------------------------------------------------------
184 
187  FwIndexType portNum,
188  Svc::InputPingPort* port
189  );
190 
191 #if FW_PORT_SERIALIZATION
192 
193  public:
194 
195  // ----------------------------------------------------------------------
196  // Connect serial input ports to special output ports
197  // ----------------------------------------------------------------------
198 
199 #if FW_ENABLE_TEXT_LOGGING == 1
200 
202  void set_LogText_OutputPort(
203  FwIndexType portNum,
204  Fw::InputSerializePort* port
205  );
206 
207 #endif
208 
211  FwIndexType portNum,
212  Fw::InputSerializePort* port
213  );
214 
217  FwIndexType portNum,
218  Fw::InputSerializePort* port
219  );
220 
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
233 #endif
234 
235 #if FW_PORT_SERIALIZATION
236 
237  public:
238 
239  // ----------------------------------------------------------------------
240  // Connect serial input ports to typed output ports
241  // ----------------------------------------------------------------------
242 
245  FwIndexType portNum,
246  Fw::InputSerializePort* port
247  );
248 
249 #endif
250 
251  public:
252 
253  // ----------------------------------------------------------------------
254  // Command registration
255  // ----------------------------------------------------------------------
256 
260  void regCommands();
261 
262  PROTECTED:
263 
264  // ----------------------------------------------------------------------
265  // Component construction and destruction
266  // ----------------------------------------------------------------------
267 
270  const char* compName = ""
271  );
272 
274  virtual ~ComLoggerComponentBase();
275 
276  PROTECTED:
277 
278  // ----------------------------------------------------------------------
279  // Getters for numbers of special input ports
280  // ----------------------------------------------------------------------
281 
286 
287  PROTECTED:
288 
289  // ----------------------------------------------------------------------
290  // Getters for numbers of typed input ports
291  // ----------------------------------------------------------------------
292 
297 
302 
303  PROTECTED:
304 
305  // ----------------------------------------------------------------------
306  // Getters for numbers of special output ports
307  // ----------------------------------------------------------------------
308 
309 #if FW_ENABLE_TEXT_LOGGING == 1
310 
314  FwIndexType getNum_LogText_OutputPorts() const;
315 
316 #endif
317 
322 
327 
332 
337 
338  PROTECTED:
339 
340  // ----------------------------------------------------------------------
341  // Getters for numbers of typed output ports
342  // ----------------------------------------------------------------------
343 
348 
349  PROTECTED:
350 
351  // ----------------------------------------------------------------------
352  // Connection status queries for special output ports
353  // ----------------------------------------------------------------------
354 
355 #if FW_ENABLE_TEXT_LOGGING == 1
356 
360  bool isConnected_LogText_OutputPort(
361  FwIndexType portNum
362  );
363 
364 #endif
365 
370  FwIndexType portNum
371  );
372 
377  FwIndexType portNum
378  );
379 
384  FwIndexType portNum
385  );
386 
391  FwIndexType portNum
392  );
393 
394  PROTECTED:
395 
396  // ----------------------------------------------------------------------
397  // Connection status queries for typed output ports
398  // ----------------------------------------------------------------------
399 
404  FwIndexType portNum
405  );
406 
407  PROTECTED:
408 
409  // ----------------------------------------------------------------------
410  // Handlers to implement for typed input ports
411  // ----------------------------------------------------------------------
412 
414  virtual void comIn_handler(
415  FwIndexType portNum,
416  Fw::ComBuffer& data,
417  U32 context
418  ) = 0;
419 
421  virtual void pingIn_handler(
422  FwIndexType portNum,
423  U32 key
424  ) = 0;
425 
426  PROTECTED:
427 
428  // ----------------------------------------------------------------------
429  // Port handler base-class functions for typed input ports
430  //
431  // Call these functions directly to bypass the corresponding ports
432  // ----------------------------------------------------------------------
433 
435  void comIn_handlerBase(
436  FwIndexType portNum,
437  Fw::ComBuffer& data,
438  U32 context
439  );
440 
442  void pingIn_handlerBase(
443  FwIndexType portNum,
444  U32 key
445  );
446 
447  PROTECTED:
448 
449  // ----------------------------------------------------------------------
450  // Pre-message hooks for typed async input ports
451  //
452  // Each of these functions is invoked just before processing a message
453  // on the corresponding port. By default, they do nothing. You can
454  // override them to provide specific pre-message behavior.
455  // ----------------------------------------------------------------------
456 
458  virtual void comIn_preMsgHook(
459  FwIndexType portNum,
460  Fw::ComBuffer& data,
461  U32 context
462  );
463 
465  virtual void pingIn_preMsgHook(
466  FwIndexType portNum,
467  U32 key
468  );
469 
470  PROTECTED:
471 
472  // ----------------------------------------------------------------------
473  // Invocation functions for typed output ports
474  // ----------------------------------------------------------------------
475 
477  void pingOut_out(
478  FwIndexType portNum,
479  U32 key
480  );
481 
482  PROTECTED:
483 
484  // ----------------------------------------------------------------------
485  // Command response
486  // ----------------------------------------------------------------------
487 
489  void cmdResponse_out(
490  FwOpcodeType opCode,
491  U32 cmdSeq,
492  Fw::CmdResponse response
493  );
494 
495  PROTECTED:
496 
497  // ----------------------------------------------------------------------
498  // Command handlers to implement
499  // ----------------------------------------------------------------------
500 
504  virtual void CloseFile_cmdHandler(
505  FwOpcodeType opCode,
506  U32 cmdSeq
507  ) = 0;
508 
509  PROTECTED:
510 
511  // ----------------------------------------------------------------------
512  // Command handler base-class functions
513  //
514  // Call these functions directly to bypass the command input port
515  // ----------------------------------------------------------------------
516 
521  FwOpcodeType opCode,
522  U32 cmdSeq,
523  Fw::CmdArgBuffer& args
524  );
525 
526  PROTECTED:
527 
528  // ----------------------------------------------------------------------
529  // Pre-message hooks for async commands
530  //
531  // Each of these functions is invoked just before processing the
532  // corresponding command. By default they do nothing. You can
533  // override them to provide specific pre-command behavior.
534  // ----------------------------------------------------------------------
535 
537  virtual void CloseFile_preMsgHook(
538  FwOpcodeType opCode,
539  U32 cmdSeq
540  );
541 
542  PROTECTED:
543 
544  // ----------------------------------------------------------------------
545  // Event logging functions
546  // ----------------------------------------------------------------------
547 
552  U32 errornum,
553  const Fw::StringBase& file
554  );
555 
560  U32 errornum,
561  U32 bytesWritten,
562  U32 bytesToWrite,
563  const Fw::StringBase& file
564  );
565 
570  const Fw::StringBase& validationFile,
571  const Fw::StringBase& file,
572  U32 status
573  );
574 
579  const Fw::StringBase& file
580  );
581 
584 
585  PROTECTED:
586 
587  // ----------------------------------------------------------------------
588  // Event throttle reset functions
589  // ----------------------------------------------------------------------
590 
593 
594  PROTECTED:
595 
596  // ----------------------------------------------------------------------
597  // Time
598  // ----------------------------------------------------------------------
599 
603  Fw::Time getTime();
604 
605  PRIVATE:
606 
607  // ----------------------------------------------------------------------
608  // Message dispatch functions
609  // ----------------------------------------------------------------------
610 
612  virtual MsgDispatchStatus doDispatch();
613 
614  PRIVATE:
615 
616  // ----------------------------------------------------------------------
617  // Calls for messages received on special input ports
618  // ----------------------------------------------------------------------
619 
621  static void m_p_cmdIn_in(
622  Fw::PassiveComponentBase* callComp,
623  FwIndexType portNum,
624  FwOpcodeType opCode,
625  U32 cmdSeq,
626  Fw::CmdArgBuffer& args
627  );
628 
629  PRIVATE:
630 
631  // ----------------------------------------------------------------------
632  // Calls for messages received on typed input ports
633  // ----------------------------------------------------------------------
634 
636  static void m_p_comIn_in(
637  Fw::PassiveComponentBase* callComp,
638  FwIndexType portNum,
639  Fw::ComBuffer& data,
640  U32 context
641  );
642 
644  static void m_p_pingIn_in(
645  Fw::PassiveComponentBase* callComp,
646  FwIndexType portNum,
647  U32 key
648  );
649 
650  PRIVATE:
651 
652  // ----------------------------------------------------------------------
653  // Special input ports
654  // ----------------------------------------------------------------------
655 
657  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
658 
659  PRIVATE:
660 
661  // ----------------------------------------------------------------------
662  // Typed input ports
663  // ----------------------------------------------------------------------
664 
666  Fw::InputComPort m_comIn_InputPort[NUM_COMIN_INPUT_PORTS];
667 
669  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
670 
671  PRIVATE:
672 
673  // ----------------------------------------------------------------------
674  // Special output ports
675  // ----------------------------------------------------------------------
676 
677 #if FW_ENABLE_TEXT_LOGGING == 1
678 
680  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
681 
682 #endif
683 
685  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
686 
688  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
689 
691  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
692 
694  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
695 
696  PRIVATE:
697 
698  // ----------------------------------------------------------------------
699  // Typed output ports
700  // ----------------------------------------------------------------------
701 
703  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
704 
705  PRIVATE:
706 
707  // ----------------------------------------------------------------------
708  // Counter values for event throttling
709  // ----------------------------------------------------------------------
710 
712  FwIndexType m_FileNotInitializedThrottle;
713 
714  };
715 
716 }
717 
718 #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
Auto-generated base for ComLogger component.
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void log_WARNING_HI_FileWriteError(U32 errornum, U32 bytesWritten, U32 bytesToWrite, const Fw::StringBase &file)
FwIndexType getNum_pingOut_OutputPorts() const
virtual ~ComLoggerComponentBase()
Destroy ComLoggerComponentBase object.
void log_WARNING_HI_FileOpenError(U32 errornum, const Fw::StringBase &file)
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
ComLoggerComponentBase(const char *compName="")
Construct ComLoggerComponentBase object.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void log_WARNING_LO_FileValidationError(const Fw::StringBase &validationFile, const Fw::StringBase &file, U32 status)
void log_DIAGNOSTIC_FileClosed(const Fw::StringBase &file)
bool isConnected_logOut_OutputPort(FwIndexType portNum)
@ EVENTID_FILENOTINITIALIZED_THROTTLE
Throttle reset count for FileNotInitialized.
friend class ComLoggerComponentBaseFriend
Friend class for white-box testing.
FwIndexType getNum_cmdIn_InputPorts() const
FwIndexType getNum_cmdRegOut_OutputPorts() const
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Fw::InputComPort * get_comIn_InputPort(FwIndexType portNum)
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void log_WARNING_LO_FileNotInitialized()
Log event FileNotInitialized.
@ OPCODE_CLOSEFILE
Forces a close of the currently opened file.
void CloseFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
FwIndexType getNum_logOut_OutputPorts() const
void regCommands()
Register commands with the Command Dispatcher.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
@ EVENTID_FILECLOSED
The ComLogger successfully closed a file on command.
@ EVENTID_FILEWRITEERROR
The ComLogger encountered an error writing to a file.
@ EVENTID_FILEVALIDATIONERROR
The ComLogger encountered an error writing the validation file.
@ EVENTID_FILEOPENERROR
The ComLogger encountered an error opening a file.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
FwIndexType getNum_comIn_InputPorts() const
virtual void CloseFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CloseFile.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
FwIndexType getNum_cmdResponseOut_OutputPorts() const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
FwIndexType getNum_pingIn_InputPorts() const
FwIndexType getNum_timeCaller_OutputPorts() const
void log_WARNING_LO_FileNotInitialized_ThrottleClear()
Reset throttle value for FileNotInitialized.