F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FprimeDeframerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FprimeDeframerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FprimeDeframer component base class
5 // ======================================================================
6 
7 #ifndef Svc_FprimeDeframerComponentAc_HPP
8 #define Svc_FprimeDeframerComponentAc_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/Time/TimePortAc.hpp"
24 #include "Os/Mutex.hpp"
26 
27 namespace Svc {
28 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
45  friend class FprimeDeframerTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
57  };
58 
60  enum {
64  };
65 
67  enum {
70  };
71 
73  enum {
79  };
80 
81  public:
82 
83  // ----------------------------------------------------------------------
84  // Component initialization
85  // ----------------------------------------------------------------------
86 
88  void init(
89  FwEnumStoreType instance = 0
90  );
91 
92 #if !FW_DIRECT_PORT_CALLS
93 
94  public:
95 
96  // ----------------------------------------------------------------------
97  // Getters for typed input ports
98  // ----------------------------------------------------------------------
99 
104  FwIndexType portNum
105  );
106 
111  FwIndexType portNum
112  );
113 
114 #endif
115 
116 #if !FW_DIRECT_PORT_CALLS
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::InputTimePort* port
144  );
145 
146 #endif
147 
148 #if !FW_DIRECT_PORT_CALLS
149 
150  public:
151 
152  // ----------------------------------------------------------------------
153  // Connect typed input ports to typed output ports
154  // ----------------------------------------------------------------------
155 
158  FwIndexType portNum,
160  );
161 
164  FwIndexType portNum,
166  );
167 
168 #endif
169 
170 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
171 
172  public:
173 
174  // ----------------------------------------------------------------------
175  // Connect serial input ports to special output ports
176  // ----------------------------------------------------------------------
177 
180  FwIndexType portNum,
181  Fw::InputSerializePort* port
182  );
183 
184 #if FW_ENABLE_TEXT_LOGGING == 1
185 
187  void set_logTextOut_OutputPort(
188  FwIndexType portNum,
189  Fw::InputSerializePort* port
190  );
191 
192 #endif
193 
196  FwIndexType portNum,
197  Fw::InputSerializePort* port
198  );
199 
200 #endif
201 
202 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
203 
204  public:
205 
206  // ----------------------------------------------------------------------
207  // Connect serial input ports to typed output ports
208  // ----------------------------------------------------------------------
209 
212  FwIndexType portNum,
213  Fw::InputSerializePort* port
214  );
215 
218  FwIndexType portNum,
219  Fw::InputSerializePort* port
220  );
221 
222 #endif
223 
224  protected:
225 
226  // ----------------------------------------------------------------------
227  // Component construction and destruction
228  // ----------------------------------------------------------------------
229 
232  const char* compName = ""
233  );
234 
237 
238  protected:
239 
240  // ----------------------------------------------------------------------
241  // Getters for numbers of typed input ports
242  // ----------------------------------------------------------------------
243 
248  return NUM_DATAIN_INPUT_PORTS;
249  }
250 
256  }
257 
258  protected:
259 
260  // ----------------------------------------------------------------------
261  // Getters for numbers of special output ports
262  // ----------------------------------------------------------------------
263 
269  }
270 
271 #if FW_ENABLE_TEXT_LOGGING == 1
272 
276  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
278  }
279 
280 #endif
281 
287  }
288 
289  protected:
290 
291  // ----------------------------------------------------------------------
292  // Getters for numbers of typed output ports
293  // ----------------------------------------------------------------------
294 
300  }
301 
307  }
308 
309  protected:
310 
311  // ----------------------------------------------------------------------
312  // Connection status queries for special output ports
313  // ----------------------------------------------------------------------
314 
319  FwIndexType portNum
320  ) const;
321 
322 #if FW_ENABLE_TEXT_LOGGING == 1
323 
327  bool isConnected_logTextOut_OutputPort(
328  FwIndexType portNum
329  ) const;
330 
331 #endif
332 
337  FwIndexType portNum
338  ) const;
339 
340  protected:
341 
342  // ----------------------------------------------------------------------
343  // Connection status queries for typed output ports
344  // ----------------------------------------------------------------------
345 
350  FwIndexType portNum
351  ) const;
352 
357  FwIndexType portNum
358  ) const;
359 
360  protected:
361 
362  // ----------------------------------------------------------------------
363  // Handlers to implement for typed input ports
364  // ----------------------------------------------------------------------
365 
367  virtual void dataIn_handler(
368  FwIndexType portNum,
369  Fw::Buffer& data,
370  const ComCfg::FrameContext& context
371  ) = 0;
372 
374  virtual void dataReturnIn_handler(
375  FwIndexType portNum,
376  Fw::Buffer& data,
377  const ComCfg::FrameContext& context
378  ) = 0;
379 
380 #if FW_DIRECT_PORT_CALLS
381  public:
382 #else
383  protected:
384 #endif
385 
386  // ----------------------------------------------------------------------
387  // Port handler base-class functions for typed input ports
388  //
389  // Call these functions directly to bypass the corresponding ports
390  // ----------------------------------------------------------------------
391 
393  void dataIn_handlerBase(
394  FwIndexType portNum,
395  Fw::Buffer& data,
396  const ComCfg::FrameContext& context
397  );
398 
401  FwIndexType portNum,
402  Fw::Buffer& data,
403  const ComCfg::FrameContext& context
404  );
405 
406  protected:
407 
408  // ----------------------------------------------------------------------
409  // Invocation functions for typed output ports
410  // ----------------------------------------------------------------------
411 
413  void dataOut_out(
414  FwIndexType portNum,
415  Fw::Buffer& data,
416  const ComCfg::FrameContext& context
417  ) const;
418 
420  void dataReturnOut_out(
421  FwIndexType portNum,
422  Fw::Buffer& data,
423  const ComCfg::FrameContext& context
424  ) const;
425 
426  protected:
427 
428  // ----------------------------------------------------------------------
429  // Event logging functions
430  // ----------------------------------------------------------------------
431 
436 
440  void log_WARNING_HI_InvalidStartWord() const;
441 
446 
450  void log_WARNING_HI_InvalidChecksum() const;
451 
455  void log_WARNING_LO_PayloadTooShort() const;
456 
457  protected:
458 
459  // ----------------------------------------------------------------------
460  // Time
461  // ----------------------------------------------------------------------
462 
466  Fw::Time getTime() const;
467 
468  protected:
469 
470  // ----------------------------------------------------------------------
471  // Mutex operations for guarded ports
472  //
473  // You can override these operations to provide more sophisticated
474  // synchronization
475  // ----------------------------------------------------------------------
476 
478  virtual void lock();
479 
481  virtual void unLock();
482 
483  private:
484 
485  // ----------------------------------------------------------------------
486  // Calls for messages received on typed input ports
487  // ----------------------------------------------------------------------
488 
490  static void m_p_dataIn_in(
491  Fw::PassiveComponentBase* callComp,
492  FwIndexType portNum,
493  Fw::Buffer& data,
494  const ComCfg::FrameContext& context
495  );
496 
498  static void m_p_dataReturnIn_in(
499  Fw::PassiveComponentBase* callComp,
500  FwIndexType portNum,
501  Fw::Buffer& data,
502  const ComCfg::FrameContext& context
503  );
504 
505  private:
506 
507  // ----------------------------------------------------------------------
508  // Invocation functions for special output ports
509  // ----------------------------------------------------------------------
510 
512  void logOut_out(
513  FwIndexType portNum,
514  FwEventIdType id,
515  Fw::Time& timeTag,
516  const Fw::LogSeverity& severity,
517  Fw::LogBuffer& args
518  ) const;
519 
520 #if FW_ENABLE_TEXT_LOGGING
521 
523  void logTextOut_out(
524  FwIndexType portNum,
525  FwEventIdType id,
526  Fw::Time& timeTag,
527  const Fw::LogSeverity& severity,
528  Fw::TextLogString& text
529  ) const;
530 
531 #endif
532 
534  void timeCaller_out(
535  FwIndexType portNum,
536  Fw::Time& time
537  ) const;
538 
539 #if !FW_DIRECT_PORT_CALLS
540 
541  private:
542 
543  // ----------------------------------------------------------------------
544  // Typed input ports
545  // ----------------------------------------------------------------------
546 
549 
552 
553 #endif
554 
555 #if !FW_DIRECT_PORT_CALLS
556 
557  private:
558 
559  // ----------------------------------------------------------------------
560  // Special output ports
561  // ----------------------------------------------------------------------
562 
564  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
565 
566 #if FW_ENABLE_TEXT_LOGGING == 1
567 
569  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
570 
571 #endif
572 
574  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
575 
576 #endif
577 
578 #if !FW_DIRECT_PORT_CALLS
579 
580  private:
581 
582  // ----------------------------------------------------------------------
583  // Typed output ports
584  // ----------------------------------------------------------------------
585 
588 
591 
592 #endif
593 
594  private:
595 
596  // ----------------------------------------------------------------------
597  // Mutexes
598  // ----------------------------------------------------------------------
599 
601  Os::Mutex m_guardedPortMutex;
602 
603  };
604 
605 }
606 
607 #endif
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
I32 FwEnumStoreType
static constexpr FwIndexType getNum_logOut_OutputPorts()
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
An invalid frame was received (not enough data to contain a valid FwPacketDescriptor type) ...
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
FwIdType FwEventIdType
The type of an event identifier.
FprimeDeframerComponentBase(const char *compName="")
Construct FprimeDeframerComponentBase object.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
An invalid frame was received (checksum mismatch)
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
static constexpr FwIndexType getNum_dataIn_InputPorts()
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
Auto-generated base for FprimeDeframer component.
friend class FprimeDeframerTester
Friend class tester implementation to support white-box testing.
friend class FprimeDeframerTesterBase
Friend class tester to support autocoded test harness.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Enum representing event severity.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
virtual ~FprimeDeframerComponentBase()
Destroy FprimeDeframerComponentBase object.
virtual void lock()
Lock the guarded mutex.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
PlatformIndexType FwIndexType
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
An invalid frame was received (too short to be a frame)
An invalid frame was received (start word is wrong)
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
virtual void unLock()
Unlock the guarded mutex.
static constexpr FwIndexType getNum_dataOut_OutputPorts()