F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
PrmDbComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title PrmDbComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for PrmDb component base class
5 // ======================================================================
6 
7 #ifndef Svc_PrmDbComponentAc_HPP
8 #define Svc_PrmDbComponentAc_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/Prm/PrmGetPortAc.hpp"
26 #include "Fw/Prm/PrmSetPortAc.hpp"
27 #include "Fw/Time/TimePortAc.hpp"
28 #include "Os/Mutex.hpp"
29 #include "Svc/Ping/PingPortAc.hpp"
33 
34 namespace Svc {
35 
42  {
43 
44  // ----------------------------------------------------------------------
45  // Friend classes
46  // ----------------------------------------------------------------------
47 
49  friend class PrmDbTesterBase;
51  friend class PrmDbTester;
52 
53  PROTECTED:
54 
55  // ----------------------------------------------------------------------
56  // Constants
57  // ----------------------------------------------------------------------
58 
60  enum {
62  };
63 
65  enum {
69  };
70 
72  enum {
78  };
79 
81  enum {
83  };
84 
86  enum {
88  };
89 
91  enum {
100  };
101 
103  enum {
105  };
106 
107  public:
108 
109  // ----------------------------------------------------------------------
110  // Component initialization
111  // ----------------------------------------------------------------------
112 
114  void init(
115  FwSizeType queueDepth,
116  FwEnumStoreType instance = 0
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Getters for special input ports
123  // ----------------------------------------------------------------------
124 
129  FwIndexType portNum
130  );
131 
132  public:
133 
134  // ----------------------------------------------------------------------
135  // Getters for typed input ports
136  // ----------------------------------------------------------------------
137 
142  FwIndexType portNum
143  );
144 
149  FwIndexType portNum
150  );
151 
156  FwIndexType portNum
157  );
158 
159  public:
160 
161  // ----------------------------------------------------------------------
162  // Connect input ports to special output ports
163  // ----------------------------------------------------------------------
164 
167  FwIndexType portNum,
168  Fw::InputCmdRegPort* port
169  );
170 
173  FwIndexType portNum,
175  );
176 
178  void set_Log_OutputPort(
179  FwIndexType portNum,
180  Fw::InputLogPort* port
181  );
182 
183 #if FW_ENABLE_TEXT_LOGGING == 1
184 
186  void set_LogText_OutputPort(
187  FwIndexType portNum,
188  Fw::InputLogTextPort* port
189  );
190 
191 #endif
192 
194  void set_Time_OutputPort(
195  FwIndexType portNum,
196  Fw::InputTimePort* port
197  );
198 
199  public:
200 
201  // ----------------------------------------------------------------------
202  // Connect typed input ports to typed output ports
203  // ----------------------------------------------------------------------
204 
207  FwIndexType portNum,
208  Svc::InputPingPort* port
209  );
210 
211 #if FW_PORT_SERIALIZATION
212 
213  public:
214 
215  // ----------------------------------------------------------------------
216  // Connect serial input ports to special output ports
217  // ----------------------------------------------------------------------
218 
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
232  void set_Log_OutputPort(
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
237 #if FW_ENABLE_TEXT_LOGGING == 1
238 
240  void set_LogText_OutputPort(
241  FwIndexType portNum,
242  Fw::InputSerializePort* port
243  );
244 
245 #endif
246 
248  void set_Time_OutputPort(
249  FwIndexType portNum,
250  Fw::InputSerializePort* port
251  );
252 
253 #endif
254 
255 #if FW_PORT_SERIALIZATION
256 
257  public:
258 
259  // ----------------------------------------------------------------------
260  // Connect serial input ports to typed output ports
261  // ----------------------------------------------------------------------
262 
265  FwIndexType portNum,
266  Fw::InputSerializePort* port
267  );
268 
269 #endif
270 
271  public:
272 
273  // ----------------------------------------------------------------------
274  // Command registration
275  // ----------------------------------------------------------------------
276 
280  void regCommands();
281 
282  PROTECTED:
283 
284  // ----------------------------------------------------------------------
285  // Component construction and destruction
286  // ----------------------------------------------------------------------
287 
290  const char* compName = ""
291  );
292 
294  virtual ~PrmDbComponentBase();
295 
296  PROTECTED:
297 
298  // ----------------------------------------------------------------------
299  // Getters for numbers of special input ports
300  // ----------------------------------------------------------------------
301 
306 
307  PROTECTED:
308 
309  // ----------------------------------------------------------------------
310  // Getters for numbers of typed input ports
311  // ----------------------------------------------------------------------
312 
317 
322 
327 
328  PROTECTED:
329 
330  // ----------------------------------------------------------------------
331  // Getters for numbers of special output ports
332  // ----------------------------------------------------------------------
333 
338 
343 
348 
349 #if FW_ENABLE_TEXT_LOGGING == 1
350 
354  FwIndexType getNum_LogText_OutputPorts() const;
355 
356 #endif
357 
362 
363  PROTECTED:
364 
365  // ----------------------------------------------------------------------
366  // Getters for numbers of typed output ports
367  // ----------------------------------------------------------------------
368 
373 
374  PROTECTED:
375 
376  // ----------------------------------------------------------------------
377  // Connection status queries for special output ports
378  // ----------------------------------------------------------------------
379 
384  FwIndexType portNum
385  );
386 
391  FwIndexType portNum
392  );
393 
398  FwIndexType portNum
399  );
400 
401 #if FW_ENABLE_TEXT_LOGGING == 1
402 
406  bool isConnected_LogText_OutputPort(
407  FwIndexType portNum
408  );
409 
410 #endif
411 
416  FwIndexType portNum
417  );
418 
419  PROTECTED:
420 
421  // ----------------------------------------------------------------------
422  // Connection status queries for typed output ports
423  // ----------------------------------------------------------------------
424 
429  FwIndexType portNum
430  );
431 
432  PROTECTED:
433 
434  // ----------------------------------------------------------------------
435  // Handlers to implement for typed input ports
436  // ----------------------------------------------------------------------
437 
440  FwIndexType portNum,
441  FwPrmIdType id,
442  Fw::ParamBuffer& val
443  ) = 0;
445 
447  virtual void pingIn_handler(
448  FwIndexType portNum,
449  U32 key
450  ) = 0;
451 
453  virtual void setPrm_handler(
454  FwIndexType portNum,
455  FwPrmIdType id,
456  Fw::ParamBuffer& val
457  ) = 0;
458 
459  PROTECTED:
460 
461  // ----------------------------------------------------------------------
462  // Port handler base-class functions for typed input ports
463  //
464  // Call these functions directly to bypass the corresponding ports
465  // ----------------------------------------------------------------------
466 
469  FwIndexType portNum,
470  FwPrmIdType id,
471  Fw::ParamBuffer& val
472  );
474 
476  void pingIn_handlerBase(
477  FwIndexType portNum,
478  U32 key
479  );
480 
482  void setPrm_handlerBase(
483  FwIndexType portNum,
484  FwPrmIdType id,
485  Fw::ParamBuffer& val
486  );
487 
488  PROTECTED:
489 
490  // ----------------------------------------------------------------------
491  // Pre-message hooks for typed async input ports
492  //
493  // Each of these functions is invoked just before processing a message
494  // on the corresponding port. By default, they do nothing. You can
495  // override them to provide specific pre-message behavior.
496  // ----------------------------------------------------------------------
497 
499  virtual void pingIn_preMsgHook(
500  FwIndexType portNum,
501  U32 key
502  );
503 
505  virtual void setPrm_preMsgHook(
506  FwIndexType portNum,
507  FwPrmIdType id,
508  Fw::ParamBuffer& val
509  );
510 
511  PROTECTED:
512 
513  // ----------------------------------------------------------------------
514  // Invocation functions for typed output ports
515  // ----------------------------------------------------------------------
516 
518  void pingOut_out(
519  FwIndexType portNum,
520  U32 key
521  );
522 
523  PROTECTED:
524 
525  // ----------------------------------------------------------------------
526  // Command response
527  // ----------------------------------------------------------------------
528 
530  void cmdResponse_out(
531  FwOpcodeType opCode,
532  U32 cmdSeq,
533  Fw::CmdResponse response
534  );
535 
536  PROTECTED:
537 
538  // ----------------------------------------------------------------------
539  // Command handlers to implement
540  // ----------------------------------------------------------------------
541 
545  virtual void PRM_SAVE_FILE_cmdHandler(
546  FwOpcodeType opCode,
547  U32 cmdSeq
548  ) = 0;
549 
550  PROTECTED:
551 
552  // ----------------------------------------------------------------------
553  // Command handler base-class functions
554  //
555  // Call these functions directly to bypass the command input port
556  // ----------------------------------------------------------------------
557 
562  FwOpcodeType opCode,
563  U32 cmdSeq,
564  Fw::CmdArgBuffer& args
565  );
566 
567  PROTECTED:
568 
569  // ----------------------------------------------------------------------
570  // Pre-message hooks for async commands
571  //
572  // Each of these functions is invoked just before processing the
573  // corresponding command. By default they do nothing. You can
574  // override them to provide specific pre-command behavior.
575  // ----------------------------------------------------------------------
576 
578  virtual void PRM_SAVE_FILE_preMsgHook(
579  FwOpcodeType opCode,
580  U32 cmdSeq
581  );
582 
583  PROTECTED:
584 
585  // ----------------------------------------------------------------------
586  // Event logging functions
587  // ----------------------------------------------------------------------
588 
593  FwPrmIdType Id
594  );
595 
600  FwPrmIdType Id
601  ) const;
602 
606  void log_FATAL_PrmDbFull(
607  FwPrmIdType Id
608  ) const;
609 
614  FwPrmIdType Id
615  ) const;
616 
622  I32 record,
623  I32 error
624  ) const;
625 
630  U32 records
631  ) const;
632 
638  I32 record,
639  I32 error
640  ) const;
641 
646  U32 records
647  ) const;
648 
649  PROTECTED:
650 
651  // ----------------------------------------------------------------------
652  // Event throttle reset functions
653  // ----------------------------------------------------------------------
654 
657 
658  PROTECTED:
659 
660  // ----------------------------------------------------------------------
661  // Time
662  // ----------------------------------------------------------------------
663 
667  Fw::Time getTime() const;
668 
669  PROTECTED:
670 
671  // ----------------------------------------------------------------------
672  // Mutex operations for guarded ports
673  //
674  // You can override these operations to provide more sophisticated
675  // synchronization
676  // ----------------------------------------------------------------------
677 
679  virtual void lock();
680 
682  virtual void unLock();
683 
684  PRIVATE:
685 
686  // ----------------------------------------------------------------------
687  // Message dispatch functions
688  // ----------------------------------------------------------------------
689 
691  virtual MsgDispatchStatus doDispatch();
692 
693  PRIVATE:
694 
695  // ----------------------------------------------------------------------
696  // Calls for messages received on special input ports
697  // ----------------------------------------------------------------------
698 
700  static void m_p_CmdDisp_in(
701  Fw::PassiveComponentBase* callComp,
702  FwIndexType portNum,
703  FwOpcodeType opCode,
704  U32 cmdSeq,
705  Fw::CmdArgBuffer& args
706  );
707 
708  PRIVATE:
709 
710  // ----------------------------------------------------------------------
711  // Calls for messages received on typed input ports
712  // ----------------------------------------------------------------------
713 
715  static Fw::ParamValid m_p_getPrm_in(
716  Fw::PassiveComponentBase* callComp,
717  FwIndexType portNum,
718  FwPrmIdType id,
719  Fw::ParamBuffer& val
720  );
722 
724  static void m_p_pingIn_in(
725  Fw::PassiveComponentBase* callComp,
726  FwIndexType portNum,
727  U32 key
728  );
729 
731  static void m_p_setPrm_in(
732  Fw::PassiveComponentBase* callComp,
733  FwIndexType portNum,
734  FwPrmIdType id,
735  Fw::ParamBuffer& val
736  );
737 
738  PRIVATE:
739 
740  // ----------------------------------------------------------------------
741  // Special input ports
742  // ----------------------------------------------------------------------
743 
745  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
746 
747  PRIVATE:
748 
749  // ----------------------------------------------------------------------
750  // Typed input ports
751  // ----------------------------------------------------------------------
752 
754  Fw::InputPrmGetPort m_getPrm_InputPort[NUM_GETPRM_INPUT_PORTS];
755 
757  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
758 
760  Fw::InputPrmSetPort m_setPrm_InputPort[NUM_SETPRM_INPUT_PORTS];
761 
762  PRIVATE:
763 
764  // ----------------------------------------------------------------------
765  // Special output ports
766  // ----------------------------------------------------------------------
767 
769  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
770 
773 
775  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
776 
777 #if FW_ENABLE_TEXT_LOGGING == 1
778 
780  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
781 
782 #endif
783 
785  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
786 
787  PRIVATE:
788 
789  // ----------------------------------------------------------------------
790  // Typed output ports
791  // ----------------------------------------------------------------------
792 
794  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
795 
796  PRIVATE:
797 
798  // ----------------------------------------------------------------------
799  // Counter values for event throttling
800  // ----------------------------------------------------------------------
801 
803  std::atomic<FwIndexType> m_PrmIdNotFoundThrottle;
804 
805  PRIVATE:
806 
807  // ----------------------------------------------------------------------
808  // Mutexes
809  // ----------------------------------------------------------------------
810 
812  Os::Mutex m_guardedPortMutex;
813 
814  };
815 
816 }
817 
818 #endif
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void regCommands()
Register commands with the Command Dispatcher.
Definition: Time.hpp:9
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
FwIdType FwOpcodeType
The type of a command opcode.
Fw::ParamValid getPrm_handlerBase(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Handler base-class function for input port getPrm.
void log_WARNING_LO_PrmIdNotFound_ThrottleClear()
Reset throttle value for PrmIdNotFound.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
void log_ACTIVITY_HI_PrmIdUpdated(FwPrmIdType Id) const
PrmDbComponentBase(const char *compName="")
Construct PrmDbComponentBase object.
FwIdType FwPrmIdType
The type of a parameter identifier.
void log_ACTIVITY_HI_PrmFileSaveComplete(U32 records) const
Fw::InputPrmSetPort * get_setPrm_InputPort(FwIndexType portNum)
friend class PrmDbTesterBase
Friend class tester to support autocoded test harness.
Enum representing a command response.
friend class PrmDbTester
Friend class tester implementation to support white-box testing.
void log_WARNING_HI_PrmFileWriteError(Svc::PrmDb_PrmWriteError stage, I32 record, I32 error) const
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
void init()
Object initializer.
Definition: ObjBase.cpp:26
virtual ~PrmDbComponentBase()
Destroy PrmDbComponentBase object.
void log_ACTIVITY_HI_PrmFileLoadComplete(U32 records) const
virtual void lock()
Lock the guarded mutex.
FwIndexType getNum_setPrm_InputPorts() const
void log_WARNING_HI_PrmFileReadError(Svc::PrmDb_PrmReadError stage, I32 record, I32 error) const
FwIndexType getNum_getPrm_InputPorts() const
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum)
Parameter ID not found in database.
void setPrm_handlerBase(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Handler base-class function for input port setPrm.
FwIndexType getNum_Log_OutputPorts() const
virtual void unLock()
Unlock the guarded mutex.
void log_ACTIVITY_HI_PrmIdAdded(FwPrmIdType Id) const
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void log_FATAL_PrmDbFull(FwPrmIdType Id) const
virtual Fw::ParamValid getPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)=0
Handler for input port getPrm.
Parameter ID updated in database.
virtual void PRM_SAVE_FILE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command PRM_SAVE_FILE.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
Auto-generated base for PrmDb component.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
Command to save parameter image to file. Uses file name passed to constructor.
FwIndexType getNum_pingOut_OutputPorts() const
void PRM_SAVE_FILE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
FwIndexType getNum_CmdDisp_InputPorts() const
FwIndexType getNum_Time_OutputPorts() const
Parameter ID added to database.
void log_WARNING_LO_PrmIdNotFound(FwPrmIdType Id)
FwIndexType getNum_CmdStatus_OutputPorts() const
PlatformIndexType FwIndexType
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
virtual void setPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)=0
Handler for input port setPrm.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
RateGroupDivider component implementation.
Enum representing parameter validity.
bool isConnected_Time_OutputPort(FwIndexType portNum)
Fw::InputPrmGetPort * get_getPrm_InputPort(FwIndexType portNum)
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
FwIndexType getNum_pingIn_InputPorts() const
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
virtual void PRM_SAVE_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
FwIndexType getNum_CmdReg_OutputPorts() const
virtual void setPrm_preMsgHook(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Pre-message hook for async input port setPrm.