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 #include "Fw/Log/LogTextPortAc.hpp"
17 #if !FW_DIRECT_PORT_CALLS
19 #endif
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #include "Fw/Prm/PrmGetPortAc.hpp"
24 #include "Fw/Prm/PrmSetPortAc.hpp"
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Fw/Tlm/TlmPortAc.hpp"
27 #include "Os/Mutex.hpp"
31 
32 namespace Svc {
33 
34  namespace Ccsds {
35 
42  {
43 
44  // ----------------------------------------------------------------------
45  // Friend classes
46  // ----------------------------------------------------------------------
47 
49  friend class TcDeframerTesterBase;
51  friend class TcDeframerTester;
52 
53  protected:
54 
55  // ----------------------------------------------------------------------
56  // Constants
57  // ----------------------------------------------------------------------
58 
60  enum {
63  };
64 
66  enum {
73  };
74 
76  enum {
80  };
81 
83  enum {
89  };
90 
91  public:
92 
93  // ----------------------------------------------------------------------
94  // Component initialization
95  // ----------------------------------------------------------------------
96 
98  void init(
99  FwEnumStoreType instance = 0
100  );
101 
102 #if !FW_DIRECT_PORT_CALLS
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Getters for typed input ports
108  // ----------------------------------------------------------------------
109 
114  FwIndexType portNum
115  );
116 
121  FwIndexType portNum
122  );
123 
124 #endif
125 
126 #if !FW_DIRECT_PORT_CALLS
127 
128  public:
129 
130  // ----------------------------------------------------------------------
131  // Connect input ports to special output ports
132  // ----------------------------------------------------------------------
133 
136  FwIndexType portNum,
137  Fw::InputLogPort* port
138  );
139 
140 #if FW_ENABLE_TEXT_LOGGING == 1
141 
143  void set_logTextOut_OutputPort(
144  FwIndexType portNum,
145  Fw::InputLogTextPort* port
146  );
147 
148 #endif
149 
152  FwIndexType portNum,
153  Fw::InputPrmGetPort* port
154  );
155 
158  FwIndexType portNum,
159  Fw::InputPrmSetPort* port
160  );
161 
164  FwIndexType portNum,
165  Fw::InputTimePort* port
166  );
167 
170  FwIndexType portNum,
171  Fw::InputTlmPort* port
172  );
173 
174 #endif
175 
176 #if !FW_DIRECT_PORT_CALLS
177 
178  public:
179 
180  // ----------------------------------------------------------------------
181  // Connect typed input ports to typed output ports
182  // ----------------------------------------------------------------------
183 
186  FwIndexType portNum,
188  );
189 
192  FwIndexType portNum,
194  );
195 
198  FwIndexType portNum,
200  );
201 
202 #endif
203 
204 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
205 
206  public:
207 
208  // ----------------------------------------------------------------------
209  // Connect serial input ports to special output ports
210  // ----------------------------------------------------------------------
211 
214  FwIndexType portNum,
215  Fw::InputSerializePort* port
216  );
217 
218 #if FW_ENABLE_TEXT_LOGGING == 1
219 
221  void set_logTextOut_OutputPort(
222  FwIndexType portNum,
223  Fw::InputSerializePort* port
224  );
225 
226 #endif
227 
230  FwIndexType portNum,
231  Fw::InputSerializePort* port
232  );
233 
236  FwIndexType portNum,
237  Fw::InputSerializePort* port
238  );
239 
242  FwIndexType portNum,
243  Fw::InputSerializePort* port
244  );
245 
246 #endif
247 
248 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
249 
250  public:
251 
252  // ----------------------------------------------------------------------
253  // Connect serial input ports to typed output ports
254  // ----------------------------------------------------------------------
255 
258  FwIndexType portNum,
259  Fw::InputSerializePort* port
260  );
261 
264  FwIndexType portNum,
265  Fw::InputSerializePort* port
266  );
267 
270  FwIndexType portNum,
271  Fw::InputSerializePort* port
272  );
273 
274 #endif
275 
276  protected:
277 
278  // ----------------------------------------------------------------------
279  // Component construction and destruction
280  // ----------------------------------------------------------------------
281 
284  const char* compName = ""
285  );
286 
288  virtual ~TcDeframerComponentBase();
289 
290  protected:
291 
292  // ----------------------------------------------------------------------
293  // Getters for numbers of typed input ports
294  // ----------------------------------------------------------------------
295 
300  return NUM_DATAIN_INPUT_PORTS;
301  }
302 
308  }
309 
310  protected:
311 
312  // ----------------------------------------------------------------------
313  // Getters for numbers of special output ports
314  // ----------------------------------------------------------------------
315 
321  }
322 
323 #if FW_ENABLE_TEXT_LOGGING == 1
324 
328  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
330  }
331 
332 #endif
333 
339  }
340 
346  }
347 
353  }
354 
360  }
361 
362  protected:
363 
364  // ----------------------------------------------------------------------
365  // Getters for numbers of typed output ports
366  // ----------------------------------------------------------------------
367 
373  }
374 
380  }
381 
387  }
388 
389  protected:
390 
391  // ----------------------------------------------------------------------
392  // Connection status queries for special output ports
393  // ----------------------------------------------------------------------
394 
399  FwIndexType portNum
400  ) const;
401 
402 #if FW_ENABLE_TEXT_LOGGING == 1
403 
407  bool isConnected_logTextOut_OutputPort(
408  FwIndexType portNum
409  ) const;
410 
411 #endif
412 
417  FwIndexType portNum
418  ) const;
419 
424  FwIndexType portNum
425  ) const;
426 
431  FwIndexType portNum
432  ) const;
433 
438  FwIndexType portNum
439  ) const;
440 
441  protected:
442 
443  // ----------------------------------------------------------------------
444  // Connection status queries for typed output ports
445  // ----------------------------------------------------------------------
446 
451  FwIndexType portNum
452  ) const;
453 
458  FwIndexType portNum
459  ) const;
460 
465  FwIndexType portNum
466  ) const;
467 
468  protected:
469 
470  // ----------------------------------------------------------------------
471  // Handlers to implement for typed input ports
472  // ----------------------------------------------------------------------
473 
475  virtual void dataIn_handler(
476  FwIndexType portNum,
477  Fw::Buffer& data,
478  const ComCfg::FrameContext& context
479  ) = 0;
480 
482  virtual void dataReturnIn_handler(
483  FwIndexType portNum,
484  Fw::Buffer& data,
485  const ComCfg::FrameContext& context
486  ) = 0;
487 
488 #if FW_DIRECT_PORT_CALLS
489  public:
490 #else
491  protected:
492 #endif
493 
494  // ----------------------------------------------------------------------
495  // Port handler base-class functions for typed input ports
496  //
497  // Call these functions directly to bypass the corresponding ports
498  // ----------------------------------------------------------------------
499 
501  void dataIn_handlerBase(
502  FwIndexType portNum,
503  Fw::Buffer& data,
504  const ComCfg::FrameContext& context
505  );
506 
509  FwIndexType portNum,
510  Fw::Buffer& data,
511  const ComCfg::FrameContext& context
512  );
513 
514  protected:
515 
516  // ----------------------------------------------------------------------
517  // Invocation functions for typed output ports
518  // ----------------------------------------------------------------------
519 
521  void dataOut_out(
522  FwIndexType portNum,
523  Fw::Buffer& data,
524  const ComCfg::FrameContext& context
525  ) const;
526 
528  void dataReturnOut_out(
529  FwIndexType portNum,
530  Fw::Buffer& data,
531  const ComCfg::FrameContext& context
532  ) const;
533 
535  void errorNotify_out(
536  FwIndexType portNum,
537  const Svc::Ccsds::FrameError& errorCode
538  ) const;
539 
540  protected:
541 
542  // ----------------------------------------------------------------------
543  // Event logging functions
544  // ----------------------------------------------------------------------
545 
549  void log_WARNING_LO_InvalidPacket() const;
550 
555  U16 transmitted,
556  U16 configured
557  ) const;
558 
563  U16 transmitted,
564  FwSizeType actual
565  ) const;
566 
571  U16 transmitted,
572  U16 configured
573  ) const;
574 
579  U16 transmitted,
580  U16 computed
581  ) const;
582 
583  protected:
584 
585  // ----------------------------------------------------------------------
586  // Time
587  // ----------------------------------------------------------------------
588 
592  Fw::Time getTime() const;
593 
594  protected:
595 
596  // ----------------------------------------------------------------------
597  // Mutex operations for guarded ports
598  //
599  // You can override these operations to provide more sophisticated
600  // synchronization
601  // ----------------------------------------------------------------------
602 
604  virtual void lock();
605 
607  virtual void unLock();
608 
609  private:
610 
611  // ----------------------------------------------------------------------
612  // Calls for messages received on typed input ports
613  // ----------------------------------------------------------------------
614 
616  static void m_p_dataIn_in(
617  Fw::PassiveComponentBase* callComp,
618  FwIndexType portNum,
619  Fw::Buffer& data,
620  const ComCfg::FrameContext& context
621  );
622 
624  static void m_p_dataReturnIn_in(
625  Fw::PassiveComponentBase* callComp,
626  FwIndexType portNum,
627  Fw::Buffer& data,
628  const ComCfg::FrameContext& context
629  );
630 
631  private:
632 
633  // ----------------------------------------------------------------------
634  // Invocation functions for special output ports
635  // ----------------------------------------------------------------------
636 
638  void logOut_out(
639  FwIndexType portNum,
640  FwEventIdType id,
641  Fw::Time& timeTag,
642  const Fw::LogSeverity& severity,
643  Fw::LogBuffer& args
644  ) const;
645 
646 #if FW_ENABLE_TEXT_LOGGING
647 
649  void logTextOut_out(
650  FwIndexType portNum,
651  FwEventIdType id,
652  Fw::Time& timeTag,
653  const Fw::LogSeverity& severity,
654  Fw::TextLogString& text
655  ) const;
656 
657 #endif
658 
660  void timeCaller_out(
661  FwIndexType portNum,
662  Fw::Time& time
663  ) const;
664 
665 #if !FW_DIRECT_PORT_CALLS
666 
667  private:
668 
669  // ----------------------------------------------------------------------
670  // Typed input ports
671  // ----------------------------------------------------------------------
672 
675 
678 
679 #endif
680 
681 #if !FW_DIRECT_PORT_CALLS
682 
683  private:
684 
685  // ----------------------------------------------------------------------
686  // Special output ports
687  // ----------------------------------------------------------------------
688 
690  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
691 
692 #if FW_ENABLE_TEXT_LOGGING == 1
693 
695  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
696 
697 #endif
698 
700  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
701 
703  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
704 
706  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
707 
709  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
710 
711 #endif
712 
713 #if !FW_DIRECT_PORT_CALLS
714 
715  private:
716 
717  // ----------------------------------------------------------------------
718  // Typed output ports
719  // ----------------------------------------------------------------------
720 
723 
726 
729 
730 #endif
731 
732  private:
733 
734  // ----------------------------------------------------------------------
735  // Mutexes
736  // ----------------------------------------------------------------------
737 
739  Os::Mutex m_guardedPortMutex;
740 
741  };
742 
743  }
744 
745 }
746 
747 #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
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
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.
Invalid packet received that will be dropped.
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