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 #include "Fw/Log/LogTextPortAc.hpp"
17 #if !FW_DIRECT_PORT_CALLS
19 #endif
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #include "Fw/Prm/PrmGetPortAc.hpp"
24 #include "Fw/Prm/PrmSetPortAc.hpp"
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Fw/Tlm/TlmPortAc.hpp"
27 #include "Os/Mutex.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 {
64  };
65 
67  enum {
74  };
75 
77  enum {
82  };
83 
85  enum {
88  };
89 
90  public:
91 
92  // ----------------------------------------------------------------------
93  // Component initialization
94  // ----------------------------------------------------------------------
95 
97  void init(
98  FwEnumStoreType instance = 0
99  );
100 
101 #if !FW_DIRECT_PORT_CALLS
102 
103  public:
104 
105  // ----------------------------------------------------------------------
106  // Getters for typed input ports
107  // ----------------------------------------------------------------------
108 
113  FwIndexType portNum
114  );
115 
120  FwIndexType portNum
121  );
122 
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS
126 
127  public:
128 
129  // ----------------------------------------------------------------------
130  // Connect input ports to special output ports
131  // ----------------------------------------------------------------------
132 
135  FwIndexType portNum,
136  Fw::InputLogPort* port
137  );
138 
139 #if FW_ENABLE_TEXT_LOGGING == 1
140 
142  void set_logTextOut_OutputPort(
143  FwIndexType portNum,
144  Fw::InputLogTextPort* port
145  );
146 
147 #endif
148 
151  FwIndexType portNum,
152  Fw::InputPrmGetPort* port
153  );
154 
157  FwIndexType portNum,
158  Fw::InputPrmSetPort* port
159  );
160 
163  FwIndexType portNum,
164  Fw::InputTimePort* port
165  );
166 
169  FwIndexType portNum,
170  Fw::InputTlmPort* port
171  );
172 
173 #endif
174 
175 #if !FW_DIRECT_PORT_CALLS
176 
177  public:
178 
179  // ----------------------------------------------------------------------
180  // Connect typed input ports to typed output ports
181  // ----------------------------------------------------------------------
182 
185  FwIndexType portNum,
187  );
188 
191  FwIndexType portNum,
193  );
194 
197  FwIndexType portNum,
199  );
200 
203  FwIndexType portNum,
205  );
206 
207 #endif
208 
209 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
210 
211  public:
212 
213  // ----------------------------------------------------------------------
214  // Connect serial input ports to special output ports
215  // ----------------------------------------------------------------------
216 
219  FwIndexType portNum,
220  Fw::InputSerializePort* port
221  );
222 
223 #if FW_ENABLE_TEXT_LOGGING == 1
224 
226  void set_logTextOut_OutputPort(
227  FwIndexType portNum,
228  Fw::InputSerializePort* port
229  );
230 
231 #endif
232 
235  FwIndexType portNum,
236  Fw::InputSerializePort* port
237  );
238 
241  FwIndexType portNum,
242  Fw::InputSerializePort* port
243  );
244 
247  FwIndexType portNum,
248  Fw::InputSerializePort* port
249  );
250 
251 #endif
252 
253 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
254 
255  public:
256 
257  // ----------------------------------------------------------------------
258  // Connect serial input ports to typed output ports
259  // ----------------------------------------------------------------------
260 
263  FwIndexType portNum,
264  Fw::InputSerializePort* port
265  );
266 
269  FwIndexType portNum,
270  Fw::InputSerializePort* port
271  );
272 
275  FwIndexType portNum,
276  Fw::InputSerializePort* port
277  );
278 
279 #endif
280 
281  protected:
282 
283  // ----------------------------------------------------------------------
284  // Component construction and destruction
285  // ----------------------------------------------------------------------
286 
289  const char* compName = ""
290  );
291 
294 
295  protected:
296 
297  // ----------------------------------------------------------------------
298  // Getters for numbers of typed input ports
299  // ----------------------------------------------------------------------
300 
305  return NUM_DATAIN_INPUT_PORTS;
306  }
307 
313  }
314 
315  protected:
316 
317  // ----------------------------------------------------------------------
318  // Getters for numbers of special output ports
319  // ----------------------------------------------------------------------
320 
326  }
327 
328 #if FW_ENABLE_TEXT_LOGGING == 1
329 
333  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
335  }
336 
337 #endif
338 
344  }
345 
351  }
352 
358  }
359 
365  }
366 
367  protected:
368 
369  // ----------------------------------------------------------------------
370  // Getters for numbers of typed output ports
371  // ----------------------------------------------------------------------
372 
378  }
379 
385  }
386 
392  }
393 
399  }
400 
401  protected:
402 
403  // ----------------------------------------------------------------------
404  // Connection status queries for special output ports
405  // ----------------------------------------------------------------------
406 
411  FwIndexType portNum
412  ) const;
413 
414 #if FW_ENABLE_TEXT_LOGGING == 1
415 
419  bool isConnected_logTextOut_OutputPort(
420  FwIndexType portNum
421  ) const;
422 
423 #endif
424 
429  FwIndexType portNum
430  ) const;
431 
436  FwIndexType portNum
437  ) const;
438 
443  FwIndexType portNum
444  ) const;
445 
450  FwIndexType portNum
451  ) const;
452 
453  protected:
454 
455  // ----------------------------------------------------------------------
456  // Connection status queries for typed output ports
457  // ----------------------------------------------------------------------
458 
463  FwIndexType portNum
464  ) const;
465 
470  FwIndexType portNum
471  ) const;
472 
477  FwIndexType portNum
478  ) const;
479 
484  FwIndexType portNum
485  ) const;
486 
487  protected:
488 
489  // ----------------------------------------------------------------------
490  // Handlers to implement for typed input ports
491  // ----------------------------------------------------------------------
492 
494  virtual void dataIn_handler(
495  FwIndexType portNum,
496  Fw::Buffer& data,
497  const ComCfg::FrameContext& context
498  ) = 0;
499 
501  virtual void dataReturnIn_handler(
502  FwIndexType portNum,
503  Fw::Buffer& data,
504  const ComCfg::FrameContext& context
505  ) = 0;
506 
507 #if FW_DIRECT_PORT_CALLS
508  public:
509 #else
510  protected:
511 #endif
512 
513  // ----------------------------------------------------------------------
514  // Port handler base-class functions for typed input ports
515  //
516  // Call these functions directly to bypass the corresponding ports
517  // ----------------------------------------------------------------------
518 
520  void dataIn_handlerBase(
521  FwIndexType portNum,
522  Fw::Buffer& data,
523  const ComCfg::FrameContext& context
524  );
525 
528  FwIndexType portNum,
529  Fw::Buffer& data,
530  const ComCfg::FrameContext& context
531  );
532 
533  protected:
534 
535  // ----------------------------------------------------------------------
536  // Invocation functions for typed output ports
537  // ----------------------------------------------------------------------
538 
540  void dataOut_out(
541  FwIndexType portNum,
542  Fw::Buffer& data,
543  const ComCfg::FrameContext& context
544  ) const;
545 
547  void dataReturnOut_out(
548  FwIndexType portNum,
549  Fw::Buffer& data,
550  const ComCfg::FrameContext& context
551  ) const;
552 
554  void errorNotify_out(
555  FwIndexType portNum,
556  const Svc::Ccsds::FrameError& errorCode
557  ) const;
558 
561  FwIndexType portNum,
562  const ComCfg::Apid& apid,
563  U16 sequenceCount
564  ) const;
565 
566  protected:
567 
568  // ----------------------------------------------------------------------
569  // Event logging functions
570  // ----------------------------------------------------------------------
571 
575  void log_WARNING_HI_InvalidPacket() const;
576 
581  FwSizeType transmitted,
582  FwSizeType actual
583  ) const;
584 
585  protected:
586 
587  // ----------------------------------------------------------------------
588  // Time
589  // ----------------------------------------------------------------------
590 
594  Fw::Time getTime() const;
595 
596  protected:
597 
598  // ----------------------------------------------------------------------
599  // Mutex operations for guarded ports
600  //
601  // You can override these operations to provide more sophisticated
602  // synchronization
603  // ----------------------------------------------------------------------
604 
606  virtual void lock();
607 
609  virtual void unLock();
610 
611  private:
612 
613  // ----------------------------------------------------------------------
614  // Calls for messages received on typed input ports
615  // ----------------------------------------------------------------------
616 
618  static void m_p_dataIn_in(
619  Fw::PassiveComponentBase* callComp,
620  FwIndexType portNum,
621  Fw::Buffer& data,
622  const ComCfg::FrameContext& context
623  );
624 
626  static void m_p_dataReturnIn_in(
627  Fw::PassiveComponentBase* callComp,
628  FwIndexType portNum,
629  Fw::Buffer& data,
630  const ComCfg::FrameContext& context
631  );
632 
633  private:
634 
635  // ----------------------------------------------------------------------
636  // Invocation functions for special output ports
637  // ----------------------------------------------------------------------
638 
640  void logOut_out(
641  FwIndexType portNum,
642  FwEventIdType id,
643  Fw::Time& timeTag,
644  const Fw::LogSeverity& severity,
645  Fw::LogBuffer& args
646  ) const;
647 
648 #if FW_ENABLE_TEXT_LOGGING
649 
651  void logTextOut_out(
652  FwIndexType portNum,
653  FwEventIdType id,
654  Fw::Time& timeTag,
655  const Fw::LogSeverity& severity,
656  Fw::TextLogString& text
657  ) const;
658 
659 #endif
660 
662  void timeCaller_out(
663  FwIndexType portNum,
664  Fw::Time& time
665  ) const;
666 
667 #if !FW_DIRECT_PORT_CALLS
668 
669  private:
670 
671  // ----------------------------------------------------------------------
672  // Typed input ports
673  // ----------------------------------------------------------------------
674 
677 
680 
681 #endif
682 
683 #if !FW_DIRECT_PORT_CALLS
684 
685  private:
686 
687  // ----------------------------------------------------------------------
688  // Special output ports
689  // ----------------------------------------------------------------------
690 
692  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
693 
694 #if FW_ENABLE_TEXT_LOGGING == 1
695 
697  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
698 
699 #endif
700 
702  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
703 
705  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
706 
708  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
709 
711  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
712 
713 #endif
714 
715 #if !FW_DIRECT_PORT_CALLS
716 
717  private:
718 
719  // ----------------------------------------------------------------------
720  // Typed output ports
721  // ----------------------------------------------------------------------
722 
725 
728 
731 
734 
735 #endif
736 
737  private:
738 
739  // ----------------------------------------------------------------------
740  // Mutexes
741  // ----------------------------------------------------------------------
742 
744  Os::Mutex m_guardedPortMutex;
745 
746  };
747 
748  }
749 
750 }
751 
752 #endif
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode) const
Invoke output port errorNotify.
static constexpr FwIndexType getNum_validateApidSeqCount_OutputPorts()
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.