F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
OsTimeComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title OsTimeComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for OsTime component base class
5 // ======================================================================
6 
7 #ifndef Svc_OsTimeComponentAc_HPP
8 #define Svc_OsTimeComponentAc_HPP
9 
10 #include <atomic>
11 
12 #include "Fw/Cmd/CmdPortAc.hpp"
13 #include "Fw/Cmd/CmdRegPortAc.hpp"
15 #include "Fw/Cmd/CmdString.hpp"
17 #include "Fw/FPrimeBasicTypes.hpp"
18 #include "Fw/Log/LogPortAc.hpp"
19 #include "Fw/Log/LogString.hpp"
20 #if FW_ENABLE_TEXT_LOGGING == 1
21 #include "Fw/Log/LogTextPortAc.hpp"
22 #endif
25 #include "Fw/Time/TimePortAc.hpp"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
43  friend class OsTimeTesterBase;
45  friend class OsTimeTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
56  };
57 
59  enum {
62  };
63 
65  enum {
71  };
72 
74  enum {
76  };
77 
79  enum {
81  };
82 
83  public:
84 
85  // ----------------------------------------------------------------------
86  // Component initialization
87  // ----------------------------------------------------------------------
88 
90  void init(
91  FwEnumStoreType instance = 0
92  );
93 
94  public:
95 
96  // ----------------------------------------------------------------------
97  // Getters for special input ports
98  // ----------------------------------------------------------------------
99 
104  FwIndexType portNum
105  );
106 
107  public:
108 
109  // ----------------------------------------------------------------------
110  // Getters for typed input ports
111  // ----------------------------------------------------------------------
112 
117  FwIndexType portNum
118  );
119 
124  FwIndexType portNum
125  );
126 
127  public:
128 
129  // ----------------------------------------------------------------------
130  // Connect input ports to special output ports
131  // ----------------------------------------------------------------------
132 
135  FwIndexType portNum,
136  Fw::InputCmdRegPort* port
137  );
138 
141  FwIndexType portNum,
143  );
144 
147  FwIndexType portNum,
148  Fw::InputLogPort* port
149  );
150 
151 #if FW_ENABLE_TEXT_LOGGING == 1
152 
154  void set_LogText_OutputPort(
155  FwIndexType portNum,
156  Fw::InputLogTextPort* port
157  );
158 
159 #endif
160 
163  FwIndexType portNum,
164  Fw::InputTimePort* port
165  );
166 
167 #if FW_PORT_SERIALIZATION
168 
169  public:
170 
171  // ----------------------------------------------------------------------
172  // Connect serial input ports to special output ports
173  // ----------------------------------------------------------------------
174 
177  FwIndexType portNum,
178  Fw::InputSerializePort* port
179  );
180 
183  FwIndexType portNum,
184  Fw::InputSerializePort* port
185  );
186 
189  FwIndexType portNum,
190  Fw::InputSerializePort* port
191  );
192 
193 #if FW_ENABLE_TEXT_LOGGING == 1
194 
196  void set_LogText_OutputPort(
197  FwIndexType portNum,
198  Fw::InputSerializePort* port
199  );
200 
201 #endif
202 
205  FwIndexType portNum,
206  Fw::InputSerializePort* port
207  );
208 
209 #endif
210 
211  public:
212 
213  // ----------------------------------------------------------------------
214  // Command registration
215  // ----------------------------------------------------------------------
216 
220  void regCommands();
221 
222  protected:
223 
224  // ----------------------------------------------------------------------
225  // Component construction and destruction
226  // ----------------------------------------------------------------------
227 
230  const char* compName = ""
231  );
232 
234  virtual ~OsTimeComponentBase();
235 
236  protected:
237 
238  // ----------------------------------------------------------------------
239  // Getters for numbers of special input ports
240  // ----------------------------------------------------------------------
241 
247  }
248 
249  protected:
250 
251  // ----------------------------------------------------------------------
252  // Getters for numbers of typed input ports
253  // ----------------------------------------------------------------------
254 
260  }
261 
267  }
268 
269  protected:
270 
271  // ----------------------------------------------------------------------
272  // Getters for numbers of special output ports
273  // ----------------------------------------------------------------------
274 
280  }
281 
287  }
288 
294  }
295 
296 #if FW_ENABLE_TEXT_LOGGING == 1
297 
301  static constexpr FwIndexType getNum_LogText_OutputPorts() {
303  }
304 
305 #endif
306 
312  }
313 
314  protected:
315 
316  // ----------------------------------------------------------------------
317  // Connection status queries for special output ports
318  // ----------------------------------------------------------------------
319 
324  FwIndexType portNum
325  );
326 
331  FwIndexType portNum
332  );
333 
338  FwIndexType portNum
339  );
340 
341 #if FW_ENABLE_TEXT_LOGGING == 1
342 
346  bool isConnected_LogText_OutputPort(
347  FwIndexType portNum
348  );
349 
350 #endif
351 
356  FwIndexType portNum
357  );
358 
359  protected:
360 
361  // ----------------------------------------------------------------------
362  // Handlers to implement for typed input ports
363  // ----------------------------------------------------------------------
364 
366  virtual void setEpoch_handler(
367  FwIndexType portNum,
368  const Fw::Time& fw_time,
369  const Os::RawTime& os_time
370  ) = 0;
371 
373  virtual void timeGetPort_handler(
374  FwIndexType portNum,
375  Fw::Time& time
376  ) = 0;
377 
378  protected:
379 
380  // ----------------------------------------------------------------------
381  // Port handler base-class functions for typed input ports
382  //
383  // Call these functions directly to bypass the corresponding ports
384  // ----------------------------------------------------------------------
385 
388  FwIndexType portNum,
389  const Fw::Time& fw_time,
390  const Os::RawTime& os_time
391  );
392 
395  FwIndexType portNum,
396  Fw::Time& time
397  );
398 
399  protected:
400 
401  // ----------------------------------------------------------------------
402  // Command response
403  // ----------------------------------------------------------------------
404 
406  void cmdResponse_out(
407  FwOpcodeType opCode,
408  U32 cmdSeq,
409  Fw::CmdResponse response
410  );
411 
412  protected:
413 
414  // ----------------------------------------------------------------------
415  // Command handlers to implement
416  // ----------------------------------------------------------------------
417 
419  virtual void SetCurrentTime_cmdHandler(
420  FwOpcodeType opCode,
421  U32 cmdSeq,
422  U32 seconds_now
423  ) = 0;
424 
425  protected:
426 
427  // ----------------------------------------------------------------------
428  // Command handler base-class functions
429  //
430  // Call these functions directly to bypass the command input port
431  // ----------------------------------------------------------------------
432 
435  FwOpcodeType opCode,
436  U32 cmdSeq,
437  Fw::CmdArgBuffer& args
438  );
439 
440  protected:
441 
442  // ----------------------------------------------------------------------
443  // Event logging functions
444  // ----------------------------------------------------------------------
445 
450  U32 status
451  ) const;
452 
453  protected:
454 
455  // ----------------------------------------------------------------------
456  // Time
457  // ----------------------------------------------------------------------
458 
462  Fw::Time getTime() const;
463 
464  private:
465 
466  // ----------------------------------------------------------------------
467  // Calls for messages received on special input ports
468  // ----------------------------------------------------------------------
469 
471  static void m_p_CmdDisp_in(
472  Fw::PassiveComponentBase* callComp,
473  FwIndexType portNum,
474  FwOpcodeType opCode,
475  U32 cmdSeq,
476  Fw::CmdArgBuffer& args
477  );
478 
479  private:
480 
481  // ----------------------------------------------------------------------
482  // Calls for messages received on typed input ports
483  // ----------------------------------------------------------------------
484 
486  static void m_p_setEpoch_in(
487  Fw::PassiveComponentBase* callComp,
488  FwIndexType portNum,
489  const Fw::Time& fw_time,
490  const Os::RawTime& os_time
491  );
492 
494  static void m_p_timeGetPort_in(
495  Fw::PassiveComponentBase* callComp,
496  FwIndexType portNum,
497  Fw::Time& time
498  );
499 
500  private:
501 
502  // ----------------------------------------------------------------------
503  // Special input ports
504  // ----------------------------------------------------------------------
505 
507  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
508 
509  private:
510 
511  // ----------------------------------------------------------------------
512  // Typed input ports
513  // ----------------------------------------------------------------------
514 
517 
519  Fw::InputTimePort m_timeGetPort_InputPort[NUM_TIMEGETPORT_INPUT_PORTS];
520 
521  private:
522 
523  // ----------------------------------------------------------------------
524  // Special output ports
525  // ----------------------------------------------------------------------
526 
528  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
529 
532 
534  Fw::OutputLogPort m_EventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
535 
536 #if FW_ENABLE_TEXT_LOGGING == 1
537 
539  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
540 
541 #endif
542 
544  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
545 
546  };
547 
548 }
549 
550 #endif
static constexpr FwIndexType getNum_setEpoch_InputPorts()
static constexpr FwIndexType getNum_EventOut_OutputPorts()
Svc::InputOsTimeEpochPort * get_setEpoch_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
FwIdType FwOpcodeType
The type of a command opcode.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
I32 FwEnumStoreType
virtual void SetCurrentTime_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 seconds_now)=0
Handler for command SetCurrentTime.
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void log_WARNING_HI_SetCurrentTimeError(U32 status) const
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
Enum representing a command response.
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
virtual void setEpoch_handler(FwIndexType portNum, const Fw::Time &fw_time, const Os::RawTime &os_time)=0
Handler for input port setEpoch.
bool isConnected_EventOut_OutputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
void setEpoch_handlerBase(FwIndexType portNum, const Fw::Time &fw_time, const Os::RawTime &os_time)
Handler base-class function for input port setEpoch.
static constexpr FwIndexType getNum_timeGetPort_InputPorts()
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void SetCurrentTime_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Base-class handler function for command SetCurrentTime.
An error occurred while attempting to set the current time.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void timeGetPort_handlerBase(FwIndexType portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
Auto-generated base for OsTime component.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
PlatformIndexType FwIndexType
friend class OsTimeTesterBase
Friend class tester to support autocoded test harness.
void set_EventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to EventOut[portNum].
virtual ~OsTimeComponentBase()
Destroy OsTimeComponentBase object.
RateGroupDivider component implementation.
virtual void timeGetPort_handler(FwIndexType portNum, Fw::Time &time)=0
Handler for input port timeGetPort.
Fw::InputTimePort * get_timeGetPort_InputPort(FwIndexType portNum)
void regCommands()
Register commands with the Command Dispatcher.
friend class OsTimeTester
Friend class tester implementation to support white-box testing.
OsTimeComponentBase(const char *compName="")
Construct OsTimeComponentBase object.
static constexpr FwIndexType getNum_CmdReg_OutputPorts()