F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
VersionComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title VersionComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Version component base class
5 // ======================================================================
6 
7 #ifndef Svc_VersionComponentAc_HPP
8 #define Svc_VersionComponentAc_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/Time/TimePortAc.hpp"
26 #include "Fw/Tlm/TlmPortAc.hpp"
27 #include "Fw/Tlm/TlmString.hpp"
28 #include "Os/Mutex.hpp"
34 
35 namespace Svc {
36 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
48  friend class VersionTesterBase;
50  friend class VersionTester;
51 
52  protected:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
59  enum {
61  };
62 
64  enum {
67  };
68 
70  enum {
77  };
78 
80  enum {
81  OPCODE_ENABLE = 0x0,
83  };
84 
86  enum {
91  };
92 
94  enum {
117  };
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Component initialization
123  // ----------------------------------------------------------------------
124 
126  void init(
127  FwEnumStoreType instance = 0
128  );
129 
130  public:
131 
132  // ----------------------------------------------------------------------
133  // Getters for special input ports
134  // ----------------------------------------------------------------------
135 
140  FwIndexType portNum
141  );
142 
143  public:
144 
145  // ----------------------------------------------------------------------
146  // Getters for typed input ports
147  // ----------------------------------------------------------------------
148 
153  FwIndexType portNum
154  );
155 
160  FwIndexType portNum
161  );
162 
163  public:
164 
165  // ----------------------------------------------------------------------
166  // Connect input ports to special output ports
167  // ----------------------------------------------------------------------
168 
171  FwIndexType portNum,
172  Fw::InputCmdRegPort* port
173  );
174 
177  FwIndexType portNum,
179  );
180 
183  FwIndexType portNum,
184  Fw::InputLogPort* port
185  );
186 
187 #if FW_ENABLE_TEXT_LOGGING == 1
188 
190  void set_logTextOut_OutputPort(
191  FwIndexType portNum,
192  Fw::InputLogTextPort* port
193  );
194 
195 #endif
196 
199  FwIndexType portNum,
200  Fw::InputTimePort* port
201  );
202 
205  FwIndexType portNum,
206  Fw::InputTlmPort* port
207  );
208 
209 #if FW_PORT_SERIALIZATION
210 
211  public:
212 
213  // ----------------------------------------------------------------------
214  // Connect serial input ports to special output ports
215  // ----------------------------------------------------------------------
216 
219  FwIndexType portNum,
220  Fw::InputSerializePort* port
221  );
222 
225  FwIndexType portNum,
226  Fw::InputSerializePort* port
227  );
228 
231  FwIndexType portNum,
232  Fw::InputSerializePort* port
233  );
234 
235 #if FW_ENABLE_TEXT_LOGGING == 1
236 
238  void set_logTextOut_OutputPort(
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
243 #endif
244 
247  FwIndexType portNum,
248  Fw::InputSerializePort* port
249  );
250 
253  FwIndexType portNum,
254  Fw::InputSerializePort* port
255  );
256 
257 #endif
258 
259  public:
260 
261  // ----------------------------------------------------------------------
262  // Command registration
263  // ----------------------------------------------------------------------
264 
268  void regCommands();
269 
270  protected:
271 
272  // ----------------------------------------------------------------------
273  // Component construction and destruction
274  // ----------------------------------------------------------------------
275 
278  const char* compName = ""
279  );
280 
282  virtual ~VersionComponentBase();
283 
284  protected:
285 
286  // ----------------------------------------------------------------------
287  // Getters for numbers of special input ports
288  // ----------------------------------------------------------------------
289 
294  return NUM_CMDIN_INPUT_PORTS;
295  }
296 
297  protected:
298 
299  // ----------------------------------------------------------------------
300  // Getters for numbers of typed input ports
301  // ----------------------------------------------------------------------
302 
308  }
309 
315  }
316 
317  protected:
318 
319  // ----------------------------------------------------------------------
320  // Getters for numbers of special output ports
321  // ----------------------------------------------------------------------
322 
328  }
329 
335  }
336 
342  }
343 
344 #if FW_ENABLE_TEXT_LOGGING == 1
345 
349  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
351  }
352 
353 #endif
354 
360  }
361 
367  }
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_logTextOut_OutputPort(
402  FwIndexType portNum
403  );
404 
405 #endif
406 
411  FwIndexType portNum
412  );
413 
418  FwIndexType portNum
419  );
420 
421  protected:
422 
423  // ----------------------------------------------------------------------
424  // Handlers to implement for typed input ports
425  // ----------------------------------------------------------------------
426 
428  virtual void getVersion_handler(
429  FwIndexType portNum,
430  const Svc::VersionCfg::VersionEnum& version_id,
431  Fw::StringBase& version_string,
432  Svc::VersionStatus& status
433  ) = 0;
434 
436  virtual void setVersion_handler(
437  FwIndexType portNum,
438  const Svc::VersionCfg::VersionEnum& version_id,
439  Fw::StringBase& version_string,
440  Svc::VersionStatus& status
441  ) = 0;
442 
443  protected:
444 
445  // ----------------------------------------------------------------------
446  // Port handler base-class functions for typed input ports
447  //
448  // Call these functions directly to bypass the corresponding ports
449  // ----------------------------------------------------------------------
450 
453  FwIndexType portNum,
454  const Svc::VersionCfg::VersionEnum& version_id,
455  Fw::StringBase& version_string,
456  Svc::VersionStatus& status
457  );
458 
461  FwIndexType portNum,
462  const Svc::VersionCfg::VersionEnum& version_id,
463  Fw::StringBase& version_string,
464  Svc::VersionStatus& status
465  );
466 
467  protected:
468 
469  // ----------------------------------------------------------------------
470  // Command response
471  // ----------------------------------------------------------------------
472 
474  void cmdResponse_out(
475  FwOpcodeType opCode,
476  U32 cmdSeq,
477  Fw::CmdResponse response
478  );
479 
480  protected:
481 
482  // ----------------------------------------------------------------------
483  // Command handlers to implement
484  // ----------------------------------------------------------------------
485 
489  virtual void ENABLE_cmdHandler(
490  FwOpcodeType opCode,
491  U32 cmdSeq,
492  Svc::VersionEnabled enable
493  ) = 0;
494 
498  virtual void VERSION_cmdHandler(
499  FwOpcodeType opCode,
500  U32 cmdSeq,
501  Svc::VersionType version_type
502  ) = 0;
503 
504  protected:
505 
506  // ----------------------------------------------------------------------
507  // Command handler base-class functions
508  //
509  // Call these functions directly to bypass the command input port
510  // ----------------------------------------------------------------------
511 
516  FwOpcodeType opCode,
517  U32 cmdSeq,
518  Fw::CmdArgBuffer& args
519  );
520 
525  FwOpcodeType opCode,
526  U32 cmdSeq,
527  Fw::CmdArgBuffer& args
528  );
529 
530  protected:
531 
532  // ----------------------------------------------------------------------
533  // Event logging functions
534  // ----------------------------------------------------------------------
535 
540  const Fw::StringBase& version
541  ) const;
542 
547  const Fw::StringBase& version
548  ) const;
549 
554  const Fw::StringBase& version
555  ) const;
556 
561  Svc::VersionCfg::VersionEnum version_enum,
562  const Fw::StringBase& version_value
563  ) const;
564 
565  protected:
566 
567  // ----------------------------------------------------------------------
568  // Telemetry write functions
569  // ----------------------------------------------------------------------
570 
575  const Fw::StringBase& arg,
576  Fw::Time _tlmTime = Fw::Time()
577  ) const;
578 
583  const Fw::StringBase& arg,
584  Fw::Time _tlmTime = Fw::Time()
585  ) const;
586 
591  const Svc::CustomVersionDb& arg,
592  Fw::Time _tlmTime = Fw::Time()
593  ) const;
594 
597  const Svc::CustomVersionDb& arg,
598  Fw::Time _tlmTime = Fw::Time()
599  ) const;
600 
603  const Svc::CustomVersionDb& arg,
604  Fw::Time _tlmTime = Fw::Time()
605  ) const;
606 
609  const Svc::CustomVersionDb& arg,
610  Fw::Time _tlmTime = Fw::Time()
611  ) const;
612 
615  const Svc::CustomVersionDb& arg,
616  Fw::Time _tlmTime = Fw::Time()
617  ) const;
618 
621  const Svc::CustomVersionDb& arg,
622  Fw::Time _tlmTime = Fw::Time()
623  ) const;
624 
627  const Svc::CustomVersionDb& arg,
628  Fw::Time _tlmTime = Fw::Time()
629  ) const;
630 
633  const Svc::CustomVersionDb& arg,
634  Fw::Time _tlmTime = Fw::Time()
635  ) const;
636 
639  const Svc::CustomVersionDb& arg,
640  Fw::Time _tlmTime = Fw::Time()
641  ) const;
642 
645  const Svc::CustomVersionDb& arg,
646  Fw::Time _tlmTime = Fw::Time()
647  ) const;
648 
653  const Fw::StringBase& arg,
654  Fw::Time _tlmTime = Fw::Time()
655  ) const;
656 
659  const Fw::StringBase& arg,
660  Fw::Time _tlmTime = Fw::Time()
661  ) const;
662 
665  const Fw::StringBase& arg,
666  Fw::Time _tlmTime = Fw::Time()
667  ) const;
668 
671  const Fw::StringBase& arg,
672  Fw::Time _tlmTime = Fw::Time()
673  ) const;
674 
677  const Fw::StringBase& arg,
678  Fw::Time _tlmTime = Fw::Time()
679  ) const;
680 
683  const Fw::StringBase& arg,
684  Fw::Time _tlmTime = Fw::Time()
685  ) const;
686 
689  const Fw::StringBase& arg,
690  Fw::Time _tlmTime = Fw::Time()
691  ) const;
692 
695  const Fw::StringBase& arg,
696  Fw::Time _tlmTime = Fw::Time()
697  ) const;
698 
701  const Fw::StringBase& arg,
702  Fw::Time _tlmTime = Fw::Time()
703  ) const;
704 
707  const Fw::StringBase& arg,
708  Fw::Time _tlmTime = Fw::Time()
709  ) const;
710 
711  protected:
712 
713  // ----------------------------------------------------------------------
714  // Time
715  // ----------------------------------------------------------------------
716 
720  Fw::Time getTime() const;
721 
722  protected:
723 
724  // ----------------------------------------------------------------------
725  // Mutex operations for guarded ports
726  //
727  // You can override these operations to provide more sophisticated
728  // synchronization
729  // ----------------------------------------------------------------------
730 
732  virtual void lock();
733 
735  virtual void unLock();
736 
737  private:
738 
739  // ----------------------------------------------------------------------
740  // Calls for messages received on special input ports
741  // ----------------------------------------------------------------------
742 
744  static void m_p_cmdIn_in(
745  Fw::PassiveComponentBase* callComp,
746  FwIndexType portNum,
747  FwOpcodeType opCode,
748  U32 cmdSeq,
749  Fw::CmdArgBuffer& args
750  );
751 
752  private:
753 
754  // ----------------------------------------------------------------------
755  // Calls for messages received on typed input ports
756  // ----------------------------------------------------------------------
757 
759  static void m_p_getVersion_in(
760  Fw::PassiveComponentBase* callComp,
761  FwIndexType portNum,
762  const Svc::VersionCfg::VersionEnum& version_id,
763  Fw::StringBase& version_string,
764  Svc::VersionStatus& status
765  );
766 
768  static void m_p_setVersion_in(
769  Fw::PassiveComponentBase* callComp,
770  FwIndexType portNum,
771  const Svc::VersionCfg::VersionEnum& version_id,
772  Fw::StringBase& version_string,
773  Svc::VersionStatus& status
774  );
775 
776  private:
777 
778  // ----------------------------------------------------------------------
779  // Special input ports
780  // ----------------------------------------------------------------------
781 
783  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
784 
785  private:
786 
787  // ----------------------------------------------------------------------
788  // Typed input ports
789  // ----------------------------------------------------------------------
790 
792  Svc::InputVersionPort m_getVersion_InputPort[NUM_GETVERSION_INPUT_PORTS];
793 
795  Svc::InputVersionPort m_setVersion_InputPort[NUM_SETVERSION_INPUT_PORTS];
796 
797  private:
798 
799  // ----------------------------------------------------------------------
800  // Special output ports
801  // ----------------------------------------------------------------------
802 
804  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
805 
807  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
808 
810  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
811 
812 #if FW_ENABLE_TEXT_LOGGING == 1
813 
815  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
816 
817 #endif
818 
820  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
821 
823  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
824 
825  private:
826 
827  // ----------------------------------------------------------------------
828  // Mutexes
829  // ----------------------------------------------------------------------
830 
832  Os::Mutex m_guardedPortMutex;
833 
834  };
835 
836 }
837 
838 #endif
void tlmWrite_LibraryVersion10(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion10.
void tlmWrite_CustomVersion07(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion07.
void tlmWrite_LibraryVersion04(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion04.
void regCommands()
Register commands with the Command Dispatcher.
FwIdType FwOpcodeType
The type of a command opcode.
void tlmWrite_LibraryVersion01(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
virtual void getVersion_handler(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)=0
Handler for input port getVersion.
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
bool isConnected_logOut_OutputPort(FwIndexType portNum)
void tlmWrite_CustomVersion02(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion02.
I32 FwEnumStoreType
void tlmWrite_CustomVersion10(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion10.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void tlmWrite_LibraryVersion06(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion06.
static constexpr FwIndexType getNum_cmdIn_InputPorts()
virtual void setVersion_handler(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)=0
Handler for input port setVersion.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void tlmWrite_CustomVersion03(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion03.
void VERSION_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void unLock()
Unlock the guarded mutex.
friend class VersionTesterBase
Friend class tester to support autocoded test harness.
void tlmWrite_LibraryVersion03(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion03.
Enum representing a command response.
static constexpr FwIndexType getNum_getVersion_InputPorts()
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::VersionEnabled enable)=0
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void tlmWrite_LibraryVersion08(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion08.
void init()
Object initializer.
Definition: ObjBase.cpp:24
virtual ~VersionComponentBase()
Destroy VersionComponentBase object.
void setVersion_handlerBase(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)
Handler base-class function for input port setVersion.
void tlmWrite_CustomVersion05(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion05.
Auto-generated base for Version component.
void log_ACTIVITY_LO_ProjectVersion(const Fw::StringBase &version) const
An enumeration for version status.
Svc::InputVersionPort * get_getVersion_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
friend class VersionTester
Friend class tester implementation to support white-box testing.
void tlmWrite_LibraryVersion05(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion05.
Svc::InputVersionPort * get_setVersion_InputPort(FwIndexType portNum)
void getVersion_handlerBase(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)
Handler base-class function for input port getVersion.
Data Structure for custom version Tlm.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
virtual void lock()
Lock the guarded mutex.
void log_ACTIVITY_LO_CustomVersions(Svc::VersionCfg::VersionEnum version_enum, const Fw::StringBase &version_value) const
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
void tlmWrite_CustomVersion09(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion09.
PlatformIndexType FwIndexType
void tlmWrite_CustomVersion06(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion06.
void tlmWrite_LibraryVersion07(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion07.
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
RateGroupDivider component implementation.
An enumeration for Version Type.
void tlmWrite_LibraryVersion02(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion02.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void tlmWrite_CustomVersion04(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion04.
A command to enable or disable Event verbosity and Telemetry.
void tlmWrite_CustomVersion01(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void log_ACTIVITY_LO_FrameworkVersion(const Fw::StringBase &version) const
VersionComponentBase(const char *compName="")
Construct VersionComponentBase object.
void log_ACTIVITY_LO_LibraryVersions(const Fw::StringBase &version) const
Tracks versions for project, framework and user defined versions etc.
void tlmWrite_CustomVersion08(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion08.
void tlmWrite_LibraryVersion09(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion09.
static constexpr FwIndexType getNum_setVersion_InputPorts()
void tlmWrite_FrameworkVersion(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
virtual void VERSION_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::VersionType version_type)=0
void tlmWrite_ProjectVersion(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const