F´ Flight Software - C/C++ Documentation  devel
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 "FpConfig.hpp"
11 #include "Fw/Cmd/CmdPortAc.hpp"
12 #include "Fw/Cmd/CmdRegPortAc.hpp"
14 #include "Fw/Cmd/CmdString.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #if FW_ENABLE_TEXT_LOGGING == 1
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #endif
23 #include "Fw/Prm/PrmGetPortAc.hpp"
24 #include "Fw/Prm/PrmSetPortAc.hpp"
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Os/Mutex.hpp"
27 #include "Svc/Ping/PingPortAc.hpp"
30 
31 namespace Svc {
32 
39  {
40 
41  // ----------------------------------------------------------------------
42  // Friend classes
43  // ----------------------------------------------------------------------
44 
47 
48  PROTECTED:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
57  };
58 
60  enum {
64  };
65 
67  enum {
73  };
74 
76  enum {
78  };
79 
81  enum {
83  };
84 
86  enum {
95  };
96 
98  enum {
100  };
101 
102  public:
103 
104  // ----------------------------------------------------------------------
105  // Component initialization
106  // ----------------------------------------------------------------------
107 
109  void init(
110  FwSizeType queueDepth,
111  FwEnumStoreType instance = 0
112  );
113 
114  public:
115 
116  // ----------------------------------------------------------------------
117  // Getters for special input ports
118  // ----------------------------------------------------------------------
119 
124  FwIndexType portNum
125  );
126 
127  public:
128 
129  // ----------------------------------------------------------------------
130  // Getters for typed input ports
131  // ----------------------------------------------------------------------
132 
137  FwIndexType portNum
138  );
139 
144  FwIndexType portNum
145  );
146 
151  FwIndexType portNum
152  );
153 
154  public:
155 
156  // ----------------------------------------------------------------------
157  // Connect input ports to special output ports
158  // ----------------------------------------------------------------------
159 
162  FwIndexType portNum,
163  Fw::InputCmdRegPort* port
164  );
165 
168  FwIndexType portNum,
170  );
171 
173  void set_Log_OutputPort(
174  FwIndexType portNum,
175  Fw::InputLogPort* port
176  );
177 
178 #if FW_ENABLE_TEXT_LOGGING == 1
179 
181  void set_LogText_OutputPort(
182  FwIndexType portNum,
183  Fw::InputLogTextPort* port
184  );
185 
186 #endif
187 
189  void set_Time_OutputPort(
190  FwIndexType portNum,
191  Fw::InputTimePort* port
192  );
193 
194  public:
195 
196  // ----------------------------------------------------------------------
197  // Connect typed input ports to typed output ports
198  // ----------------------------------------------------------------------
199 
202  FwIndexType portNum,
203  Svc::InputPingPort* port
204  );
205 
206 #if FW_PORT_SERIALIZATION
207 
208  public:
209 
210  // ----------------------------------------------------------------------
211  // Connect serial input ports to special output ports
212  // ----------------------------------------------------------------------
213 
216  FwIndexType portNum,
217  Fw::InputSerializePort* port
218  );
219 
222  FwIndexType portNum,
223  Fw::InputSerializePort* port
224  );
225 
227  void set_Log_OutputPort(
228  FwIndexType portNum,
229  Fw::InputSerializePort* port
230  );
231 
232 #if FW_ENABLE_TEXT_LOGGING == 1
233 
235  void set_LogText_OutputPort(
236  FwIndexType portNum,
237  Fw::InputSerializePort* port
238  );
239 
240 #endif
241 
243  void set_Time_OutputPort(
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
248 #endif
249 
250 #if FW_PORT_SERIALIZATION
251 
252  public:
253 
254  // ----------------------------------------------------------------------
255  // Connect serial input ports to typed output ports
256  // ----------------------------------------------------------------------
257 
260  FwIndexType portNum,
261  Fw::InputSerializePort* port
262  );
263 
264 #endif
265 
266  public:
267 
268  // ----------------------------------------------------------------------
269  // Command registration
270  // ----------------------------------------------------------------------
271 
275  void regCommands();
276 
277  PROTECTED:
278 
279  // ----------------------------------------------------------------------
280  // Component construction and destruction
281  // ----------------------------------------------------------------------
282 
285  const char* compName = ""
286  );
287 
289  virtual ~PrmDbComponentBase();
290 
291  PROTECTED:
292 
293  // ----------------------------------------------------------------------
294  // Getters for numbers of special input ports
295  // ----------------------------------------------------------------------
296 
301 
302  PROTECTED:
303 
304  // ----------------------------------------------------------------------
305  // Getters for numbers of typed input ports
306  // ----------------------------------------------------------------------
307 
312 
317 
322 
323  PROTECTED:
324 
325  // ----------------------------------------------------------------------
326  // Getters for numbers of special output ports
327  // ----------------------------------------------------------------------
328 
333 
338 
343 
344 #if FW_ENABLE_TEXT_LOGGING == 1
345 
349  FwIndexType getNum_LogText_OutputPorts() const;
350 
351 #endif
352 
357 
358  PROTECTED:
359 
360  // ----------------------------------------------------------------------
361  // Getters for numbers of typed output ports
362  // ----------------------------------------------------------------------
363 
368 
369  PROTECTED:
370 
371  // ----------------------------------------------------------------------
372  // Connection status queries for special output ports
373  // ----------------------------------------------------------------------
374 
379  FwIndexType portNum
380  );
381 
386  FwIndexType portNum
387  );
388 
393  FwIndexType portNum
394  );
395 
396 #if FW_ENABLE_TEXT_LOGGING == 1
397 
401  bool isConnected_LogText_OutputPort(
402  FwIndexType portNum
403  );
404 
405 #endif
406 
411  FwIndexType portNum
412  );
413 
414  PROTECTED:
415 
416  // ----------------------------------------------------------------------
417  // Connection status queries for typed output ports
418  // ----------------------------------------------------------------------
419 
424  FwIndexType portNum
425  );
426 
427  PROTECTED:
428 
429  // ----------------------------------------------------------------------
430  // Handlers to implement for typed input ports
431  // ----------------------------------------------------------------------
432 
435  FwIndexType portNum,
436  FwPrmIdType id,
437  Fw::ParamBuffer& val
438  ) = 0;
439 
441  virtual void pingIn_handler(
442  FwIndexType portNum,
443  U32 key
444  ) = 0;
445 
447  virtual void setPrm_handler(
448  FwIndexType portNum,
449  FwPrmIdType id,
450  Fw::ParamBuffer& val
451  ) = 0;
452 
453  PROTECTED:
454 
455  // ----------------------------------------------------------------------
456  // Port handler base-class functions for typed input ports
457  //
458  // Call these functions directly to bypass the corresponding ports
459  // ----------------------------------------------------------------------
460 
463  FwIndexType portNum,
464  FwPrmIdType id,
465  Fw::ParamBuffer& val
466  );
467 
469  void pingIn_handlerBase(
470  FwIndexType portNum,
471  U32 key
472  );
473 
475  void setPrm_handlerBase(
476  FwIndexType portNum,
477  FwPrmIdType id,
478  Fw::ParamBuffer& val
479  );
480 
481  PROTECTED:
482 
483  // ----------------------------------------------------------------------
484  // Pre-message hooks for typed async input ports
485  //
486  // Each of these functions is invoked just before processing a message
487  // on the corresponding port. By default, they do nothing. You can
488  // override them to provide specific pre-message behavior.
489  // ----------------------------------------------------------------------
490 
492  virtual void pingIn_preMsgHook(
493  FwIndexType portNum,
494  U32 key
495  );
496 
498  virtual void setPrm_preMsgHook(
499  FwIndexType portNum,
500  FwPrmIdType id,
501  Fw::ParamBuffer& val
502  );
503 
504  PROTECTED:
505 
506  // ----------------------------------------------------------------------
507  // Invocation functions for typed output ports
508  // ----------------------------------------------------------------------
509 
511  void pingOut_out(
512  FwIndexType portNum,
513  U32 key
514  );
515 
516  PROTECTED:
517 
518  // ----------------------------------------------------------------------
519  // Command response
520  // ----------------------------------------------------------------------
521 
523  void cmdResponse_out(
524  FwOpcodeType opCode,
525  U32 cmdSeq,
526  Fw::CmdResponse response
527  );
528 
529  PROTECTED:
530 
531  // ----------------------------------------------------------------------
532  // Command handlers to implement
533  // ----------------------------------------------------------------------
534 
539  FwOpcodeType opCode,
540  U32 cmdSeq
541  ) = 0;
542 
543  PROTECTED:
544 
545  // ----------------------------------------------------------------------
546  // Command handler base-class functions
547  //
548  // Call these functions directly to bypass the command input port
549  // ----------------------------------------------------------------------
550 
555  FwOpcodeType opCode,
556  U32 cmdSeq,
557  Fw::CmdArgBuffer& args
558  );
559 
560  PROTECTED:
561 
562  // ----------------------------------------------------------------------
563  // Pre-message hooks for async commands
564  //
565  // Each of these functions is invoked just before processing the
566  // corresponding command. By default they do nothing. You can
567  // override them to provide specific pre-command behavior.
568  // ----------------------------------------------------------------------
569 
571  virtual void PRM_SAVE_FILE_preMsgHook(
572  FwOpcodeType opCode,
573  U32 cmdSeq
574  );
575 
576  PROTECTED:
577 
578  // ----------------------------------------------------------------------
579  // Event logging functions
580  // ----------------------------------------------------------------------
581 
586  U32 Id
587  );
588 
593  U32 Id
594  );
595 
599  void log_FATAL_PrmDbFull(
600  U32 Id
601  );
602 
607  U32 Id
608  );
609 
615  I32 record,
616  I32 error
617  );
618 
623  U32 records
624  );
625 
631  I32 record,
632  I32 error
633  );
634 
639  U32 records
640  );
641 
642  PROTECTED:
643 
644  // ----------------------------------------------------------------------
645  // Event throttle reset functions
646  // ----------------------------------------------------------------------
647 
650 
651  PROTECTED:
652 
653  // ----------------------------------------------------------------------
654  // Time
655  // ----------------------------------------------------------------------
656 
660  Fw::Time getTime();
661 
662  PROTECTED:
663 
664  // ----------------------------------------------------------------------
665  // Mutex operations for guarded ports
666  //
667  // You can override these operations to provide more sophisticated
668  // synchronization
669  // ----------------------------------------------------------------------
670 
672  virtual void lock();
673 
675  virtual void unLock();
676 
677  PRIVATE:
678 
679  // ----------------------------------------------------------------------
680  // Message dispatch functions
681  // ----------------------------------------------------------------------
682 
684  virtual MsgDispatchStatus doDispatch();
685 
686  PRIVATE:
687 
688  // ----------------------------------------------------------------------
689  // Calls for messages received on special input ports
690  // ----------------------------------------------------------------------
691 
693  static void m_p_CmdDisp_in(
694  Fw::PassiveComponentBase* callComp,
695  FwIndexType portNum,
696  FwOpcodeType opCode,
697  U32 cmdSeq,
698  Fw::CmdArgBuffer& args
699  );
700 
701  PRIVATE:
702 
703  // ----------------------------------------------------------------------
704  // Calls for messages received on typed input ports
705  // ----------------------------------------------------------------------
706 
708  static Fw::ParamValid m_p_getPrm_in(
709  Fw::PassiveComponentBase* callComp,
710  FwIndexType portNum,
711  FwPrmIdType id,
712  Fw::ParamBuffer& val
713  );
714 
716  static void m_p_pingIn_in(
717  Fw::PassiveComponentBase* callComp,
718  FwIndexType portNum,
719  U32 key
720  );
721 
723  static void m_p_setPrm_in(
724  Fw::PassiveComponentBase* callComp,
725  FwIndexType portNum,
726  FwPrmIdType id,
727  Fw::ParamBuffer& val
728  );
729 
730  PRIVATE:
731 
732  // ----------------------------------------------------------------------
733  // Special input ports
734  // ----------------------------------------------------------------------
735 
737  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
738 
739  PRIVATE:
740 
741  // ----------------------------------------------------------------------
742  // Typed input ports
743  // ----------------------------------------------------------------------
744 
746  Fw::InputPrmGetPort m_getPrm_InputPort[NUM_GETPRM_INPUT_PORTS];
747 
749  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
750 
752  Fw::InputPrmSetPort m_setPrm_InputPort[NUM_SETPRM_INPUT_PORTS];
753 
754  PRIVATE:
755 
756  // ----------------------------------------------------------------------
757  // Special output ports
758  // ----------------------------------------------------------------------
759 
761  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
762 
765 
767  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
768 
769 #if FW_ENABLE_TEXT_LOGGING == 1
770 
772  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
773 
774 #endif
775 
777  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
778 
779  PRIVATE:
780 
781  // ----------------------------------------------------------------------
782  // Typed output ports
783  // ----------------------------------------------------------------------
784 
786  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
787 
788  PRIVATE:
789 
790  // ----------------------------------------------------------------------
791  // Counter values for event throttling
792  // ----------------------------------------------------------------------
793 
795  FwIndexType m_PrmIdNotFoundThrottle;
796 
797  PRIVATE:
798 
799  // ----------------------------------------------------------------------
800  // Mutexes
801  // ----------------------------------------------------------------------
802 
804  Os::Mutex m_guardedPortMutex;
805 
806  };
807 
808 }
809 
810 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
U32 FwPrmIdType
Definition: FpConfig.h:107
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
Enum representing parameter validity.
Definition: Time.hpp:9
Auto-generated base for PrmDb component.
virtual void unLock()
Unlock the guarded mutex.
void setPrm_handlerBase(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Handler base-class function for input port setPrm.
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum)
@ OPCODE_PRM_SAVE_FILE
Command to save parameter image to file. Uses file name passed to constructor.
FwIndexType getNum_getPrm_InputPorts() const
void log_WARNING_HI_PrmFileReadError(Svc::PrmDb_PrmReadError stage, I32 record, I32 error)
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
virtual void setPrm_preMsgHook(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Pre-message hook for async input port setPrm.
void log_WARNING_HI_PrmFileWriteError(Svc::PrmDb_PrmWriteError stage, I32 record, I32 error)
void log_ACTIVITY_HI_PrmIdUpdated(U32 Id)
FwIndexType getNum_pingOut_OutputPorts() const
virtual ~PrmDbComponentBase()
Destroy PrmDbComponentBase object.
void log_WARNING_LO_PrmIdNotFound_ThrottleClear()
Reset throttle value for PrmIdNotFound.
PrmDbComponentBase(const char *compName="")
Construct PrmDbComponentBase object.
@ EVENTID_PRMIDNOTFOUND_THROTTLE
Throttle reset count for PrmIdNotFound.
FwIndexType getNum_setPrm_InputPorts() const
Fw::InputPrmGetPort * get_getPrm_InputPort(FwIndexType portNum)
virtual void PRM_SAVE_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
FwIndexType getNum_Time_OutputPorts() const
FwIndexType getNum_pingIn_InputPorts() const
@ EVENTID_PRMDBFULL
Parameter database is full.
@ EVENTID_PRMFILESAVECOMPLETE
Save of parameter file completed.
@ EVENTID_PRMIDADDED
Parameter ID added to database.
@ EVENTID_PRMFILEREADERROR
Failed to read parameter file.
@ EVENTID_PRMIDNOTFOUND
Parameter ID not found in database.
@ EVENTID_PRMFILELOADCOMPLETE
Load of parameter file completed.
@ EVENTID_PRMFILEWRITEERROR
Failed to write parameter file.
@ EVENTID_PRMIDUPDATED
Parameter ID updated in database.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
void PRM_SAVE_FILE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
FwIndexType getNum_CmdDisp_InputPorts() const
virtual void lock()
Lock the guarded mutex.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
Fw::InputPrmSetPort * get_setPrm_InputPort(FwIndexType portNum)
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
friend class PrmDbComponentBaseFriend
Friend class for white-box testing.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
virtual Fw::ParamValid getPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)=0
Handler for input port getPrm.
virtual void PRM_SAVE_FILE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command PRM_SAVE_FILE.
void regCommands()
Register commands with the Command Dispatcher.
void log_ACTIVITY_HI_PrmFileLoadComplete(U32 records)
FwIndexType getNum_Log_OutputPorts() const
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void log_WARNING_LO_PrmIdNotFound(U32 Id)
void log_ACTIVITY_HI_PrmFileSaveComplete(U32 records)
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
virtual void setPrm_handler(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)=0
Handler for input port setPrm.
FwIndexType getNum_CmdReg_OutputPorts() const
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Fw::ParamValid getPrm_handlerBase(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Handler base-class function for input port getPrm.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
bool isConnected_Time_OutputPort(FwIndexType portNum)
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
FwIndexType getNum_CmdStatus_OutputPorts() const
void log_ACTIVITY_HI_PrmIdAdded(U32 Id)