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"
32 
33 namespace Svc {
34 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
50  friend class PrmDbTesterBase;
51 
52  PROTECTED:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
59  enum {
61  };
62 
64  enum {
68  };
69 
71  enum {
77  };
78 
80  enum {
82  };
83 
85  enum {
87  };
88 
90  enum {
99  };
100 
102  enum {
104  };
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Component initialization
110  // ----------------------------------------------------------------------
111 
113  void init(
114  FwSizeType queueDepth,
115  FwEnumStoreType instance = 0
116  );
117 
118  public:
119 
120  // ----------------------------------------------------------------------
121  // Getters for special input ports
122  // ----------------------------------------------------------------------
123 
128  FwIndexType portNum
129  );
130 
131  public:
132 
133  // ----------------------------------------------------------------------
134  // Getters for typed input ports
135  // ----------------------------------------------------------------------
136 
141  FwIndexType portNum
142  );
143 
148  FwIndexType portNum
149  );
150 
155  FwIndexType portNum
156  );
157 
158  public:
159 
160  // ----------------------------------------------------------------------
161  // Connect input ports to special output ports
162  // ----------------------------------------------------------------------
163 
166  FwIndexType portNum,
167  Fw::InputCmdRegPort* port
168  );
169 
172  FwIndexType portNum,
174  );
175 
177  void set_Log_OutputPort(
178  FwIndexType portNum,
179  Fw::InputLogPort* port
180  );
181 
182 #if FW_ENABLE_TEXT_LOGGING == 1
183 
185  void set_LogText_OutputPort(
186  FwIndexType portNum,
187  Fw::InputLogTextPort* port
188  );
189 
190 #endif
191 
193  void set_Time_OutputPort(
194  FwIndexType portNum,
195  Fw::InputTimePort* port
196  );
197 
198  public:
199 
200  // ----------------------------------------------------------------------
201  // Connect typed input ports to typed output ports
202  // ----------------------------------------------------------------------
203 
206  FwIndexType portNum,
207  Svc::InputPingPort* port
208  );
209 
210 #if FW_PORT_SERIALIZATION
211 
212  public:
213 
214  // ----------------------------------------------------------------------
215  // Connect serial input ports to special output ports
216  // ----------------------------------------------------------------------
217 
220  FwIndexType portNum,
221  Fw::InputSerializePort* port
222  );
223 
226  FwIndexType portNum,
227  Fw::InputSerializePort* port
228  );
229 
231  void set_Log_OutputPort(
232  FwIndexType portNum,
233  Fw::InputSerializePort* port
234  );
235 
236 #if FW_ENABLE_TEXT_LOGGING == 1
237 
239  void set_LogText_OutputPort(
240  FwIndexType portNum,
241  Fw::InputSerializePort* port
242  );
243 
244 #endif
245 
247  void set_Time_OutputPort(
248  FwIndexType portNum,
249  Fw::InputSerializePort* port
250  );
251 
252 #endif
253 
254 #if FW_PORT_SERIALIZATION
255 
256  public:
257 
258  // ----------------------------------------------------------------------
259  // Connect serial input ports to typed output ports
260  // ----------------------------------------------------------------------
261 
264  FwIndexType portNum,
265  Fw::InputSerializePort* port
266  );
267 
268 #endif
269 
270  public:
271 
272  // ----------------------------------------------------------------------
273  // Command registration
274  // ----------------------------------------------------------------------
275 
279  void regCommands();
280 
281  PROTECTED:
282 
283  // ----------------------------------------------------------------------
284  // Component construction and destruction
285  // ----------------------------------------------------------------------
286 
289  const char* compName = ""
290  );
291 
293  virtual ~PrmDbComponentBase();
294 
295  PROTECTED:
296 
297  // ----------------------------------------------------------------------
298  // Getters for numbers of special input ports
299  // ----------------------------------------------------------------------
300 
305 
306  PROTECTED:
307 
308  // ----------------------------------------------------------------------
309  // Getters for numbers of typed input ports
310  // ----------------------------------------------------------------------
311 
316 
321 
326 
327  PROTECTED:
328 
329  // ----------------------------------------------------------------------
330  // Getters for numbers of special output ports
331  // ----------------------------------------------------------------------
332 
337 
342 
347 
348 #if FW_ENABLE_TEXT_LOGGING == 1
349 
353  FwIndexType getNum_LogText_OutputPorts() const;
354 
355 #endif
356 
361 
362  PROTECTED:
363 
364  // ----------------------------------------------------------------------
365  // Getters for numbers of typed output ports
366  // ----------------------------------------------------------------------
367 
372 
373  PROTECTED:
374 
375  // ----------------------------------------------------------------------
376  // Connection status queries for special output ports
377  // ----------------------------------------------------------------------
378 
383  FwIndexType portNum
384  );
385 
390  FwIndexType portNum
391  );
392 
397  FwIndexType portNum
398  );
399 
400 #if FW_ENABLE_TEXT_LOGGING == 1
401 
405  bool isConnected_LogText_OutputPort(
406  FwIndexType portNum
407  );
408 
409 #endif
410 
415  FwIndexType portNum
416  );
417 
418  PROTECTED:
419 
420  // ----------------------------------------------------------------------
421  // Connection status queries for typed output ports
422  // ----------------------------------------------------------------------
423 
428  FwIndexType portNum
429  );
430 
431  PROTECTED:
432 
433  // ----------------------------------------------------------------------
434  // Handlers to implement for typed input ports
435  // ----------------------------------------------------------------------
436 
439  FwIndexType portNum,
440  FwPrmIdType id,
441  Fw::ParamBuffer& val
442  ) = 0;
443 
445  virtual void pingIn_handler(
446  FwIndexType portNum,
447  U32 key
448  ) = 0;
449 
451  virtual void setPrm_handler(
452  FwIndexType portNum,
453  FwPrmIdType id,
454  Fw::ParamBuffer& val
455  ) = 0;
456 
457  PROTECTED:
458 
459  // ----------------------------------------------------------------------
460  // Port handler base-class functions for typed input ports
461  //
462  // Call these functions directly to bypass the corresponding ports
463  // ----------------------------------------------------------------------
464 
467  FwIndexType portNum,
468  FwPrmIdType id,
469  Fw::ParamBuffer& val
470  );
471 
473  void pingIn_handlerBase(
474  FwIndexType portNum,
475  U32 key
476  );
477 
479  void setPrm_handlerBase(
480  FwIndexType portNum,
481  FwPrmIdType id,
482  Fw::ParamBuffer& val
483  );
484 
485  PROTECTED:
486 
487  // ----------------------------------------------------------------------
488  // Pre-message hooks for typed async input ports
489  //
490  // Each of these functions is invoked just before processing a message
491  // on the corresponding port. By default, they do nothing. You can
492  // override them to provide specific pre-message behavior.
493  // ----------------------------------------------------------------------
494 
496  virtual void pingIn_preMsgHook(
497  FwIndexType portNum,
498  U32 key
499  );
500 
502  virtual void setPrm_preMsgHook(
503  FwIndexType portNum,
504  FwPrmIdType id,
505  Fw::ParamBuffer& val
506  );
507 
508  PROTECTED:
509 
510  // ----------------------------------------------------------------------
511  // Invocation functions for typed output ports
512  // ----------------------------------------------------------------------
513 
515  void pingOut_out(
516  FwIndexType portNum,
517  U32 key
518  );
519 
520  PROTECTED:
521 
522  // ----------------------------------------------------------------------
523  // Command response
524  // ----------------------------------------------------------------------
525 
527  void cmdResponse_out(
528  FwOpcodeType opCode,
529  U32 cmdSeq,
530  Fw::CmdResponse response
531  );
532 
533  PROTECTED:
534 
535  // ----------------------------------------------------------------------
536  // Command handlers to implement
537  // ----------------------------------------------------------------------
538 
542  virtual void PRM_SAVE_FILE_cmdHandler(
543  FwOpcodeType opCode,
544  U32 cmdSeq
545  ) = 0;
546 
547  PROTECTED:
548 
549  // ----------------------------------------------------------------------
550  // Command handler base-class functions
551  //
552  // Call these functions directly to bypass the command input port
553  // ----------------------------------------------------------------------
554 
559  FwOpcodeType opCode,
560  U32 cmdSeq,
561  Fw::CmdArgBuffer& args
562  );
563 
564  PROTECTED:
565 
566  // ----------------------------------------------------------------------
567  // Pre-message hooks for async commands
568  //
569  // Each of these functions is invoked just before processing the
570  // corresponding command. By default they do nothing. You can
571  // override them to provide specific pre-command behavior.
572  // ----------------------------------------------------------------------
573 
575  virtual void PRM_SAVE_FILE_preMsgHook(
576  FwOpcodeType opCode,
577  U32 cmdSeq
578  );
579 
580  PROTECTED:
581 
582  // ----------------------------------------------------------------------
583  // Event logging functions
584  // ----------------------------------------------------------------------
585 
590  U32 Id
591  );
592 
597  U32 Id
598  ) const;
599 
603  void log_FATAL_PrmDbFull(
604  U32 Id
605  ) const;
606 
611  U32 Id
612  ) const;
613 
619  I32 record,
620  I32 error
621  ) const;
622 
627  U32 records
628  ) const;
629 
635  I32 record,
636  I32 error
637  ) const;
638 
643  U32 records
644  ) const;
645 
646  PROTECTED:
647 
648  // ----------------------------------------------------------------------
649  // Event throttle reset functions
650  // ----------------------------------------------------------------------
651 
654 
655  PROTECTED:
656 
657  // ----------------------------------------------------------------------
658  // Time
659  // ----------------------------------------------------------------------
660 
664  Fw::Time getTime() const;
665 
666  PROTECTED:
667 
668  // ----------------------------------------------------------------------
669  // Mutex operations for guarded ports
670  //
671  // You can override these operations to provide more sophisticated
672  // synchronization
673  // ----------------------------------------------------------------------
674 
676  virtual void lock();
677 
679  virtual void unLock();
680 
681  PRIVATE:
682 
683  // ----------------------------------------------------------------------
684  // Message dispatch functions
685  // ----------------------------------------------------------------------
686 
688  virtual MsgDispatchStatus doDispatch();
689 
690  PRIVATE:
691 
692  // ----------------------------------------------------------------------
693  // Calls for messages received on special input ports
694  // ----------------------------------------------------------------------
695 
697  static void m_p_CmdDisp_in(
698  Fw::PassiveComponentBase* callComp,
699  FwIndexType portNum,
700  FwOpcodeType opCode,
701  U32 cmdSeq,
702  Fw::CmdArgBuffer& args
703  );
704 
705  PRIVATE:
706 
707  // ----------------------------------------------------------------------
708  // Calls for messages received on typed input ports
709  // ----------------------------------------------------------------------
710 
712  static Fw::ParamValid m_p_getPrm_in(
713  Fw::PassiveComponentBase* callComp,
714  FwIndexType portNum,
715  FwPrmIdType id,
716  Fw::ParamBuffer& val
717  );
718 
720  static void m_p_pingIn_in(
721  Fw::PassiveComponentBase* callComp,
722  FwIndexType portNum,
723  U32 key
724  );
725 
727  static void m_p_setPrm_in(
728  Fw::PassiveComponentBase* callComp,
729  FwIndexType portNum,
730  FwPrmIdType id,
731  Fw::ParamBuffer& val
732  );
733 
734  PRIVATE:
735 
736  // ----------------------------------------------------------------------
737  // Special input ports
738  // ----------------------------------------------------------------------
739 
741  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
742 
743  PRIVATE:
744 
745  // ----------------------------------------------------------------------
746  // Typed input ports
747  // ----------------------------------------------------------------------
748 
750  Fw::InputPrmGetPort m_getPrm_InputPort[NUM_GETPRM_INPUT_PORTS];
751 
753  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
754 
756  Fw::InputPrmSetPort m_setPrm_InputPort[NUM_SETPRM_INPUT_PORTS];
757 
758  PRIVATE:
759 
760  // ----------------------------------------------------------------------
761  // Special output ports
762  // ----------------------------------------------------------------------
763 
765  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
766 
769 
771  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
772 
773 #if FW_ENABLE_TEXT_LOGGING == 1
774 
776  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
777 
778 #endif
779 
781  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
782 
783  PRIVATE:
784 
785  // ----------------------------------------------------------------------
786  // Typed output ports
787  // ----------------------------------------------------------------------
788 
790  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
791 
792  PRIVATE:
793 
794  // ----------------------------------------------------------------------
795  // Counter values for event throttling
796  // ----------------------------------------------------------------------
797 
799  std::atomic<FwIndexType> m_PrmIdNotFoundThrottle;
800 
801  PRIVATE:
802 
803  // ----------------------------------------------------------------------
804  // Mutexes
805  // ----------------------------------------------------------------------
806 
808  Os::Mutex m_guardedPortMutex;
809 
810  };
811 
812 }
813 
814 #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)
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_WARNING_LO_PrmIdNotFound(U32 Id)
PrmDbComponentBase(const char *compName="")
Construct PrmDbComponentBase object.
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.
Parameter ID added to database.
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
Parameter ID updated in database.
U32 FwOpcodeType
The type of a command opcode.
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
friend class PrmDbComponentBaseFriend
Friend class for white-box testing.
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)
void log_ACTIVITY_HI_PrmIdAdded(U32 Id) const
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.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
Command to save parameter image to file. Uses file name passed to constructor.
U32 FwPrmIdType
The type of a parameter identifier.
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 log_ACTIVITY_HI_PrmIdUpdated(U32 Id) const
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.
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
FwIndexType getNum_CmdStatus_OutputPorts() const
PlatformIndexType FwIndexType
Parameter ID not found in database.
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
void log_FATAL_PrmDbFull(U32 Id) const
virtual void setPrm_preMsgHook(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Pre-message hook for async input port setPrm.