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/TlmPortAc.hpp"
28 #include "Fw/Tlm/TlmString.hpp"
29 #include "Svc/Ping/PingPortAc.hpp"
31 
32 namespace Svc {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
50 
51  PROTECTED:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
60  };
61 
63  enum {
67  };
68 
70  enum {
77  };
78 
80  enum {
83  };
84 
86  enum {
89  };
90 
92  enum {
98  };
99 
101  enum {
103  };
104 
105  public:
106 
107  // ----------------------------------------------------------------------
108  // Component initialization
109  // ----------------------------------------------------------------------
110 
112  void init(
113  FwSizeType queueDepth,
114  FwEnumStoreType instance = 0
115  );
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Getters for special input ports
121  // ----------------------------------------------------------------------
122 
127  FwIndexType portNum
128  );
129 
130  public:
131 
132  // ----------------------------------------------------------------------
133  // Getters for typed input ports
134  // ----------------------------------------------------------------------
135 
140  FwIndexType portNum
141  );
142 
147  FwIndexType portNum
148  );
149 
154  FwIndexType portNum
155  );
156 
157  public:
158 
159  // ----------------------------------------------------------------------
160  // Connect input ports to special output ports
161  // ----------------------------------------------------------------------
162 
165  FwIndexType portNum,
166  Fw::InputCmdRegPort* port
167  );
168 
171  FwIndexType portNum,
173  );
174 
177  FwIndexType portNum,
178  Fw::InputLogPort* port
179  );
180 
181 #if FW_ENABLE_TEXT_LOGGING == 1
182 
184  void set_textEventOut_OutputPort(
185  FwIndexType portNum,
186  Fw::InputLogTextPort* port
187  );
188 
189 #endif
190 
193  FwIndexType portNum,
194  Fw::InputTimePort* port
195  );
196 
199  FwIndexType portNum,
200  Fw::InputTlmPort* port
201  );
202 
203  public:
204 
205  // ----------------------------------------------------------------------
206  // Connect typed input ports to typed output ports
207  // ----------------------------------------------------------------------
208 
211  FwIndexType portNum,
212  Fw::InputComPort* port
213  );
214 
217  FwIndexType portNum,
218  Svc::InputPingPort* port
219  );
220 
221 #if FW_PORT_SERIALIZATION
222 
223  public:
224 
225  // ----------------------------------------------------------------------
226  // Connect serial input ports to special output ports
227  // ----------------------------------------------------------------------
228 
231  FwIndexType portNum,
232  Fw::InputSerializePort* port
233  );
234 
237  FwIndexType portNum,
238  Fw::InputSerializePort* port
239  );
240 
243  FwIndexType portNum,
244  Fw::InputSerializePort* port
245  );
246 
247 #if FW_ENABLE_TEXT_LOGGING == 1
248 
250  void set_textEventOut_OutputPort(
251  FwIndexType portNum,
252  Fw::InputSerializePort* port
253  );
254 
255 #endif
256 
259  FwIndexType portNum,
260  Fw::InputSerializePort* port
261  );
262 
265  FwIndexType portNum,
266  Fw::InputSerializePort* port
267  );
268 
269 #endif
270 
271 #if FW_PORT_SERIALIZATION
272 
273  public:
274 
275  // ----------------------------------------------------------------------
276  // Connect serial input ports to typed output ports
277  // ----------------------------------------------------------------------
278 
281  FwIndexType portNum,
282  Fw::InputSerializePort* port
283  );
284 
287  FwIndexType portNum,
288  Fw::InputSerializePort* port
289  );
290 
291 #endif
292 
293  public:
294 
295  // ----------------------------------------------------------------------
296  // Command registration
297  // ----------------------------------------------------------------------
298 
302  void regCommands();
303 
304  PROTECTED:
305 
306  // ----------------------------------------------------------------------
307  // Component construction and destruction
308  // ----------------------------------------------------------------------
309 
312  const char* compName = ""
313  );
314 
316  virtual ~TlmPacketizerComponentBase();
317 
318  PROTECTED:
319 
320  // ----------------------------------------------------------------------
321  // Getters for numbers of special input ports
322  // ----------------------------------------------------------------------
323 
328 
329  PROTECTED:
330 
331  // ----------------------------------------------------------------------
332  // Getters for numbers of typed input ports
333  // ----------------------------------------------------------------------
334 
339 
344 
349 
350  PROTECTED:
351 
352  // ----------------------------------------------------------------------
353  // Getters for numbers of special output ports
354  // ----------------------------------------------------------------------
355 
360 
365 
370 
371 #if FW_ENABLE_TEXT_LOGGING == 1
372 
376  FwIndexType getNum_textEventOut_OutputPorts() const;
377 
378 #endif
379 
384 
389 
390  PROTECTED:
391 
392  // ----------------------------------------------------------------------
393  // Getters for numbers of typed output ports
394  // ----------------------------------------------------------------------
395 
400 
405 
406  PROTECTED:
407 
408  // ----------------------------------------------------------------------
409  // Connection status queries for special output ports
410  // ----------------------------------------------------------------------
411 
416  FwIndexType portNum
417  );
418 
423  FwIndexType portNum
424  );
425 
430  FwIndexType portNum
431  );
432 
433 #if FW_ENABLE_TEXT_LOGGING == 1
434 
438  bool isConnected_textEventOut_OutputPort(
439  FwIndexType portNum
440  );
441 
442 #endif
443 
448  FwIndexType portNum
449  );
450 
455  FwIndexType portNum
456  );
457 
458  PROTECTED:
459 
460  // ----------------------------------------------------------------------
461  // Connection status queries for typed output ports
462  // ----------------------------------------------------------------------
463 
468  FwIndexType portNum
469  );
470 
475  FwIndexType portNum
476  );
477 
478  PROTECTED:
479 
480  // ----------------------------------------------------------------------
481  // Handlers to implement for typed input ports
482  // ----------------------------------------------------------------------
483 
485  virtual void Run_handler(
486  FwIndexType portNum,
487  U32 context
488  ) = 0;
489 
491  virtual void TlmRecv_handler(
492  FwIndexType portNum,
493  FwChanIdType id,
494  Fw::Time& timeTag,
495  Fw::TlmBuffer& val
496  ) = 0;
497 
499  virtual void pingIn_handler(
500  FwIndexType portNum,
501  U32 key
502  ) = 0;
503 
504  PROTECTED:
505 
506  // ----------------------------------------------------------------------
507  // Port handler base-class functions for typed input ports
508  //
509  // Call these functions directly to bypass the corresponding ports
510  // ----------------------------------------------------------------------
511 
513  void Run_handlerBase(
514  FwIndexType portNum,
515  U32 context
516  );
517 
519  void TlmRecv_handlerBase(
520  FwIndexType portNum,
521  FwChanIdType id,
522  Fw::Time& timeTag,
523  Fw::TlmBuffer& val
524  );
525 
527  void pingIn_handlerBase(
528  FwIndexType portNum,
529  U32 key
530  );
531 
532  PROTECTED:
533 
534  // ----------------------------------------------------------------------
535  // Pre-message hooks for typed async input ports
536  //
537  // Each of these functions is invoked just before processing a message
538  // on the corresponding port. By default, they do nothing. You can
539  // override them to provide specific pre-message behavior.
540  // ----------------------------------------------------------------------
541 
543  virtual void Run_preMsgHook(
544  FwIndexType portNum,
545  U32 context
546  );
547 
549  virtual void pingIn_preMsgHook(
550  FwIndexType portNum,
551  U32 key
552  );
553 
554  PROTECTED:
555 
556  // ----------------------------------------------------------------------
557  // Invocation functions for typed output ports
558  // ----------------------------------------------------------------------
559 
561  void PktSend_out(
562  FwIndexType portNum,
563  Fw::ComBuffer& data,
564  U32 context
565  );
566 
568  void pingOut_out(
569  FwIndexType portNum,
570  U32 key
571  );
572 
573  PROTECTED:
574 
575  // ----------------------------------------------------------------------
576  // Command response
577  // ----------------------------------------------------------------------
578 
580  void cmdResponse_out(
581  FwOpcodeType opCode,
582  U32 cmdSeq,
583  Fw::CmdResponse response
584  );
585 
586  PROTECTED:
587 
588  // ----------------------------------------------------------------------
589  // Command handlers to implement
590  // ----------------------------------------------------------------------
591 
595  virtual void SET_LEVEL_cmdHandler(
596  FwOpcodeType opCode,
597  U32 cmdSeq,
598  U32 level
599  ) = 0;
600 
604  virtual void SEND_PKT_cmdHandler(
605  FwOpcodeType opCode,
606  U32 cmdSeq,
607  U32 id
608  ) = 0;
609 
610  PROTECTED:
611 
612  // ----------------------------------------------------------------------
613  // Command handler base-class functions
614  //
615  // Call these functions directly to bypass the command input port
616  // ----------------------------------------------------------------------
617 
622  FwOpcodeType opCode,
623  U32 cmdSeq,
624  Fw::CmdArgBuffer& args
625  );
626 
631  FwOpcodeType opCode,
632  U32 cmdSeq,
633  Fw::CmdArgBuffer& args
634  );
635 
636  PROTECTED:
637 
638  // ----------------------------------------------------------------------
639  // Pre-message hooks for async commands
640  //
641  // Each of these functions is invoked just before processing the
642  // corresponding command. By default they do nothing. You can
643  // override them to provide specific pre-command behavior.
644  // ----------------------------------------------------------------------
645 
647  virtual void SET_LEVEL_preMsgHook(
648  FwOpcodeType opCode,
649  U32 cmdSeq
650  );
651 
653  virtual void SEND_PKT_preMsgHook(
654  FwOpcodeType opCode,
655  U32 cmdSeq
656  );
657 
658  PROTECTED:
659 
660  // ----------------------------------------------------------------------
661  // Event logging functions
662  // ----------------------------------------------------------------------
663 
668  U32 Id
669  ) const;
670 
675  U32 id
676  ) const;
677 
682  U32 level,
683  U32 max
684  ) const;
685 
690  U32 id
691  ) const;
692 
697  U32 id
698  ) const;
699 
700  PROTECTED:
701 
702  // ----------------------------------------------------------------------
703  // Telemetry write functions
704  // ----------------------------------------------------------------------
705 
709  void tlmWrite_SendLevel(
710  U32 arg,
711  Fw::Time _tlmTime = Fw::Time()
712  ) const;
713 
714  PROTECTED:
715 
716  // ----------------------------------------------------------------------
717  // Time
718  // ----------------------------------------------------------------------
719 
723  Fw::Time getTime() const;
724 
725  PRIVATE:
726 
727  // ----------------------------------------------------------------------
728  // Message dispatch functions
729  // ----------------------------------------------------------------------
730 
732  virtual MsgDispatchStatus doDispatch();
733 
734  PRIVATE:
735 
736  // ----------------------------------------------------------------------
737  // Calls for messages received on special input ports
738  // ----------------------------------------------------------------------
739 
741  static void m_p_cmdIn_in(
742  Fw::PassiveComponentBase* callComp,
743  FwIndexType portNum,
744  FwOpcodeType opCode,
745  U32 cmdSeq,
746  Fw::CmdArgBuffer& args
747  );
748 
749  PRIVATE:
750 
751  // ----------------------------------------------------------------------
752  // Calls for messages received on typed input ports
753  // ----------------------------------------------------------------------
754 
756  static void m_p_Run_in(
757  Fw::PassiveComponentBase* callComp,
758  FwIndexType portNum,
759  U32 context
760  );
761 
763  static void m_p_TlmRecv_in(
764  Fw::PassiveComponentBase* callComp,
765  FwIndexType portNum,
766  FwChanIdType id,
767  Fw::Time& timeTag,
768  Fw::TlmBuffer& val
769  );
770 
772  static void m_p_pingIn_in(
773  Fw::PassiveComponentBase* callComp,
774  FwIndexType portNum,
775  U32 key
776  );
777 
778  PRIVATE:
779 
780  // ----------------------------------------------------------------------
781  // Special input ports
782  // ----------------------------------------------------------------------
783 
785  Fw::InputCmdPort m_cmdIn_InputPort[NUM_CMDIN_INPUT_PORTS];
786 
787  PRIVATE:
788 
789  // ----------------------------------------------------------------------
790  // Typed input ports
791  // ----------------------------------------------------------------------
792 
794  Svc::InputSchedPort m_Run_InputPort[NUM_RUN_INPUT_PORTS];
795 
797  Fw::InputTlmPort m_TlmRecv_InputPort[NUM_TLMRECV_INPUT_PORTS];
798 
800  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
801 
802  PRIVATE:
803 
804  // ----------------------------------------------------------------------
805  // Special output ports
806  // ----------------------------------------------------------------------
807 
809  Fw::OutputCmdRegPort m_cmdRegOut_OutputPort[NUM_CMDREGOUT_OUTPUT_PORTS];
810 
812  Fw::OutputCmdResponsePort m_cmdResponseOut_OutputPort[NUM_CMDRESPONSEOUT_OUTPUT_PORTS];
813 
815  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
816 
817 #if FW_ENABLE_TEXT_LOGGING == 1
818 
820  Fw::OutputLogTextPort m_textEventOut_OutputPort[NUM_TEXTEVENTOUT_OUTPUT_PORTS];
821 
822 #endif
823 
825  Fw::OutputTimePort m_timeGetOut_OutputPort[NUM_TIMEGETOUT_OUTPUT_PORTS];
826 
828  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
829 
830  PRIVATE:
831 
832  // ----------------------------------------------------------------------
833  // Typed output ports
834  // ----------------------------------------------------------------------
835 
837  Fw::OutputComPort m_PktSend_OutputPort[NUM_PKTSEND_OUTPUT_PORTS];
838 
840  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
841 
842  };
843 
844 }
845 
846 #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)
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 TlmPacketizerComponentBaseFriend
Friend class for white-box testing.
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
Telemetry channel is not part of a telemetry packet.
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.
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
Auto-generated base for TlmPacketizer component.