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
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
25 #include "Fw/Prm/PrmGetPortAc.hpp"
26 #include "Fw/Prm/PrmSetPortAc.hpp"
27 #include "Fw/Time/TimePortAc.hpp"
28 #include "Fw/Tlm/TlmPortAc.hpp"
29 #include "Os/Mutex.hpp"
34 
35 namespace Svc {
36 
37  namespace Ccsds {
38 
45  {
46 
47  // ----------------------------------------------------------------------
48  // Friend classes
49  // ----------------------------------------------------------------------
50 
55 
56  protected:
57 
58  // ----------------------------------------------------------------------
59  // Constants
60  // ----------------------------------------------------------------------
61 
63  enum {
66  };
67 
69  enum {
76  };
77 
79  enum {
84  };
85 
87  enum {
90  };
91 
92  public:
93 
94  // ----------------------------------------------------------------------
95  // Component initialization
96  // ----------------------------------------------------------------------
97 
99  void init(
100  FwEnumStoreType instance = 0
101  );
102 
103 #if !FW_DIRECT_PORT_CALLS
104 
105  public:
106 
107  // ----------------------------------------------------------------------
108  // Getters for typed input ports
109  // ----------------------------------------------------------------------
110 
115  FwIndexType portNum
116  );
117 
122  FwIndexType portNum
123  );
124 
125 #endif
126 
127 #if !FW_DIRECT_PORT_CALLS
128 
129  public:
130 
131  // ----------------------------------------------------------------------
132  // Connect input ports to special output ports
133  // ----------------------------------------------------------------------
134 
137  FwIndexType portNum,
138  Fw::InputLogPort* port
139  );
140 
141 #if FW_ENABLE_TEXT_LOGGING == 1
142 
144  void set_logTextOut_OutputPort(
145  FwIndexType portNum,
146  Fw::InputLogTextPort* port
147  );
148 
149 #endif
150 
153  FwIndexType portNum,
154  Fw::InputPrmGetPort* port
155  );
156 
159  FwIndexType portNum,
160  Fw::InputPrmSetPort* port
161  );
162 
165  FwIndexType portNum,
166  Fw::InputTimePort* port
167  );
168 
171  FwIndexType portNum,
172  Fw::InputTlmPort* port
173  );
174 
175 #endif
176 
177 #if !FW_DIRECT_PORT_CALLS
178 
179  public:
180 
181  // ----------------------------------------------------------------------
182  // Connect typed input ports to typed output ports
183  // ----------------------------------------------------------------------
184 
187  FwIndexType portNum,
189  );
190 
193  FwIndexType portNum,
195  );
196 
199  FwIndexType portNum,
201  );
202 
205  FwIndexType portNum,
207  );
208 
209 #endif
210 
211 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
212 
213  public:
214 
215  // ----------------------------------------------------------------------
216  // Connect serial input ports to special output ports
217  // ----------------------------------------------------------------------
218 
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
225 #if FW_ENABLE_TEXT_LOGGING == 1
226 
228  void set_logTextOut_OutputPort(
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
233 #endif
234 
237  FwIndexType portNum,
238  Fw::InputSerializePort* port
239  );
240 
243  FwIndexType portNum,
244  Fw::InputSerializePort* port
245  );
246 
249  FwIndexType portNum,
250  Fw::InputSerializePort* port
251  );
252 
253 #endif
254 
255 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
256 
257  public:
258 
259  // ----------------------------------------------------------------------
260  // Connect serial input ports to typed output ports
261  // ----------------------------------------------------------------------
262 
265  FwIndexType portNum,
266  Fw::InputSerializePort* port
267  );
268 
271  FwIndexType portNum,
272  Fw::InputSerializePort* port
273  );
274 
277  FwIndexType portNum,
278  Fw::InputSerializePort* port
279  );
280 
281 #endif
282 
283  protected:
284 
285  // ----------------------------------------------------------------------
286  // Component construction and destruction
287  // ----------------------------------------------------------------------
288 
291  const char* compName = ""
292  );
293 
296 
297  protected:
298 
299  // ----------------------------------------------------------------------
300  // Getters for numbers of typed input ports
301  // ----------------------------------------------------------------------
302 
307  return NUM_DATAIN_INPUT_PORTS;
308  }
309 
315  }
316 
317  protected:
318 
319  // ----------------------------------------------------------------------
320  // Getters for numbers of special output ports
321  // ----------------------------------------------------------------------
322 
328  }
329 
330 #if FW_ENABLE_TEXT_LOGGING == 1
331 
335  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
337  }
338 
339 #endif
340 
346  }
347 
353  }
354 
360  }
361 
367  }
368 
369  protected:
370 
371  // ----------------------------------------------------------------------
372  // Getters for numbers of typed output ports
373  // ----------------------------------------------------------------------
374 
380  }
381 
387  }
388 
394  }
395 
401  }
402 
403  protected:
404 
405  // ----------------------------------------------------------------------
406  // Connection status queries for special output ports
407  // ----------------------------------------------------------------------
408 
413  FwIndexType portNum
414  ) const;
415 
416 #if FW_ENABLE_TEXT_LOGGING == 1
417 
421  bool isConnected_logTextOut_OutputPort(
422  FwIndexType portNum
423  ) const;
424 
425 #endif
426 
431  FwIndexType portNum
432  ) const;
433 
438  FwIndexType portNum
439  ) const;
440 
445  FwIndexType portNum
446  ) const;
447 
452  FwIndexType portNum
453  ) const;
454 
455  protected:
456 
457  // ----------------------------------------------------------------------
458  // Connection status queries for typed output ports
459  // ----------------------------------------------------------------------
460 
465  FwIndexType portNum
466  ) const;
467 
472  FwIndexType portNum
473  ) const;
474 
479  FwIndexType portNum
480  ) const;
481 
486  FwIndexType portNum
487  ) const;
488 
489  protected:
490 
491  // ----------------------------------------------------------------------
492  // Handlers to implement for typed input ports
493  // ----------------------------------------------------------------------
494 
496  virtual void dataIn_handler(
497  FwIndexType portNum,
498  Fw::Buffer& data,
499  const ComCfg::FrameContext& context
500  ) = 0;
501 
503  virtual void dataReturnIn_handler(
504  FwIndexType portNum,
505  Fw::Buffer& data,
506  const ComCfg::FrameContext& context
507  ) = 0;
508 
509 #if FW_DIRECT_PORT_CALLS
510  public:
511 #else
512  protected:
513 #endif
514 
515  // ----------------------------------------------------------------------
516  // Port handler base-class functions for typed input ports
517  //
518  // Call these functions directly to bypass the corresponding ports
519  // ----------------------------------------------------------------------
520 
522  void dataIn_handlerBase(
523  FwIndexType portNum,
524  Fw::Buffer& data,
525  const ComCfg::FrameContext& context
526  );
527 
530  FwIndexType portNum,
531  Fw::Buffer& data,
532  const ComCfg::FrameContext& context
533  );
534 
535  protected:
536 
537  // ----------------------------------------------------------------------
538  // Invocation functions for typed output ports
539  // ----------------------------------------------------------------------
540 
542  void dataOut_out(
543  FwIndexType portNum,
544  Fw::Buffer& data,
545  const ComCfg::FrameContext& context
546  ) const;
547 
549  void dataReturnOut_out(
550  FwIndexType portNum,
551  Fw::Buffer& data,
552  const ComCfg::FrameContext& context
553  ) const;
554 
556  void errorNotify_out(
557  FwIndexType portNum,
558  const Svc::Ccsds::FrameError& errorCode
559  ) const;
560 
563  FwIndexType portNum,
564  const ComCfg::Apid& apid,
565  U16 sequenceCount
566  ) const;
567 
568  protected:
569 
570  // ----------------------------------------------------------------------
571  // Event logging functions
572  // ----------------------------------------------------------------------
573 
577  void log_WARNING_HI_InvalidPacket() const;
578 
583  FwSizeType transmitted,
584  FwSizeType actual
585  ) const;
586 
587  protected:
588 
589  // ----------------------------------------------------------------------
590  // Time
591  // ----------------------------------------------------------------------
592 
596  Fw::Time getTime() const;
597 
598  protected:
599 
600  // ----------------------------------------------------------------------
601  // Mutex operations for guarded ports
602  //
603  // You can override these operations to provide more sophisticated
604  // synchronization
605  // ----------------------------------------------------------------------
606 
608  virtual void lock();
609 
611  virtual void unLock();
612 
613  private:
614 
615  // ----------------------------------------------------------------------
616  // Calls for messages received on typed input ports
617  // ----------------------------------------------------------------------
618 
620  static void m_p_dataIn_in(
621  Fw::PassiveComponentBase* callComp,
622  FwIndexType portNum,
623  Fw::Buffer& data,
624  const ComCfg::FrameContext& context
625  );
626 
628  static void m_p_dataReturnIn_in(
629  Fw::PassiveComponentBase* callComp,
630  FwIndexType portNum,
631  Fw::Buffer& data,
632  const ComCfg::FrameContext& context
633  );
634 
635  private:
636 
637  // ----------------------------------------------------------------------
638  // Invocation functions for special output ports
639  // ----------------------------------------------------------------------
640 
642  void logOut_out(
643  FwIndexType portNum,
644  FwEventIdType id,
645  Fw::Time& timeTag,
646  const Fw::LogSeverity& severity,
647  Fw::LogBuffer& args
648  ) const;
649 
650 #if FW_ENABLE_TEXT_LOGGING
651 
653  void logTextOut_out(
654  FwIndexType portNum,
655  FwEventIdType id,
656  Fw::Time& timeTag,
657  const Fw::LogSeverity& severity,
658  Fw::TextLogString& text
659  ) const;
660 
661 #endif
662 
664  void timeCaller_out(
665  FwIndexType portNum,
666  Fw::Time& time
667  ) const;
668 
669 #if !FW_DIRECT_PORT_CALLS
670 
671  private:
672 
673  // ----------------------------------------------------------------------
674  // Typed input ports
675  // ----------------------------------------------------------------------
676 
679 
682 
683 #endif
684 
685 #if !FW_DIRECT_PORT_CALLS
686 
687  private:
688 
689  // ----------------------------------------------------------------------
690  // Special output ports
691  // ----------------------------------------------------------------------
692 
694  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
695 
696 #if FW_ENABLE_TEXT_LOGGING == 1
697 
699  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
700 
701 #endif
702 
704  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
705 
707  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
708 
710  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
711 
713  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
714 
715 #endif
716 
717 #if !FW_DIRECT_PORT_CALLS
718 
719  private:
720 
721  // ----------------------------------------------------------------------
722  // Typed output ports
723  // ----------------------------------------------------------------------
724 
727 
730 
733 
736 
737 #endif
738 
739  private:
740 
741  // ----------------------------------------------------------------------
742  // Mutexes
743  // ----------------------------------------------------------------------
744 
746  Os::Mutex m_guardedPortMutex;
747 
748  };
749 
750  }
751 
752 }
753 
754 #endif
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode) const
Invoke output port errorNotify.
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.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
U16 validateApidSeqCount_out(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount) const
Invoke output port validateApidSeqCount.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
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)
FwIdType FwEventIdType
The type of an event identifier.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
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.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
Enum representing event severity.
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
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.
bool isConnected_validateApidSeqCount_OutputPort(FwIndexType portNum) const
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
void log_WARNING_HI_InvalidLength(FwSizeType transmitted, FwSizeType actual) const
virtual ~SpacePacketDeframerComponentBase()
Destroy SpacePacketDeframerComponentBase object.