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
19 #if !FW_DIRECT_PORT_CALLS
21 #endif
22 #if !FW_DIRECT_PORT_CALLS
24 #endif
25 #include "Fw/Time/TimePortAc.hpp"
26 #include "Os/Mutex.hpp"
28 
29 namespace Svc {
30 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
47  friend class FprimeDeframerTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
59  };
60 
62  enum {
66  };
67 
69  enum {
72  };
73 
75  enum {
81  };
82 
83  public:
84 
85  // ----------------------------------------------------------------------
86  // Component initialization
87  // ----------------------------------------------------------------------
88 
90  void init(
91  FwEnumStoreType instance = 0
92  );
93 
94 #if !FW_DIRECT_PORT_CALLS
95 
96  public:
97 
98  // ----------------------------------------------------------------------
99  // Getters for typed input ports
100  // ----------------------------------------------------------------------
101 
106  FwIndexType portNum
107  );
108 
113  FwIndexType portNum
114  );
115 
116 #endif
117 
118 #if !FW_DIRECT_PORT_CALLS
119 
120  public:
121 
122  // ----------------------------------------------------------------------
123  // Connect input ports to special output ports
124  // ----------------------------------------------------------------------
125 
128  FwIndexType portNum,
129  Fw::InputLogPort* port
130  );
131 
132 #if FW_ENABLE_TEXT_LOGGING == 1
133 
135  void set_logTextOut_OutputPort(
136  FwIndexType portNum,
137  Fw::InputLogTextPort* port
138  );
139 
140 #endif
141 
144  FwIndexType portNum,
145  Fw::InputTimePort* port
146  );
147 
148 #endif
149 
150 #if !FW_DIRECT_PORT_CALLS
151 
152  public:
153 
154  // ----------------------------------------------------------------------
155  // Connect typed input ports to typed output ports
156  // ----------------------------------------------------------------------
157 
160  FwIndexType portNum,
162  );
163 
166  FwIndexType portNum,
168  );
169 
170 #endif
171 
172 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
173 
174  public:
175 
176  // ----------------------------------------------------------------------
177  // Connect serial input ports to special output ports
178  // ----------------------------------------------------------------------
179 
182  FwIndexType portNum,
183  Fw::InputSerializePort* port
184  );
185 
186 #if FW_ENABLE_TEXT_LOGGING == 1
187 
189  void set_logTextOut_OutputPort(
190  FwIndexType portNum,
191  Fw::InputSerializePort* port
192  );
193 
194 #endif
195 
198  FwIndexType portNum,
199  Fw::InputSerializePort* port
200  );
201 
202 #endif
203 
204 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
205 
206  public:
207 
208  // ----------------------------------------------------------------------
209  // Connect serial input ports to typed output ports
210  // ----------------------------------------------------------------------
211 
214  FwIndexType portNum,
215  Fw::InputSerializePort* port
216  );
217 
220  FwIndexType portNum,
221  Fw::InputSerializePort* port
222  );
223 
224 #endif
225 
226  protected:
227 
228  // ----------------------------------------------------------------------
229  // Component construction and destruction
230  // ----------------------------------------------------------------------
231 
234  const char* compName = ""
235  );
236 
239 
240  protected:
241 
242  // ----------------------------------------------------------------------
243  // Getters for numbers of typed input ports
244  // ----------------------------------------------------------------------
245 
250  return NUM_DATAIN_INPUT_PORTS;
251  }
252 
258  }
259 
260  protected:
261 
262  // ----------------------------------------------------------------------
263  // Getters for numbers of special output ports
264  // ----------------------------------------------------------------------
265 
271  }
272 
273 #if FW_ENABLE_TEXT_LOGGING == 1
274 
278  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
280  }
281 
282 #endif
283 
289  }
290 
291  protected:
292 
293  // ----------------------------------------------------------------------
294  // Getters for numbers of typed output ports
295  // ----------------------------------------------------------------------
296 
302  }
303 
309  }
310 
311  protected:
312 
313  // ----------------------------------------------------------------------
314  // Connection status queries for special output ports
315  // ----------------------------------------------------------------------
316 
321  FwIndexType portNum
322  ) const;
323 
324 #if FW_ENABLE_TEXT_LOGGING == 1
325 
329  bool isConnected_logTextOut_OutputPort(
330  FwIndexType portNum
331  ) const;
332 
333 #endif
334 
339  FwIndexType portNum
340  ) const;
341 
342  protected:
343 
344  // ----------------------------------------------------------------------
345  // Connection status queries for typed output ports
346  // ----------------------------------------------------------------------
347 
352  FwIndexType portNum
353  ) const;
354 
359  FwIndexType portNum
360  ) const;
361 
362  protected:
363 
364  // ----------------------------------------------------------------------
365  // Handlers to implement for typed input ports
366  // ----------------------------------------------------------------------
367 
369  virtual void dataIn_handler(
370  FwIndexType portNum,
371  Fw::Buffer& data,
372  const ComCfg::FrameContext& context
373  ) = 0;
374 
376  virtual void dataReturnIn_handler(
377  FwIndexType portNum,
378  Fw::Buffer& data,
379  const ComCfg::FrameContext& context
380  ) = 0;
381 
382 #if FW_DIRECT_PORT_CALLS
383  public:
384 #else
385  protected:
386 #endif
387 
388  // ----------------------------------------------------------------------
389  // Port handler base-class functions for typed input ports
390  //
391  // Call these functions directly to bypass the corresponding ports
392  // ----------------------------------------------------------------------
393 
395  void dataIn_handlerBase(
396  FwIndexType portNum,
397  Fw::Buffer& data,
398  const ComCfg::FrameContext& context
399  );
400 
403  FwIndexType portNum,
404  Fw::Buffer& data,
405  const ComCfg::FrameContext& context
406  );
407 
408  protected:
409 
410  // ----------------------------------------------------------------------
411  // Invocation functions for typed output ports
412  // ----------------------------------------------------------------------
413 
415  void dataOut_out(
416  FwIndexType portNum,
417  Fw::Buffer& data,
418  const ComCfg::FrameContext& context
419  ) const;
420 
422  void dataReturnOut_out(
423  FwIndexType portNum,
424  Fw::Buffer& data,
425  const ComCfg::FrameContext& context
426  ) const;
427 
428  protected:
429 
430  // ----------------------------------------------------------------------
431  // Event logging functions
432  // ----------------------------------------------------------------------
433 
438 
442  void log_WARNING_HI_InvalidStartWord() const;
443 
448 
452  void log_WARNING_HI_InvalidChecksum() const;
453 
457  void log_WARNING_LO_PayloadTooShort() const;
458 
459  protected:
460 
461  // ----------------------------------------------------------------------
462  // Time
463  // ----------------------------------------------------------------------
464 
468  Fw::Time getTime() const;
469 
470  protected:
471 
472  // ----------------------------------------------------------------------
473  // Mutex operations for guarded ports
474  //
475  // You can override these operations to provide more sophisticated
476  // synchronization
477  // ----------------------------------------------------------------------
478 
480  virtual void lock();
481 
483  virtual void unLock();
484 
485  private:
486 
487  // ----------------------------------------------------------------------
488  // Calls for messages received on typed input ports
489  // ----------------------------------------------------------------------
490 
492  static void m_p_dataIn_in(
493  Fw::PassiveComponentBase* callComp,
494  FwIndexType portNum,
495  Fw::Buffer& data,
496  const ComCfg::FrameContext& context
497  );
498 
500  static void m_p_dataReturnIn_in(
501  Fw::PassiveComponentBase* callComp,
502  FwIndexType portNum,
503  Fw::Buffer& data,
504  const ComCfg::FrameContext& context
505  );
506 
507  private:
508 
509  // ----------------------------------------------------------------------
510  // Invocation functions for special output ports
511  // ----------------------------------------------------------------------
512 
514  void logOut_out(
515  FwIndexType portNum,
516  FwEventIdType id,
517  Fw::Time& timeTag,
518  const Fw::LogSeverity& severity,
519  Fw::LogBuffer& args
520  ) const;
521 
522 #if FW_ENABLE_TEXT_LOGGING
523 
525  void logTextOut_out(
526  FwIndexType portNum,
527  FwEventIdType id,
528  Fw::Time& timeTag,
529  const Fw::LogSeverity& severity,
530  Fw::TextLogString& text
531  ) const;
532 
533 #endif
534 
536  void timeCaller_out(
537  FwIndexType portNum,
538  Fw::Time& time
539  ) const;
540 
541 #if !FW_DIRECT_PORT_CALLS
542 
543  private:
544 
545  // ----------------------------------------------------------------------
546  // Typed input ports
547  // ----------------------------------------------------------------------
548 
551 
554 
555 #endif
556 
557 #if !FW_DIRECT_PORT_CALLS
558 
559  private:
560 
561  // ----------------------------------------------------------------------
562  // Special output ports
563  // ----------------------------------------------------------------------
564 
566  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
567 
568 #if FW_ENABLE_TEXT_LOGGING == 1
569 
571  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
572 
573 #endif
574 
576  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
577 
578 #endif
579 
580 #if !FW_DIRECT_PORT_CALLS
581 
582  private:
583 
584  // ----------------------------------------------------------------------
585  // Typed output ports
586  // ----------------------------------------------------------------------
587 
590 
593 
594 #endif
595 
596  private:
597 
598  // ----------------------------------------------------------------------
599  // Mutexes
600  // ----------------------------------------------------------------------
601 
603  Os::Mutex m_guardedPortMutex;
604 
605  };
606 
607 }
608 
609 #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()