F´ Flight Software - C/C++ Documentation  devel
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 "FpConfig.hpp"
11 #include "Fw/Cmd/CmdPortAc.hpp"
12 #include "Fw/Cmd/CmdRegPortAc.hpp"
14 #include "Fw/Cmd/CmdString.hpp"
15 #include "Fw/Com/ComPortAc.hpp"
17 #include "Fw/Log/LogPortAc.hpp"
18 #include "Fw/Log/LogString.hpp"
19 #if FW_ENABLE_TEXT_LOGGING == 1
20 #include "Fw/Log/LogTextPortAc.hpp"
21 #endif
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Fw/Tlm/TlmPortAc.hpp"
26 #include "Fw/Tlm/TlmString.hpp"
27 #include "Svc/Ping/PingPortAc.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
46 
47  PROTECTED:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
56  };
57 
59  enum {
63  };
64 
66  enum {
73  };
74 
76  enum {
79  };
80 
82  enum {
85  };
86 
88  enum {
94  };
95 
97  enum {
99  };
100 
101  public:
102 
103  // ----------------------------------------------------------------------
104  // Component initialization
105  // ----------------------------------------------------------------------
106 
108  void init(
109  FwQueueSizeType queueDepth,
110  FwEnumStoreType instance = 0
111  );
112 
113  public:
114 
115  // ----------------------------------------------------------------------
116  // Getters for special input ports
117  // ----------------------------------------------------------------------
118 
123  FwIndexType portNum
124  );
125 
126  public:
127 
128  // ----------------------------------------------------------------------
129  // Getters for typed input ports
130  // ----------------------------------------------------------------------
131 
136  FwIndexType portNum
137  );
138 
143  FwIndexType portNum
144  );
145 
150  FwIndexType portNum
151  );
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Connect input ports to special output ports
157  // ----------------------------------------------------------------------
158 
161  FwIndexType portNum,
162  Fw::InputCmdRegPort* port
163  );
164 
167  FwIndexType portNum,
169  );
170 
173  FwIndexType portNum,
174  Fw::InputLogPort* port
175  );
176 
177 #if FW_ENABLE_TEXT_LOGGING == 1
178 
180  void set_textEventOut_OutputPort(
181  FwIndexType portNum,
182  Fw::InputLogTextPort* port
183  );
184 
185 #endif
186 
189  FwIndexType portNum,
190  Fw::InputTimePort* port
191  );
192 
195  FwIndexType portNum,
196  Fw::InputTlmPort* port
197  );
198 
199  public:
200 
201  // ----------------------------------------------------------------------
202  // Connect typed input ports to typed output ports
203  // ----------------------------------------------------------------------
204 
207  FwIndexType portNum,
208  Fw::InputComPort* port
209  );
210 
213  FwIndexType portNum,
214  Svc::InputPingPort* port
215  );
216 
217 #if FW_PORT_SERIALIZATION
218 
219  public:
220 
221  // ----------------------------------------------------------------------
222  // Connect serial input ports to special output ports
223  // ----------------------------------------------------------------------
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
243 #if FW_ENABLE_TEXT_LOGGING == 1
244 
246  void set_textEventOut_OutputPort(
247  FwIndexType portNum,
248  Fw::InputSerializePort* port
249  );
250 
251 #endif
252 
255  FwIndexType portNum,
256  Fw::InputSerializePort* port
257  );
258 
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
265 #endif
266 
267 #if FW_PORT_SERIALIZATION
268 
269  public:
270 
271  // ----------------------------------------------------------------------
272  // Connect serial input ports to typed output ports
273  // ----------------------------------------------------------------------
274 
277  FwIndexType portNum,
278  Fw::InputSerializePort* port
279  );
280 
283  FwIndexType portNum,
284  Fw::InputSerializePort* port
285  );
286 
287 #endif
288 
289  public:
290 
291  // ----------------------------------------------------------------------
292  // Command registration
293  // ----------------------------------------------------------------------
294 
298  void regCommands();
299 
300  PROTECTED:
301 
302  // ----------------------------------------------------------------------
303  // Component construction and destruction
304  // ----------------------------------------------------------------------
305 
308  const char* compName = ""
309  );
310 
312  virtual ~TlmPacketizerComponentBase();
313 
314  PROTECTED:
315 
316  // ----------------------------------------------------------------------
317  // Getters for numbers of special input ports
318  // ----------------------------------------------------------------------
319 
324 
325  PROTECTED:
326 
327  // ----------------------------------------------------------------------
328  // Getters for numbers of typed input ports
329  // ----------------------------------------------------------------------
330 
335 
340 
345 
346  PROTECTED:
347 
348  // ----------------------------------------------------------------------
349  // Getters for numbers of special output ports
350  // ----------------------------------------------------------------------
351 
356 
361 
366 
367 #if FW_ENABLE_TEXT_LOGGING == 1
368 
372  FwIndexType getNum_textEventOut_OutputPorts() const;
373 
374 #endif
375 
380 
385 
386  PROTECTED:
387 
388  // ----------------------------------------------------------------------
389  // Getters for numbers of typed output ports
390  // ----------------------------------------------------------------------
391 
396 
401 
402  PROTECTED:
403 
404  // ----------------------------------------------------------------------
405  // Connection status queries for special output ports
406  // ----------------------------------------------------------------------
407 
412  FwIndexType portNum
413  );
414 
419  FwIndexType portNum
420  );
421 
426  FwIndexType portNum
427  );
428 
429 #if FW_ENABLE_TEXT_LOGGING == 1
430 
434  bool isConnected_textEventOut_OutputPort(
435  FwIndexType portNum
436  );
437 
438 #endif
439 
444  FwIndexType portNum
445  );
446 
451  FwIndexType portNum
452  );
453 
454  PROTECTED:
455 
456  // ----------------------------------------------------------------------
457  // Connection status queries for typed output ports
458  // ----------------------------------------------------------------------
459 
464  FwIndexType portNum
465  );
466 
471  FwIndexType portNum
472  );
473 
474  PROTECTED:
475 
476  // ----------------------------------------------------------------------
477  // Handlers to implement for typed input ports
478  // ----------------------------------------------------------------------
479 
481  virtual void Run_handler(
482  FwIndexType portNum,
483  U32 context
484  ) = 0;
485 
487  virtual void TlmRecv_handler(
488  FwIndexType portNum,
489  FwChanIdType id,
490  Fw::Time& timeTag,
491  Fw::TlmBuffer& val
492  ) = 0;
493 
495  virtual void pingIn_handler(
496  FwIndexType portNum,
497  U32 key
498  ) = 0;
499 
500  PROTECTED:
501 
502  // ----------------------------------------------------------------------
503  // Port handler base-class functions for typed input ports
504  //
505  // Call these functions directly to bypass the corresponding ports
506  // ----------------------------------------------------------------------
507 
509  void Run_handlerBase(
510  FwIndexType portNum,
511  U32 context
512  );
513 
515  void TlmRecv_handlerBase(
516  FwIndexType portNum,
517  FwChanIdType id,
518  Fw::Time& timeTag,
519  Fw::TlmBuffer& val
520  );
521 
523  void pingIn_handlerBase(
524  FwIndexType portNum,
525  U32 key
526  );
527 
528  PROTECTED:
529 
530  // ----------------------------------------------------------------------
531  // Pre-message hooks for typed async input ports
532  //
533  // Each of these functions is invoked just before processing a message
534  // on the corresponding port. By default, they do nothing. You can
535  // override them to provide specific pre-message behavior.
536  // ----------------------------------------------------------------------
537 
539  virtual void Run_preMsgHook(
540  FwIndexType portNum,
541  U32 context
542  );
543 
545  virtual void pingIn_preMsgHook(
546  FwIndexType portNum,
547  U32 key
548  );
549 
550  PROTECTED:
551 
552  // ----------------------------------------------------------------------
553  // Invocation functions for typed output ports
554  // ----------------------------------------------------------------------
555 
557  void PktSend_out(
558  FwIndexType portNum,
559  Fw::ComBuffer& data,
560  U32 context
561  );
562 
564  void pingOut_out(
565  FwIndexType portNum,
566  U32 key
567  );
568 
569  PROTECTED:
570 
571  // ----------------------------------------------------------------------
572  // Command response
573  // ----------------------------------------------------------------------
574 
576  void cmdResponse_out(
577  FwOpcodeType opCode,
578  U32 cmdSeq,
579  Fw::CmdResponse response
580  );
581 
582  PROTECTED:
583 
584  // ----------------------------------------------------------------------
585  // Command handlers to implement
586  // ----------------------------------------------------------------------
587 
591  virtual void SET_LEVEL_cmdHandler(
592  FwOpcodeType opCode,
593  U32 cmdSeq,
594  U32 level
595  ) = 0;
596 
600  virtual void SEND_PKT_cmdHandler(
601  FwOpcodeType opCode,
602  U32 cmdSeq,
603  U32 id
604  ) = 0;
605 
606  PROTECTED:
607 
608  // ----------------------------------------------------------------------
609  // Command handler base-class functions
610  //
611  // Call these functions directly to bypass the command input port
612  // ----------------------------------------------------------------------
613 
618  FwOpcodeType opCode,
619  U32 cmdSeq,
620  Fw::CmdArgBuffer& args
621  );
622 
627  FwOpcodeType opCode,
628  U32 cmdSeq,
629  Fw::CmdArgBuffer& args
630  );
631 
632  PROTECTED:
633 
634  // ----------------------------------------------------------------------
635  // Pre-message hooks for async commands
636  //
637  // Each of these functions is invoked just before processing the
638  // corresponding command. By default they do nothing. You can
639  // override them to provide specific pre-command behavior.
640  // ----------------------------------------------------------------------
641 
643  virtual void SET_LEVEL_preMsgHook(
644  FwOpcodeType opCode,
645  U32 cmdSeq
646  );
647 
649  virtual void SEND_PKT_preMsgHook(
650  FwOpcodeType opCode,
651  U32 cmdSeq
652  );
653 
654  PROTECTED:
655 
656  // ----------------------------------------------------------------------
657  // Event logging functions
658  // ----------------------------------------------------------------------
659 
664  U32 Id
665  );
666 
671  U32 id
672  );
673 
678  U32 level,
679  U32 max
680  );
681 
686  U32 id
687  );
688 
693  U32 id
694  );
695 
696  PROTECTED:
697 
698  // ----------------------------------------------------------------------
699  // Telemetry write functions
700  // ----------------------------------------------------------------------
701 
705  void tlmWrite_SendLevel(
706  U32 arg,
707  Fw::Time _tlmTime = Fw::Time()
708  );
709 
710  PROTECTED:
711 
712  // ----------------------------------------------------------------------
713  // Time
714  // ----------------------------------------------------------------------
715 
719  Fw::Time getTime();
720 
721  PRIVATE:
722 
723  // ----------------------------------------------------------------------
724  // Message dispatch functions
725  // ----------------------------------------------------------------------
726 
728  virtual MsgDispatchStatus doDispatch();
729 
730  PRIVATE:
731 
732  // ----------------------------------------------------------------------
733  // Calls for messages received on special input ports
734  // ----------------------------------------------------------------------
735 
737  static void m_p_cmdIn_in(
738  Fw::PassiveComponentBase* callComp,
739  FwIndexType portNum,
740  FwOpcodeType opCode,
741  U32 cmdSeq,
742  Fw::CmdArgBuffer& args
743  );
744 
745  PRIVATE:
746 
747  // ----------------------------------------------------------------------
748  // Calls for messages received on typed input ports
749  // ----------------------------------------------------------------------
750 
752  static void m_p_Run_in(
753  Fw::PassiveComponentBase* callComp,
754  FwIndexType portNum,
755  U32 context
756  );
757 
759  static void m_p_TlmRecv_in(
760  Fw::PassiveComponentBase* callComp,
761  FwIndexType portNum,
762  FwChanIdType id,
763  Fw::Time& timeTag,
764  Fw::TlmBuffer& val
765  );
766 
768  static void m_p_pingIn_in(
769  Fw::PassiveComponentBase* callComp,
770  FwIndexType portNum,
771  U32 key
772  );
773 
774  PRIVATE:
775 
776  // ----------------------------------------------------------------------
777  // Special input ports
778  // ----------------------------------------------------------------------
779 
781  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
782 
783  PRIVATE:
784 
785  // ----------------------------------------------------------------------
786  // Typed input ports
787  // ----------------------------------------------------------------------
788 
790  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
791 
793  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
794 
796  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
797 
798  PRIVATE:
799 
800  // ----------------------------------------------------------------------
801  // Special output ports
802  // ----------------------------------------------------------------------
803 
805  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
806 
808  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
809 
811  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
812 
813 #if FW_ENABLE_TEXT_LOGGING == 1
814 
816  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
817 
818 #endif
819 
821  Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS];
822 
824  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
825 
826  PRIVATE:
827 
828  // ----------------------------------------------------------------------
829  // Typed output ports
830  // ----------------------------------------------------------------------
831 
833  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
834 
836  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
837 
838  };
839 
840 }
841 
842 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:51
U32 FwChanIdType
Definition: FpConfig.h:82
FwIndexType FwQueueSizeType
Definition: FpConfig.h:117
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 TlmPacketizer component.
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
void regCommands()
Register commands with the Command Dispatcher.
virtual void SET_LEVEL_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_LEVEL.
void set_timeGetOut_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeGetOut[portNum].
virtual void Run_handler(FwIndexType portNum, U32 context)=0
Handler for input port Run.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void TlmRecv_handlerBase(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Handler base-class function for input port TlmRecv.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
void tlmWrite_SendLevel(U32 arg, Fw::Time _tlmTime=Fw::Time())
Fw::InputTlmPort * get_TlmRecv_InputPort(FwIndexType portNum)
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
virtual void SEND_PKT_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 id)=0
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
@ CHANNELID_SENDLEVEL
Channel ID for SendLevel.
void SET_LEVEL_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual ~TlmPacketizerComponentBase()
Destroy TlmPacketizerComponentBase object.
@ EVENTID_NOCHAN
Telemetry channel is not part of a telemetry packet.
@ EVENTID_LEVELSET
Telemetry send level set.
@ EVENTID_PACKETNOTFOUND
Couldn't find the packet to send.
@ EVENTID_MAXLEVELEXCEED
Telemetry send level set.
friend class TlmPacketizerComponentBaseFriend
Friend class for white-box testing.
virtual void Run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port Run.
Svc::InputSchedPort * get_Run_InputPort(FwIndexType portNum)
@ OPCODE_SEND_PKT
Force a packet to be sent.
@ OPCODE_SET_LEVEL
Set telemetry send level.
virtual void TlmRecv_handler(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)=0
Handler for input port TlmRecv.
void log_WARNING_LO_MaxLevelExceed(U32 level, U32 max)
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
TlmPacketizerComponentBase(const char *compName="")
Construct TlmPacketizerComponentBase object.
virtual void SEND_PKT_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SEND_PKT.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum)
void Run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port Run.
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void SEND_PKT_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
virtual void SET_LEVEL_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 level)=0