F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TlmPacketizerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TlmPacketizerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for TlmPacketizer component base class
5 // ======================================================================
6 
7 #ifndef Svc_TlmPacketizerComponentAc_HPP
8 #define Svc_TlmPacketizerComponentAc_HPP
9 
10 #include <atomic>
11 
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.hpp"
16 #include "Fw/Com/ComPortAc.hpp"
18 #include "Fw/FPrimeBasicTypes.hpp"
19 #include "Fw/Log/LogPortAc.hpp"
20 #include "Fw/Log/LogString.hpp"
21 #if FW_ENABLE_TEXT_LOGGING == 1
22 #include "Fw/Log/LogTextPortAc.hpp"
23 #endif
26 #include "Fw/Time/TimePortAc.hpp"
27 #include "Fw/Tlm/TlmGetPortAc.hpp"
28 #include "Fw/Tlm/TlmPortAc.hpp"
29 #include "Fw/Tlm/TlmString.hpp"
30 #include "Svc/Ping/PingPortAc.hpp"
33 
34 namespace Svc {
35 
42  {
43 
44  // ----------------------------------------------------------------------
45  // Friend classes
46  // ----------------------------------------------------------------------
47 
51  friend class TlmPacketizerTester;
52 
53  protected:
54 
55  // ----------------------------------------------------------------------
56  // Constants
57  // ----------------------------------------------------------------------
58 
60  enum {
62  };
63 
65  enum {
70  };
71 
73  enum {
80  };
81 
83  enum {
86  };
87 
89  enum {
92  };
93 
95  enum {
101  };
102 
104  enum {
106  };
107 
108  public:
109 
110  // ----------------------------------------------------------------------
111  // Component initialization
112  // ----------------------------------------------------------------------
113 
115  void init(
116  FwSizeType queueDepth,
117  FwEnumStoreType instance = 0
118  );
119 
120  public:
121 
122  // ----------------------------------------------------------------------
123  // Getters for special input ports
124  // ----------------------------------------------------------------------
125 
130  FwIndexType portNum
131  );
132 
133  public:
134 
135  // ----------------------------------------------------------------------
136  // Getters for typed input ports
137  // ----------------------------------------------------------------------
138 
143  FwIndexType portNum
144  );
145 
150  FwIndexType portNum
151  );
152 
157  FwIndexType portNum
158  );
159 
164  FwIndexType portNum
165  );
166 
167  public:
168 
169  // ----------------------------------------------------------------------
170  // Connect input ports to special output ports
171  // ----------------------------------------------------------------------
172 
175  FwIndexType portNum,
176  Fw::InputCmdRegPort* port
177  );
178 
181  FwIndexType portNum,
183  );
184 
187  FwIndexType portNum,
188  Fw::InputLogPort* port
189  );
190 
191 #if FW_ENABLE_TEXT_LOGGING == 1
192 
194  void set_textEventOut_OutputPort(
195  FwIndexType portNum,
196  Fw::InputLogTextPort* port
197  );
198 
199 #endif
200 
203  FwIndexType portNum,
204  Fw::InputTimePort* port
205  );
206 
209  FwIndexType portNum,
210  Fw::InputTlmPort* port
211  );
212 
213  public:
214 
215  // ----------------------------------------------------------------------
216  // Connect typed input ports to typed output ports
217  // ----------------------------------------------------------------------
218 
221  FwIndexType portNum,
222  Fw::InputComPort* port
223  );
224 
227  FwIndexType portNum,
228  Svc::InputPingPort* port
229  );
230 
231 #if FW_PORT_SERIALIZATION
232 
233  public:
234 
235  // ----------------------------------------------------------------------
236  // Connect serial input ports to special output ports
237  // ----------------------------------------------------------------------
238 
241  FwIndexType portNum,
242  Fw::InputSerializePort* port
243  );
244 
247  FwIndexType portNum,
248  Fw::InputSerializePort* port
249  );
250 
253  FwIndexType portNum,
254  Fw::InputSerializePort* port
255  );
256 
257 #if FW_ENABLE_TEXT_LOGGING == 1
258 
260  void set_textEventOut_OutputPort(
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
265 #endif
266 
269  FwIndexType portNum,
270  Fw::InputSerializePort* port
271  );
272 
275  FwIndexType portNum,
276  Fw::InputSerializePort* port
277  );
278 
279 #endif
280 
281 #if FW_PORT_SERIALIZATION
282 
283  public:
284 
285  // ----------------------------------------------------------------------
286  // Connect serial input ports to typed output ports
287  // ----------------------------------------------------------------------
288 
291  FwIndexType portNum,
292  Fw::InputSerializePort* port
293  );
294 
297  FwIndexType portNum,
298  Fw::InputSerializePort* port
299  );
300 
301 #endif
302 
303  public:
304 
305  // ----------------------------------------------------------------------
306  // Command registration
307  // ----------------------------------------------------------------------
308 
312  void regCommands();
313 
314  protected:
315 
316  // ----------------------------------------------------------------------
317  // Component construction and destruction
318  // ----------------------------------------------------------------------
319 
322  const char* compName = ""
323  );
324 
326  virtual ~TlmPacketizerComponentBase();
327 
328  protected:
329 
330  // ----------------------------------------------------------------------
331  // Getters for numbers of special input ports
332  // ----------------------------------------------------------------------
333 
338  return NUM_CMDIN_INPUT_PORTS;
339  }
340 
341  protected:
342 
343  // ----------------------------------------------------------------------
344  // Getters for numbers of typed input ports
345  // ----------------------------------------------------------------------
346 
350  static constexpr FwIndexType getNum_Run_InputPorts() {
351  return NUM_RUN_INPUT_PORTS;
352  }
353 
358  return NUM_TLMGET_INPUT_PORTS;
359  }
360 
366  }
367 
372  return NUM_PINGIN_INPUT_PORTS;
373  }
374 
375  protected:
376 
377  // ----------------------------------------------------------------------
378  // Getters for numbers of special output ports
379  // ----------------------------------------------------------------------
380 
386  }
387 
393  }
394 
400  }
401 
402 #if FW_ENABLE_TEXT_LOGGING == 1
403 
407  static constexpr FwIndexType getNum_textEventOut_OutputPorts() {
409  }
410 
411 #endif
412 
418  }
419 
425  }
426 
427  protected:
428 
429  // ----------------------------------------------------------------------
430  // Getters for numbers of typed output ports
431  // ----------------------------------------------------------------------
432 
438  }
439 
445  }
446 
447  protected:
448 
449  // ----------------------------------------------------------------------
450  // Connection status queries for special output ports
451  // ----------------------------------------------------------------------
452 
457  FwIndexType portNum
458  );
459 
464  FwIndexType portNum
465  );
466 
471  FwIndexType portNum
472  );
473 
474 #if FW_ENABLE_TEXT_LOGGING == 1
475 
479  bool isConnected_textEventOut_OutputPort(
480  FwIndexType portNum
481  );
482 
483 #endif
484 
489  FwIndexType portNum
490  );
491 
496  FwIndexType portNum
497  );
498 
499  protected:
500 
501  // ----------------------------------------------------------------------
502  // Connection status queries for typed output ports
503  // ----------------------------------------------------------------------
504 
509  FwIndexType portNum
510  );
511 
516  FwIndexType portNum
517  );
518 
519  protected:
520 
521  // ----------------------------------------------------------------------
522  // Handlers to implement for typed input ports
523  // ----------------------------------------------------------------------
524 
526  virtual void Run_handler(
527  FwIndexType portNum,
528  U32 context
529  ) = 0;
530 
533  FwIndexType portNum,
534  FwChanIdType id,
535  Fw::Time& timeTag,
536  Fw::TlmBuffer& val
537  ) = 0;
540 
542  virtual void TlmRecv_handler(
543  FwIndexType portNum,
544  FwChanIdType id,
545  Fw::Time& timeTag,
546  Fw::TlmBuffer& val
547  ) = 0;
548 
550  virtual void pingIn_handler(
551  FwIndexType portNum,
552  U32 key
553  ) = 0;
554 
555  protected:
556 
557  // ----------------------------------------------------------------------
558  // Port handler base-class functions for typed input ports
559  //
560  // Call these functions directly to bypass the corresponding ports
561  // ----------------------------------------------------------------------
562 
564  void Run_handlerBase(
565  FwIndexType portNum,
566  U32 context
567  );
568 
571  FwIndexType portNum,
572  FwChanIdType id,
573  Fw::Time& timeTag,
574  Fw::TlmBuffer& val
575  );
578 
580  void TlmRecv_handlerBase(
581  FwIndexType portNum,
582  FwChanIdType id,
583  Fw::Time& timeTag,
584  Fw::TlmBuffer& val
585  );
586 
588  void pingIn_handlerBase(
589  FwIndexType portNum,
590  U32 key
591  );
592 
593  protected:
594 
595  // ----------------------------------------------------------------------
596  // Pre-message hooks for typed async input ports
597  //
598  // Each of these functions is invoked just before processing a message
599  // on the corresponding port. By default, they do nothing. You can
600  // override them to provide specific pre-message behavior.
601  // ----------------------------------------------------------------------
602 
604  virtual void Run_preMsgHook(
605  FwIndexType portNum,
606  U32 context
607  );
608 
610  virtual void pingIn_preMsgHook(
611  FwIndexType portNum,
612  U32 key
613  );
614 
615  protected:
616 
617  // ----------------------------------------------------------------------
618  // Invocation functions for typed output ports
619  // ----------------------------------------------------------------------
620 
622  void PktSend_out(
623  FwIndexType portNum,
624  Fw::ComBuffer& data,
625  U32 context
626  );
627 
629  void pingOut_out(
630  FwIndexType portNum,
631  U32 key
632  );
633 
634  protected:
635 
636  // ----------------------------------------------------------------------
637  // Command response
638  // ----------------------------------------------------------------------
639 
641  void cmdResponse_out(
642  FwOpcodeType opCode,
643  U32 cmdSeq,
644  Fw::CmdResponse response
645  );
646 
647  protected:
648 
649  // ----------------------------------------------------------------------
650  // Command handlers to implement
651  // ----------------------------------------------------------------------
652 
656  virtual void SET_LEVEL_cmdHandler(
657  FwOpcodeType opCode,
658  U32 cmdSeq,
659  FwChanIdType level
660  ) = 0;
661 
665  virtual void SEND_PKT_cmdHandler(
666  FwOpcodeType opCode,
667  U32 cmdSeq,
668  U32 id
669  ) = 0;
670 
671  protected:
672 
673  // ----------------------------------------------------------------------
674  // Command handler base-class functions
675  //
676  // Call these functions directly to bypass the command input port
677  // ----------------------------------------------------------------------
678 
683  FwOpcodeType opCode,
684  U32 cmdSeq,
685  Fw::CmdArgBuffer& args
686  );
687 
692  FwOpcodeType opCode,
693  U32 cmdSeq,
694  Fw::CmdArgBuffer& args
695  );
696 
697  protected:
698 
699  // ----------------------------------------------------------------------
700  // Pre-message hooks for async commands
701  //
702  // Each of these functions is invoked just before processing the
703  // corresponding command. By default they do nothing. You can
704  // override them to provide specific pre-command behavior.
705  // ----------------------------------------------------------------------
706 
708  virtual void SET_LEVEL_preMsgHook(
709  FwOpcodeType opCode,
710  U32 cmdSeq
711  );
712 
714  virtual void SEND_PKT_preMsgHook(
715  FwOpcodeType opCode,
716  U32 cmdSeq
717  );
718 
719  protected:
720 
721  // ----------------------------------------------------------------------
722  // Event logging functions
723  // ----------------------------------------------------------------------
724 
729  FwChanIdType Id
730  ) const;
731 
736  FwChanIdType id
737  ) const;
738 
743  FwChanIdType level,
744  FwChanIdType max
745  ) const;
746 
751  U32 id
752  ) const;
753 
758  U32 id
759  ) const;
760 
761  protected:
762 
763  // ----------------------------------------------------------------------
764  // Telemetry write functions
765  // ----------------------------------------------------------------------
766 
770  void tlmWrite_SendLevel(
771  FwChanIdType arg,
772  Fw::Time _tlmTime = Fw::Time()
773  ) const;
774 
775  protected:
776 
777  // ----------------------------------------------------------------------
778  // Time
779  // ----------------------------------------------------------------------
780 
784  Fw::Time getTime() const;
785 
786  private:
787 
788  // ----------------------------------------------------------------------
789  // Message dispatch functions
790  // ----------------------------------------------------------------------
791 
793  virtual MsgDispatchStatus doDispatch();
794 
795  private:
796 
797  // ----------------------------------------------------------------------
798  // Calls for messages received on special input ports
799  // ----------------------------------------------------------------------
800 
802  static void m_p_cmdIn_in(
803  Fw::PassiveComponentBase* callComp,
804  FwIndexType portNum,
805  FwOpcodeType opCode,
806  U32 cmdSeq,
807  Fw::CmdArgBuffer& args
808  );
809 
810  private:
811 
812  // ----------------------------------------------------------------------
813  // Calls for messages received on typed input ports
814  // ----------------------------------------------------------------------
815 
817  static void m_p_Run_in(
818  Fw::PassiveComponentBase* callComp,
819  FwIndexType portNum,
820  U32 context
821  );
822 
824  static Fw::TlmValid m_p_TlmGet_in(
825  Fw::PassiveComponentBase* callComp,
826  FwIndexType portNum,
827  FwChanIdType id,
828  Fw::Time& timeTag,
829  Fw::TlmBuffer& val
830  );
833 
835  static void m_p_TlmRecv_in(
836  Fw::PassiveComponentBase* callComp,
837  FwIndexType portNum,
838  FwChanIdType id,
839  Fw::Time& timeTag,
840  Fw::TlmBuffer& val
841  );
842 
844  static void m_p_pingIn_in(
845  Fw::PassiveComponentBase* callComp,
846  FwIndexType portNum,
847  U32 key
848  );
849 
850  private:
851 
852  // ----------------------------------------------------------------------
853  // Special input ports
854  // ----------------------------------------------------------------------
855 
857  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
858 
859  private:
860 
861  // ----------------------------------------------------------------------
862  // Typed input ports
863  // ----------------------------------------------------------------------
864 
866  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
867 
869  Fw::InputTlmGetPort m_TlmGet_InputPort[NUM_TLMGET_INPUT_PORTS];
870 
872  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
873 
875  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
876 
877  private:
878 
879  // ----------------------------------------------------------------------
880  // Special output ports
881  // ----------------------------------------------------------------------
882 
884  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
885 
887  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
888 
890  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
891 
892 #if FW_ENABLE_TEXT_LOGGING == 1
893 
895  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
896 
897 #endif
898 
900  Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS];
901 
903  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
904 
905  private:
906 
907  // ----------------------------------------------------------------------
908  // Typed output ports
909  // ----------------------------------------------------------------------
910 
912  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
913 
915  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
916 
917  };
918 
919 }
920 
921 #endif
void SEND_PKT_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
friend class TlmPacketizerTesterBase
Friend class tester to support autocoded test harness.
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
FwIdType FwOpcodeType
The type of a command opcode.
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
PlatformSizeType FwSizeType
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
I32 FwEnumStoreType
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
virtual void TlmRecv_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
static constexpr FwIndexType getNum_PktSend_OutputPorts()
void log_WARNING_LO_NoChan(FwChanIdType Id) const
static constexpr FwIndexType getNum_pingIn_InputPorts()
void TlmRecv_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Enum representing a command response.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
virtual void SET_LEVEL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, FwChanIdType level)=0
virtual ~TlmPacketizerComponentBase()
Destroy TlmPacketizerComponentBase object.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void init()
Object initializer.
Definition: ObjBase.cpp:24
void tlmWrite_SendLevel(FwChanIdType arg, Fw::Time _tlmTime=Fw::Time()) const
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
Fw::InputTlmGetPort * get_TlmGet_InputPort(FwIndexType portNum)
virtual void Run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port Run.
static constexpr FwIndexType getNum_timeGetOut_OutputPorts()
FwIdType FwChanIdType
The type of a telemetry channel identifier.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
friend class TlmPacketizerTester
Friend class tester implementation to support white-box testing.
Fw::TlmValid TlmGet_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmGet.
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
static constexpr FwIndexType getNum_eventOut_OutputPorts()
virtual void SEND_PKT_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 id)=0
void log_WARNING_LO_MaxLevelExceed(FwChanIdType level, FwChanIdType max) const
PlatformIndexType FwIndexType
TlmPacketizerComponentBase(const char *compName="")
Construct TlmPacketizerComponentBase object.
Telemetry channel is not part of a telemetry packet.
void log_ACTIVITY_HI_LevelSet(FwChanIdType id) const
void set_timeGetOut_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeGetOut[portNum].
virtual void SEND_PKT_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SEND_PKT.
RateGroupDivider component implementation.
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_TlmGet_InputPorts()
Fw::InputTlmPort * get_TlmRecv_InputPort(FwIndexType portNum)
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum)
void regCommands()
Register commands with the Command Dispatcher.
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
void SET_LEVEL_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void SET_LEVEL_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_LEVEL.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
static constexpr FwIndexType getNum_Run_InputPorts()
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
virtual Fw::TlmValid TlmGet_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmGet.
static constexpr FwIndexType getNum_TlmRecv_InputPorts()
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
Auto-generated base for TlmPacketizer component.
static constexpr FwIndexType getNum_cmdIn_InputPorts()