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 #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 
31  namespace Ccsds {
32 
39  {
40 
41  // ----------------------------------------------------------------------
42  // Friend classes
43  // ----------------------------------------------------------------------
44 
46  friend class ApidManagerTesterBase;
48  friend class ApidManagerTester;
49 
50  protected:
51 
52  // ----------------------------------------------------------------------
53  // Constants
54  // ----------------------------------------------------------------------
55 
57  enum {
60  };
61 
63  enum {
67  };
68 
70  enum {
73  };
74 
75  public:
76 
77  // ----------------------------------------------------------------------
78  // Component initialization
79  // ----------------------------------------------------------------------
80 
82  void init(
83  FwEnumStoreType instance = 0
84  );
85 
86 #if !FW_DIRECT_PORT_CALLS
87 
88  public:
89 
90  // ----------------------------------------------------------------------
91  // Getters for typed input ports
92  // ----------------------------------------------------------------------
93 
98  FwIndexType portNum
99  );
100 
105  FwIndexType portNum
106  );
107 
108 #endif
109 
110 #if !FW_DIRECT_PORT_CALLS
111 
112  public:
113 
114  // ----------------------------------------------------------------------
115  // Connect input ports to special output ports
116  // ----------------------------------------------------------------------
117 
120  FwIndexType portNum,
121  Fw::InputLogPort* port
122  );
123 
124 #if FW_ENABLE_TEXT_LOGGING == 1
125 
127  void set_logTextOut_OutputPort(
128  FwIndexType portNum,
129  Fw::InputLogTextPort* port
130  );
131 
132 #endif
133 
136  FwIndexType portNum,
137  Fw::InputTimePort* port
138  );
139 
140 #endif
141 
142 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
143 
144  public:
145 
146  // ----------------------------------------------------------------------
147  // Connect serial input ports to special output ports
148  // ----------------------------------------------------------------------
149 
152  FwIndexType portNum,
153  Fw::InputSerializePort* port
154  );
155 
156 #if FW_ENABLE_TEXT_LOGGING == 1
157 
159  void set_logTextOut_OutputPort(
160  FwIndexType portNum,
161  Fw::InputSerializePort* port
162  );
163 
164 #endif
165 
168  FwIndexType portNum,
169  Fw::InputSerializePort* port
170  );
171 
172 #endif
173 
174  protected:
175 
176  // ----------------------------------------------------------------------
177  // Component construction and destruction
178  // ----------------------------------------------------------------------
179 
182  const char* compName = ""
183  );
184 
186  virtual ~ApidManagerComponentBase();
187 
188  protected:
189 
190  // ----------------------------------------------------------------------
191  // Getters for numbers of typed input ports
192  // ----------------------------------------------------------------------
193 
199  }
200 
206  }
207 
208  protected:
209 
210  // ----------------------------------------------------------------------
211  // Getters for numbers of special output ports
212  // ----------------------------------------------------------------------
213 
219  }
220 
221 #if FW_ENABLE_TEXT_LOGGING == 1
222 
226  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
228  }
229 
230 #endif
231 
237  }
238 
239  protected:
240 
241  // ----------------------------------------------------------------------
242  // Connection status queries for special output ports
243  // ----------------------------------------------------------------------
244 
249  FwIndexType portNum
250  ) const;
251 
252 #if FW_ENABLE_TEXT_LOGGING == 1
253 
257  bool isConnected_logTextOut_OutputPort(
258  FwIndexType portNum
259  ) const;
260 
261 #endif
262 
267  FwIndexType portNum
268  ) const;
269 
270  protected:
271 
272  // ----------------------------------------------------------------------
273  // Handlers to implement for typed input ports
274  // ----------------------------------------------------------------------
275 
277  virtual U16 getApidSeqCountIn_handler(
278  FwIndexType portNum,
279  const ComCfg::Apid& apid,
280  U16 sequenceCount
281  ) = 0;
282 
284  virtual U16 validateApidSeqCountIn_handler(
285  FwIndexType portNum,
286  const ComCfg::Apid& apid,
287  U16 sequenceCount
288  ) = 0;
289 
290 #if FW_DIRECT_PORT_CALLS
291  public:
292 #else
293  protected:
294 #endif
295 
296  // ----------------------------------------------------------------------
297  // Port handler base-class functions for typed input ports
298  //
299  // Call these functions directly to bypass the corresponding ports
300  // ----------------------------------------------------------------------
301 
304  FwIndexType portNum,
305  const ComCfg::Apid& apid,
306  U16 sequenceCount
307  );
308 
311  FwIndexType portNum,
312  const ComCfg::Apid& apid,
313  U16 sequenceCount
314  );
315 
316  protected:
317 
318  // ----------------------------------------------------------------------
319  // Event logging functions
320  // ----------------------------------------------------------------------
321 
326  U16 transmitted,
327  U16 expected
328  ) const;
329 
333  void log_WARNING_HI_ApidTableFull(U16 invalidApidValue) const;
334 
335  protected:
336 
337  // ----------------------------------------------------------------------
338  // Time
339  // ----------------------------------------------------------------------
340 
344  Fw::Time getTime() const;
345 
346  protected:
347 
348  // ----------------------------------------------------------------------
349  // Mutex operations for guarded ports
350  //
351  // You can override these operations to provide more sophisticated
352  // synchronization
353  // ----------------------------------------------------------------------
354 
356  virtual void lock();
357 
359  virtual void unLock();
360 
361  private:
362 
363  // ----------------------------------------------------------------------
364  // Calls for messages received on typed input ports
365  // ----------------------------------------------------------------------
366 
368  static U16 m_p_getApidSeqCountIn_in(
369  Fw::PassiveComponentBase* callComp,
370  FwIndexType portNum,
371  const ComCfg::Apid& apid,
372  U16 sequenceCount
373  );
374 
376  static U16 m_p_validateApidSeqCountIn_in(
377  Fw::PassiveComponentBase* callComp,
378  FwIndexType portNum,
379  const ComCfg::Apid& apid,
380  U16 sequenceCount
381  );
382 
383  private:
384 
385  // ----------------------------------------------------------------------
386  // Invocation functions for special output ports
387  // ----------------------------------------------------------------------
388 
390  void logOut_out(
391  FwIndexType portNum,
392  FwEventIdType id,
393  Fw::Time& timeTag,
394  const Fw::LogSeverity& severity,
395  Fw::LogBuffer& args
396  ) const;
397 
398 #if FW_ENABLE_TEXT_LOGGING
399 
401  void logTextOut_out(
402  FwIndexType portNum,
403  FwEventIdType id,
404  Fw::Time& timeTag,
405  const Fw::LogSeverity& severity,
406  Fw::TextLogString& text
407  ) const;
408 
409 #endif
410 
412  void timeCaller_out(
413  FwIndexType portNum,
414  Fw::Time& time
415  ) const;
416 
417 #if !FW_DIRECT_PORT_CALLS
418 
419  private:
420 
421  // ----------------------------------------------------------------------
422  // Typed input ports
423  // ----------------------------------------------------------------------
424 
427 
430 
431 #endif
432 
433 #if !FW_DIRECT_PORT_CALLS
434 
435  private:
436 
437  // ----------------------------------------------------------------------
438  // Special output ports
439  // ----------------------------------------------------------------------
440 
442  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
443 
444 #if FW_ENABLE_TEXT_LOGGING == 1
445 
447  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
448 
449 #endif
450 
452  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
453 
454 #endif
455 
456  private:
457 
458  // ----------------------------------------------------------------------
459  // Mutexes
460  // ----------------------------------------------------------------------
461 
463  Os::Mutex m_guardedPortMutex;
464 
465  };
466 
467  }
468 
469 }
470 
471 #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.