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 {
86  };
87 
88  public:
89 
90  // ----------------------------------------------------------------------
91  // Component initialization
92  // ----------------------------------------------------------------------
93 
95  void init(
96  FwEnumStoreType instance = 0
97  );
98 
99  public:
100 
101  // ----------------------------------------------------------------------
102  // Getters for typed input ports
103  // ----------------------------------------------------------------------
104 
109  FwIndexType portNum
110  );
111 
116  FwIndexType portNum
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Connect input ports to special output ports
123  // ----------------------------------------------------------------------
124 
127  FwIndexType portNum,
128  Fw::InputLogPort* port
129  );
130 
131 #if FW_ENABLE_TEXT_LOGGING == 1
132 
134  void set_logTextOut_OutputPort(
135  FwIndexType portNum,
136  Fw::InputLogTextPort* port
137  );
138 
139 #endif
140 
143  FwIndexType portNum,
144  Fw::InputPrmGetPort* port
145  );
146 
149  FwIndexType portNum,
150  Fw::InputPrmSetPort* port
151  );
152 
155  FwIndexType portNum,
156  Fw::InputTimePort* port
157  );
158 
161  FwIndexType portNum,
162  Fw::InputTlmPort* port
163  );
164 
165  public:
166 
167  // ----------------------------------------------------------------------
168  // Connect typed input ports to typed output ports
169  // ----------------------------------------------------------------------
170 
173  FwIndexType portNum,
175  );
176 
179  FwIndexType portNum,
181  );
182 
185  FwIndexType portNum,
187  );
188 
189 #if FW_PORT_SERIALIZATION
190 
191  public:
192 
193  // ----------------------------------------------------------------------
194  // Connect serial input ports to special output ports
195  // ----------------------------------------------------------------------
196 
199  FwIndexType portNum,
200  Fw::InputSerializePort* port
201  );
202 
203 #if FW_ENABLE_TEXT_LOGGING == 1
204 
206  void set_logTextOut_OutputPort(
207  FwIndexType portNum,
208  Fw::InputSerializePort* port
209  );
210 
211 #endif
212 
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
231 #endif
232 
233 #if FW_PORT_SERIALIZATION
234 
235  public:
236 
237  // ----------------------------------------------------------------------
238  // Connect serial input ports to typed output ports
239  // ----------------------------------------------------------------------
240 
243  FwIndexType portNum,
244  Fw::InputSerializePort* port
245  );
246 
249  FwIndexType portNum,
250  Fw::InputSerializePort* port
251  );
252 
255  FwIndexType portNum,
256  Fw::InputSerializePort* port
257  );
258 
259 #endif
260 
261  protected:
262 
263  // ----------------------------------------------------------------------
264  // Component construction and destruction
265  // ----------------------------------------------------------------------
266 
269  const char* compName = ""
270  );
271 
273  virtual ~TcDeframerComponentBase();
274 
275  protected:
276 
277  // ----------------------------------------------------------------------
278  // Getters for numbers of typed input ports
279  // ----------------------------------------------------------------------
280 
285  return NUM_DATAIN_INPUT_PORTS;
286  }
287 
293  }
294 
295  protected:
296 
297  // ----------------------------------------------------------------------
298  // Getters for numbers of special output ports
299  // ----------------------------------------------------------------------
300 
306  }
307 
308 #if FW_ENABLE_TEXT_LOGGING == 1
309 
313  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
315  }
316 
317 #endif
318 
324  }
325 
331  }
332 
338  }
339 
345  }
346 
347  protected:
348 
349  // ----------------------------------------------------------------------
350  // Getters for numbers of typed output ports
351  // ----------------------------------------------------------------------
352 
358  }
359 
365  }
366 
372  }
373 
374  protected:
375 
376  // ----------------------------------------------------------------------
377  // Connection status queries for special output ports
378  // ----------------------------------------------------------------------
379 
384  FwIndexType portNum
385  );
386 
387 #if FW_ENABLE_TEXT_LOGGING == 1
388 
392  bool isConnected_logTextOut_OutputPort(
393  FwIndexType portNum
394  );
395 
396 #endif
397 
402  FwIndexType portNum
403  );
404 
409  FwIndexType portNum
410  );
411 
416  FwIndexType portNum
417  );
418 
423  FwIndexType portNum
424  );
425 
426  protected:
427 
428  // ----------------------------------------------------------------------
429  // Connection status queries for typed output ports
430  // ----------------------------------------------------------------------
431 
436  FwIndexType portNum
437  );
438 
443  FwIndexType portNum
444  );
445 
450  FwIndexType portNum
451  );
452 
453  protected:
454 
455  // ----------------------------------------------------------------------
456  // Handlers to implement for typed input ports
457  // ----------------------------------------------------------------------
458 
460  virtual void dataIn_handler(
461  FwIndexType portNum,
462  Fw::Buffer& data,
463  const ComCfg::FrameContext& context
464  ) = 0;
465 
467  virtual void dataReturnIn_handler(
468  FwIndexType portNum,
469  Fw::Buffer& data,
470  const ComCfg::FrameContext& context
471  ) = 0;
472 
473  protected:
474 
475  // ----------------------------------------------------------------------
476  // Port handler base-class functions for typed input ports
477  //
478  // Call these functions directly to bypass the corresponding ports
479  // ----------------------------------------------------------------------
480 
482  void dataIn_handlerBase(
483  FwIndexType portNum,
484  Fw::Buffer& data,
485  const ComCfg::FrameContext& context
486  );
487 
490  FwIndexType portNum,
491  Fw::Buffer& data,
492  const ComCfg::FrameContext& context
493  );
494 
495  protected:
496 
497  // ----------------------------------------------------------------------
498  // Invocation functions for typed output ports
499  // ----------------------------------------------------------------------
500 
502  void dataOut_out(
503  FwIndexType portNum,
504  Fw::Buffer& data,
505  const ComCfg::FrameContext& context
506  );
507 
509  void dataReturnOut_out(
510  FwIndexType portNum,
511  Fw::Buffer& data,
512  const ComCfg::FrameContext& context
513  );
514 
516  void errorNotify_out(
517  FwIndexType portNum,
518  const Svc::Ccsds::FrameError& errorCode
519  );
520 
521  protected:
522 
523  // ----------------------------------------------------------------------
524  // Event logging functions
525  // ----------------------------------------------------------------------
526 
531  U16 transmitted,
532  U16 configured
533  ) const;
534 
539  U16 transmitted,
540  FwSizeType actual
541  ) const;
542 
547  U16 transmitted,
548  U16 configured
549  ) const;
550 
555  U16 transmitted,
556  U16 computed
557  ) const;
558 
559  protected:
560 
561  // ----------------------------------------------------------------------
562  // Time
563  // ----------------------------------------------------------------------
564 
568  Fw::Time getTime() const;
569 
570  protected:
571 
572  // ----------------------------------------------------------------------
573  // Mutex operations for guarded ports
574  //
575  // You can override these operations to provide more sophisticated
576  // synchronization
577  // ----------------------------------------------------------------------
578 
580  virtual void lock();
581 
583  virtual void unLock();
584 
585  private:
586 
587  // ----------------------------------------------------------------------
588  // Calls for messages received on typed input ports
589  // ----------------------------------------------------------------------
590 
592  static void m_p_dataIn_in(
593  Fw::PassiveComponentBase* callComp,
594  FwIndexType portNum,
595  Fw::Buffer& data,
596  const ComCfg::FrameContext& context
597  );
598 
600  static void m_p_dataReturnIn_in(
601  Fw::PassiveComponentBase* callComp,
602  FwIndexType portNum,
603  Fw::Buffer& data,
604  const ComCfg::FrameContext& context
605  );
606 
607  private:
608 
609  // ----------------------------------------------------------------------
610  // Typed input ports
611  // ----------------------------------------------------------------------
612 
615 
618 
619  private:
620 
621  // ----------------------------------------------------------------------
622  // Special output ports
623  // ----------------------------------------------------------------------
624 
626  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
627 
628 #if FW_ENABLE_TEXT_LOGGING == 1
629 
631  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
632 
633 #endif
634 
636  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
637 
639  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
640 
642  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
643 
645  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
646 
647  private:
648 
649  // ----------------------------------------------------------------------
650  // Typed output ports
651  // ----------------------------------------------------------------------
652 
655 
658 
661 
662  private:
663 
664  // ----------------------------------------------------------------------
665  // Mutexes
666  // ----------------------------------------------------------------------
667 
669  Os::Mutex m_guardedPortMutex;
670 
671  };
672 
673  }
674 
675 }
676 
677 #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()
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