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
21 #include "Fw/Prm/PrmGetPortAc.hpp"
22 #include "Fw/Prm/PrmSetPortAc.hpp"
23 #include "Fw/Time/TimePortAc.hpp"
24 #include "Fw/Tlm/TlmPortAc.hpp"
25 #include "Os/Mutex.hpp"
29 
30 namespace Svc {
31 
32  namespace Ccsds {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
47  friend class TcDeframerTesterBase;
49  friend class TcDeframerTester;
50 
51  protected:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
61  };
62 
64  enum {
71  };
72 
74  enum {
78  };
79 
81  enum {
87  };
88 
89  public:
90 
91  // ----------------------------------------------------------------------
92  // Component initialization
93  // ----------------------------------------------------------------------
94 
96  void init(
97  FwEnumStoreType instance = 0
98  );
99 
100  public:
101 
102  // ----------------------------------------------------------------------
103  // Getters for typed input ports
104  // ----------------------------------------------------------------------
105 
110  FwIndexType portNum
111  );
112 
117  FwIndexType portNum
118  );
119 
120  public:
121 
122  // ----------------------------------------------------------------------
123  // Connect input ports to special output ports
124  // ----------------------------------------------------------------------
125 
128  FwIndexType portNum,
129  Fw::InputLogPort* port
130  );
131 
132 #if FW_ENABLE_TEXT_LOGGING == 1
133 
135  void set_logTextOut_OutputPort(
136  FwIndexType portNum,
137  Fw::InputLogTextPort* port
138  );
139 
140 #endif
141 
144  FwIndexType portNum,
145  Fw::InputPrmGetPort* port
146  );
147 
150  FwIndexType portNum,
151  Fw::InputPrmSetPort* port
152  );
153 
156  FwIndexType portNum,
157  Fw::InputTimePort* port
158  );
159 
162  FwIndexType portNum,
163  Fw::InputTlmPort* port
164  );
165 
166  public:
167 
168  // ----------------------------------------------------------------------
169  // Connect typed input ports to typed output ports
170  // ----------------------------------------------------------------------
171 
174  FwIndexType portNum,
176  );
177 
180  FwIndexType portNum,
182  );
183 
186  FwIndexType portNum,
188  );
189 
190 #if FW_PORT_SERIALIZATION
191 
192  public:
193 
194  // ----------------------------------------------------------------------
195  // Connect serial input ports to special output ports
196  // ----------------------------------------------------------------------
197 
200  FwIndexType portNum,
201  Fw::InputSerializePort* port
202  );
203 
204 #if FW_ENABLE_TEXT_LOGGING == 1
205 
207  void set_logTextOut_OutputPort(
208  FwIndexType portNum,
209  Fw::InputSerializePort* port
210  );
211 
212 #endif
213 
216  FwIndexType portNum,
217  Fw::InputSerializePort* port
218  );
219 
222  FwIndexType portNum,
223  Fw::InputSerializePort* port
224  );
225 
228  FwIndexType portNum,
229  Fw::InputSerializePort* port
230  );
231 
232 #endif
233 
234 #if FW_PORT_SERIALIZATION
235 
236  public:
237 
238  // ----------------------------------------------------------------------
239  // Connect serial input ports to typed output ports
240  // ----------------------------------------------------------------------
241 
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
250  FwIndexType portNum,
251  Fw::InputSerializePort* port
252  );
253 
256  FwIndexType portNum,
257  Fw::InputSerializePort* port
258  );
259 
260 #endif
261 
262  protected:
263 
264  // ----------------------------------------------------------------------
265  // Component construction and destruction
266  // ----------------------------------------------------------------------
267 
270  const char* compName = ""
271  );
272 
274  virtual ~TcDeframerComponentBase();
275 
276  protected:
277 
278  // ----------------------------------------------------------------------
279  // Getters for numbers of typed input ports
280  // ----------------------------------------------------------------------
281 
286  return NUM_DATAIN_INPUT_PORTS;
287  }
288 
294  }
295 
296  protected:
297 
298  // ----------------------------------------------------------------------
299  // Getters for numbers of special output ports
300  // ----------------------------------------------------------------------
301 
307  }
308 
309 #if FW_ENABLE_TEXT_LOGGING == 1
310 
314  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
316  }
317 
318 #endif
319 
325  }
326 
332  }
333 
339  }
340 
346  }
347 
348  protected:
349 
350  // ----------------------------------------------------------------------
351  // Getters for numbers of typed output ports
352  // ----------------------------------------------------------------------
353 
359  }
360 
366  }
367 
373  }
374 
375  protected:
376 
377  // ----------------------------------------------------------------------
378  // Connection status queries for special output ports
379  // ----------------------------------------------------------------------
380 
385  FwIndexType portNum
386  );
387 
388 #if FW_ENABLE_TEXT_LOGGING == 1
389 
393  bool isConnected_logTextOut_OutputPort(
394  FwIndexType portNum
395  );
396 
397 #endif
398 
403  FwIndexType portNum
404  );
405 
410  FwIndexType portNum
411  );
412 
417  FwIndexType portNum
418  );
419 
424  FwIndexType portNum
425  );
426 
427  protected:
428 
429  // ----------------------------------------------------------------------
430  // Connection status queries for typed output ports
431  // ----------------------------------------------------------------------
432 
437  FwIndexType portNum
438  );
439 
444  FwIndexType portNum
445  );
446 
451  FwIndexType portNum
452  );
453 
454  protected:
455 
456  // ----------------------------------------------------------------------
457  // Handlers to implement for typed input ports
458  // ----------------------------------------------------------------------
459 
461  virtual void dataIn_handler(
462  FwIndexType portNum,
463  Fw::Buffer& data,
464  const ComCfg::FrameContext& context
465  ) = 0;
466 
468  virtual void dataReturnIn_handler(
469  FwIndexType portNum,
470  Fw::Buffer& data,
471  const ComCfg::FrameContext& context
472  ) = 0;
473 
474  protected:
475 
476  // ----------------------------------------------------------------------
477  // Port handler base-class functions for typed input ports
478  //
479  // Call these functions directly to bypass the corresponding ports
480  // ----------------------------------------------------------------------
481 
483  void dataIn_handlerBase(
484  FwIndexType portNum,
485  Fw::Buffer& data,
486  const ComCfg::FrameContext& context
487  );
488 
491  FwIndexType portNum,
492  Fw::Buffer& data,
493  const ComCfg::FrameContext& context
494  );
495 
496  protected:
497 
498  // ----------------------------------------------------------------------
499  // Invocation functions for typed output ports
500  // ----------------------------------------------------------------------
501 
503  void dataOut_out(
504  FwIndexType portNum,
505  Fw::Buffer& data,
506  const ComCfg::FrameContext& context
507  );
508 
510  void dataReturnOut_out(
511  FwIndexType portNum,
512  Fw::Buffer& data,
513  const ComCfg::FrameContext& context
514  );
515 
517  void errorNotify_out(
518  FwIndexType portNum,
519  const Svc::Ccsds::FrameError& errorCode
520  );
521 
522  protected:
523 
524  // ----------------------------------------------------------------------
525  // Event logging functions
526  // ----------------------------------------------------------------------
527 
531  void log_WARNING_LO_InvalidPacket() const;
532 
537  U16 transmitted,
538  U16 configured
539  ) const;
540 
545  U16 transmitted,
546  FwSizeType actual
547  ) const;
548 
553  U16 transmitted,
554  U16 configured
555  ) const;
556 
561  U16 transmitted,
562  U16 computed
563  ) const;
564 
565  protected:
566 
567  // ----------------------------------------------------------------------
568  // Time
569  // ----------------------------------------------------------------------
570 
574  Fw::Time getTime() const;
575 
576  protected:
577 
578  // ----------------------------------------------------------------------
579  // Mutex operations for guarded ports
580  //
581  // You can override these operations to provide more sophisticated
582  // synchronization
583  // ----------------------------------------------------------------------
584 
586  virtual void lock();
587 
589  virtual void unLock();
590 
591  private:
592 
593  // ----------------------------------------------------------------------
594  // Calls for messages received on typed input ports
595  // ----------------------------------------------------------------------
596 
598  static void m_p_dataIn_in(
599  Fw::PassiveComponentBase* callComp,
600  FwIndexType portNum,
601  Fw::Buffer& data,
602  const ComCfg::FrameContext& context
603  );
604 
606  static void m_p_dataReturnIn_in(
607  Fw::PassiveComponentBase* callComp,
608  FwIndexType portNum,
609  Fw::Buffer& data,
610  const ComCfg::FrameContext& context
611  );
612 
613  private:
614 
615  // ----------------------------------------------------------------------
616  // Typed input ports
617  // ----------------------------------------------------------------------
618 
621 
624 
625  private:
626 
627  // ----------------------------------------------------------------------
628  // Special output ports
629  // ----------------------------------------------------------------------
630 
632  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
633 
634 #if FW_ENABLE_TEXT_LOGGING == 1
635 
637  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
638 
639 #endif
640 
642  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
643 
645  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
646 
648  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
649 
651  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
652 
653  private:
654 
655  // ----------------------------------------------------------------------
656  // Typed output ports
657  // ----------------------------------------------------------------------
658 
661 
664 
667 
668  private:
669 
670  // ----------------------------------------------------------------------
671  // Mutexes
672  // ----------------------------------------------------------------------
673 
675  Os::Mutex m_guardedPortMutex;
676 
677  };
678 
679  }
680 
681 }
682 
683 #endif
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum)
bool isConnected_errorNotify_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
Enum representing an error during framing/deframing in the CCSDS protocols.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum)
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
static constexpr FwIndexType getNum_logOut_OutputPorts()
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_dataIn_InputPorts()
bool isConnected_logOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
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()
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
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
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.
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].
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode)
Invoke output port errorNotify.
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.
friend class TcDeframerTesterBase
Friend class tester to support autocoded test harness.
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
static constexpr FwIndexType getNum_dataOut_OutputPorts()
Invalid packet received that will be dropped.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
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].
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void log_WARNING_HI_InvalidFrameLength(U16 transmitted, FwSizeType actual) const