F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TcDeframerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TcDeframerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for TcDeframer component base class
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_TcDeframerComponentAc_HPP
8 #define Svc_Ccsds_TcDeframerComponentAc_HPP
9 
10 #include <atomic>
11 
13 #include "Fw/FPrimeBasicTypes.hpp"
14 #include "Fw/Log/LogPortAc.hpp"
15 #include "Fw/Log/LogString.hpp"
16 #if FW_ENABLE_TEXT_LOGGING == 1
17 #include "Fw/Log/LogTextPortAc.hpp"
18 #endif
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
25 #include "Fw/Prm/PrmGetPortAc.hpp"
26 #include "Fw/Prm/PrmSetPortAc.hpp"
27 #include "Fw/Time/TimePortAc.hpp"
28 #include "Fw/Tlm/TlmPortAc.hpp"
29 #include "Os/Mutex.hpp"
33 
34 namespace Svc {
35 
36  namespace Ccsds {
37 
44  {
45 
46  // ----------------------------------------------------------------------
47  // Friend classes
48  // ----------------------------------------------------------------------
49 
51  friend class TcDeframerTesterBase;
53  friend class TcDeframerTester;
54 
55  protected:
56 
57  // ----------------------------------------------------------------------
58  // Constants
59  // ----------------------------------------------------------------------
60 
62  enum {
65  };
66 
68  enum {
75  };
76 
78  enum {
82  };
83 
85  enum {
91  };
92 
93  public:
94 
95  // ----------------------------------------------------------------------
96  // Component initialization
97  // ----------------------------------------------------------------------
98 
100  void init(
101  FwEnumStoreType instance = 0
102  );
103 
104 #if !FW_DIRECT_PORT_CALLS
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Getters for typed input ports
110  // ----------------------------------------------------------------------
111 
116  FwIndexType portNum
117  );
118 
123  FwIndexType portNum
124  );
125 
126 #endif
127 
128 #if !FW_DIRECT_PORT_CALLS
129 
130  public:
131 
132  // ----------------------------------------------------------------------
133  // Connect input ports to special output ports
134  // ----------------------------------------------------------------------
135 
138  FwIndexType portNum,
139  Fw::InputLogPort* port
140  );
141 
142 #if FW_ENABLE_TEXT_LOGGING == 1
143 
145  void set_logTextOut_OutputPort(
146  FwIndexType portNum,
147  Fw::InputLogTextPort* port
148  );
149 
150 #endif
151 
154  FwIndexType portNum,
155  Fw::InputPrmGetPort* port
156  );
157 
160  FwIndexType portNum,
161  Fw::InputPrmSetPort* port
162  );
163 
166  FwIndexType portNum,
167  Fw::InputTimePort* port
168  );
169 
172  FwIndexType portNum,
173  Fw::InputTlmPort* port
174  );
175 
176 #endif
177 
178 #if !FW_DIRECT_PORT_CALLS
179 
180  public:
181 
182  // ----------------------------------------------------------------------
183  // Connect typed input ports to typed output ports
184  // ----------------------------------------------------------------------
185 
188  FwIndexType portNum,
190  );
191 
194  FwIndexType portNum,
196  );
197 
200  FwIndexType portNum,
202  );
203 
204 #endif
205 
206 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
207 
208  public:
209 
210  // ----------------------------------------------------------------------
211  // Connect serial input ports to special output ports
212  // ----------------------------------------------------------------------
213 
216  FwIndexType portNum,
217  Fw::InputSerializePort* port
218  );
219 
220 #if FW_ENABLE_TEXT_LOGGING == 1
221 
223  void set_logTextOut_OutputPort(
224  FwIndexType portNum,
225  Fw::InputSerializePort* port
226  );
227 
228 #endif
229 
232  FwIndexType portNum,
233  Fw::InputSerializePort* port
234  );
235 
238  FwIndexType portNum,
239  Fw::InputSerializePort* port
240  );
241 
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
248 #endif
249 
250 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
251 
252  public:
253 
254  // ----------------------------------------------------------------------
255  // Connect serial input ports to typed output ports
256  // ----------------------------------------------------------------------
257 
260  FwIndexType portNum,
261  Fw::InputSerializePort* port
262  );
263 
266  FwIndexType portNum,
267  Fw::InputSerializePort* port
268  );
269 
272  FwIndexType portNum,
273  Fw::InputSerializePort* port
274  );
275 
276 #endif
277 
278  protected:
279 
280  // ----------------------------------------------------------------------
281  // Component construction and destruction
282  // ----------------------------------------------------------------------
283 
286  const char* compName = ""
287  );
288 
290  virtual ~TcDeframerComponentBase();
291 
292  protected:
293 
294  // ----------------------------------------------------------------------
295  // Getters for numbers of typed input ports
296  // ----------------------------------------------------------------------
297 
302  return NUM_DATAIN_INPUT_PORTS;
303  }
304 
310  }
311 
312  protected:
313 
314  // ----------------------------------------------------------------------
315  // Getters for numbers of special output ports
316  // ----------------------------------------------------------------------
317 
323  }
324 
325 #if FW_ENABLE_TEXT_LOGGING == 1
326 
330  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
332  }
333 
334 #endif
335 
341  }
342 
348  }
349 
355  }
356 
362  }
363 
364  protected:
365 
366  // ----------------------------------------------------------------------
367  // Getters for numbers of typed output ports
368  // ----------------------------------------------------------------------
369 
375  }
376 
382  }
383 
389  }
390 
391  protected:
392 
393  // ----------------------------------------------------------------------
394  // Connection status queries for special output ports
395  // ----------------------------------------------------------------------
396 
401  FwIndexType portNum
402  ) const;
403 
404 #if FW_ENABLE_TEXT_LOGGING == 1
405 
409  bool isConnected_logTextOut_OutputPort(
410  FwIndexType portNum
411  ) const;
412 
413 #endif
414 
419  FwIndexType portNum
420  ) const;
421 
426  FwIndexType portNum
427  ) const;
428 
433  FwIndexType portNum
434  ) const;
435 
440  FwIndexType portNum
441  ) const;
442 
443  protected:
444 
445  // ----------------------------------------------------------------------
446  // Connection status queries for typed output ports
447  // ----------------------------------------------------------------------
448 
453  FwIndexType portNum
454  ) const;
455 
460  FwIndexType portNum
461  ) const;
462 
467  FwIndexType portNum
468  ) const;
469 
470  protected:
471 
472  // ----------------------------------------------------------------------
473  // Handlers to implement for typed input ports
474  // ----------------------------------------------------------------------
475 
477  virtual void dataIn_handler(
478  FwIndexType portNum,
479  Fw::Buffer& data,
480  const ComCfg::FrameContext& context
481  ) = 0;
482 
484  virtual void dataReturnIn_handler(
485  FwIndexType portNum,
486  Fw::Buffer& data,
487  const ComCfg::FrameContext& context
488  ) = 0;
489 
490 #if FW_DIRECT_PORT_CALLS
491  public:
492 #else
493  protected:
494 #endif
495 
496  // ----------------------------------------------------------------------
497  // Port handler base-class functions for typed input ports
498  //
499  // Call these functions directly to bypass the corresponding ports
500  // ----------------------------------------------------------------------
501 
503  void dataIn_handlerBase(
504  FwIndexType portNum,
505  Fw::Buffer& data,
506  const ComCfg::FrameContext& context
507  );
508 
511  FwIndexType portNum,
512  Fw::Buffer& data,
513  const ComCfg::FrameContext& context
514  );
515 
516  protected:
517 
518  // ----------------------------------------------------------------------
519  // Invocation functions for typed output ports
520  // ----------------------------------------------------------------------
521 
523  void dataOut_out(
524  FwIndexType portNum,
525  Fw::Buffer& data,
526  const ComCfg::FrameContext& context
527  ) const;
528 
530  void dataReturnOut_out(
531  FwIndexType portNum,
532  Fw::Buffer& data,
533  const ComCfg::FrameContext& context
534  ) const;
535 
537  void errorNotify_out(
538  FwIndexType portNum,
539  const Svc::Ccsds::FrameError& errorCode
540  ) const;
541 
542  protected:
543 
544  // ----------------------------------------------------------------------
545  // Event logging functions
546  // ----------------------------------------------------------------------
547 
551  void log_WARNING_LO_InvalidPacket() const;
552 
557  U16 transmitted,
558  U16 configured
559  ) const;
560 
565  U16 transmitted,
566  FwSizeType actual
567  ) const;
568 
573  U16 transmitted,
574  U16 configured
575  ) const;
576 
581  U16 transmitted,
582  U16 computed
583  ) const;
584 
585  protected:
586 
587  // ----------------------------------------------------------------------
588  // Time
589  // ----------------------------------------------------------------------
590 
594  Fw::Time getTime() const;
595 
596  protected:
597 
598  // ----------------------------------------------------------------------
599  // Mutex operations for guarded ports
600  //
601  // You can override these operations to provide more sophisticated
602  // synchronization
603  // ----------------------------------------------------------------------
604 
606  virtual void lock();
607 
609  virtual void unLock();
610 
611  private:
612 
613  // ----------------------------------------------------------------------
614  // Calls for messages received on typed input ports
615  // ----------------------------------------------------------------------
616 
618  static void m_p_dataIn_in(
619  Fw::PassiveComponentBase* callComp,
620  FwIndexType portNum,
621  Fw::Buffer& data,
622  const ComCfg::FrameContext& context
623  );
624 
626  static void m_p_dataReturnIn_in(
627  Fw::PassiveComponentBase* callComp,
628  FwIndexType portNum,
629  Fw::Buffer& data,
630  const ComCfg::FrameContext& context
631  );
632 
633  private:
634 
635  // ----------------------------------------------------------------------
636  // Invocation functions for special output ports
637  // ----------------------------------------------------------------------
638 
640  void logOut_out(
641  FwIndexType portNum,
642  FwEventIdType id,
643  Fw::Time& timeTag,
644  const Fw::LogSeverity& severity,
645  Fw::LogBuffer& args
646  ) const;
647 
648 #if FW_ENABLE_TEXT_LOGGING
649 
651  void logTextOut_out(
652  FwIndexType portNum,
653  FwEventIdType id,
654  Fw::Time& timeTag,
655  const Fw::LogSeverity& severity,
656  Fw::TextLogString& text
657  ) const;
658 
659 #endif
660 
662  void timeCaller_out(
663  FwIndexType portNum,
664  Fw::Time& time
665  ) const;
666 
667 #if !FW_DIRECT_PORT_CALLS
668 
669  private:
670 
671  // ----------------------------------------------------------------------
672  // Typed input ports
673  // ----------------------------------------------------------------------
674 
677 
680 
681 #endif
682 
683 #if !FW_DIRECT_PORT_CALLS
684 
685  private:
686 
687  // ----------------------------------------------------------------------
688  // Special output ports
689  // ----------------------------------------------------------------------
690 
692  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
693 
694 #if FW_ENABLE_TEXT_LOGGING == 1
695 
697  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
698 
699 #endif
700 
702  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
703 
705  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
706 
708  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
709 
711  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
712 
713 #endif
714 
715 #if !FW_DIRECT_PORT_CALLS
716 
717  private:
718 
719  // ----------------------------------------------------------------------
720  // Typed output ports
721  // ----------------------------------------------------------------------
722 
725 
728 
731 
732 #endif
733 
734  private:
735 
736  // ----------------------------------------------------------------------
737  // Mutexes
738  // ----------------------------------------------------------------------
739 
741  Os::Mutex m_guardedPortMutex;
742 
743  };
744 
745  }
746 
747 }
748 
749 #endif
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
Enum representing an error during framing/deframing in the CCSDS protocols.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_dataIn_InputPorts()
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
Invalid packet received that will be dropped.
static constexpr FwIndexType getNum_errorNotify_OutputPorts()
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
static constexpr FwIndexType getNum_prmSetOut_OutputPorts()
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
virtual void lock()
Lock the guarded mutex.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum) const
void init()
Object initializer.
Definition: ObjBase.cpp:24
void log_ACTIVITY_LO_InvalidVcId(U16 transmitted, U16 configured) const
void log_WARNING_HI_InvalidCrc(U16 transmitted, U16 computed) const
FwIdType FwEventIdType
The type of an event identifier.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
virtual ~TcDeframerComponentBase()
Destroy TcDeframerComponentBase object.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
TcDeframerComponentBase(const char *compName="")
Construct TcDeframerComponentBase object.
static constexpr FwIndexType getNum_prmGetOut_OutputPorts()
friend class TcDeframerTester
Friend class tester implementation to support white-box testing.
Enum representing event severity.
bool isConnected_errorNotify_OutputPort(FwIndexType portNum) const
void set_errorNotify_OutputPort(FwIndexType portNum, Svc::Ccsds::InputErrorNotifyPort *port)
Connect port to errorNotify[portNum].
void log_WARNING_LO_InvalidSpacecraftId(U16 transmitted, U16 configured) const
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
PlatformIndexType FwIndexType
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
friend class TcDeframerTesterBase
Friend class tester to support autocoded test harness.
Type used to pass context info between components during framing/deframing.
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode) const
Invoke output port errorNotify.
RateGroupDivider component implementation.
static constexpr FwIndexType getNum_dataOut_OutputPorts()
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
virtual void unLock()
Unlock the guarded mutex.
Auto-generated base for TcDeframer component.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void log_WARNING_HI_InvalidFrameLength(U16 transmitted, FwSizeType actual) const