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 #if FW_ENABLE_TEXT_LOGGING == 1
18 #include "Fw/Log/LogTextPortAc.hpp"
19 #endif
22 #include "Fw/Time/TimePortAc.hpp"
23 #include "Fw/Tlm/TlmPortAc.hpp"
24 #include "Fw/Tlm/TlmString.hpp"
25 #include "Os/Mutex.hpp"
28 
29 namespace Svc {
30 
35  {
36 
37  // ----------------------------------------------------------------------
38  // Friend classes
39  // ----------------------------------------------------------------------
40 
43 
44  PROTECTED:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
51  enum {
53  };
54 
56  enum {
58  };
59 
61  enum {
68  };
69 
71  enum {
72  OPCODE_ENABLE = 0x0,
73  };
74 
76  enum {
81  CHANNELID_CPU = 0x4,
98  };
99 
100  public:
101 
102  // ----------------------------------------------------------------------
103  // Component initialization
104  // ----------------------------------------------------------------------
105 
107  void init(
108  FwEnumStoreType instance = 0
109  );
110 
111  public:
112 
113  // ----------------------------------------------------------------------
114  // Getters for special input ports
115  // ----------------------------------------------------------------------
116 
121  FwIndexType portNum
122  );
123 
124  public:
125 
126  // ----------------------------------------------------------------------
127  // Getters for typed input ports
128  // ----------------------------------------------------------------------
129 
134  FwIndexType portNum
135  );
136 
137  public:
138 
139  // ----------------------------------------------------------------------
140  // Connect input ports to special output ports
141  // ----------------------------------------------------------------------
142 
145  FwIndexType portNum,
146  Fw::InputCmdRegPort* port
147  );
148 
151  FwIndexType portNum,
153  );
154 
156  void set_Log_OutputPort(
157  FwIndexType portNum,
158  Fw::InputLogPort* port
159  );
160 
161 #if FW_ENABLE_TEXT_LOGGING == 1
162 
164  void set_LogText_OutputPort(
165  FwIndexType portNum,
166  Fw::InputLogTextPort* port
167  );
168 
169 #endif
170 
172  void set_Time_OutputPort(
173  FwIndexType portNum,
174  Fw::InputTimePort* port
175  );
176 
178  void set_Tlm_OutputPort(
179  FwIndexType portNum,
180  Fw::InputTlmPort* port
181  );
182 
183 #if FW_PORT_SERIALIZATION
184 
185  public:
186 
187  // ----------------------------------------------------------------------
188  // Connect serial input ports to special output ports
189  // ----------------------------------------------------------------------
190 
193  FwIndexType portNum,
194  Fw::InputSerializePort* port
195  );
196 
199  FwIndexType portNum,
200  Fw::InputSerializePort* port
201  );
202 
204  void set_Log_OutputPort(
205  FwIndexType portNum,
206  Fw::InputSerializePort* port
207  );
208 
209 #if FW_ENABLE_TEXT_LOGGING == 1
210 
212  void set_LogText_OutputPort(
213  FwIndexType portNum,
214  Fw::InputSerializePort* port
215  );
216 
217 #endif
218 
220  void set_Time_OutputPort(
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
226  void set_Tlm_OutputPort(
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
231 #endif
232 
233  public:
234 
235  // ----------------------------------------------------------------------
236  // Command registration
237  // ----------------------------------------------------------------------
238 
242  void regCommands();
243 
244  PROTECTED:
245 
246  // ----------------------------------------------------------------------
247  // Component construction and destruction
248  // ----------------------------------------------------------------------
249 
252  const char* compName = ""
253  );
254 
257 
258  PROTECTED:
259 
260  // ----------------------------------------------------------------------
261  // Getters for numbers of special input ports
262  // ----------------------------------------------------------------------
263 
268 
269  PROTECTED:
270 
271  // ----------------------------------------------------------------------
272  // Getters for numbers of typed input ports
273  // ----------------------------------------------------------------------
274 
279 
280  PROTECTED:
281 
282  // ----------------------------------------------------------------------
283  // Getters for numbers of special output ports
284  // ----------------------------------------------------------------------
285 
290 
295 
300 
301 #if FW_ENABLE_TEXT_LOGGING == 1
302 
306  FwIndexType getNum_LogText_OutputPorts() const;
307 
308 #endif
309 
314 
319 
320  PROTECTED:
321 
322  // ----------------------------------------------------------------------
323  // Connection status queries for special output ports
324  // ----------------------------------------------------------------------
325 
330  FwIndexType portNum
331  );
332 
337  FwIndexType portNum
338  );
339 
344  FwIndexType portNum
345  );
346 
347 #if FW_ENABLE_TEXT_LOGGING == 1
348 
352  bool isConnected_LogText_OutputPort(
353  FwIndexType portNum
354  );
355 
356 #endif
357 
362  FwIndexType portNum
363  );
364 
369  FwIndexType portNum
370  );
371 
372  PROTECTED:
373 
374  // ----------------------------------------------------------------------
375  // Handlers to implement for typed input ports
376  // ----------------------------------------------------------------------
377 
379  virtual void run_handler(
380  FwIndexType portNum,
381  U32 context
382  ) = 0;
383 
384  PROTECTED:
385 
386  // ----------------------------------------------------------------------
387  // Port handler base-class functions for typed input ports
388  //
389  // Call these functions directly to bypass the corresponding ports
390  // ----------------------------------------------------------------------
391 
393  void run_handlerBase(
394  FwIndexType portNum,
395  U32 context
396  );
397 
398  PROTECTED:
399 
400  // ----------------------------------------------------------------------
401  // Command response
402  // ----------------------------------------------------------------------
403 
405  void cmdResponse_out(
406  FwOpcodeType opCode,
407  U32 cmdSeq,
408  Fw::CmdResponse response
409  );
410 
411  PROTECTED:
412 
413  // ----------------------------------------------------------------------
414  // Command handlers to implement
415  // ----------------------------------------------------------------------
416 
420  virtual void ENABLE_cmdHandler(
421  FwOpcodeType opCode,
422  U32 cmdSeq,
424  ) = 0;
425 
426  PROTECTED:
427 
428  // ----------------------------------------------------------------------
429  // Command handler base-class functions
430  //
431  // Call these functions directly to bypass the command input port
432  // ----------------------------------------------------------------------
433 
438  FwOpcodeType opCode,
439  U32 cmdSeq,
440  Fw::CmdArgBuffer& args
441  );
442 
443  PROTECTED:
444 
445  // ----------------------------------------------------------------------
446  // Telemetry write functions
447  // ----------------------------------------------------------------------
448 
453  U64 arg,
454  Fw::Time _tlmTime = Fw::Time()
455  );
456 
461  U64 arg,
462  Fw::Time _tlmTime = Fw::Time()
463  );
464 
469  U64 arg,
470  Fw::Time _tlmTime = Fw::Time()
471  );
472 
477  U64 arg,
478  Fw::Time _tlmTime = Fw::Time()
479  );
480 
484  void tlmWrite_CPU(
485  F32 arg,
486  Fw::Time _tlmTime = Fw::Time()
487  );
488 
492  void tlmWrite_CPU_00(
493  F32 arg,
494  Fw::Time _tlmTime = Fw::Time()
495  );
496 
500  void tlmWrite_CPU_01(
501  F32 arg,
502  Fw::Time _tlmTime = Fw::Time()
503  );
504 
508  void tlmWrite_CPU_02(
509  F32 arg,
510  Fw::Time _tlmTime = Fw::Time()
511  );
512 
516  void tlmWrite_CPU_03(
517  F32 arg,
518  Fw::Time _tlmTime = Fw::Time()
519  );
520 
524  void tlmWrite_CPU_04(
525  F32 arg,
526  Fw::Time _tlmTime = Fw::Time()
527  );
528 
532  void tlmWrite_CPU_05(
533  F32 arg,
534  Fw::Time _tlmTime = Fw::Time()
535  );
536 
540  void tlmWrite_CPU_06(
541  F32 arg,
542  Fw::Time _tlmTime = Fw::Time()
543  );
544 
548  void tlmWrite_CPU_07(
549  F32 arg,
550  Fw::Time _tlmTime = Fw::Time()
551  );
552 
556  void tlmWrite_CPU_08(
557  F32 arg,
558  Fw::Time _tlmTime = Fw::Time()
559  );
560 
564  void tlmWrite_CPU_09(
565  F32 arg,
566  Fw::Time _tlmTime = Fw::Time()
567  );
568 
572  void tlmWrite_CPU_10(
573  F32 arg,
574  Fw::Time _tlmTime = Fw::Time()
575  );
576 
580  void tlmWrite_CPU_11(
581  F32 arg,
582  Fw::Time _tlmTime = Fw::Time()
583  );
584 
588  void tlmWrite_CPU_12(
589  F32 arg,
590  Fw::Time _tlmTime = Fw::Time()
591  );
592 
596  void tlmWrite_CPU_13(
597  F32 arg,
598  Fw::Time _tlmTime = Fw::Time()
599  );
600 
604  void tlmWrite_CPU_14(
605  F32 arg,
606  Fw::Time _tlmTime = Fw::Time()
607  );
608 
612  void tlmWrite_CPU_15(
613  F32 arg,
614  Fw::Time _tlmTime = Fw::Time()
615  );
616 
617  PROTECTED:
618 
619  // ----------------------------------------------------------------------
620  // Time
621  // ----------------------------------------------------------------------
622 
626  Fw::Time getTime();
627 
628  PROTECTED:
629 
630  // ----------------------------------------------------------------------
631  // Mutex operations for guarded ports
632  //
633  // You can override these operations to provide more sophisticated
634  // synchronization
635  // ----------------------------------------------------------------------
636 
638  virtual void lock();
639 
641  virtual void unLock();
642 
643  PRIVATE:
644 
645  // ----------------------------------------------------------------------
646  // Calls for messages received on special input ports
647  // ----------------------------------------------------------------------
648 
650  static void m_p_CmdDisp_in(
651  Fw::PassiveComponentBase* callComp,
652  FwIndexType portNum,
653  FwOpcodeType opCode,
654  U32 cmdSeq,
655  Fw::CmdArgBuffer& args
656  );
657 
658  PRIVATE:
659 
660  // ----------------------------------------------------------------------
661  // Calls for messages received on typed input ports
662  // ----------------------------------------------------------------------
663 
665  static void m_p_run_in(
666  Fw::PassiveComponentBase* callComp,
667  FwIndexType portNum,
668  U32 context
669  );
670 
671  PRIVATE:
672 
673  // ----------------------------------------------------------------------
674  // Special input ports
675  // ----------------------------------------------------------------------
676 
678  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
679 
680  PRIVATE:
681 
682  // ----------------------------------------------------------------------
683  // Typed input ports
684  // ----------------------------------------------------------------------
685 
687  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
688 
689  PRIVATE:
690 
691  // ----------------------------------------------------------------------
692  // Special output ports
693  // ----------------------------------------------------------------------
694 
696  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
697 
700 
702  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
703 
704 #if FW_ENABLE_TEXT_LOGGING == 1
705 
707  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
708 
709 #endif
710 
712  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
713 
715  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
716 
717  PRIVATE:
718 
719  // ----------------------------------------------------------------------
720  // Mutexes
721  // ----------------------------------------------------------------------
722 
724  Os::Mutex m_guardedPortMutex;
725 
726  };
727 
728 }
729 
730 #endif
float F32
32-bit floating point
Definition: BasicTypes.h:49
I32 FwEnumStoreType
Definition: FpConfig.h:64
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
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 set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void tlmWrite_NON_VOLATILE_FREE(U64 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())
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
@ OPCODE_ENABLE
A command to enable or disable system resource telemetry.
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)
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())
@ CHANNELID_NON_VOLATILE_TOTAL
Channel ID for NON_VOLATILE_TOTAL.
@ CHANNELID_MEMORY_USED
Channel ID for MEMORY_USED.
@ CHANNELID_MEMORY_TOTAL
Channel ID for MEMORY_TOTAL.
@ CHANNELID_NON_VOLATILE_FREE
Channel ID for NON_VOLATILE_FREE.
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 tlmWrite_CPU_03(F32 arg, Fw::Time _tlmTime=Fw::Time())
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