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 {
70  };
71 
72  public:
73 
74  // ----------------------------------------------------------------------
75  // Component initialization
76  // ----------------------------------------------------------------------
77 
79  void init(
80  FwEnumStoreType instance = 0
81  );
82 
83 #if !FW_DIRECT_PORT_CALLS
84 
85  public:
86 
87  // ----------------------------------------------------------------------
88  // Getters for typed input ports
89  // ----------------------------------------------------------------------
90 
95  FwIndexType portNum
96  );
97 
102  FwIndexType portNum
103  );
104 
105 #endif
106 
107 #if !FW_DIRECT_PORT_CALLS
108 
109  public:
110 
111  // ----------------------------------------------------------------------
112  // Connect input ports to special output ports
113  // ----------------------------------------------------------------------
114 
117  FwIndexType portNum,
118  Fw::InputLogPort* port
119  );
120 
121 #if FW_ENABLE_TEXT_LOGGING == 1
122 
124  void set_logTextOut_OutputPort(
125  FwIndexType portNum,
126  Fw::InputLogTextPort* port
127  );
128 
129 #endif
130 
133  FwIndexType portNum,
134  Fw::InputTimePort* port
135  );
136 
137 #endif
138 
139 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
140 
141  public:
142 
143  // ----------------------------------------------------------------------
144  // Connect serial input ports to special output ports
145  // ----------------------------------------------------------------------
146 
149  FwIndexType portNum,
150  Fw::InputSerializePort* port
151  );
152 
153 #if FW_ENABLE_TEXT_LOGGING == 1
154 
156  void set_logTextOut_OutputPort(
157  FwIndexType portNum,
158  Fw::InputSerializePort* port
159  );
160 
161 #endif
162 
165  FwIndexType portNum,
166  Fw::InputSerializePort* port
167  );
168 
169 #endif
170 
171  protected:
172 
173  // ----------------------------------------------------------------------
174  // Component construction and destruction
175  // ----------------------------------------------------------------------
176 
179  const char* compName = ""
180  );
181 
183  virtual ~ApidManagerComponentBase();
184 
185  protected:
186 
187  // ----------------------------------------------------------------------
188  // Getters for numbers of typed input ports
189  // ----------------------------------------------------------------------
190 
196  }
197 
203  }
204 
205  protected:
206 
207  // ----------------------------------------------------------------------
208  // Getters for numbers of special output ports
209  // ----------------------------------------------------------------------
210 
216  }
217 
218 #if FW_ENABLE_TEXT_LOGGING == 1
219 
223  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
225  }
226 
227 #endif
228 
234  }
235 
236  protected:
237 
238  // ----------------------------------------------------------------------
239  // Connection status queries for special output ports
240  // ----------------------------------------------------------------------
241 
246  FwIndexType portNum
247  ) const;
248 
249 #if FW_ENABLE_TEXT_LOGGING == 1
250 
254  bool isConnected_logTextOut_OutputPort(
255  FwIndexType portNum
256  ) const;
257 
258 #endif
259 
264  FwIndexType portNum
265  ) const;
266 
267  protected:
268 
269  // ----------------------------------------------------------------------
270  // Handlers to implement for typed input ports
271  // ----------------------------------------------------------------------
272 
274  virtual U16 getApidSeqCountIn_handler(
275  FwIndexType portNum,
276  const ComCfg::Apid& apid,
277  U16 sequenceCount
278  ) = 0;
279 
281  virtual U16 validateApidSeqCountIn_handler(
282  FwIndexType portNum,
283  const ComCfg::Apid& apid,
284  U16 sequenceCount
285  ) = 0;
286 
287 #if FW_DIRECT_PORT_CALLS
288  public:
289 #else
290  protected:
291 #endif
292 
293  // ----------------------------------------------------------------------
294  // Port handler base-class functions for typed input ports
295  //
296  // Call these functions directly to bypass the corresponding ports
297  // ----------------------------------------------------------------------
298 
301  FwIndexType portNum,
302  const ComCfg::Apid& apid,
303  U16 sequenceCount
304  );
305 
308  FwIndexType portNum,
309  const ComCfg::Apid& apid,
310  U16 sequenceCount
311  );
312 
313  protected:
314 
315  // ----------------------------------------------------------------------
316  // Event logging functions
317  // ----------------------------------------------------------------------
318 
323  U16 transmitted,
324  U16 expected
325  ) const;
326 
327  protected:
328 
329  // ----------------------------------------------------------------------
330  // Time
331  // ----------------------------------------------------------------------
332 
336  Fw::Time getTime() const;
337 
338  protected:
339 
340  // ----------------------------------------------------------------------
341  // Mutex operations for guarded ports
342  //
343  // You can override these operations to provide more sophisticated
344  // synchronization
345  // ----------------------------------------------------------------------
346 
348  virtual void lock();
349 
351  virtual void unLock();
352 
353  private:
354 
355  // ----------------------------------------------------------------------
356  // Calls for messages received on typed input ports
357  // ----------------------------------------------------------------------
358 
360  static U16 m_p_getApidSeqCountIn_in(
361  Fw::PassiveComponentBase* callComp,
362  FwIndexType portNum,
363  const ComCfg::Apid& apid,
364  U16 sequenceCount
365  );
366 
368  static U16 m_p_validateApidSeqCountIn_in(
369  Fw::PassiveComponentBase* callComp,
370  FwIndexType portNum,
371  const ComCfg::Apid& apid,
372  U16 sequenceCount
373  );
374 
375  private:
376 
377  // ----------------------------------------------------------------------
378  // Invocation functions for special output ports
379  // ----------------------------------------------------------------------
380 
382  void logOut_out(
383  FwIndexType portNum,
384  FwEventIdType id,
385  Fw::Time& timeTag,
386  const Fw::LogSeverity& severity,
387  Fw::LogBuffer& args
388  ) const;
389 
390 #if FW_ENABLE_TEXT_LOGGING
391 
393  void logTextOut_out(
394  FwIndexType portNum,
395  FwEventIdType id,
396  Fw::Time& timeTag,
397  const Fw::LogSeverity& severity,
398  Fw::TextLogString& text
399  ) const;
400 
401 #endif
402 
404  void timeCaller_out(
405  FwIndexType portNum,
406  Fw::Time& time
407  ) const;
408 
409 #if !FW_DIRECT_PORT_CALLS
410 
411  private:
412 
413  // ----------------------------------------------------------------------
414  // Typed input ports
415  // ----------------------------------------------------------------------
416 
419 
422 
423 #endif
424 
425 #if !FW_DIRECT_PORT_CALLS
426 
427  private:
428 
429  // ----------------------------------------------------------------------
430  // Special output ports
431  // ----------------------------------------------------------------------
432 
434  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
435 
436 #if FW_ENABLE_TEXT_LOGGING == 1
437 
439  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
440 
441 #endif
442 
444  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
445 
446 #endif
447 
448  private:
449 
450  // ----------------------------------------------------------------------
451  // Mutexes
452  // ----------------------------------------------------------------------
453 
455  Os::Mutex m_guardedPortMutex;
456 
457  };
458 
459  }
460 
461 }
462 
463 #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_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:18
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.