F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
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 <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/LogPortAc.hpp"
20 #include "Fw/Log/LogString.hpp"
21 #if FW_ENABLE_TEXT_LOGGING == 1
22 #include "Fw/Log/LogTextPortAc.hpp"
23 #endif
26 #include "Fw/Time/TimePortAc.hpp"
27 #include "Svc/Ping/PingPortAc.hpp"
28 
29 namespace Svc {
30 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
46  friend class ComLoggerTesterBase;
47 
48  PROTECTED:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
57  };
58 
60  enum {
63  };
64 
66  enum {
72  };
73 
75  enum {
77  };
78 
80  enum {
82  };
83 
85  enum {
91  };
92 
94  enum {
96  };
97 
98  public:
99 
100  // ----------------------------------------------------------------------
101  // Component initialization
102  // ----------------------------------------------------------------------
103 
105  void init(
106  FwSizeType queueDepth,
107  FwEnumStoreType instance = 0
108  );
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Getters for special input ports
114  // ----------------------------------------------------------------------
115 
120  FwIndexType portNum
121  );
122 
123  public:
124 
125  // ----------------------------------------------------------------------
126  // Getters for typed input ports
127  // ----------------------------------------------------------------------
128 
133  FwIndexType portNum
134  );
135 
140  FwIndexType portNum
141  );
142 
143  public:
144 
145  // ----------------------------------------------------------------------
146  // Connect input ports to special output ports
147  // ----------------------------------------------------------------------
148 
149 #if FW_ENABLE_TEXT_LOGGING == 1
150 
152  void set_LogText_OutputPort(
153  FwIndexType portNum,
154  Fw::InputLogTextPort* port
155  );
156 
157 #endif
158 
161  FwIndexType portNum,
162  Fw::InputCmdRegPort* port
163  );
164 
167  FwIndexType portNum,
169  );
170 
173  FwIndexType portNum,
174  Fw::InputLogPort* port
175  );
176 
179  FwIndexType portNum,
180  Fw::InputTimePort* port
181  );
182 
183  public:
184 
185  // ----------------------------------------------------------------------
186  // Connect typed input ports to typed output ports
187  // ----------------------------------------------------------------------
188 
191  FwIndexType portNum,
192  Svc::InputPingPort* port
193  );
194 
195 #if FW_PORT_SERIALIZATION
196 
197  public:
198 
199  // ----------------------------------------------------------------------
200  // Connect serial input ports to special output ports
201  // ----------------------------------------------------------------------
202 
203 #if FW_ENABLE_TEXT_LOGGING == 1
204 
206  void set_LogText_OutputPort(
207  FwIndexType portNum,
208  Fw::InputSerializePort* port
209  );
210 
211 #endif
212 
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
237 #endif
238 
239 #if FW_PORT_SERIALIZATION
240 
241  public:
242 
243  // ----------------------------------------------------------------------
244  // Connect serial input ports to typed output ports
245  // ----------------------------------------------------------------------
246 
249  FwIndexType portNum,
250  Fw::InputSerializePort* port
251  );
252 
253 #endif
254 
255  public:
256 
257  // ----------------------------------------------------------------------
258  // Command registration
259  // ----------------------------------------------------------------------
260 
264  void regCommands();
265 
266  PROTECTED:
267 
268  // ----------------------------------------------------------------------
269  // Component construction and destruction
270  // ----------------------------------------------------------------------
271 
274  const char* compName = ""
275  );
276 
278  virtual ~ComLoggerComponentBase();
279 
280  PROTECTED:
281 
282  // ----------------------------------------------------------------------
283  // Getters for numbers of special input ports
284  // ----------------------------------------------------------------------
285 
290 
291  PROTECTED:
292 
293  // ----------------------------------------------------------------------
294  // Getters for numbers of typed input ports
295  // ----------------------------------------------------------------------
296 
301 
306 
307  PROTECTED:
308 
309  // ----------------------------------------------------------------------
310  // Getters for numbers of special output ports
311  // ----------------------------------------------------------------------
312 
313 #if FW_ENABLE_TEXT_LOGGING == 1
314 
318  FwIndexType getNum_LogText_OutputPorts() const;
319 
320 #endif
321 
326 
331 
336 
341 
342  PROTECTED:
343 
344  // ----------------------------------------------------------------------
345  // Getters for numbers of typed output ports
346  // ----------------------------------------------------------------------
347 
352 
353  PROTECTED:
354 
355  // ----------------------------------------------------------------------
356  // Connection status queries for special output ports
357  // ----------------------------------------------------------------------
358 
359 #if FW_ENABLE_TEXT_LOGGING == 1
360 
364  bool isConnected_LogText_OutputPort(
365  FwIndexType portNum
366  );
367 
368 #endif
369 
374  FwIndexType portNum
375  );
376 
381  FwIndexType portNum
382  );
383 
388  FwIndexType portNum
389  );
390 
395  FwIndexType portNum
396  );
397 
398  PROTECTED:
399 
400  // ----------------------------------------------------------------------
401  // Connection status queries for typed output ports
402  // ----------------------------------------------------------------------
403 
408  FwIndexType portNum
409  );
410 
411  PROTECTED:
412 
413  // ----------------------------------------------------------------------
414  // Handlers to implement for typed input ports
415  // ----------------------------------------------------------------------
416 
418  virtual void comIn_handler(
419  FwIndexType portNum,
420  Fw::ComBuffer& data,
421  U32 context
422  ) = 0;
423 
425  virtual void pingIn_handler(
426  FwIndexType portNum,
427  U32 key
428  ) = 0;
429 
430  PROTECTED:
431 
432  // ----------------------------------------------------------------------
433  // Port handler base-class functions for typed input ports
434  //
435  // Call these functions directly to bypass the corresponding ports
436  // ----------------------------------------------------------------------
437 
439  void comIn_handlerBase(
440  FwIndexType portNum,
441  Fw::ComBuffer& data,
442  U32 context
443  );
444 
446  void pingIn_handlerBase(
447  FwIndexType portNum,
448  U32 key
449  );
450 
451  PROTECTED:
452 
453  // ----------------------------------------------------------------------
454  // Pre-message hooks for typed async input ports
455  //
456  // Each of these functions is invoked just before processing a message
457  // on the corresponding port. By default, they do nothing. You can
458  // override them to provide specific pre-message behavior.
459  // ----------------------------------------------------------------------
460 
462  virtual void comIn_preMsgHook(
463  FwIndexType portNum,
464  Fw::ComBuffer& data,
465  U32 context
466  );
467 
469  virtual void pingIn_preMsgHook(
470  FwIndexType portNum,
471  U32 key
472  );
473 
474  PROTECTED:
475 
476  // ----------------------------------------------------------------------
477  // Invocation functions for typed output ports
478  // ----------------------------------------------------------------------
479 
481  void pingOut_out(
482  FwIndexType portNum,
483  U32 key
484  );
485 
486  PROTECTED:
487 
488  // ----------------------------------------------------------------------
489  // Command response
490  // ----------------------------------------------------------------------
491 
493  void cmdResponse_out(
494  FwOpcodeType opCode,
495  U32 cmdSeq,
496  Fw::CmdResponse response
497  );
498 
499  PROTECTED:
500 
501  // ----------------------------------------------------------------------
502  // Command handlers to implement
503  // ----------------------------------------------------------------------
504 
508  virtual void CloseFile_cmdHandler(
509  FwOpcodeType opCode,
510  U32 cmdSeq
511  ) = 0;
512 
513  PROTECTED:
514 
515  // ----------------------------------------------------------------------
516  // Command handler base-class functions
517  //
518  // Call these functions directly to bypass the command input port
519  // ----------------------------------------------------------------------
520 
525  FwOpcodeType opCode,
526  U32 cmdSeq,
527  Fw::CmdArgBuffer& args
528  );
529 
530  PROTECTED:
531 
532  // ----------------------------------------------------------------------
533  // Pre-message hooks for async commands
534  //
535  // Each of these functions is invoked just before processing the
536  // corresponding command. By default they do nothing. You can
537  // override them to provide specific pre-command behavior.
538  // ----------------------------------------------------------------------
539 
541  virtual void CloseFile_preMsgHook(
542  FwOpcodeType opCode,
543  U32 cmdSeq
544  );
545 
546  PROTECTED:
547 
548  // ----------------------------------------------------------------------
549  // Event logging functions
550  // ----------------------------------------------------------------------
551 
556  U32 errornum,
557  const Fw::StringBase& file
558  ) const;
559 
564  U32 errornum,
565  U32 bytesWritten,
566  U32 bytesToWrite,
567  const Fw::StringBase& file
568  ) const;
569 
574  const Fw::StringBase& validationFile,
575  const Fw::StringBase& file,
576  U32 status
577  ) const;
578 
583  const Fw::StringBase& file
584  ) const;
585 
588 
589  PROTECTED:
590 
591  // ----------------------------------------------------------------------
592  // Event throttle reset functions
593  // ----------------------------------------------------------------------
594 
597 
598  PROTECTED:
599 
600  // ----------------------------------------------------------------------
601  // Time
602  // ----------------------------------------------------------------------
603 
607  Fw::Time getTime() const;
608 
609  PRIVATE:
610 
611  // ----------------------------------------------------------------------
612  // Message dispatch functions
613  // ----------------------------------------------------------------------
614 
616  virtual MsgDispatchStatus doDispatch();
617 
618  PRIVATE:
619 
620  // ----------------------------------------------------------------------
621  // Calls for messages received on special input ports
622  // ----------------------------------------------------------------------
623 
625  static void m_p_cmdIn_in(
626  Fw::PassiveComponentBase* callComp,
627  FwIndexType portNum,
628  FwOpcodeType opCode,
629  U32 cmdSeq,
630  Fw::CmdArgBuffer& args
631  );
632 
633  PRIVATE:
634 
635  // ----------------------------------------------------------------------
636  // Calls for messages received on typed input ports
637  // ----------------------------------------------------------------------
638 
640  static void m_p_comIn_in(
641  Fw::PassiveComponentBase* callComp,
642  FwIndexType portNum,
643  Fw::ComBuffer& data,
644  U32 context
645  );
646 
648  static void m_p_pingIn_in(
649  Fw::PassiveComponentBase* callComp,
650  FwIndexType portNum,
651  U32 key
652  );
653 
654  PRIVATE:
655 
656  // ----------------------------------------------------------------------
657  // Special input ports
658  // ----------------------------------------------------------------------
659 
661  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
662 
663  PRIVATE:
664 
665  // ----------------------------------------------------------------------
666  // Typed input ports
667  // ----------------------------------------------------------------------
668 
670  Fw::InputComPort m_comIn_InputPort[NUM_COMIN_INPUT_PORTS];
671 
673  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
674 
675  PRIVATE:
676 
677  // ----------------------------------------------------------------------
678  // Special output ports
679  // ----------------------------------------------------------------------
680 
681 #if FW_ENABLE_TEXT_LOGGING == 1
682 
684  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
685 
686 #endif
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 
698  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
699 
700  PRIVATE:
701 
702  // ----------------------------------------------------------------------
703  // Typed output ports
704  // ----------------------------------------------------------------------
705 
707  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
708 
709  PRIVATE:
710 
711  // ----------------------------------------------------------------------
712  // Counter values for event throttling
713  // ----------------------------------------------------------------------
714 
716  std::atomic<FwIndexType> m_FileNotInitializedThrottle;
717 
718  };
719 
720 }
721 
722 #endif
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
Definition: Time.hpp:9
ComLoggerComponentBase(const char *compName="")
Construct ComLoggerComponentBase object.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
PlatformSizeType FwSizeType
void log_WARNING_LO_FileNotInitialized()
Log event FileNotInitialized.
I32 FwEnumStoreType
void log_DIAGNOSTIC_FileClosed(const Fw::StringBase &file) const
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
Forces a close of the currently opened file.
FwIndexType getNum_cmdResponseOut_OutputPorts() const
The ComLogger successfully closed a file on command.
Enum representing a command response.
void regCommands()
Register commands with the Command Dispatcher.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void init()
Object initializer.
Definition: ObjBase.cpp:26
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
FwIndexType getNum_pingOut_OutputPorts() const
bool isConnected_logOut_OutputPort(FwIndexType portNum)
U32 FwOpcodeType
The type of a command opcode.
virtual void CloseFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CloseFile.
void log_WARNING_HI_FileOpenError(U32 errornum, const Fw::StringBase &file) const
void log_WARNING_LO_FileNotInitialized_ThrottleClear()
Reset throttle value for FileNotInitialized.
The ComLogger encountered an error writing the validation file.
void CloseFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
FwIndexType getNum_pingIn_InputPorts() const
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Fw::InputComPort * get_comIn_InputPort(FwIndexType portNum)
void log_WARNING_HI_FileWriteError(U32 errornum, U32 bytesWritten, U32 bytesToWrite, const Fw::StringBase &file) const
virtual ~ComLoggerComponentBase()
Destroy ComLoggerComponentBase object.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
FwIndexType getNum_cmdIn_InputPorts() const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
FwIndexType getNum_comIn_InputPorts() const
void log_WARNING_LO_FileValidationError(const Fw::StringBase &validationFile, const Fw::StringBase &file, U32 status) const
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
FwIndexType getNum_timeCaller_OutputPorts() const
FwIndexType getNum_logOut_OutputPorts() const
friend class ComLoggerTesterBase
Friend class tester to support autocoded test harness.
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.
RateGroupDivider component implementation.
FwIndexType getNum_cmdRegOut_OutputPorts() const
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
The ComLogger encountered an error opening a file.
friend class ComLoggerComponentBaseFriend
Friend class for white-box testing.
The ComLogger encountered an error writing to a file.
Auto-generated base for ComLogger component.