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 
339  PROTECTED:
340 
341  // ----------------------------------------------------------------------
342  // Getters for numbers of typed input ports
343  // ----------------------------------------------------------------------
344 
349 
354 
359 
364 
365  PROTECTED:
366 
367  // ----------------------------------------------------------------------
368  // Getters for numbers of special output ports
369  // ----------------------------------------------------------------------
370 
375 
380 
385 
386 #if FW_ENABLE_TEXT_LOGGING == 1
387 
391  FwIndexType getNum_textEventOut_OutputPorts() const;
392 
393 #endif
394 
399 
404 
405  PROTECTED:
406 
407  // ----------------------------------------------------------------------
408  // Getters for numbers of typed output ports
409  // ----------------------------------------------------------------------
410 
415 
420 
421  PROTECTED:
422 
423  // ----------------------------------------------------------------------
424  // Connection status queries for special output ports
425  // ----------------------------------------------------------------------
426 
431  FwIndexType portNum
432  );
433 
438  FwIndexType portNum
439  );
440 
445  FwIndexType portNum
446  );
447 
448 #if FW_ENABLE_TEXT_LOGGING == 1
449 
453  bool isConnected_textEventOut_OutputPort(
454  FwIndexType portNum
455  );
456 
457 #endif
458 
463  FwIndexType portNum
464  );
465 
470  FwIndexType portNum
471  );
472 
473  PROTECTED:
474 
475  // ----------------------------------------------------------------------
476  // Connection status queries for typed output ports
477  // ----------------------------------------------------------------------
478 
483  FwIndexType portNum
484  );
485 
490  FwIndexType portNum
491  );
492 
493  PROTECTED:
494 
495  // ----------------------------------------------------------------------
496  // Handlers to implement for typed input ports
497  // ----------------------------------------------------------------------
498 
500  virtual void Run_handler(
501  FwIndexType portNum,
502  U32 context
503  ) = 0;
504 
507  FwIndexType portNum,
508  FwChanIdType id,
509  Fw::Time& timeTag,
510  Fw::TlmBuffer& val
511  ) = 0;
514 
516  virtual void TlmRecv_handler(
517  FwIndexType portNum,
518  FwChanIdType id,
519  Fw::Time& timeTag,
520  Fw::TlmBuffer& val
521  ) = 0;
522 
524  virtual void pingIn_handler(
525  FwIndexType portNum,
526  U32 key
527  ) = 0;
528 
529  PROTECTED:
530 
531  // ----------------------------------------------------------------------
532  // Port handler base-class functions for typed input ports
533  //
534  // Call these functions directly to bypass the corresponding ports
535  // ----------------------------------------------------------------------
536 
538  void Run_handlerBase(
539  FwIndexType portNum,
540  U32 context
541  );
542 
545  FwIndexType portNum,
546  FwChanIdType id,
547  Fw::Time& timeTag,
548  Fw::TlmBuffer& val
549  );
552 
554  void TlmRecv_handlerBase(
555  FwIndexType portNum,
556  FwChanIdType id,
557  Fw::Time& timeTag,
558  Fw::TlmBuffer& val
559  );
560 
562  void pingIn_handlerBase(
563  FwIndexType portNum,
564  U32 key
565  );
566 
567  PROTECTED:
568 
569  // ----------------------------------------------------------------------
570  // Pre-message hooks for typed async input ports
571  //
572  // Each of these functions is invoked just before processing a message
573  // on the corresponding port. By default, they do nothing. You can
574  // override them to provide specific pre-message behavior.
575  // ----------------------------------------------------------------------
576 
578  virtual void Run_preMsgHook(
579  FwIndexType portNum,
580  U32 context
581  );
582 
584  virtual void pingIn_preMsgHook(
585  FwIndexType portNum,
586  U32 key
587  );
588 
589  PROTECTED:
590 
591  // ----------------------------------------------------------------------
592  // Invocation functions for typed output ports
593  // ----------------------------------------------------------------------
594 
596  void PktSend_out(
597  FwIndexType portNum,
598  Fw::ComBuffer& data,
599  U32 context
600  );
601 
603  void pingOut_out(
604  FwIndexType portNum,
605  U32 key
606  );
607 
608  PROTECTED:
609 
610  // ----------------------------------------------------------------------
611  // Command response
612  // ----------------------------------------------------------------------
613 
615  void cmdResponse_out(
616  FwOpcodeType opCode,
617  U32 cmdSeq,
618  Fw::CmdResponse response
619  );
620 
621  PROTECTED:
622 
623  // ----------------------------------------------------------------------
624  // Command handlers to implement
625  // ----------------------------------------------------------------------
626 
630  virtual void SET_LEVEL_cmdHandler(
631  FwOpcodeType opCode,
632  U32 cmdSeq,
633  FwChanIdType level
634  ) = 0;
635 
639  virtual void SEND_PKT_cmdHandler(
640  FwOpcodeType opCode,
641  U32 cmdSeq,
642  U32 id
643  ) = 0;
644 
645  PROTECTED:
646 
647  // ----------------------------------------------------------------------
648  // Command handler base-class functions
649  //
650  // Call these functions directly to bypass the command input port
651  // ----------------------------------------------------------------------
652 
657  FwOpcodeType opCode,
658  U32 cmdSeq,
659  Fw::CmdArgBuffer& args
660  );
661 
666  FwOpcodeType opCode,
667  U32 cmdSeq,
668  Fw::CmdArgBuffer& args
669  );
670 
671  PROTECTED:
672 
673  // ----------------------------------------------------------------------
674  // Pre-message hooks for async commands
675  //
676  // Each of these functions is invoked just before processing the
677  // corresponding command. By default they do nothing. You can
678  // override them to provide specific pre-command behavior.
679  // ----------------------------------------------------------------------
680 
682  virtual void SET_LEVEL_preMsgHook(
683  FwOpcodeType opCode,
684  U32 cmdSeq
685  );
686 
688  virtual void SEND_PKT_preMsgHook(
689  FwOpcodeType opCode,
690  U32 cmdSeq
691  );
692 
693  PROTECTED:
694 
695  // ----------------------------------------------------------------------
696  // Event logging functions
697  // ----------------------------------------------------------------------
698 
703  FwChanIdType Id
704  ) const;
705 
710  FwChanIdType id
711  ) const;
712 
717  FwChanIdType level,
718  FwChanIdType max
719  ) const;
720 
725  U32 id
726  ) const;
727 
732  U32 id
733  ) const;
734 
735  PROTECTED:
736 
737  // ----------------------------------------------------------------------
738  // Telemetry write functions
739  // ----------------------------------------------------------------------
740 
744  void tlmWrite_SendLevel(
745  FwChanIdType arg,
746  Fw::Time _tlmTime = Fw::Time()
747  ) const;
748 
749  PROTECTED:
750 
751  // ----------------------------------------------------------------------
752  // Time
753  // ----------------------------------------------------------------------
754 
758  Fw::Time getTime() const;
759 
760  PRIVATE:
761 
762  // ----------------------------------------------------------------------
763  // Message dispatch functions
764  // ----------------------------------------------------------------------
765 
767  virtual MsgDispatchStatus doDispatch();
768 
769  PRIVATE:
770 
771  // ----------------------------------------------------------------------
772  // Calls for messages received on special input ports
773  // ----------------------------------------------------------------------
774 
776  static void m_p_cmdIn_in(
777  Fw::PassiveComponentBase* callComp,
778  FwIndexType portNum,
779  FwOpcodeType opCode,
780  U32 cmdSeq,
781  Fw::CmdArgBuffer& args
782  );
783 
784  PRIVATE:
785 
786  // ----------------------------------------------------------------------
787  // Calls for messages received on typed input ports
788  // ----------------------------------------------------------------------
789 
791  static void m_p_Run_in(
792  Fw::PassiveComponentBase* callComp,
793  FwIndexType portNum,
794  U32 context
795  );
796 
798  static Fw::TlmValid m_p_TlmGet_in(
799  Fw::PassiveComponentBase* callComp,
800  FwIndexType portNum,
801  FwChanIdType id,
802  Fw::Time& timeTag,
803  Fw::TlmBuffer& val
804  );
807 
809  static void m_p_TlmRecv_in(
810  Fw::PassiveComponentBase* callComp,
811  FwIndexType portNum,
812  FwChanIdType id,
813  Fw::Time& timeTag,
814  Fw::TlmBuffer& val
815  );
816 
818  static void m_p_pingIn_in(
819  Fw::PassiveComponentBase* callComp,
820  FwIndexType portNum,
821  U32 key
822  );
823 
824  PRIVATE:
825 
826  // ----------------------------------------------------------------------
827  // Special input ports
828  // ----------------------------------------------------------------------
829 
831  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
832 
833  PRIVATE:
834 
835  // ----------------------------------------------------------------------
836  // Typed input ports
837  // ----------------------------------------------------------------------
838 
840  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
841 
843  Fw::InputTlmGetPort m_TlmGet_InputPort[NUM_TLMGET_INPUT_PORTS];
844 
846  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
847 
849  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
850 
851  PRIVATE:
852 
853  // ----------------------------------------------------------------------
854  // Special output ports
855  // ----------------------------------------------------------------------
856 
858  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
859 
861  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
862 
864  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
865 
866 #if FW_ENABLE_TEXT_LOGGING == 1
867 
869  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
870 
871 #endif
872 
874  Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS];
875 
877  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
878 
879  PRIVATE:
880 
881  // ----------------------------------------------------------------------
882  // Typed output ports
883  // ----------------------------------------------------------------------
884 
886  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
887 
889  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
890 
891  };
892 
893 }
894 
895 #endif
void SEND_PKT_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
friend class TlmPacketizerTesterBase
Friend class tester to support autocoded test harness.
Definition: Time.hpp:9
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
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.
void log_WARNING_LO_NoChan(FwChanIdType Id) const
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:26
void tlmWrite_SendLevel(FwChanIdType arg, Fw::Time _tlmTime=Fw::Time()) const
Telemetry channel is not part of a telemetry packet.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
Fw::InputTlmGetPort * get_TlmGet_InputPort(FwIndexType portNum)
virtual void Run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port Run.
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].
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.
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.
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)
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.
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.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
Auto-generated base for TlmPacketizer component.