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"
35 
36 namespace Svc {
37 
42  {
43 
44  // ----------------------------------------------------------------------
45  // Friend classes
46  // ----------------------------------------------------------------------
47 
49  friend class VersionTesterBase;
51  friend class VersionTester;
52 
53  protected:
54 
55  // ----------------------------------------------------------------------
56  // Constants
57  // ----------------------------------------------------------------------
58 
60  enum {
62  };
63 
65  enum {
68  };
69 
71  enum {
78  };
79 
81  enum {
82  OPCODE_ENABLE = 0x0,
84  };
85 
87  enum {
92  };
93 
95  enum {
118  };
119 
120  public:
121 
122  // ----------------------------------------------------------------------
123  // Component initialization
124  // ----------------------------------------------------------------------
125 
127  void init(
128  FwEnumStoreType instance = 0
129  );
130 
131  public:
132 
133  // ----------------------------------------------------------------------
134  // Getters for special input ports
135  // ----------------------------------------------------------------------
136 
141  FwIndexType portNum
142  );
143 
144  public:
145 
146  // ----------------------------------------------------------------------
147  // Getters for typed input ports
148  // ----------------------------------------------------------------------
149 
154  FwIndexType portNum
155  );
156 
161  FwIndexType portNum
162  );
163 
164  public:
165 
166  // ----------------------------------------------------------------------
167  // Connect input ports to special output ports
168  // ----------------------------------------------------------------------
169 
172  FwIndexType portNum,
173  Fw::InputCmdRegPort* port
174  );
175 
178  FwIndexType portNum,
180  );
181 
184  FwIndexType portNum,
185  Fw::InputLogPort* port
186  );
187 
188 #if FW_ENABLE_TEXT_LOGGING == 1
189 
191  void set_logTextOut_OutputPort(
192  FwIndexType portNum,
193  Fw::InputLogTextPort* port
194  );
195 
196 #endif
197 
200  FwIndexType portNum,
201  Fw::InputTimePort* port
202  );
203 
206  FwIndexType portNum,
207  Fw::InputTlmPort* 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 
232  FwIndexType portNum,
233  Fw::InputSerializePort* port
234  );
235 
236 #if FW_ENABLE_TEXT_LOGGING == 1
237 
239  void set_logTextOut_OutputPort(
240  FwIndexType portNum,
241  Fw::InputSerializePort* port
242  );
243 
244 #endif
245 
248  FwIndexType portNum,
249  Fw::InputSerializePort* port
250  );
251 
254  FwIndexType portNum,
255  Fw::InputSerializePort* port
256  );
257 
258 #endif
259 
260  public:
261 
262  // ----------------------------------------------------------------------
263  // Command registration
264  // ----------------------------------------------------------------------
265 
269  void regCommands();
270 
271  protected:
272 
273  // ----------------------------------------------------------------------
274  // Component construction and destruction
275  // ----------------------------------------------------------------------
276 
279  const char* compName = ""
280  );
281 
283  virtual ~VersionComponentBase();
284 
285  protected:
286 
287  // ----------------------------------------------------------------------
288  // Getters for numbers of special input ports
289  // ----------------------------------------------------------------------
290 
295  return NUM_CMDIN_INPUT_PORTS;
296  }
297 
298  protected:
299 
300  // ----------------------------------------------------------------------
301  // Getters for numbers of typed input ports
302  // ----------------------------------------------------------------------
303 
309  }
310 
316  }
317 
318  protected:
319 
320  // ----------------------------------------------------------------------
321  // Getters for numbers of special output ports
322  // ----------------------------------------------------------------------
323 
329  }
330 
336  }
337 
343  }
344 
345 #if FW_ENABLE_TEXT_LOGGING == 1
346 
350  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
352  }
353 
354 #endif
355 
361  }
362 
368  }
369 
370  protected:
371 
372  // ----------------------------------------------------------------------
373  // Connection status queries for special output ports
374  // ----------------------------------------------------------------------
375 
380  FwIndexType portNum
381  );
382 
387  FwIndexType portNum
388  );
389 
394  FwIndexType portNum
395  );
396 
397 #if FW_ENABLE_TEXT_LOGGING == 1
398 
402  bool isConnected_logTextOut_OutputPort(
403  FwIndexType portNum
404  );
405 
406 #endif
407 
412  FwIndexType portNum
413  );
414 
419  FwIndexType portNum
420  );
421 
422  protected:
423 
424  // ----------------------------------------------------------------------
425  // Handlers to implement for typed input ports
426  // ----------------------------------------------------------------------
427 
429  virtual void getVersion_handler(
430  FwIndexType portNum,
431  const Svc::VersionCfg::VersionEnum& version_id,
432  Fw::StringBase& version_string,
433  Svc::VersionStatus& status
434  ) = 0;
435 
437  virtual void setVersion_handler(
438  FwIndexType portNum,
439  const Svc::VersionCfg::VersionEnum& version_id,
440  Fw::StringBase& version_string,
441  Svc::VersionStatus& status
442  ) = 0;
443 
444  protected:
445 
446  // ----------------------------------------------------------------------
447  // Port handler base-class functions for typed input ports
448  //
449  // Call these functions directly to bypass the corresponding ports
450  // ----------------------------------------------------------------------
451 
454  FwIndexType portNum,
455  const Svc::VersionCfg::VersionEnum& version_id,
456  Fw::StringBase& version_string,
457  Svc::VersionStatus& status
458  );
459 
462  FwIndexType portNum,
463  const Svc::VersionCfg::VersionEnum& version_id,
464  Fw::StringBase& version_string,
465  Svc::VersionStatus& status
466  );
467 
468  protected:
469 
470  // ----------------------------------------------------------------------
471  // Command response
472  // ----------------------------------------------------------------------
473 
475  void cmdResponse_out(
476  FwOpcodeType opCode,
477  U32 cmdSeq,
478  Fw::CmdResponse response
479  );
480 
481  protected:
482 
483  // ----------------------------------------------------------------------
484  // Command handlers to implement
485  // ----------------------------------------------------------------------
486 
490  virtual void ENABLE_cmdHandler(
491  FwOpcodeType opCode,
492  U32 cmdSeq,
493  Svc::VersionEnabled enable
494  ) = 0;
495 
499  virtual void VERSION_cmdHandler(
500  FwOpcodeType opCode,
501  U32 cmdSeq,
502  Svc::VersionType version_type
503  ) = 0;
504 
505  protected:
506 
507  // ----------------------------------------------------------------------
508  // Command handler base-class functions
509  //
510  // Call these functions directly to bypass the command input port
511  // ----------------------------------------------------------------------
512 
517  FwOpcodeType opCode,
518  U32 cmdSeq,
519  Fw::CmdArgBuffer& args
520  );
521 
526  FwOpcodeType opCode,
527  U32 cmdSeq,
528  Fw::CmdArgBuffer& args
529  );
530 
531  protected:
532 
533  // ----------------------------------------------------------------------
534  // Event logging functions
535  // ----------------------------------------------------------------------
536 
541  const Fw::StringBase& version
542  ) const;
543 
548  const Fw::StringBase& version
549  ) const;
550 
555  const Fw::StringBase& version
556  ) const;
557 
562  Svc::VersionCfg::VersionEnum version_enum,
563  const Fw::StringBase& version_value
564  ) const;
565 
566  protected:
567 
568  // ----------------------------------------------------------------------
569  // Telemetry write functions
570  // ----------------------------------------------------------------------
571 
576  const Fw::StringBase& arg,
577  Fw::Time _tlmTime = Fw::Time()
578  ) const;
579 
584  const Fw::StringBase& arg,
585  Fw::Time _tlmTime = Fw::Time()
586  ) const;
587 
592  const Svc::CustomVersionDb& arg,
593  Fw::Time _tlmTime = Fw::Time()
594  ) const;
595 
598  const Svc::CustomVersionDb& arg,
599  Fw::Time _tlmTime = Fw::Time()
600  ) const;
601 
604  const Svc::CustomVersionDb& arg,
605  Fw::Time _tlmTime = Fw::Time()
606  ) const;
607 
610  const Svc::CustomVersionDb& arg,
611  Fw::Time _tlmTime = Fw::Time()
612  ) const;
613 
616  const Svc::CustomVersionDb& arg,
617  Fw::Time _tlmTime = Fw::Time()
618  ) const;
619 
622  const Svc::CustomVersionDb& arg,
623  Fw::Time _tlmTime = Fw::Time()
624  ) const;
625 
628  const Svc::CustomVersionDb& arg,
629  Fw::Time _tlmTime = Fw::Time()
630  ) const;
631 
634  const Svc::CustomVersionDb& arg,
635  Fw::Time _tlmTime = Fw::Time()
636  ) const;
637 
640  const Svc::CustomVersionDb& arg,
641  Fw::Time _tlmTime = Fw::Time()
642  ) const;
643 
646  const Svc::CustomVersionDb& arg,
647  Fw::Time _tlmTime = Fw::Time()
648  ) const;
649 
654  const Fw::StringBase& arg,
655  Fw::Time _tlmTime = Fw::Time()
656  ) const;
657 
660  const Fw::StringBase& arg,
661  Fw::Time _tlmTime = Fw::Time()
662  ) const;
663 
666  const Fw::StringBase& arg,
667  Fw::Time _tlmTime = Fw::Time()
668  ) const;
669 
672  const Fw::StringBase& arg,
673  Fw::Time _tlmTime = Fw::Time()
674  ) const;
675 
678  const Fw::StringBase& arg,
679  Fw::Time _tlmTime = Fw::Time()
680  ) const;
681 
684  const Fw::StringBase& arg,
685  Fw::Time _tlmTime = Fw::Time()
686  ) const;
687 
690  const Fw::StringBase& arg,
691  Fw::Time _tlmTime = Fw::Time()
692  ) const;
693 
696  const Fw::StringBase& arg,
697  Fw::Time _tlmTime = Fw::Time()
698  ) const;
699 
702  const Fw::StringBase& arg,
703  Fw::Time _tlmTime = Fw::Time()
704  ) const;
705 
708  const Fw::StringBase& arg,
709  Fw::Time _tlmTime = Fw::Time()
710  ) const;
711 
712  protected:
713 
714  // ----------------------------------------------------------------------
715  // Time
716  // ----------------------------------------------------------------------
717 
721  Fw::Time getTime() const;
722 
723  protected:
724 
725  // ----------------------------------------------------------------------
726  // Mutex operations for guarded ports
727  //
728  // You can override these operations to provide more sophisticated
729  // synchronization
730  // ----------------------------------------------------------------------
731 
733  virtual void lock();
734 
736  virtual void unLock();
737 
738  private:
739 
740  // ----------------------------------------------------------------------
741  // Calls for messages received on special input ports
742  // ----------------------------------------------------------------------
743 
745  static void m_p_cmdIn_in(
746  Fw::PassiveComponentBase* callComp,
747  FwIndexType portNum,
748  FwOpcodeType opCode,
749  U32 cmdSeq,
750  Fw::CmdArgBuffer& args
751  );
752 
753  private:
754 
755  // ----------------------------------------------------------------------
756  // Calls for messages received on typed input ports
757  // ----------------------------------------------------------------------
758 
760  static void m_p_getVersion_in(
761  Fw::PassiveComponentBase* callComp,
762  FwIndexType portNum,
763  const Svc::VersionCfg::VersionEnum& version_id,
764  Fw::StringBase& version_string,
765  Svc::VersionStatus& status
766  );
767 
769  static void m_p_setVersion_in(
770  Fw::PassiveComponentBase* callComp,
771  FwIndexType portNum,
772  const Svc::VersionCfg::VersionEnum& version_id,
773  Fw::StringBase& version_string,
774  Svc::VersionStatus& status
775  );
776 
777  private:
778 
779  // ----------------------------------------------------------------------
780  // Special input ports
781  // ----------------------------------------------------------------------
782 
784  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
785 
786  private:
787 
788  // ----------------------------------------------------------------------
789  // Typed input ports
790  // ----------------------------------------------------------------------
791 
793  Svc::InputVersionPort m_getVersion_InputPort[NUM_GETVERSION_INPUT_PORTS];
794 
796  Svc::InputVersionPort m_setVersion_InputPort[NUM_SETVERSION_INPUT_PORTS];
797 
798  private:
799 
800  // ----------------------------------------------------------------------
801  // Special output ports
802  // ----------------------------------------------------------------------
803 
805  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
806 
808  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
809 
811  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
812 
813 #if FW_ENABLE_TEXT_LOGGING == 1
814 
816  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
817 
818 #endif
819 
821  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
822 
824  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
825 
826  private:
827 
828  // ----------------------------------------------------------------------
829  // Mutexes
830  // ----------------------------------------------------------------------
831 
833  Os::Mutex m_guardedPortMutex;
834 
835  };
836 
837 }
838 
839 #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.
A command to enable or disable Event verbosity and Telemetry.
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.
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