F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SpacePacketFramerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SpacePacketFramerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for SpacePacketFramer component base class
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_SpacePacketFramerComponentAc_HPP
8 #define Svc_Ccsds_SpacePacketFramerComponentAc_HPP
9 
10 #include <atomic>
11 
15 #include "Fw/FPrimeBasicTypes.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #include "Fw/Log/LogTextPortAc.hpp"
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
26 #include "Fw/Prm/PrmGetPortAc.hpp"
27 #include "Fw/Prm/PrmSetPortAc.hpp"
28 #include "Fw/Time/TimePortAc.hpp"
29 #include "Fw/Tlm/TlmPortAc.hpp"
32 
33 namespace Svc {
34 
35  namespace Ccsds {
36 
43  {
44 
45  // ----------------------------------------------------------------------
46  // Friend classes
47  // ----------------------------------------------------------------------
48 
53 
54  protected:
55 
56  // ----------------------------------------------------------------------
57  // Constants
58  // ----------------------------------------------------------------------
59 
61  enum {
65  };
66 
68  enum {
75  };
76 
78  enum {
85  };
86 
88  enum {
90  };
91 
93  enum {
95  };
96 
97  public:
98 
99  // ----------------------------------------------------------------------
100  // Component initialization
101  // ----------------------------------------------------------------------
102 
104  void init(
105  FwEnumStoreType instance = 0
106  );
107 
108 #if !FW_DIRECT_PORT_CALLS
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Getters for typed input ports
114  // ----------------------------------------------------------------------
115 
120  FwIndexType portNum
121  );
122 
127  FwIndexType portNum
128  );
129 
134  FwIndexType portNum
135  );
136 
137 #endif
138 
139 #if !FW_DIRECT_PORT_CALLS
140 
141  public:
142 
143  // ----------------------------------------------------------------------
144  // Connect input ports to special output ports
145  // ----------------------------------------------------------------------
146 
149  FwIndexType portNum,
150  Fw::InputLogPort* port
151  );
152 
153 #if FW_ENABLE_TEXT_LOGGING == 1
154 
156  void set_logTextOut_OutputPort(
157  FwIndexType portNum,
158  Fw::InputLogTextPort* port
159  );
160 
161 #endif
162 
165  FwIndexType portNum,
166  Fw::InputPrmGetPort* port
167  );
168 
171  FwIndexType portNum,
172  Fw::InputPrmSetPort* port
173  );
174 
177  FwIndexType portNum,
178  Fw::InputTimePort* port
179  );
180 
183  FwIndexType portNum,
184  Fw::InputTlmPort* port
185  );
186 
187 #endif
188 
189 #if !FW_DIRECT_PORT_CALLS
190 
191  public:
192 
193  // ----------------------------------------------------------------------
194  // Connect typed input ports to typed output ports
195  // ----------------------------------------------------------------------
196 
199  FwIndexType portNum,
201  );
202 
205  FwIndexType portNum,
207  );
208 
211  FwIndexType portNum,
213  );
214 
217  FwIndexType portNum,
219  );
220 
223  FwIndexType portNum,
225  );
226 
229  FwIndexType portNum,
231  );
232 
233 #endif
234 
235 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
236 
237  public:
238 
239  // ----------------------------------------------------------------------
240  // Connect serial input ports to special output ports
241  // ----------------------------------------------------------------------
242 
245  FwIndexType portNum,
246  Fw::InputSerializePort* port
247  );
248 
249 #if FW_ENABLE_TEXT_LOGGING == 1
250 
252  void set_logTextOut_OutputPort(
253  FwIndexType portNum,
254  Fw::InputSerializePort* port
255  );
256 
257 #endif
258 
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
267  FwIndexType portNum,
268  Fw::InputSerializePort* port
269  );
270 
273  FwIndexType portNum,
274  Fw::InputSerializePort* port
275  );
276 
277 #endif
278 
279 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
280 
281  public:
282 
283  // ----------------------------------------------------------------------
284  // Connect serial input ports to typed output ports
285  // ----------------------------------------------------------------------
286 
289  FwIndexType portNum,
290  Fw::InputSerializePort* port
291  );
292 
295  FwIndexType portNum,
296  Fw::InputSerializePort* port
297  );
298 
301  FwIndexType portNum,
302  Fw::InputSerializePort* port
303  );
304 
307  FwIndexType portNum,
308  Fw::InputSerializePort* port
309  );
310 
311 #endif
312 
313  protected:
314 
315  // ----------------------------------------------------------------------
316  // Component construction and destruction
317  // ----------------------------------------------------------------------
318 
321  const char* compName = ""
322  );
323 
326 
327  protected:
328 
329  // ----------------------------------------------------------------------
330  // Getters for numbers of typed input ports
331  // ----------------------------------------------------------------------
332 
338  }
339 
344  return NUM_DATAIN_INPUT_PORTS;
345  }
346 
352  }
353 
354  protected:
355 
356  // ----------------------------------------------------------------------
357  // Getters for numbers of special output ports
358  // ----------------------------------------------------------------------
359 
365  }
366 
367 #if FW_ENABLE_TEXT_LOGGING == 1
368 
372  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
374  }
375 
376 #endif
377 
383  }
384 
390  }
391 
397  }
398 
404  }
405 
406  protected:
407 
408  // ----------------------------------------------------------------------
409  // Getters for numbers of typed output ports
410  // ----------------------------------------------------------------------
411 
417  }
418 
424  }
425 
431  }
432 
438  }
439 
445  }
446 
452  }
453 
454  protected:
455 
456  // ----------------------------------------------------------------------
457  // Connection status queries for special output ports
458  // ----------------------------------------------------------------------
459 
464  FwIndexType portNum
465  ) const;
466 
467 #if FW_ENABLE_TEXT_LOGGING == 1
468 
472  bool isConnected_logTextOut_OutputPort(
473  FwIndexType portNum
474  ) const;
475 
476 #endif
477 
482  FwIndexType portNum
483  ) const;
484 
489  FwIndexType portNum
490  ) const;
491 
496  FwIndexType portNum
497  ) const;
498 
503  FwIndexType portNum
504  ) const;
505 
506  protected:
507 
508  // ----------------------------------------------------------------------
509  // Connection status queries for typed output ports
510  // ----------------------------------------------------------------------
511 
516  FwIndexType portNum
517  ) const;
518 
523  FwIndexType portNum
524  ) const;
525 
530  FwIndexType portNum
531  ) const;
532 
537  FwIndexType portNum
538  ) const;
539 
544  FwIndexType portNum
545  ) const;
546 
551  FwIndexType portNum
552  ) const;
553 
554  protected:
555 
556  // ----------------------------------------------------------------------
557  // Handlers to implement for typed input ports
558  // ----------------------------------------------------------------------
559 
561  virtual void comStatusIn_handler(
562  FwIndexType portNum,
563  Fw::Success& condition
564  ) = 0;
565 
567  virtual void dataIn_handler(
568  FwIndexType portNum,
569  Fw::Buffer& data,
570  const ComCfg::FrameContext& context
571  ) = 0;
572 
574  virtual void dataReturnIn_handler(
575  FwIndexType portNum,
576  Fw::Buffer& data,
577  const ComCfg::FrameContext& context
578  ) = 0;
579 
580 #if FW_DIRECT_PORT_CALLS
581  public:
582 #else
583  protected:
584 #endif
585 
586  // ----------------------------------------------------------------------
587  // Port handler base-class functions for typed input ports
588  //
589  // Call these functions directly to bypass the corresponding ports
590  // ----------------------------------------------------------------------
591 
594  FwIndexType portNum,
595  Fw::Success& condition
596  );
597 
599  void dataIn_handlerBase(
600  FwIndexType portNum,
601  Fw::Buffer& data,
602  const ComCfg::FrameContext& context
603  );
604 
607  FwIndexType portNum,
608  Fw::Buffer& data,
609  const ComCfg::FrameContext& context
610  );
611 
612  protected:
613 
614  // ----------------------------------------------------------------------
615  // Invocation functions for typed output ports
616  // ----------------------------------------------------------------------
617 
620  FwIndexType portNum,
621  FwSizeType size
622  ) const;
623 
626  FwIndexType portNum,
627  Fw::Buffer& fwBuffer
628  ) const;
629 
631  void comStatusOut_out(
632  FwIndexType portNum,
633  Fw::Success& condition
634  ) const;
635 
637  void dataOut_out(
638  FwIndexType portNum,
639  Fw::Buffer& data,
640  const ComCfg::FrameContext& context
641  ) const;
642 
644  void dataReturnOut_out(
645  FwIndexType portNum,
646  Fw::Buffer& data,
647  const ComCfg::FrameContext& context
648  ) const;
649 
652  FwIndexType portNum,
653  const ComCfg::Apid& apid,
654  U16 sequenceCount
655  ) const;
656 
657  protected:
658 
659  // ----------------------------------------------------------------------
660  // Event logging functions
661  // ----------------------------------------------------------------------
662 
667 
668  protected:
669 
670  // ----------------------------------------------------------------------
671  // Event throttle reset functions
672  // ----------------------------------------------------------------------
673 
676 
677  protected:
678 
679  // ----------------------------------------------------------------------
680  // Time
681  // ----------------------------------------------------------------------
682 
686  Fw::Time getTime() const;
687 
688  private:
689 
690  // ----------------------------------------------------------------------
691  // Calls for messages received on typed input ports
692  // ----------------------------------------------------------------------
693 
695  static void m_p_comStatusIn_in(
696  Fw::PassiveComponentBase* callComp,
697  FwIndexType portNum,
698  Fw::Success& condition
699  );
700 
702  static void m_p_dataIn_in(
703  Fw::PassiveComponentBase* callComp,
704  FwIndexType portNum,
705  Fw::Buffer& data,
706  const ComCfg::FrameContext& context
707  );
708 
710  static void m_p_dataReturnIn_in(
711  Fw::PassiveComponentBase* callComp,
712  FwIndexType portNum,
713  Fw::Buffer& data,
714  const ComCfg::FrameContext& context
715  );
716 
717  private:
718 
719  // ----------------------------------------------------------------------
720  // Invocation functions for special output ports
721  // ----------------------------------------------------------------------
722 
724  void logOut_out(
725  FwIndexType portNum,
726  FwEventIdType id,
727  Fw::Time& timeTag,
728  const Fw::LogSeverity& severity,
729  Fw::LogBuffer& args
730  ) const;
731 
732 #if FW_ENABLE_TEXT_LOGGING
733 
735  void logTextOut_out(
736  FwIndexType portNum,
737  FwEventIdType id,
738  Fw::Time& timeTag,
739  const Fw::LogSeverity& severity,
740  Fw::TextLogString& text
741  ) const;
742 
743 #endif
744 
746  void timeCaller_out(
747  FwIndexType portNum,
748  Fw::Time& time
749  ) const;
750 
751 #if !FW_DIRECT_PORT_CALLS
752 
753  private:
754 
755  // ----------------------------------------------------------------------
756  // Typed input ports
757  // ----------------------------------------------------------------------
758 
761 
764 
767 
768 #endif
769 
770 #if !FW_DIRECT_PORT_CALLS
771 
772  private:
773 
774  // ----------------------------------------------------------------------
775  // Special output ports
776  // ----------------------------------------------------------------------
777 
779  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
780 
781 #if FW_ENABLE_TEXT_LOGGING == 1
782 
784  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
785 
786 #endif
787 
789  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
790 
792  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
793 
795  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
796 
798  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
799 
800 #endif
801 
802 #if !FW_DIRECT_PORT_CALLS
803 
804  private:
805 
806  // ----------------------------------------------------------------------
807  // Typed output ports
808  // ----------------------------------------------------------------------
809 
811  Fw::OutputBufferGetPort m_bufferAllocate_OutputPort[NUM_BUFFERALLOCATE_OUTPUT_PORTS];
812 
814  Fw::OutputBufferSendPort m_bufferDeallocate_OutputPort[NUM_BUFFERDEALLOCATE_OUTPUT_PORTS];
815 
818 
821 
824 
827 
828 #endif
829 
830  private:
831 
832  // ----------------------------------------------------------------------
833  // Counter values for event throttling
834  // ----------------------------------------------------------------------
835 
837  std::atomic<FwIndexType> m_NoBufferAvailableThrottle;
838 
839  };
840 
841  }
842 
843 }
844 
845 #endif
SpacePacketFramerComponentBase(const char *compName="")
Construct SpacePacketFramerComponentBase object.
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum) const
PlatformSizeType FwSizeType
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
I32 FwEnumStoreType
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum) const
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
No buffer was available to hold the packet, which was dropped.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
static constexpr FwIndexType getNum_getApidSeqCount_OutputPorts()
void comStatusIn_handlerBase(FwIndexType portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
FwIdType FwEventIdType
The type of an event identifier.
void log_WARNING_HI_NoBufferAvailable_ThrottleClear()
Reset throttle value for NoBufferAvailable.
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferDeallocate.
void comStatusOut_out(FwIndexType portNum, Fw::Success &condition) const
Invoke output port comStatusOut.
static constexpr FwIndexType getNum_comStatusOut_OutputPorts()
bool isConnected_comStatusOut_OutputPort(FwIndexType portNum) const
void set_getApidSeqCount_OutputPort(FwIndexType portNum, Svc::Ccsds::InputApidSequenceCountPort *port)
Connect port to getApidSeqCount[portNum].
friend class SpacePacketFramerTester
Friend class tester implementation to support white-box testing.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
static constexpr FwIndexType getNum_bufferAllocate_OutputPorts()
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
Enum representing event severity.
static constexpr FwIndexType getNum_bufferDeallocate_OutputPorts()
Fw::Buffer bufferAllocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port bufferAllocate.
Auto-generated base for SpacePacketFramer component.
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
friend class SpacePacketFramerTesterBase
Friend class tester to support autocoded test harness.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
bool isConnected_getApidSeqCount_OutputPort(FwIndexType portNum) const
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum) const
U16 getApidSeqCount_out(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount) const
Invoke output port getApidSeqCount.
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum) const
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
RateGroupDivider component implementation.
virtual ~SpacePacketFramerComponentBase()
Destroy SpacePacketFramerComponentBase object.
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:18
Success/Failure.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].