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 {
85  };
86 
87  public:
88 
89  // ----------------------------------------------------------------------
90  // Component initialization
91  // ----------------------------------------------------------------------
92 
94  void init(
95  FwEnumStoreType instance = 0
96  );
97 
98  public:
99 
100  // ----------------------------------------------------------------------
101  // Getters for typed input ports
102  // ----------------------------------------------------------------------
103 
108  FwIndexType portNum
109  );
110 
115  FwIndexType portNum
116  );
117 
118  public:
119 
120  // ----------------------------------------------------------------------
121  // Connect input ports to special output ports
122  // ----------------------------------------------------------------------
123 
126  FwIndexType portNum,
127  Fw::InputLogPort* port
128  );
129 
130 #if FW_ENABLE_TEXT_LOGGING == 1
131 
133  void set_logTextOut_OutputPort(
134  FwIndexType portNum,
135  Fw::InputLogTextPort* port
136  );
137 
138 #endif
139 
142  FwIndexType portNum,
143  Fw::InputPrmGetPort* port
144  );
145 
148  FwIndexType portNum,
149  Fw::InputPrmSetPort* port
150  );
151 
154  FwIndexType portNum,
155  Fw::InputTimePort* port
156  );
157 
160  FwIndexType portNum,
161  Fw::InputTlmPort* port
162  );
163 
164  public:
165 
166  // ----------------------------------------------------------------------
167  // Connect typed input ports to typed output ports
168  // ----------------------------------------------------------------------
169 
172  FwIndexType portNum,
174  );
175 
178  FwIndexType portNum,
180  );
181 
184  FwIndexType portNum,
186  );
187 
190  FwIndexType portNum,
192  );
193 
194 #if FW_PORT_SERIALIZATION
195 
196  public:
197 
198  // ----------------------------------------------------------------------
199  // Connect serial input ports to special output ports
200  // ----------------------------------------------------------------------
201 
204  FwIndexType portNum,
205  Fw::InputSerializePort* port
206  );
207 
208 #if FW_ENABLE_TEXT_LOGGING == 1
209 
211  void set_logTextOut_OutputPort(
212  FwIndexType portNum,
213  Fw::InputSerializePort* port
214  );
215 
216 #endif
217 
220  FwIndexType portNum,
221  Fw::InputSerializePort* port
222  );
223 
226  FwIndexType portNum,
227  Fw::InputSerializePort* port
228  );
229 
232  FwIndexType portNum,
233  Fw::InputSerializePort* port
234  );
235 
236 #endif
237 
238 #if FW_PORT_SERIALIZATION
239 
240  public:
241 
242  // ----------------------------------------------------------------------
243  // Connect serial input ports to typed output ports
244  // ----------------------------------------------------------------------
245 
248  FwIndexType portNum,
249  Fw::InputSerializePort* port
250  );
251 
254  FwIndexType portNum,
255  Fw::InputSerializePort* port
256  );
257 
260  FwIndexType portNum,
261  Fw::InputSerializePort* port
262  );
263 
264 #endif
265 
266  protected:
267 
268  // ----------------------------------------------------------------------
269  // Component construction and destruction
270  // ----------------------------------------------------------------------
271 
274  const char* compName = ""
275  );
276 
279 
280  protected:
281 
282  // ----------------------------------------------------------------------
283  // Getters for numbers of typed input ports
284  // ----------------------------------------------------------------------
285 
290  return NUM_DATAIN_INPUT_PORTS;
291  }
292 
298  }
299 
300  protected:
301 
302  // ----------------------------------------------------------------------
303  // Getters for numbers of special output ports
304  // ----------------------------------------------------------------------
305 
311  }
312 
313 #if FW_ENABLE_TEXT_LOGGING == 1
314 
318  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
320  }
321 
322 #endif
323 
329  }
330 
336  }
337 
343  }
344 
350  }
351 
352  protected:
353 
354  // ----------------------------------------------------------------------
355  // Getters for numbers of typed output ports
356  // ----------------------------------------------------------------------
357 
363  }
364 
370  }
371 
377  }
378 
384  }
385 
386  protected:
387 
388  // ----------------------------------------------------------------------
389  // Connection status queries for special output ports
390  // ----------------------------------------------------------------------
391 
396  FwIndexType portNum
397  );
398 
399 #if FW_ENABLE_TEXT_LOGGING == 1
400 
404  bool isConnected_logTextOut_OutputPort(
405  FwIndexType portNum
406  );
407 
408 #endif
409 
414  FwIndexType portNum
415  );
416 
421  FwIndexType portNum
422  );
423 
428  FwIndexType portNum
429  );
430 
435  FwIndexType portNum
436  );
437 
438  protected:
439 
440  // ----------------------------------------------------------------------
441  // Connection status queries for typed output ports
442  // ----------------------------------------------------------------------
443 
448  FwIndexType portNum
449  );
450 
455  FwIndexType portNum
456  );
457 
462  FwIndexType portNum
463  );
464 
469  FwIndexType portNum
470  );
471 
472  protected:
473 
474  // ----------------------------------------------------------------------
475  // Handlers to implement for typed input ports
476  // ----------------------------------------------------------------------
477 
479  virtual void dataIn_handler(
480  FwIndexType portNum,
481  Fw::Buffer& data,
482  const ComCfg::FrameContext& context
483  ) = 0;
484 
486  virtual void dataReturnIn_handler(
487  FwIndexType portNum,
488  Fw::Buffer& data,
489  const ComCfg::FrameContext& context
490  ) = 0;
491 
492  protected:
493 
494  // ----------------------------------------------------------------------
495  // Port handler base-class functions for typed input ports
496  //
497  // Call these functions directly to bypass the corresponding ports
498  // ----------------------------------------------------------------------
499 
501  void dataIn_handlerBase(
502  FwIndexType portNum,
503  Fw::Buffer& data,
504  const ComCfg::FrameContext& context
505  );
506 
509  FwIndexType portNum,
510  Fw::Buffer& data,
511  const ComCfg::FrameContext& context
512  );
513 
514  protected:
515 
516  // ----------------------------------------------------------------------
517  // Invocation functions for typed output ports
518  // ----------------------------------------------------------------------
519 
521  void dataOut_out(
522  FwIndexType portNum,
523  Fw::Buffer& data,
524  const ComCfg::FrameContext& context
525  );
526 
528  void dataReturnOut_out(
529  FwIndexType portNum,
530  Fw::Buffer& data,
531  const ComCfg::FrameContext& context
532  );
533 
535  void errorNotify_out(
536  FwIndexType portNum,
537  const Svc::Ccsds::FrameError& errorCode
538  );
539 
542  FwIndexType portNum,
543  const ComCfg::Apid& apid,
544  U16 sequenceCount
545  );
546 
547  protected:
548 
549  // ----------------------------------------------------------------------
550  // Event logging functions
551  // ----------------------------------------------------------------------
552 
557  U16 transmitted,
558  FwSizeType actual
559  ) const;
560 
561  protected:
562 
563  // ----------------------------------------------------------------------
564  // Time
565  // ----------------------------------------------------------------------
566 
570  Fw::Time getTime() const;
571 
572  protected:
573 
574  // ----------------------------------------------------------------------
575  // Mutex operations for guarded ports
576  //
577  // You can override these operations to provide more sophisticated
578  // synchronization
579  // ----------------------------------------------------------------------
580 
582  virtual void lock();
583 
585  virtual void unLock();
586 
587  private:
588 
589  // ----------------------------------------------------------------------
590  // Calls for messages received on typed input ports
591  // ----------------------------------------------------------------------
592 
594  static void m_p_dataIn_in(
595  Fw::PassiveComponentBase* callComp,
596  FwIndexType portNum,
597  Fw::Buffer& data,
598  const ComCfg::FrameContext& context
599  );
600 
602  static void m_p_dataReturnIn_in(
603  Fw::PassiveComponentBase* callComp,
604  FwIndexType portNum,
605  Fw::Buffer& data,
606  const ComCfg::FrameContext& context
607  );
608 
609  private:
610 
611  // ----------------------------------------------------------------------
612  // Typed input ports
613  // ----------------------------------------------------------------------
614 
617 
620 
621  private:
622 
623  // ----------------------------------------------------------------------
624  // Special output ports
625  // ----------------------------------------------------------------------
626 
628  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
629 
630 #if FW_ENABLE_TEXT_LOGGING == 1
631 
633  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
634 
635 #endif
636 
638  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
639 
641  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
642 
644  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
645 
647  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
648 
649  private:
650 
651  // ----------------------------------------------------------------------
652  // Typed output ports
653  // ----------------------------------------------------------------------
654 
657 
660 
663 
666 
667  private:
668 
669  // ----------------------------------------------------------------------
670  // Mutexes
671  // ----------------------------------------------------------------------
672 
674  Os::Mutex m_guardedPortMutex;
675 
676  };
677 
678  }
679 
680 }
681 
682 #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.