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"
32 
33 namespace Svc {
34 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
50  friend class TlmPacketizerTester;
51 
52  PROTECTED:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
59  enum {
61  };
62 
64  enum {
69  };
70 
72  enum {
79  };
80 
82  enum {
85  };
86 
88  enum {
91  };
92 
94  enum {
100  };
101 
103  enum {
105  };
106 
107  public:
108 
109  // ----------------------------------------------------------------------
110  // Component initialization
111  // ----------------------------------------------------------------------
112 
114  void init(
115  FwSizeType queueDepth,
116  FwEnumStoreType instance = 0
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Getters for special input ports
123  // ----------------------------------------------------------------------
124 
129  FwIndexType portNum
130  );
131 
132  public:
133 
134  // ----------------------------------------------------------------------
135  // Getters for typed input ports
136  // ----------------------------------------------------------------------
137 
142  FwIndexType portNum
143  );
144 
149  FwIndexType portNum
150  );
151 
156  FwIndexType portNum
157  );
158 
163  FwIndexType portNum
164  );
165 
166  public:
167 
168  // ----------------------------------------------------------------------
169  // Connect input ports to special output ports
170  // ----------------------------------------------------------------------
171 
174  FwIndexType portNum,
175  Fw::InputCmdRegPort* port
176  );
177 
180  FwIndexType portNum,
182  );
183 
186  FwIndexType portNum,
187  Fw::InputLogPort* port
188  );
189 
190 #if FW_ENABLE_TEXT_LOGGING == 1
191 
193  void set_textEventOut_OutputPort(
194  FwIndexType portNum,
195  Fw::InputLogTextPort* port
196  );
197 
198 #endif
199 
202  FwIndexType portNum,
203  Fw::InputTimePort* port
204  );
205 
208  FwIndexType portNum,
209  Fw::InputTlmPort* port
210  );
211 
212  public:
213 
214  // ----------------------------------------------------------------------
215  // Connect typed input ports to typed output ports
216  // ----------------------------------------------------------------------
217 
220  FwIndexType portNum,
221  Fw::InputComPort* port
222  );
223 
226  FwIndexType portNum,
227  Svc::InputPingPort* port
228  );
229 
230 #if FW_PORT_SERIALIZATION
231 
232  public:
233 
234  // ----------------------------------------------------------------------
235  // Connect serial input ports to special output ports
236  // ----------------------------------------------------------------------
237 
240  FwIndexType portNum,
241  Fw::InputSerializePort* port
242  );
243 
246  FwIndexType portNum,
247  Fw::InputSerializePort* port
248  );
249 
252  FwIndexType portNum,
253  Fw::InputSerializePort* port
254  );
255 
256 #if FW_ENABLE_TEXT_LOGGING == 1
257 
259  void set_textEventOut_OutputPort(
260  FwIndexType portNum,
261  Fw::InputSerializePort* port
262  );
263 
264 #endif
265 
268  FwIndexType portNum,
269  Fw::InputSerializePort* port
270  );
271 
274  FwIndexType portNum,
275  Fw::InputSerializePort* port
276  );
277 
278 #endif
279 
280 #if FW_PORT_SERIALIZATION
281 
282  public:
283 
284  // ----------------------------------------------------------------------
285  // Connect serial input ports to typed output ports
286  // ----------------------------------------------------------------------
287 
290  FwIndexType portNum,
291  Fw::InputSerializePort* port
292  );
293 
296  FwIndexType portNum,
297  Fw::InputSerializePort* port
298  );
299 
300 #endif
301 
302  public:
303 
304  // ----------------------------------------------------------------------
305  // Command registration
306  // ----------------------------------------------------------------------
307 
311  void regCommands();
312 
313  PROTECTED:
314 
315  // ----------------------------------------------------------------------
316  // Component construction and destruction
317  // ----------------------------------------------------------------------
318 
321  const char* compName = ""
322  );
323 
325  virtual ~TlmPacketizerComponentBase();
326 
327  PROTECTED:
328 
329  // ----------------------------------------------------------------------
330  // Getters for numbers of special input ports
331  // ----------------------------------------------------------------------
332 
337 
338  PROTECTED:
339 
340  // ----------------------------------------------------------------------
341  // Getters for numbers of typed input ports
342  // ----------------------------------------------------------------------
343 
348 
353 
358 
363 
364  PROTECTED:
365 
366  // ----------------------------------------------------------------------
367  // Getters for numbers of special output ports
368  // ----------------------------------------------------------------------
369 
374 
379 
384 
385 #if FW_ENABLE_TEXT_LOGGING == 1
386 
390  FwIndexType getNum_textEventOut_OutputPorts() const;
391 
392 #endif
393 
398 
403 
404  PROTECTED:
405 
406  // ----------------------------------------------------------------------
407  // Getters for numbers of typed output ports
408  // ----------------------------------------------------------------------
409 
414 
419 
420  PROTECTED:
421 
422  // ----------------------------------------------------------------------
423  // Connection status queries for special output ports
424  // ----------------------------------------------------------------------
425 
430  FwIndexType portNum
431  );
432 
437  FwIndexType portNum
438  );
439 
444  FwIndexType portNum
445  );
446 
447 #if FW_ENABLE_TEXT_LOGGING == 1
448 
452  bool isConnected_textEventOut_OutputPort(
453  FwIndexType portNum
454  );
455 
456 #endif
457 
462  FwIndexType portNum
463  );
464 
469  FwIndexType portNum
470  );
471 
472  PROTECTED:
473 
474  // ----------------------------------------------------------------------
475  // Connection status queries for typed output ports
476  // ----------------------------------------------------------------------
477 
482  FwIndexType portNum
483  );
484 
489  FwIndexType portNum
490  );
491 
492  PROTECTED:
493 
494  // ----------------------------------------------------------------------
495  // Handlers to implement for typed input ports
496  // ----------------------------------------------------------------------
497 
499  virtual void Run_handler(
500  FwIndexType portNum,
501  U32 context
502  ) = 0;
503 
506  FwIndexType portNum,
507  FwChanIdType id,
508  Fw::Time& timeTag,
509  Fw::TlmBuffer& val
510  ) = 0;
513 
515  virtual void TlmRecv_handler(
516  FwIndexType portNum,
517  FwChanIdType id,
518  Fw::Time& timeTag,
519  Fw::TlmBuffer& val
520  ) = 0;
521 
523  virtual void pingIn_handler(
524  FwIndexType portNum,
525  U32 key
526  ) = 0;
527 
528  PROTECTED:
529 
530  // ----------------------------------------------------------------------
531  // Port handler base-class functions for typed input ports
532  //
533  // Call these functions directly to bypass the corresponding ports
534  // ----------------------------------------------------------------------
535 
537  void Run_handlerBase(
538  FwIndexType portNum,
539  U32 context
540  );
541 
544  FwIndexType portNum,
545  FwChanIdType id,
546  Fw::Time& timeTag,
547  Fw::TlmBuffer& val
548  );
551 
553  void TlmRecv_handlerBase(
554  FwIndexType portNum,
555  FwChanIdType id,
556  Fw::Time& timeTag,
557  Fw::TlmBuffer& val
558  );
559 
561  void pingIn_handlerBase(
562  FwIndexType portNum,
563  U32 key
564  );
565 
566  PROTECTED:
567 
568  // ----------------------------------------------------------------------
569  // Pre-message hooks for typed async input ports
570  //
571  // Each of these functions is invoked just before processing a message
572  // on the corresponding port. By default, they do nothing. You can
573  // override them to provide specific pre-message behavior.
574  // ----------------------------------------------------------------------
575 
577  virtual void Run_preMsgHook(
578  FwIndexType portNum,
579  U32 context
580  );
581 
583  virtual void pingIn_preMsgHook(
584  FwIndexType portNum,
585  U32 key
586  );
587 
588  PROTECTED:
589 
590  // ----------------------------------------------------------------------
591  // Invocation functions for typed output ports
592  // ----------------------------------------------------------------------
593 
595  void PktSend_out(
596  FwIndexType portNum,
597  Fw::ComBuffer& data,
598  U32 context
599  );
600 
602  void pingOut_out(
603  FwIndexType portNum,
604  U32 key
605  );
606 
607  PROTECTED:
608 
609  // ----------------------------------------------------------------------
610  // Command response
611  // ----------------------------------------------------------------------
612 
614  void cmdResponse_out(
615  FwOpcodeType opCode,
616  U32 cmdSeq,
617  Fw::CmdResponse response
618  );
619 
620  PROTECTED:
621 
622  // ----------------------------------------------------------------------
623  // Command handlers to implement
624  // ----------------------------------------------------------------------
625 
629  virtual void SET_LEVEL_cmdHandler(
630  FwOpcodeType opCode,
631  U32 cmdSeq,
632  U32 level
633  ) = 0;
634 
638  virtual void SEND_PKT_cmdHandler(
639  FwOpcodeType opCode,
640  U32 cmdSeq,
641  U32 id
642  ) = 0;
643 
644  PROTECTED:
645 
646  // ----------------------------------------------------------------------
647  // Command handler base-class functions
648  //
649  // Call these functions directly to bypass the command input port
650  // ----------------------------------------------------------------------
651 
656  FwOpcodeType opCode,
657  U32 cmdSeq,
658  Fw::CmdArgBuffer& args
659  );
660 
665  FwOpcodeType opCode,
666  U32 cmdSeq,
667  Fw::CmdArgBuffer& args
668  );
669 
670  PROTECTED:
671 
672  // ----------------------------------------------------------------------
673  // Pre-message hooks for async commands
674  //
675  // Each of these functions is invoked just before processing the
676  // corresponding command. By default they do nothing. You can
677  // override them to provide specific pre-command behavior.
678  // ----------------------------------------------------------------------
679 
681  virtual void SET_LEVEL_preMsgHook(
682  FwOpcodeType opCode,
683  U32 cmdSeq
684  );
685 
687  virtual void SEND_PKT_preMsgHook(
688  FwOpcodeType opCode,
689  U32 cmdSeq
690  );
691 
692  PROTECTED:
693 
694  // ----------------------------------------------------------------------
695  // Event logging functions
696  // ----------------------------------------------------------------------
697 
702  U32 Id
703  ) const;
704 
709  U32 id
710  ) const;
711 
716  U32 level,
717  U32 max
718  ) const;
719 
724  U32 id
725  ) const;
726 
731  U32 id
732  ) const;
733 
734  PROTECTED:
735 
736  // ----------------------------------------------------------------------
737  // Telemetry write functions
738  // ----------------------------------------------------------------------
739 
743  void tlmWrite_SendLevel(
744  U32 arg,
745  Fw::Time _tlmTime = Fw::Time()
746  ) const;
747 
748  PROTECTED:
749 
750  // ----------------------------------------------------------------------
751  // Time
752  // ----------------------------------------------------------------------
753 
757  Fw::Time getTime() const;
758 
759  PRIVATE:
760 
761  // ----------------------------------------------------------------------
762  // Message dispatch functions
763  // ----------------------------------------------------------------------
764 
766  virtual MsgDispatchStatus doDispatch();
767 
768  PRIVATE:
769 
770  // ----------------------------------------------------------------------
771  // Calls for messages received on special input ports
772  // ----------------------------------------------------------------------
773 
775  static void m_p_cmdIn_in(
776  Fw::PassiveComponentBase* callComp,
777  FwIndexType portNum,
778  FwOpcodeType opCode,
779  U32 cmdSeq,
780  Fw::CmdArgBuffer& args
781  );
782 
783  PRIVATE:
784 
785  // ----------------------------------------------------------------------
786  // Calls for messages received on typed input ports
787  // ----------------------------------------------------------------------
788 
790  static void m_p_Run_in(
791  Fw::PassiveComponentBase* callComp,
792  FwIndexType portNum,
793  U32 context
794  );
795 
797  static Fw::TlmValid m_p_TlmGet_in(
798  Fw::PassiveComponentBase* callComp,
799  FwIndexType portNum,
800  FwChanIdType id,
801  Fw::Time& timeTag,
802  Fw::TlmBuffer& val
803  );
806 
808  static void m_p_TlmRecv_in(
809  Fw::PassiveComponentBase* callComp,
810  FwIndexType portNum,
811  FwChanIdType id,
812  Fw::Time& timeTag,
813  Fw::TlmBuffer& val
814  );
815 
817  static void m_p_pingIn_in(
818  Fw::PassiveComponentBase* callComp,
819  FwIndexType portNum,
820  U32 key
821  );
822 
823  PRIVATE:
824 
825  // ----------------------------------------------------------------------
826  // Special input ports
827  // ----------------------------------------------------------------------
828 
830  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
831 
832  PRIVATE:
833 
834  // ----------------------------------------------------------------------
835  // Typed input ports
836  // ----------------------------------------------------------------------
837 
839  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
840 
842  Fw::InputTlmGetPort m_TlmGet_InputPort[NUM_TLMGET_INPUT_PORTS];
843 
845  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
846 
848  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
849 
850  PRIVATE:
851 
852  // ----------------------------------------------------------------------
853  // Special output ports
854  // ----------------------------------------------------------------------
855 
857  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
858 
860  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
861 
863  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
864 
865 #if FW_ENABLE_TEXT_LOGGING == 1
866 
868  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
869 
870 #endif
871 
873  Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS];
874 
876  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
877 
878  PRIVATE:
879 
880  // ----------------------------------------------------------------------
881  // Typed output ports
882  // ----------------------------------------------------------------------
883 
885  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
886 
888  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
889 
890  };
891 
892 }
893 
894 #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].
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.
U32 FwChanIdType
The type of a telemetry channel identifier.
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 ~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
U32 FwOpcodeType
The type of a command opcode.
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.
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.
void log_WARNING_LO_MaxLevelExceed(U32 level, U32 max) const
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
virtual void SET_LEVEL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 level)=0
virtual void SEND_PKT_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 id)=0
void tlmWrite_SendLevel(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
PlatformIndexType FwIndexType
TlmPacketizerComponentBase(const char *compName="")
Construct TlmPacketizerComponentBase object.
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.
Telemetry channel is not part of a telemetry packet.