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 
295 
296  protected:
297 
298  // ----------------------------------------------------------------------
299  // Getters for numbers of special output ports
300  // ----------------------------------------------------------------------
301 
306 
307 #if FW_ENABLE_TEXT_LOGGING == 1
308 
312  FwIndexType getNum_logTextOut_OutputPorts() const;
313 
314 #endif
315 
320 
325 
330 
335 
336  protected:
337 
338  // ----------------------------------------------------------------------
339  // Getters for numbers of typed output ports
340  // ----------------------------------------------------------------------
341 
346 
351 
356 
361 
362  protected:
363 
364  // ----------------------------------------------------------------------
365  // Connection status queries for special output ports
366  // ----------------------------------------------------------------------
367 
372  FwIndexType portNum
373  );
374 
375 #if FW_ENABLE_TEXT_LOGGING == 1
376 
380  bool isConnected_logTextOut_OutputPort(
381  FwIndexType portNum
382  );
383 
384 #endif
385 
390  FwIndexType portNum
391  );
392 
397  FwIndexType portNum
398  );
399 
404  FwIndexType portNum
405  );
406 
411  FwIndexType portNum
412  );
413 
414  protected:
415 
416  // ----------------------------------------------------------------------
417  // Connection status queries for typed output ports
418  // ----------------------------------------------------------------------
419 
424  FwIndexType portNum
425  );
426 
431  FwIndexType portNum
432  );
433 
438  FwIndexType portNum
439  );
440 
445  FwIndexType portNum
446  );
447 
448  protected:
449 
450  // ----------------------------------------------------------------------
451  // Handlers to implement for typed input ports
452  // ----------------------------------------------------------------------
453 
455  virtual void dataIn_handler(
456  FwIndexType portNum,
457  Fw::Buffer& data,
458  const ComCfg::FrameContext& context
459  ) = 0;
460 
462  virtual void dataReturnIn_handler(
463  FwIndexType portNum,
464  Fw::Buffer& data,
465  const ComCfg::FrameContext& context
466  ) = 0;
467 
468  protected:
469 
470  // ----------------------------------------------------------------------
471  // Port handler base-class functions for typed input ports
472  //
473  // Call these functions directly to bypass the corresponding ports
474  // ----------------------------------------------------------------------
475 
477  void dataIn_handlerBase(
478  FwIndexType portNum,
479  Fw::Buffer& data,
480  const ComCfg::FrameContext& context
481  );
482 
485  FwIndexType portNum,
486  Fw::Buffer& data,
487  const ComCfg::FrameContext& context
488  );
489 
490  protected:
491 
492  // ----------------------------------------------------------------------
493  // Invocation functions for typed output ports
494  // ----------------------------------------------------------------------
495 
497  void dataOut_out(
498  FwIndexType portNum,
499  Fw::Buffer& data,
500  const ComCfg::FrameContext& context
501  );
502 
504  void dataReturnOut_out(
505  FwIndexType portNum,
506  Fw::Buffer& data,
507  const ComCfg::FrameContext& context
508  );
509 
511  void errorNotify_out(
512  FwIndexType portNum,
513  const Svc::Ccsds::FrameError& errorCode
514  );
515 
518  FwIndexType portNum,
519  const ComCfg::Apid& apid,
520  U16 sequenceCount
521  );
522 
523  protected:
524 
525  // ----------------------------------------------------------------------
526  // Event logging functions
527  // ----------------------------------------------------------------------
528 
533  U16 transmitted,
534  FwSizeType actual
535  ) const;
536 
537  protected:
538 
539  // ----------------------------------------------------------------------
540  // Time
541  // ----------------------------------------------------------------------
542 
546  Fw::Time getTime() const;
547 
548  protected:
549 
550  // ----------------------------------------------------------------------
551  // Mutex operations for guarded ports
552  //
553  // You can override these operations to provide more sophisticated
554  // synchronization
555  // ----------------------------------------------------------------------
556 
558  virtual void lock();
559 
561  virtual void unLock();
562 
563  private:
564 
565  // ----------------------------------------------------------------------
566  // Calls for messages received on typed input ports
567  // ----------------------------------------------------------------------
568 
570  static void m_p_dataIn_in(
571  Fw::PassiveComponentBase* callComp,
572  FwIndexType portNum,
573  Fw::Buffer& data,
574  const ComCfg::FrameContext& context
575  );
576 
578  static void m_p_dataReturnIn_in(
579  Fw::PassiveComponentBase* callComp,
580  FwIndexType portNum,
581  Fw::Buffer& data,
582  const ComCfg::FrameContext& context
583  );
584 
585  private:
586 
587  // ----------------------------------------------------------------------
588  // Typed input ports
589  // ----------------------------------------------------------------------
590 
593 
596 
597  private:
598 
599  // ----------------------------------------------------------------------
600  // Special output ports
601  // ----------------------------------------------------------------------
602 
604  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
605 
606 #if FW_ENABLE_TEXT_LOGGING == 1
607 
609  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
610 
611 #endif
612 
614  Fw::OutputPrmGetPort m_prmGetOut_OutputPort[NUM_PRMGETOUT_OUTPUT_PORTS];
615 
617  Fw::OutputPrmSetPort m_prmSetOut_OutputPort[NUM_PRMSETOUT_OUTPUT_PORTS];
618 
620  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
621 
623  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
624 
625  private:
626 
627  // ----------------------------------------------------------------------
628  // Typed output ports
629  // ----------------------------------------------------------------------
630 
633 
636 
639 
642 
643  private:
644 
645  // ----------------------------------------------------------------------
646  // Mutexes
647  // ----------------------------------------------------------------------
648 
650  Os::Mutex m_guardedPortMutex;
651 
652  };
653 
654  }
655 
656 }
657 
658 #endif
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.