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 
50  friend class VersionTesterBase;
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 
295  PROTECTED:
296 
297  // ----------------------------------------------------------------------
298  // Getters for numbers of typed input ports
299  // ----------------------------------------------------------------------
300 
305 
310 
311  PROTECTED:
312 
313  // ----------------------------------------------------------------------
314  // Getters for numbers of special output ports
315  // ----------------------------------------------------------------------
316 
321 
326 
331 
332 #if FW_ENABLE_TEXT_LOGGING == 1
333 
337  FwIndexType getNum_logTextOut_OutputPorts() const;
338 
339 #endif
340 
345 
350 
351  PROTECTED:
352 
353  // ----------------------------------------------------------------------
354  // Connection status queries for special output ports
355  // ----------------------------------------------------------------------
356 
361  FwIndexType portNum
362  );
363 
368  FwIndexType portNum
369  );
370 
375  FwIndexType portNum
376  );
377 
378 #if FW_ENABLE_TEXT_LOGGING == 1
379 
383  bool isConnected_logTextOut_OutputPort(
384  FwIndexType portNum
385  );
386 
387 #endif
388 
393  FwIndexType portNum
394  );
395 
400  FwIndexType portNum
401  );
402 
403  PROTECTED:
404 
405  // ----------------------------------------------------------------------
406  // Handlers to implement for typed input ports
407  // ----------------------------------------------------------------------
408 
410  virtual void getVersion_handler(
411  FwIndexType portNum,
412  const Svc::VersionCfg::VersionEnum& version_id,
413  Fw::StringBase& version_string,
414  Svc::VersionStatus& status
415  ) = 0;
416 
418  virtual void setVersion_handler(
419  FwIndexType portNum,
420  const Svc::VersionCfg::VersionEnum& version_id,
421  Fw::StringBase& version_string,
422  Svc::VersionStatus& status
423  ) = 0;
424 
425  PROTECTED:
426 
427  // ----------------------------------------------------------------------
428  // Port handler base-class functions for typed input ports
429  //
430  // Call these functions directly to bypass the corresponding ports
431  // ----------------------------------------------------------------------
432 
435  FwIndexType portNum,
436  const Svc::VersionCfg::VersionEnum& version_id,
437  Fw::StringBase& version_string,
438  Svc::VersionStatus& status
439  );
440 
443  FwIndexType portNum,
444  const Svc::VersionCfg::VersionEnum& version_id,
445  Fw::StringBase& version_string,
446  Svc::VersionStatus& status
447  );
448 
449  PROTECTED:
450 
451  // ----------------------------------------------------------------------
452  // Command response
453  // ----------------------------------------------------------------------
454 
456  void cmdResponse_out(
457  FwOpcodeType opCode,
458  U32 cmdSeq,
459  Fw::CmdResponse response
460  );
461 
462  PROTECTED:
463 
464  // ----------------------------------------------------------------------
465  // Command handlers to implement
466  // ----------------------------------------------------------------------
467 
471  virtual void ENABLE_cmdHandler(
472  FwOpcodeType opCode,
473  U32 cmdSeq,
474  Svc::VersionEnabled enable
475  ) = 0;
476 
480  virtual void VERSION_cmdHandler(
481  FwOpcodeType opCode,
482  U32 cmdSeq,
483  Svc::VersionType version_type
484  ) = 0;
485 
486  PROTECTED:
487 
488  // ----------------------------------------------------------------------
489  // Command handler base-class functions
490  //
491  // Call these functions directly to bypass the command input port
492  // ----------------------------------------------------------------------
493 
498  FwOpcodeType opCode,
499  U32 cmdSeq,
500  Fw::CmdArgBuffer& args
501  );
502 
507  FwOpcodeType opCode,
508  U32 cmdSeq,
509  Fw::CmdArgBuffer& args
510  );
511 
512  PROTECTED:
513 
514  // ----------------------------------------------------------------------
515  // Event logging functions
516  // ----------------------------------------------------------------------
517 
522  const Fw::StringBase& version
523  ) const;
524 
529  const Fw::StringBase& version
530  ) const;
531 
536  const Fw::StringBase& version
537  ) const;
538 
543  Svc::VersionCfg::VersionEnum version_enum,
544  const Fw::StringBase& version_value
545  ) const;
546 
547  PROTECTED:
548 
549  // ----------------------------------------------------------------------
550  // Telemetry write functions
551  // ----------------------------------------------------------------------
552 
557  const Fw::StringBase& arg,
558  Fw::Time _tlmTime = Fw::Time()
559  ) const;
560 
565  const Fw::StringBase& arg,
566  Fw::Time _tlmTime = Fw::Time()
567  ) const;
568 
573  const Svc::CustomVersionDb& arg,
574  Fw::Time _tlmTime = Fw::Time()
575  ) const;
576 
579  const Svc::CustomVersionDb& arg,
580  Fw::Time _tlmTime = Fw::Time()
581  ) const;
582 
585  const Svc::CustomVersionDb& arg,
586  Fw::Time _tlmTime = Fw::Time()
587  ) const;
588 
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 
635  const Fw::StringBase& arg,
636  Fw::Time _tlmTime = Fw::Time()
637  ) const;
638 
641  const Fw::StringBase& arg,
642  Fw::Time _tlmTime = Fw::Time()
643  ) const;
644 
647  const Fw::StringBase& arg,
648  Fw::Time _tlmTime = Fw::Time()
649  ) const;
650 
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 
693  PROTECTED:
694 
695  // ----------------------------------------------------------------------
696  // Time
697  // ----------------------------------------------------------------------
698 
702  Fw::Time getTime() const;
703 
704  PROTECTED:
705 
706  // ----------------------------------------------------------------------
707  // Mutex operations for guarded ports
708  //
709  // You can override these operations to provide more sophisticated
710  // synchronization
711  // ----------------------------------------------------------------------
712 
714  virtual void lock();
715 
717  virtual void unLock();
718 
719  PRIVATE:
720 
721  // ----------------------------------------------------------------------
722  // Calls for messages received on special input ports
723  // ----------------------------------------------------------------------
724 
726  static void m_p_cmdIn_in(
727  Fw::PassiveComponentBase* callComp,
728  FwIndexType portNum,
729  FwOpcodeType opCode,
730  U32 cmdSeq,
731  Fw::CmdArgBuffer& args
732  );
733 
734  PRIVATE:
735 
736  // ----------------------------------------------------------------------
737  // Calls for messages received on typed input ports
738  // ----------------------------------------------------------------------
739 
741  static void m_p_getVersion_in(
742  Fw::PassiveComponentBase* callComp,
743  FwIndexType portNum,
744  const Svc::VersionCfg::VersionEnum& version_id,
745  Fw::StringBase& version_string,
746  Svc::VersionStatus& status
747  );
748 
750  static void m_p_setVersion_in(
751  Fw::PassiveComponentBase* callComp,
752  FwIndexType portNum,
753  const Svc::VersionCfg::VersionEnum& version_id,
754  Fw::StringBase& version_string,
755  Svc::VersionStatus& status
756  );
757 
758  PRIVATE:
759 
760  // ----------------------------------------------------------------------
761  // Special input ports
762  // ----------------------------------------------------------------------
763 
765  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
766 
767  PRIVATE:
768 
769  // ----------------------------------------------------------------------
770  // Typed input ports
771  // ----------------------------------------------------------------------
772 
774  Svc::InputVersionPort m_getVersion_InputPort[NUM_GETVERSION_INPUT_PORTS];
775 
777  Svc::InputVersionPort m_setVersion_InputPort[NUM_SETVERSION_INPUT_PORTS];
778 
779  PRIVATE:
780 
781  // ----------------------------------------------------------------------
782  // Special output ports
783  // ----------------------------------------------------------------------
784 
786  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
787 
789  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
790 
792  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
793 
794 #if FW_ENABLE_TEXT_LOGGING == 1
795 
797  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
798 
799 #endif
800 
802  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
803 
805  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
806 
807  PRIVATE:
808 
809  // ----------------------------------------------------------------------
810  // Mutexes
811  // ----------------------------------------------------------------------
812 
814  Os::Mutex m_guardedPortMutex;
815 
816  };
817 
818 }
819 
820 #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.
Definition: Time.hpp:9
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.
FwIndexType getNum_getVersion_InputPorts() const
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.
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
A command to enable or disable Event verbosity and Telemetry.
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.
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.
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
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:26
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.
U32 FwOpcodeType
The type of a command opcode.
Svc::InputVersionPort * get_getVersion_InputPort(FwIndexType portNum)
FwIndexType getNum_cmdRegOut_OutputPorts() const
void tlmWrite_LibraryVersion05(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion05.
Svc::InputVersionPort * get_setVersion_InputPort(FwIndexType portNum)
FwIndexType getNum_setVersion_InputPorts() const
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].
FwIndexType getNum_tlmOut_OutputPorts() const
FwIndexType getNum_cmdResponseOut_OutputPorts() const
virtual void lock()
Lock the guarded mutex.
FwIndexType getNum_timeCaller_OutputPorts() const
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.
FwIndexType getNum_logOut_OutputPorts() const
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)
FwIndexType getNum_cmdIn_InputPorts() const
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
friend class VersionComponentBaseFriend
Friend class for white-box testing.
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.
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