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 #if FW_ENABLE_TEXT_LOGGING == 1
17 #include "Fw/Log/LogTextPortAc.hpp"
18 #endif
21 #include "Fw/Time/TimePortAc.hpp"
22 #include "Os/Mutex.hpp"
24 
25 namespace Svc {
26 
34  {
35 
36  // ----------------------------------------------------------------------
37  // Friend classes
38  // ----------------------------------------------------------------------
39 
43  friend class FprimeDeframerTester;
44 
45  protected:
46 
47  // ----------------------------------------------------------------------
48  // Constants
49  // ----------------------------------------------------------------------
50 
52  enum {
55  };
56 
58  enum {
62  };
63 
65  enum {
68  };
69 
71  enum {
77  };
78 
79  public:
80 
81  // ----------------------------------------------------------------------
82  // Component initialization
83  // ----------------------------------------------------------------------
84 
86  void init(
87  FwEnumStoreType instance = 0
88  );
89 
90  public:
91 
92  // ----------------------------------------------------------------------
93  // Getters for typed input ports
94  // ----------------------------------------------------------------------
95 
100  FwIndexType portNum
101  );
102 
107  FwIndexType portNum
108  );
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Connect input ports to special output ports
114  // ----------------------------------------------------------------------
115 
118  FwIndexType portNum,
119  Fw::InputLogPort* port
120  );
121 
122 #if FW_ENABLE_TEXT_LOGGING == 1
123 
125  void set_logTextOut_OutputPort(
126  FwIndexType portNum,
127  Fw::InputLogTextPort* port
128  );
129 
130 #endif
131 
134  FwIndexType portNum,
135  Fw::InputTimePort* port
136  );
137 
138  public:
139 
140  // ----------------------------------------------------------------------
141  // Connect typed input ports to typed output ports
142  // ----------------------------------------------------------------------
143 
146  FwIndexType portNum,
148  );
149 
152  FwIndexType portNum,
154  );
155 
156 #if FW_PORT_SERIALIZATION
157 
158  public:
159 
160  // ----------------------------------------------------------------------
161  // Connect serial input ports to special output ports
162  // ----------------------------------------------------------------------
163 
166  FwIndexType portNum,
167  Fw::InputSerializePort* port
168  );
169 
170 #if FW_ENABLE_TEXT_LOGGING == 1
171 
173  void set_logTextOut_OutputPort(
174  FwIndexType portNum,
175  Fw::InputSerializePort* port
176  );
177 
178 #endif
179 
182  FwIndexType portNum,
183  Fw::InputSerializePort* port
184  );
185 
186 #endif
187 
188 #if FW_PORT_SERIALIZATION
189 
190  public:
191 
192  // ----------------------------------------------------------------------
193  // Connect serial input ports to typed output ports
194  // ----------------------------------------------------------------------
195 
198  FwIndexType portNum,
199  Fw::InputSerializePort* port
200  );
201 
204  FwIndexType portNum,
205  Fw::InputSerializePort* port
206  );
207 
208 #endif
209 
210  protected:
211 
212  // ----------------------------------------------------------------------
213  // Component construction and destruction
214  // ----------------------------------------------------------------------
215 
218  const char* compName = ""
219  );
220 
223 
224  protected:
225 
226  // ----------------------------------------------------------------------
227  // Getters for numbers of typed input ports
228  // ----------------------------------------------------------------------
229 
234  return NUM_DATAIN_INPUT_PORTS;
235  }
236 
242  }
243 
244  protected:
245 
246  // ----------------------------------------------------------------------
247  // Getters for numbers of special output ports
248  // ----------------------------------------------------------------------
249 
255  }
256 
257 #if FW_ENABLE_TEXT_LOGGING == 1
258 
262  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
264  }
265 
266 #endif
267 
273  }
274 
275  protected:
276 
277  // ----------------------------------------------------------------------
278  // Getters for numbers of typed output ports
279  // ----------------------------------------------------------------------
280 
286  }
287 
293  }
294 
295  protected:
296 
297  // ----------------------------------------------------------------------
298  // Connection status queries for special output ports
299  // ----------------------------------------------------------------------
300 
305  FwIndexType portNum
306  );
307 
308 #if FW_ENABLE_TEXT_LOGGING == 1
309 
313  bool isConnected_logTextOut_OutputPort(
314  FwIndexType portNum
315  );
316 
317 #endif
318 
323  FwIndexType portNum
324  );
325 
326  protected:
327 
328  // ----------------------------------------------------------------------
329  // Connection status queries for typed output ports
330  // ----------------------------------------------------------------------
331 
336  FwIndexType portNum
337  );
338 
343  FwIndexType portNum
344  );
345 
346  protected:
347 
348  // ----------------------------------------------------------------------
349  // Handlers to implement for typed input ports
350  // ----------------------------------------------------------------------
351 
353  virtual void dataIn_handler(
354  FwIndexType portNum,
355  Fw::Buffer& data,
356  const ComCfg::FrameContext& context
357  ) = 0;
358 
360  virtual void dataReturnIn_handler(
361  FwIndexType portNum,
362  Fw::Buffer& data,
363  const ComCfg::FrameContext& context
364  ) = 0;
365 
366  protected:
367 
368  // ----------------------------------------------------------------------
369  // Port handler base-class functions for typed input ports
370  //
371  // Call these functions directly to bypass the corresponding ports
372  // ----------------------------------------------------------------------
373 
375  void dataIn_handlerBase(
376  FwIndexType portNum,
377  Fw::Buffer& data,
378  const ComCfg::FrameContext& context
379  );
380 
383  FwIndexType portNum,
384  Fw::Buffer& data,
385  const ComCfg::FrameContext& context
386  );
387 
388  protected:
389 
390  // ----------------------------------------------------------------------
391  // Invocation functions for typed output ports
392  // ----------------------------------------------------------------------
393 
395  void dataOut_out(
396  FwIndexType portNum,
397  Fw::Buffer& data,
398  const ComCfg::FrameContext& context
399  );
400 
402  void dataReturnOut_out(
403  FwIndexType portNum,
404  Fw::Buffer& data,
405  const ComCfg::FrameContext& context
406  );
407 
408  protected:
409 
410  // ----------------------------------------------------------------------
411  // Event logging functions
412  // ----------------------------------------------------------------------
413 
418 
422  void log_WARNING_HI_InvalidStartWord() const;
423 
428 
432  void log_WARNING_HI_InvalidChecksum() const;
433 
437  void log_WARNING_LO_PayloadTooShort() const;
438 
439  protected:
440 
441  // ----------------------------------------------------------------------
442  // Time
443  // ----------------------------------------------------------------------
444 
448  Fw::Time getTime() const;
449 
450  protected:
451 
452  // ----------------------------------------------------------------------
453  // Mutex operations for guarded ports
454  //
455  // You can override these operations to provide more sophisticated
456  // synchronization
457  // ----------------------------------------------------------------------
458 
460  virtual void lock();
461 
463  virtual void unLock();
464 
465  private:
466 
467  // ----------------------------------------------------------------------
468  // Calls for messages received on typed input ports
469  // ----------------------------------------------------------------------
470 
472  static void m_p_dataIn_in(
473  Fw::PassiveComponentBase* callComp,
474  FwIndexType portNum,
475  Fw::Buffer& data,
476  const ComCfg::FrameContext& context
477  );
478 
480  static void m_p_dataReturnIn_in(
481  Fw::PassiveComponentBase* callComp,
482  FwIndexType portNum,
483  Fw::Buffer& data,
484  const ComCfg::FrameContext& context
485  );
486 
487  private:
488 
489  // ----------------------------------------------------------------------
490  // Typed input ports
491  // ----------------------------------------------------------------------
492 
495 
498 
499  private:
500 
501  // ----------------------------------------------------------------------
502  // Special output ports
503  // ----------------------------------------------------------------------
504 
506  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
507 
508 #if FW_ENABLE_TEXT_LOGGING == 1
509 
511  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
512 
513 #endif
514 
516  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
517 
518  private:
519 
520  // ----------------------------------------------------------------------
521  // Typed output ports
522  // ----------------------------------------------------------------------
523 
526 
529 
530  private:
531 
532  // ----------------------------------------------------------------------
533  // Mutexes
534  // ----------------------------------------------------------------------
535 
537  Os::Mutex m_guardedPortMutex;
538 
539  };
540 
541 }
542 
543 #endif
bool isConnected_logOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
I32 FwEnumStoreType
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_logOut_OutputPorts()
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
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 (too short to be a frame)
An invalid frame was received (not enough data to contain a valid FwPacketDescriptor type) ...
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()
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].
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.
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.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
RateGroupDivider component implementation.
An invalid frame was received (start word is wrong)
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
An invalid frame was received (checksum mismatch)
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()