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 
290 
291  protected:
292 
293  // ----------------------------------------------------------------------
294  // Getters for numbers of special output ports
295  // ----------------------------------------------------------------------
296 
301 
302 #if FW_ENABLE_TEXT_LOGGING == 1
303 
307  FwIndexType getNum_logTextOut_OutputPorts() const;
308 
309 #endif
310 
315 
320 
325 
330 
331  protected:
332 
333  // ----------------------------------------------------------------------
334  // Getters for numbers of typed output ports
335  // ----------------------------------------------------------------------
336 
341 
346 
351 
352  protected:
353 
354  // ----------------------------------------------------------------------
355  // Connection status queries for special output ports
356  // ----------------------------------------------------------------------
357 
362  FwIndexType portNum
363  );
364 
365 #if FW_ENABLE_TEXT_LOGGING == 1
366 
370  bool isConnected_logTextOut_OutputPort(
371  FwIndexType portNum
372  );
373 
374 #endif
375 
380  FwIndexType portNum
381  );
382 
387  FwIndexType portNum
388  );
389 
394  FwIndexType portNum
395  );
396 
401  FwIndexType portNum
402  );
403 
404  protected:
405 
406  // ----------------------------------------------------------------------
407  // Connection status queries for typed output ports
408  // ----------------------------------------------------------------------
409 
414  FwIndexType portNum
415  );
416 
421  FwIndexType portNum
422  );
423 
428  FwIndexType portNum
429  );
430 
431  protected:
432 
433  // ----------------------------------------------------------------------
434  // Handlers to implement for typed input ports
435  // ----------------------------------------------------------------------
436 
438  virtual void dataIn_handler(
439  FwIndexType portNum,
440  Fw::Buffer& data,
441  const ComCfg::FrameContext& context
442  ) = 0;
443 
445  virtual void dataReturnIn_handler(
446  FwIndexType portNum,
447  Fw::Buffer& data,
448  const ComCfg::FrameContext& context
449  ) = 0;
450 
451  protected:
452 
453  // ----------------------------------------------------------------------
454  // Port handler base-class functions for typed input ports
455  //
456  // Call these functions directly to bypass the corresponding ports
457  // ----------------------------------------------------------------------
458 
460  void dataIn_handlerBase(
461  FwIndexType portNum,
462  Fw::Buffer& data,
463  const ComCfg::FrameContext& context
464  );
465 
468  FwIndexType portNum,
469  Fw::Buffer& data,
470  const ComCfg::FrameContext& context
471  );
472 
473  protected:
474 
475  // ----------------------------------------------------------------------
476  // Invocation functions for typed output ports
477  // ----------------------------------------------------------------------
478 
480  void dataOut_out(
481  FwIndexType portNum,
482  Fw::Buffer& data,
483  const ComCfg::FrameContext& context
484  );
485 
487  void dataReturnOut_out(
488  FwIndexType portNum,
489  Fw::Buffer& data,
490  const ComCfg::FrameContext& context
491  );
492 
494  void errorNotify_out(
495  FwIndexType portNum,
496  const Svc::Ccsds::FrameError& errorCode
497  );
498 
499  protected:
500 
501  // ----------------------------------------------------------------------
502  // Event logging functions
503  // ----------------------------------------------------------------------
504 
509  U16 transmitted,
510  U16 configured
511  ) const;
512 
517  U16 transmitted,
518  FwSizeType actual
519  ) const;
520 
525  U16 transmitted,
526  U16 configured
527  ) const;
528 
533  U16 transmitted,
534  U16 computed
535  ) const;
536 
537  protected:
538 
539  // ----------------------------------------------------------------------
540  // Time
541  // ----------------------------------------------------------------------
542 
546  Fw::Time getTime() const;
547 
548  protected:
549 
550  // ----------------------------------------------------------------------
551  // Mutex operations for guarded ports
552  //
553  // You can override these operations to provide more sophisticated
554  // synchronization
555  // ----------------------------------------------------------------------
556 
558  virtual void lock();
559 
561  virtual void unLock();
562 
563  private:
564 
565  // ----------------------------------------------------------------------
566  // Calls for messages received on typed input ports
567  // ----------------------------------------------------------------------
568 
570  static void m_p_dataIn_in(
571  Fw::PassiveComponentBase* callComp,
572  FwIndexType portNum,
573  Fw::Buffer& data,
574  const ComCfg::FrameContext& context
575  );
576 
578  static void m_p_dataReturnIn_in(
579  Fw::PassiveComponentBase* callComp,
580  FwIndexType portNum,
581  Fw::Buffer& data,
582  const ComCfg::FrameContext& context
583  );
584 
585  private:
586 
587  // ----------------------------------------------------------------------
588  // Typed input ports
589  // ----------------------------------------------------------------------
590 
593 
596 
597  private:
598 
599  // ----------------------------------------------------------------------
600  // Special output ports
601  // ----------------------------------------------------------------------
602 
604  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
605 
606 #if FW_ENABLE_TEXT_LOGGING == 1
607 
609  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
610 
611 #endif
612 
614  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
615 
617  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
618 
620  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
621 
623  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
624 
625  private:
626 
627  // ----------------------------------------------------------------------
628  // Typed output ports
629  // ----------------------------------------------------------------------
630 
633 
636 
639 
640  private:
641 
642  // ----------------------------------------------------------------------
643  // Mutexes
644  // ----------------------------------------------------------------------
645 
647  Os::Mutex m_guardedPortMutex;
648 
649  };
650 
651  }
652 
653 }
654 
655 #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)
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].
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_logOut_OutputPort(FwIndexType portNum)
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
virtual void lock()
Lock the guarded mutex.
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.
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.
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.
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