F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SpacePacketDeframerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SpacePacketDeframerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for SpacePacketDeframer component base class
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_SpacePacketDeframerComponentAc_HPP
8 #define Svc_Ccsds_SpacePacketDeframerComponentAc_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"
30 
31 namespace Svc {
32 
33  namespace Ccsds {
34 
41  {
42 
43  // ----------------------------------------------------------------------
44  // Friend classes
45  // ----------------------------------------------------------------------
46 
51 
52  protected:
53 
54  // ----------------------------------------------------------------------
55  // Constants
56  // ----------------------------------------------------------------------
57 
59  enum {
62  };
63 
65  enum {
72  };
73 
75  enum {
80  };
81 
83  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 
191  FwIndexType portNum,
193  );
194 
195 #if FW_PORT_SERIALIZATION
196 
197  public:
198 
199  // ----------------------------------------------------------------------
200  // Connect serial input ports to special output ports
201  // ----------------------------------------------------------------------
202 
205  FwIndexType portNum,
206  Fw::InputSerializePort* port
207  );
208 
209 #if FW_ENABLE_TEXT_LOGGING == 1
210 
212  void set_logTextOut_OutputPort(
213  FwIndexType portNum,
214  Fw::InputSerializePort* port
215  );
216 
217 #endif
218 
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
237 #endif
238 
239 #if FW_PORT_SERIALIZATION
240 
241  public:
242 
243  // ----------------------------------------------------------------------
244  // Connect serial input ports to typed output ports
245  // ----------------------------------------------------------------------
246 
249  FwIndexType portNum,
250  Fw::InputSerializePort* port
251  );
252 
255  FwIndexType portNum,
256  Fw::InputSerializePort* port
257  );
258 
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
265 #endif
266 
267  protected:
268 
269  // ----------------------------------------------------------------------
270  // Component construction and destruction
271  // ----------------------------------------------------------------------
272 
275  const char* compName = ""
276  );
277 
280 
281  protected:
282 
283  // ----------------------------------------------------------------------
284  // Getters for numbers of typed input ports
285  // ----------------------------------------------------------------------
286 
291  return NUM_DATAIN_INPUT_PORTS;
292  }
293 
299  }
300 
301  protected:
302 
303  // ----------------------------------------------------------------------
304  // Getters for numbers of special output ports
305  // ----------------------------------------------------------------------
306 
312  }
313 
314 #if FW_ENABLE_TEXT_LOGGING == 1
315 
319  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
321  }
322 
323 #endif
324 
330  }
331 
337  }
338 
344  }
345 
351  }
352 
353  protected:
354 
355  // ----------------------------------------------------------------------
356  // Getters for numbers of typed output ports
357  // ----------------------------------------------------------------------
358 
364  }
365 
371  }
372 
378  }
379 
385  }
386 
387  protected:
388 
389  // ----------------------------------------------------------------------
390  // Connection status queries for special output ports
391  // ----------------------------------------------------------------------
392 
397  FwIndexType portNum
398  );
399 
400 #if FW_ENABLE_TEXT_LOGGING == 1
401 
405  bool isConnected_logTextOut_OutputPort(
406  FwIndexType portNum
407  );
408 
409 #endif
410 
415  FwIndexType portNum
416  );
417 
422  FwIndexType portNum
423  );
424 
429  FwIndexType portNum
430  );
431 
436  FwIndexType portNum
437  );
438 
439  protected:
440 
441  // ----------------------------------------------------------------------
442  // Connection status queries for typed output ports
443  // ----------------------------------------------------------------------
444 
449  FwIndexType portNum
450  );
451 
456  FwIndexType portNum
457  );
458 
463  FwIndexType portNum
464  );
465 
470  FwIndexType portNum
471  );
472 
473  protected:
474 
475  // ----------------------------------------------------------------------
476  // Handlers to implement for typed input ports
477  // ----------------------------------------------------------------------
478 
480  virtual void dataIn_handler(
481  FwIndexType portNum,
482  Fw::Buffer& data,
483  const ComCfg::FrameContext& context
484  ) = 0;
485 
487  virtual void dataReturnIn_handler(
488  FwIndexType portNum,
489  Fw::Buffer& data,
490  const ComCfg::FrameContext& context
491  ) = 0;
492 
493  protected:
494 
495  // ----------------------------------------------------------------------
496  // Port handler base-class functions for typed input ports
497  //
498  // Call these functions directly to bypass the corresponding ports
499  // ----------------------------------------------------------------------
500 
502  void dataIn_handlerBase(
503  FwIndexType portNum,
504  Fw::Buffer& data,
505  const ComCfg::FrameContext& context
506  );
507 
510  FwIndexType portNum,
511  Fw::Buffer& data,
512  const ComCfg::FrameContext& context
513  );
514 
515  protected:
516 
517  // ----------------------------------------------------------------------
518  // Invocation functions for typed output ports
519  // ----------------------------------------------------------------------
520 
522  void dataOut_out(
523  FwIndexType portNum,
524  Fw::Buffer& data,
525  const ComCfg::FrameContext& context
526  );
527 
529  void dataReturnOut_out(
530  FwIndexType portNum,
531  Fw::Buffer& data,
532  const ComCfg::FrameContext& context
533  );
534 
536  void errorNotify_out(
537  FwIndexType portNum,
538  const Svc::Ccsds::FrameError& errorCode
539  );
540 
543  FwIndexType portNum,
544  const ComCfg::Apid& apid,
545  U16 sequenceCount
546  );
547 
548  protected:
549 
550  // ----------------------------------------------------------------------
551  // Event logging functions
552  // ----------------------------------------------------------------------
553 
557  void log_WARNING_HI_InvalidPacket() const;
558 
563  U16 transmitted,
564  FwSizeType actual
565  ) const;
566 
567  protected:
568 
569  // ----------------------------------------------------------------------
570  // Time
571  // ----------------------------------------------------------------------
572 
576  Fw::Time getTime() const;
577 
578  protected:
579 
580  // ----------------------------------------------------------------------
581  // Mutex operations for guarded ports
582  //
583  // You can override these operations to provide more sophisticated
584  // synchronization
585  // ----------------------------------------------------------------------
586 
588  virtual void lock();
589 
591  virtual void unLock();
592 
593  private:
594 
595  // ----------------------------------------------------------------------
596  // Calls for messages received on typed input ports
597  // ----------------------------------------------------------------------
598 
600  static void m_p_dataIn_in(
601  Fw::PassiveComponentBase* callComp,
602  FwIndexType portNum,
603  Fw::Buffer& data,
604  const ComCfg::FrameContext& context
605  );
606 
608  static void m_p_dataReturnIn_in(
609  Fw::PassiveComponentBase* callComp,
610  FwIndexType portNum,
611  Fw::Buffer& data,
612  const ComCfg::FrameContext& context
613  );
614 
615  private:
616 
617  // ----------------------------------------------------------------------
618  // Typed input ports
619  // ----------------------------------------------------------------------
620 
623 
626 
627  private:
628 
629  // ----------------------------------------------------------------------
630  // Special output ports
631  // ----------------------------------------------------------------------
632 
634  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
635 
636 #if FW_ENABLE_TEXT_LOGGING == 1
637 
639  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
640 
641 #endif
642 
644  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
645 
647  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
648 
650  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
651 
653  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
654 
655  private:
656 
657  // ----------------------------------------------------------------------
658  // Typed output ports
659  // ----------------------------------------------------------------------
660 
663 
666 
669 
672 
673  private:
674 
675  // ----------------------------------------------------------------------
676  // Mutexes
677  // ----------------------------------------------------------------------
678 
680  Os::Mutex m_guardedPortMutex;
681 
682  };
683 
684  }
685 
686 }
687 
688 #endif
static constexpr FwIndexType getNum_validateApidSeqCount_OutputPorts()
Enum representing an error during framing/deframing in the CCSDS protocols.
PlatformSizeType FwSizeType
void set_errorNotify_OutputPort(FwIndexType portNum, Svc::Ccsds::InputErrorNotifyPort *port)
Connect port to errorNotify[portNum].
I32 FwEnumStoreType
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void log_WARNING_HI_InvalidLength(U16 transmitted, FwSizeType actual) const
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void init()
Object initializer.
Definition: ObjBase.cpp:24
friend class SpacePacketDeframerTester
Friend class tester implementation to support white-box testing.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
SpacePacketDeframerComponentBase(const char *compName="")
Construct SpacePacketDeframerComponentBase object.
friend class SpacePacketDeframerTesterBase
Friend class tester to support autocoded test harness.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode)
Invoke output port errorNotify.
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
void set_validateApidSeqCount_OutputPort(FwIndexType portNum, Svc::Ccsds::InputApidSequenceCountPort *port)
Connect port to validateApidSeqCount[portNum].
RateGroupDivider component implementation.
Auto-generated base for SpacePacketDeframer component.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:17
virtual ~SpacePacketDeframerComponentBase()
Destroy SpacePacketDeframerComponentBase object.
U16 validateApidSeqCount_out(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount)
Invoke output port validateApidSeqCount.