F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ApidManagerComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ApidManagerComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ApidManager component base class
5 // ======================================================================
6 
7 #ifndef Svc_Ccsds_ApidManagerComponentAc_HPP
8 #define Svc_Ccsds_ApidManagerComponentAc_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 
29  namespace Ccsds {
30 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
44  friend class ApidManagerTesterBase;
46  friend class ApidManagerTester;
47 
48  protected:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
58  };
59 
61  enum {
65  };
66 
68  enum {
71  };
72 
73  public:
74 
75  // ----------------------------------------------------------------------
76  // Component initialization
77  // ----------------------------------------------------------------------
78 
80  void init(
81  FwEnumStoreType instance = 0
82  );
83 
84 #if !FW_DIRECT_PORT_CALLS
85 
86  public:
87 
88  // ----------------------------------------------------------------------
89  // Getters for typed input ports
90  // ----------------------------------------------------------------------
91 
96  FwIndexType portNum
97  );
98 
103  FwIndexType portNum
104  );
105 
106 #endif
107 
108 #if !FW_DIRECT_PORT_CALLS
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 #endif
139 
140 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
141 
142  public:
143 
144  // ----------------------------------------------------------------------
145  // Connect serial input ports to special output ports
146  // ----------------------------------------------------------------------
147 
150  FwIndexType portNum,
151  Fw::InputSerializePort* port
152  );
153 
154 #if FW_ENABLE_TEXT_LOGGING == 1
155 
157  void set_logTextOut_OutputPort(
158  FwIndexType portNum,
159  Fw::InputSerializePort* port
160  );
161 
162 #endif
163 
166  FwIndexType portNum,
167  Fw::InputSerializePort* port
168  );
169 
170 #endif
171 
172  protected:
173 
174  // ----------------------------------------------------------------------
175  // Component construction and destruction
176  // ----------------------------------------------------------------------
177 
180  const char* compName = ""
181  );
182 
184  virtual ~ApidManagerComponentBase();
185 
186  protected:
187 
188  // ----------------------------------------------------------------------
189  // Getters for numbers of typed input ports
190  // ----------------------------------------------------------------------
191 
197  }
198 
204  }
205 
206  protected:
207 
208  // ----------------------------------------------------------------------
209  // Getters for numbers of special output ports
210  // ----------------------------------------------------------------------
211 
217  }
218 
219 #if FW_ENABLE_TEXT_LOGGING == 1
220 
224  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
226  }
227 
228 #endif
229 
235  }
236 
237  protected:
238 
239  // ----------------------------------------------------------------------
240  // Connection status queries for special output ports
241  // ----------------------------------------------------------------------
242 
247  FwIndexType portNum
248  ) const;
249 
250 #if FW_ENABLE_TEXT_LOGGING == 1
251 
255  bool isConnected_logTextOut_OutputPort(
256  FwIndexType portNum
257  ) const;
258 
259 #endif
260 
265  FwIndexType portNum
266  ) const;
267 
268  protected:
269 
270  // ----------------------------------------------------------------------
271  // Handlers to implement for typed input ports
272  // ----------------------------------------------------------------------
273 
275  virtual U16 getApidSeqCountIn_handler(
276  FwIndexType portNum,
277  const ComCfg::Apid& apid,
278  U16 sequenceCount
279  ) = 0;
280 
282  virtual U16 validateApidSeqCountIn_handler(
283  FwIndexType portNum,
284  const ComCfg::Apid& apid,
285  U16 sequenceCount
286  ) = 0;
287 
288 #if FW_DIRECT_PORT_CALLS
289  public:
290 #else
291  protected:
292 #endif
293 
294  // ----------------------------------------------------------------------
295  // Port handler base-class functions for typed input ports
296  //
297  // Call these functions directly to bypass the corresponding ports
298  // ----------------------------------------------------------------------
299 
302  FwIndexType portNum,
303  const ComCfg::Apid& apid,
304  U16 sequenceCount
305  );
306 
309  FwIndexType portNum,
310  const ComCfg::Apid& apid,
311  U16 sequenceCount
312  );
313 
314  protected:
315 
316  // ----------------------------------------------------------------------
317  // Event logging functions
318  // ----------------------------------------------------------------------
319 
324  U16 transmitted,
325  U16 expected
326  ) const;
327 
331  void log_WARNING_HI_ApidTableFull(U16 invalidApidValue) const;
332 
333  protected:
334 
335  // ----------------------------------------------------------------------
336  // Time
337  // ----------------------------------------------------------------------
338 
342  Fw::Time getTime() const;
343 
344  protected:
345 
346  // ----------------------------------------------------------------------
347  // Mutex operations for guarded ports
348  //
349  // You can override these operations to provide more sophisticated
350  // synchronization
351  // ----------------------------------------------------------------------
352 
354  virtual void lock();
355 
357  virtual void unLock();
358 
359  private:
360 
361  // ----------------------------------------------------------------------
362  // Calls for messages received on typed input ports
363  // ----------------------------------------------------------------------
364 
366  static U16 m_p_getApidSeqCountIn_in(
367  Fw::PassiveComponentBase* callComp,
368  FwIndexType portNum,
369  const ComCfg::Apid& apid,
370  U16 sequenceCount
371  );
372 
374  static U16 m_p_validateApidSeqCountIn_in(
375  Fw::PassiveComponentBase* callComp,
376  FwIndexType portNum,
377  const ComCfg::Apid& apid,
378  U16 sequenceCount
379  );
380 
381  private:
382 
383  // ----------------------------------------------------------------------
384  // Invocation functions for special output ports
385  // ----------------------------------------------------------------------
386 
388  void logOut_out(
389  FwIndexType portNum,
390  FwEventIdType id,
391  Fw::Time& timeTag,
392  const Fw::LogSeverity& severity,
393  Fw::LogBuffer& args
394  ) const;
395 
396 #if FW_ENABLE_TEXT_LOGGING
397 
399  void logTextOut_out(
400  FwIndexType portNum,
401  FwEventIdType id,
402  Fw::Time& timeTag,
403  const Fw::LogSeverity& severity,
404  Fw::TextLogString& text
405  ) const;
406 
407 #endif
408 
410  void timeCaller_out(
411  FwIndexType portNum,
412  Fw::Time& time
413  ) const;
414 
415 #if !FW_DIRECT_PORT_CALLS
416 
417  private:
418 
419  // ----------------------------------------------------------------------
420  // Typed input ports
421  // ----------------------------------------------------------------------
422 
425 
428 
429 #endif
430 
431 #if !FW_DIRECT_PORT_CALLS
432 
433  private:
434 
435  // ----------------------------------------------------------------------
436  // Special output ports
437  // ----------------------------------------------------------------------
438 
440  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
441 
442 #if FW_ENABLE_TEXT_LOGGING == 1
443 
445  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
446 
447 #endif
448 
450  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
451 
452 #endif
453 
454  private:
455 
456  // ----------------------------------------------------------------------
457  // Mutexes
458  // ----------------------------------------------------------------------
459 
461  Os::Mutex m_guardedPortMutex;
462 
463  };
464 
465  }
466 
467 }
468 
469 #endif
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
virtual void unLock()
Unlock the guarded mutex.
I32 FwEnumStoreType
friend class ApidManagerTesterBase
Friend class tester to support autocoded test harness.
virtual ~ApidManagerComponentBase()
Destroy ApidManagerComponentBase object.
static constexpr FwIndexType getNum_getApidSeqCountIn_InputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
Svc::Ccsds::InputApidSequenceCountPort * get_validateApidSeqCountIn_InputPort(FwIndexType portNum)
FwIdType FwEventIdType
The type of an event identifier.
ApidManagerComponentBase(const char *compName="")
Construct ApidManagerComponentBase object.
friend class ApidManagerTester
Friend class tester implementation to support white-box testing.
virtual U16 validateApidSeqCountIn_handler(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount)=0
Handler for input port validateApidSeqCountIn.
Enum representing event severity.
void log_WARNING_HI_ApidTableFull(U16 invalidApidValue) const
void log_WARNING_LO_UnexpectedSequenceCount(U16 transmitted, U16 expected) const
virtual void lock()
Lock the guarded mutex.
static constexpr FwIndexType getNum_logOut_OutputPorts()
U16 getApidSeqCountIn_handlerBase(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount)
Handler base-class function for input port getApidSeqCountIn.
PlatformIndexType FwIndexType
U16 validateApidSeqCountIn_handlerBase(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount)
Handler base-class function for input port validateApidSeqCountIn.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
RateGroupDivider component implementation.
Auto-generated base for ApidManager component.
static constexpr FwIndexType getNum_validateApidSeqCountIn_InputPorts()
Svc::Ccsds::InputApidSequenceCountPort * get_getApidSeqCountIn_InputPort(FwIndexType portNum)
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:17
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
virtual U16 getApidSeqCountIn_handler(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount)=0
Handler for input port getApidSeqCountIn.