F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
SystemResourcesComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SystemResourcesComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for SystemResources component base class
5 // ======================================================================
6 
7 #ifndef Svc_SystemResourcesComponentAc_HPP
8 #define Svc_SystemResourcesComponentAc_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/Time/TimePortAc.hpp"
24 #include "Fw/Tlm/TlmPortAc.hpp"
25 #include "Fw/Tlm/TlmString.hpp"
26 #include "Os/Mutex.hpp"
29 
30 namespace Svc {
31 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
44 
45  PROTECTED:
46 
47  // ----------------------------------------------------------------------
48  // Constants
49  // ----------------------------------------------------------------------
50 
52  enum {
54  };
55 
57  enum {
59  };
60 
62  enum {
69  };
70 
72  enum {
73  OPCODE_ENABLE = 0x0,
75  };
76 
78  enum {
81  };
82 
84  enum {
89  CHANNELID_CPU = 0x4,
108  };
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Component initialization
114  // ----------------------------------------------------------------------
115 
117  void init(
118  FwEnumStoreType instance = 0
119  );
120 
121  public:
122 
123  // ----------------------------------------------------------------------
124  // Getters for special input ports
125  // ----------------------------------------------------------------------
126 
131  FwIndexType portNum
132  );
133 
134  public:
135 
136  // ----------------------------------------------------------------------
137  // Getters for typed input ports
138  // ----------------------------------------------------------------------
139 
144  FwIndexType portNum
145  );
146 
147  public:
148 
149  // ----------------------------------------------------------------------
150  // Connect input ports to special output ports
151  // ----------------------------------------------------------------------
152 
155  FwIndexType portNum,
156  Fw::InputCmdRegPort* port
157  );
158 
161  FwIndexType portNum,
163  );
164 
166  void set_Log_OutputPort(
167  FwIndexType portNum,
168  Fw::InputLogPort* port
169  );
170 
171 #if FW_ENABLE_TEXT_LOGGING == 1
172 
174  void set_LogText_OutputPort(
175  FwIndexType portNum,
176  Fw::InputLogTextPort* port
177  );
178 
179 #endif
180 
182  void set_Time_OutputPort(
183  FwIndexType portNum,
184  Fw::InputTimePort* port
185  );
186 
188  void set_Tlm_OutputPort(
189  FwIndexType portNum,
190  Fw::InputTlmPort* port
191  );
192 
193 #if FW_PORT_SERIALIZATION
194 
195  public:
196 
197  // ----------------------------------------------------------------------
198  // Connect serial input ports to special output ports
199  // ----------------------------------------------------------------------
200 
203  FwIndexType portNum,
204  Fw::InputSerializePort* port
205  );
206 
209  FwIndexType portNum,
210  Fw::InputSerializePort* port
211  );
212 
214  void set_Log_OutputPort(
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
219 #if FW_ENABLE_TEXT_LOGGING == 1
220 
222  void set_LogText_OutputPort(
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
227 #endif
228 
230  void set_Time_OutputPort(
231  FwIndexType portNum,
232  Fw::InputSerializePort* port
233  );
234 
236  void set_Tlm_OutputPort(
237  FwIndexType portNum,
238  Fw::InputSerializePort* port
239  );
240 
241 #endif
242 
243  public:
244 
245  // ----------------------------------------------------------------------
246  // Command registration
247  // ----------------------------------------------------------------------
248 
252  void regCommands();
253 
254  PROTECTED:
255 
256  // ----------------------------------------------------------------------
257  // Component construction and destruction
258  // ----------------------------------------------------------------------
259 
262  const char* compName = ""
263  );
264 
267 
268  PROTECTED:
269 
270  // ----------------------------------------------------------------------
271  // Getters for numbers of special input ports
272  // ----------------------------------------------------------------------
273 
278 
279  PROTECTED:
280 
281  // ----------------------------------------------------------------------
282  // Getters for numbers of typed input ports
283  // ----------------------------------------------------------------------
284 
289 
290  PROTECTED:
291 
292  // ----------------------------------------------------------------------
293  // Getters for numbers of special output ports
294  // ----------------------------------------------------------------------
295 
300 
305 
310 
311 #if FW_ENABLE_TEXT_LOGGING == 1
312 
316  FwIndexType getNum_LogText_OutputPorts() const;
317 
318 #endif
319 
324 
329 
330  PROTECTED:
331 
332  // ----------------------------------------------------------------------
333  // Connection status queries for special output ports
334  // ----------------------------------------------------------------------
335 
340  FwIndexType portNum
341  );
342 
347  FwIndexType portNum
348  );
349 
354  FwIndexType portNum
355  );
356 
357 #if FW_ENABLE_TEXT_LOGGING == 1
358 
362  bool isConnected_LogText_OutputPort(
363  FwIndexType portNum
364  );
365 
366 #endif
367 
372  FwIndexType portNum
373  );
374 
379  FwIndexType portNum
380  );
381 
382  PROTECTED:
383 
384  // ----------------------------------------------------------------------
385  // Handlers to implement for typed input ports
386  // ----------------------------------------------------------------------
387 
389  virtual void run_handler(
390  FwIndexType portNum,
391  U32 context
392  ) = 0;
393 
394  PROTECTED:
395 
396  // ----------------------------------------------------------------------
397  // Port handler base-class functions for typed input ports
398  //
399  // Call these functions directly to bypass the corresponding ports
400  // ----------------------------------------------------------------------
401 
403  void run_handlerBase(
404  FwIndexType portNum,
405  U32 context
406  );
407 
408  PROTECTED:
409 
410  // ----------------------------------------------------------------------
411  // Command response
412  // ----------------------------------------------------------------------
413 
415  void cmdResponse_out(
416  FwOpcodeType opCode,
417  U32 cmdSeq,
418  Fw::CmdResponse response
419  );
420 
421  PROTECTED:
422 
423  // ----------------------------------------------------------------------
424  // Command handlers to implement
425  // ----------------------------------------------------------------------
426 
430  virtual void ENABLE_cmdHandler(
431  FwOpcodeType opCode,
432  U32 cmdSeq,
434  ) = 0;
435 
439  virtual void VERSION_cmdHandler(
440  FwOpcodeType opCode,
441  U32 cmdSeq
442  ) = 0;
443 
444  PROTECTED:
445 
446  // ----------------------------------------------------------------------
447  // Command handler base-class functions
448  //
449  // Call these functions directly to bypass the command input port
450  // ----------------------------------------------------------------------
451 
456  FwOpcodeType opCode,
457  U32 cmdSeq,
458  Fw::CmdArgBuffer& args
459  );
460 
465  FwOpcodeType opCode,
466  U32 cmdSeq,
467  Fw::CmdArgBuffer& args
468  );
469 
470  PROTECTED:
471 
472  // ----------------------------------------------------------------------
473  // Event logging functions
474  // ----------------------------------------------------------------------
475 
480  const Fw::StringBase& version
481  );
482 
487  const Fw::StringBase& version
488  );
489 
490  PROTECTED:
491 
492  // ----------------------------------------------------------------------
493  // Telemetry write functions
494  // ----------------------------------------------------------------------
495 
500  U64 arg,
501  Fw::Time _tlmTime = Fw::Time()
502  );
503 
508  U64 arg,
509  Fw::Time _tlmTime = Fw::Time()
510  );
511 
516  U64 arg,
517  Fw::Time _tlmTime = Fw::Time()
518  );
519 
524  U64 arg,
525  Fw::Time _tlmTime = Fw::Time()
526  );
527 
531  void tlmWrite_CPU(
532  F32 arg,
533  Fw::Time _tlmTime = Fw::Time()
534  );
535 
539  void tlmWrite_CPU_00(
540  F32 arg,
541  Fw::Time _tlmTime = Fw::Time()
542  );
543 
547  void tlmWrite_CPU_01(
548  F32 arg,
549  Fw::Time _tlmTime = Fw::Time()
550  );
551 
555  void tlmWrite_CPU_02(
556  F32 arg,
557  Fw::Time _tlmTime = Fw::Time()
558  );
559 
563  void tlmWrite_CPU_03(
564  F32 arg,
565  Fw::Time _tlmTime = Fw::Time()
566  );
567 
571  void tlmWrite_CPU_04(
572  F32 arg,
573  Fw::Time _tlmTime = Fw::Time()
574  );
575 
579  void tlmWrite_CPU_05(
580  F32 arg,
581  Fw::Time _tlmTime = Fw::Time()
582  );
583 
587  void tlmWrite_CPU_06(
588  F32 arg,
589  Fw::Time _tlmTime = Fw::Time()
590  );
591 
595  void tlmWrite_CPU_07(
596  F32 arg,
597  Fw::Time _tlmTime = Fw::Time()
598  );
599 
603  void tlmWrite_CPU_08(
604  F32 arg,
605  Fw::Time _tlmTime = Fw::Time()
606  );
607 
611  void tlmWrite_CPU_09(
612  F32 arg,
613  Fw::Time _tlmTime = Fw::Time()
614  );
615 
619  void tlmWrite_CPU_10(
620  F32 arg,
621  Fw::Time _tlmTime = Fw::Time()
622  );
623 
627  void tlmWrite_CPU_11(
628  F32 arg,
629  Fw::Time _tlmTime = Fw::Time()
630  );
631 
635  void tlmWrite_CPU_12(
636  F32 arg,
637  Fw::Time _tlmTime = Fw::Time()
638  );
639 
643  void tlmWrite_CPU_13(
644  F32 arg,
645  Fw::Time _tlmTime = Fw::Time()
646  );
647 
651  void tlmWrite_CPU_14(
652  F32 arg,
653  Fw::Time _tlmTime = Fw::Time()
654  );
655 
659  void tlmWrite_CPU_15(
660  F32 arg,
661  Fw::Time _tlmTime = Fw::Time()
662  );
663 
668  const Fw::StringBase& arg,
669  Fw::Time _tlmTime = Fw::Time()
670  );
671 
676  const Fw::StringBase& arg,
677  Fw::Time _tlmTime = Fw::Time()
678  );
679 
680  PROTECTED:
681 
682  // ----------------------------------------------------------------------
683  // Time
684  // ----------------------------------------------------------------------
685 
689  Fw::Time getTime();
690 
691  PROTECTED:
692 
693  // ----------------------------------------------------------------------
694  // Mutex operations for guarded ports
695  //
696  // You can override these operations to provide more sophisticated
697  // synchronization
698  // ----------------------------------------------------------------------
699 
701  virtual void lock();
702 
704  virtual void unLock();
705 
706  PRIVATE:
707 
708  // ----------------------------------------------------------------------
709  // Calls for messages received on special input ports
710  // ----------------------------------------------------------------------
711 
713  static void m_p_CmdDisp_in(
714  Fw::PassiveComponentBase* callComp,
715  FwIndexType portNum,
716  FwOpcodeType opCode,
717  U32 cmdSeq,
718  Fw::CmdArgBuffer& args
719  );
720 
721  PRIVATE:
722 
723  // ----------------------------------------------------------------------
724  // Calls for messages received on typed input ports
725  // ----------------------------------------------------------------------
726 
728  static void m_p_run_in(
729  Fw::PassiveComponentBase* callComp,
730  FwIndexType portNum,
731  U32 context
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  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
751 
752  PRIVATE:
753 
754  // ----------------------------------------------------------------------
755  // Special output ports
756  // ----------------------------------------------------------------------
757 
759  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
760 
763 
765  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
766 
767 #if FW_ENABLE_TEXT_LOGGING == 1
768 
770  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
771 
772 #endif
773 
775  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
776 
778  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
779 
780  PRIVATE:
781 
782  // ----------------------------------------------------------------------
783  // Mutexes
784  // ----------------------------------------------------------------------
785 
787  Os::Mutex m_guardedPortMutex;
788 
789  };
790 
791 }
792 
793 #endif
float F32
32-bit floating point
Definition: BasicTypes.h:45
I32 FwEnumStoreType
Definition: FpConfig.h:51
U32 FwOpcodeType
Definition: FpConfig.h:78
PlatformIndexType FwIndexType
Definition: FpConfig.h:20
C++-compatible configuration header for fprime configuration.
Enum representing a command response.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
Auto-generated base for SystemResources component.
void tlmWrite_CPU_01(F32 arg, Fw::Time _tlmTime=Fw::Time())
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void tlmWrite_CPU_02(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_14(F32 arg, Fw::Time _tlmTime=Fw::Time())
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
virtual void unLock()
Unlock the guarded mutex.
void tlmWrite_MEMORY_USED(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_NON_VOLATILE_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_FRAMEWORK_VERSION(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time())
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
@ CHANNELID_FRAMEWORK_VERSION
Channel ID for FRAMEWORK_VERSION.
@ CHANNELID_NON_VOLATILE_TOTAL
Channel ID for NON_VOLATILE_TOTAL.
@ CHANNELID_MEMORY_USED
Channel ID for MEMORY_USED.
@ CHANNELID_PROJECT_VERSION
Channel ID for PROJECT_VERSION.
@ CHANNELID_MEMORY_TOTAL
Channel ID for MEMORY_TOTAL.
@ CHANNELID_NON_VOLATILE_FREE
Channel ID for NON_VOLATILE_FREE.
void tlmWrite_NON_VOLATILE_FREE(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_PROJECT_VERSION(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time())
SystemResourcesComponentBase(const char *compName="")
Construct SystemResourcesComponentBase object.
void tlmWrite_CPU_00(F32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
void tlmWrite_CPU_09(F32 arg, Fw::Time _tlmTime=Fw::Time())
@ OPCODE_ENABLE
A command to enable or disable system resource telemetry.
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void log_ACTIVITY_LO_FRAMEWORK_VERSION(const Fw::StringBase &version)
void tlmWrite_CPU_10(F32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void tlmWrite_CPU_06(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_08(F32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_Time_OutputPort(FwIndexType portNum)
virtual void VERSION_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void tlmWrite_MEMORY_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time())
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
void tlmWrite_CPU_07(F32 arg, Fw::Time _tlmTime=Fw::Time())
virtual void lock()
Lock the guarded mutex.
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
void tlmWrite_CPU_15(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_04(F32 arg, Fw::Time _tlmTime=Fw::Time())
friend class SystemResourcesComponentBaseFriend
Friend class for white-box testing.
void tlmWrite_CPU(F32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_Log_OutputPort(FwIndexType portNum)
void regCommands()
Register commands with the Command Dispatcher.
void tlmWrite_CPU_12(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_05(F32 arg, Fw::Time _tlmTime=Fw::Time())
virtual void ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::SystemResourceEnabled enable)=0
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
void tlmWrite_CPU_11(F32 arg, Fw::Time _tlmTime=Fw::Time())
void VERSION_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void tlmWrite_CPU_03(F32 arg, Fw::Time _tlmTime=Fw::Time())
@ EVENTID_FRAMEWORK_VERSION
Version of the git repository.
@ EVENTID_PROJECT_VERSION
Version of the git repository.
void log_ACTIVITY_LO_PROJECT_VERSION(const Fw::StringBase &version)
virtual ~SystemResourcesComponentBase()
Destroy SystemResourcesComponentBase object.
void tlmWrite_CPU_13(F32 arg, Fw::Time _tlmTime=Fw::Time())
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
#define U64(C)
Definition: sha.h:176