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 #include "Fw/Log/LogTextPortAc.hpp"
21 #if !FW_DIRECT_PORT_CALLS
23 #endif
24 #if !FW_DIRECT_PORT_CALLS
26 #endif
27 #include "Fw/Time/TimePortAc.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
45  friend class OsTimeTesterBase;
47  friend class OsTimeTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
58  };
59 
61  enum {
64  };
65 
67  enum {
73  };
74 
76  enum {
78  };
79 
81  enum {
83  };
84 
85  public:
86 
87  // ----------------------------------------------------------------------
88  // Component initialization
89  // ----------------------------------------------------------------------
90 
92  void init(
93  FwEnumStoreType instance = 0
94  );
95 
96 #if !FW_DIRECT_PORT_CALLS
97 
98  public:
99 
100  // ----------------------------------------------------------------------
101  // Getters for special input ports
102  // ----------------------------------------------------------------------
103 
108  FwIndexType portNum
109  );
110 
111 #endif
112 
113 #if !FW_DIRECT_PORT_CALLS
114 
115  public:
116 
117  // ----------------------------------------------------------------------
118  // Getters for typed input ports
119  // ----------------------------------------------------------------------
120 
125  FwIndexType portNum
126  );
127 
132  FwIndexType portNum
133  );
134 
135 #endif
136 
137 #if !FW_DIRECT_PORT_CALLS
138 
139  public:
140 
141  // ----------------------------------------------------------------------
142  // Connect input ports to special output ports
143  // ----------------------------------------------------------------------
144 
147  FwIndexType portNum,
148  Fw::InputCmdRegPort* port
149  );
150 
153  FwIndexType portNum,
155  );
156 
159  FwIndexType portNum,
160  Fw::InputLogPort* port
161  );
162 
163 #if FW_ENABLE_TEXT_LOGGING == 1
164 
166  void set_LogText_OutputPort(
167  FwIndexType portNum,
168  Fw::InputLogTextPort* port
169  );
170 
171 #endif
172 
175  FwIndexType portNum,
176  Fw::InputTimePort* port
177  );
178 
179 #endif
180 
181 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
182 
183  public:
184 
185  // ----------------------------------------------------------------------
186  // Connect serial input ports to special output ports
187  // ----------------------------------------------------------------------
188 
191  FwIndexType portNum,
192  Fw::InputSerializePort* port
193  );
194 
197  FwIndexType portNum,
198  Fw::InputSerializePort* port
199  );
200 
203  FwIndexType portNum,
204  Fw::InputSerializePort* port
205  );
206 
207 #if FW_ENABLE_TEXT_LOGGING == 1
208 
210  void set_LogText_OutputPort(
211  FwIndexType portNum,
212  Fw::InputSerializePort* port
213  );
214 
215 #endif
216 
219  FwIndexType portNum,
220  Fw::InputSerializePort* port
221  );
222 
223 #endif
224 
225  public:
226 
227  // ----------------------------------------------------------------------
228  // Command registration
229  // ----------------------------------------------------------------------
230 
234  void regCommands();
235 
236  protected:
237 
238  // ----------------------------------------------------------------------
239  // Component construction and destruction
240  // ----------------------------------------------------------------------
241 
244  const char* compName = ""
245  );
246 
248  virtual ~OsTimeComponentBase();
249 
250  protected:
251 
252  // ----------------------------------------------------------------------
253  // Getters for numbers of special input ports
254  // ----------------------------------------------------------------------
255 
261  }
262 
263  protected:
264 
265  // ----------------------------------------------------------------------
266  // Getters for numbers of typed input ports
267  // ----------------------------------------------------------------------
268 
274  }
275 
281  }
282 
283  protected:
284 
285  // ----------------------------------------------------------------------
286  // Getters for numbers of special output ports
287  // ----------------------------------------------------------------------
288 
294  }
295 
301  }
302 
308  }
309 
310 #if FW_ENABLE_TEXT_LOGGING == 1
311 
315  static constexpr FwIndexType getNum_LogText_OutputPorts() {
317  }
318 
319 #endif
320 
326  }
327 
328  protected:
329 
330  // ----------------------------------------------------------------------
331  // Connection status queries for special output ports
332  // ----------------------------------------------------------------------
333 
338  FwIndexType portNum
339  ) const;
340 
345  FwIndexType portNum
346  ) const;
347 
352  FwIndexType portNum
353  ) const;
354 
355 #if FW_ENABLE_TEXT_LOGGING == 1
356 
360  bool isConnected_LogText_OutputPort(
361  FwIndexType portNum
362  ) const;
363 
364 #endif
365 
370  FwIndexType portNum
371  ) const;
372 
373 #if FW_DIRECT_PORT_CALLS
374  public:
375 #else
376  protected:
377 #endif
378 
379  // ----------------------------------------------------------------------
380  // Port handler base-class functions for special input ports
381  //
382  // Call these functions directly to bypass the corresponding ports
383  // ----------------------------------------------------------------------
384 
386  void CmdDisp_handlerBase(
387  FwIndexType portNum,
388  FwOpcodeType opCode,
389  U32 cmdSeq,
390  Fw::CmdArgBuffer& args
391  );
392 
393  protected:
394 
395  // ----------------------------------------------------------------------
396  // Handlers to implement for typed input ports
397  // ----------------------------------------------------------------------
398 
400  virtual void setEpoch_handler(
401  FwIndexType portNum,
402  const Fw::Time& fw_time,
403  const Os::RawTime& os_time
404  ) = 0;
405 
407  virtual void timeGetPort_handler(
408  FwIndexType portNum,
409  Fw::Time& time
410  ) = 0;
411 
412 #if FW_DIRECT_PORT_CALLS
413  public:
414 #else
415  protected:
416 #endif
417 
418  // ----------------------------------------------------------------------
419  // Port handler base-class functions for typed input ports
420  //
421  // Call these functions directly to bypass the corresponding ports
422  // ----------------------------------------------------------------------
423 
426  FwIndexType portNum,
427  const Fw::Time& fw_time,
428  const Os::RawTime& os_time
429  );
430 
433  FwIndexType portNum,
434  Fw::Time& time
435  );
436 
437  protected:
438 
439  // ----------------------------------------------------------------------
440  // Command response
441  // ----------------------------------------------------------------------
442 
444  void cmdResponse_out(
445  FwOpcodeType opCode,
446  U32 cmdSeq,
447  Fw::CmdResponse response
448  );
449 
450  protected:
451 
452  // ----------------------------------------------------------------------
453  // Command handlers to implement
454  // ----------------------------------------------------------------------
455 
457  virtual void SetCurrentTime_cmdHandler(
458  FwOpcodeType opCode,
459  U32 cmdSeq,
460  U32 seconds_now
461  ) = 0;
462 
463  protected:
464 
465  // ----------------------------------------------------------------------
466  // Command handler base-class functions
467  //
468  // Call these functions directly to bypass the command input port
469  // ----------------------------------------------------------------------
470 
473  FwOpcodeType opCode,
474  U32 cmdSeq,
475  Fw::CmdArgBuffer& args
476  );
477 
478  protected:
479 
480  // ----------------------------------------------------------------------
481  // Event logging functions
482  // ----------------------------------------------------------------------
483 
488  U32 status
489  ) const;
490 
491  protected:
492 
493  // ----------------------------------------------------------------------
494  // Time
495  // ----------------------------------------------------------------------
496 
500  Fw::Time getTime() const;
501 
502  private:
503 
504  // ----------------------------------------------------------------------
505  // Calls for messages received on special input ports
506  // ----------------------------------------------------------------------
507 
509  static void m_p_CmdDisp_in(
510  Fw::PassiveComponentBase* callComp,
511  FwIndexType portNum,
512  FwOpcodeType opCode,
513  U32 cmdSeq,
514  Fw::CmdArgBuffer& args
515  );
516 
517  private:
518 
519  // ----------------------------------------------------------------------
520  // Calls for messages received on typed input ports
521  // ----------------------------------------------------------------------
522 
524  static void m_p_setEpoch_in(
525  Fw::PassiveComponentBase* callComp,
526  FwIndexType portNum,
527  const Fw::Time& fw_time,
528  const Os::RawTime& os_time
529  );
530 
532  static void m_p_timeGetPort_in(
533  Fw::PassiveComponentBase* callComp,
534  FwIndexType portNum,
535  Fw::Time& time
536  );
537 
538  private:
539 
540  // ----------------------------------------------------------------------
541  // Invocation functions for special output ports
542  // ----------------------------------------------------------------------
543 
545  void CmdReg_out(
546  FwIndexType portNum,
547  FwOpcodeType opCode
548  ) const;
549 
551  void CmdStatus_out(
552  FwIndexType portNum,
553  FwOpcodeType opCode,
554  U32 cmdSeq,
555  const Fw::CmdResponse& response
556  ) const;
557 
559  void EventOut_out(
560  FwIndexType portNum,
561  FwEventIdType id,
562  Fw::Time& timeTag,
563  const Fw::LogSeverity& severity,
564  Fw::LogBuffer& args
565  ) const;
566 
567 #if FW_ENABLE_TEXT_LOGGING
568 
570  void LogText_out(
571  FwIndexType portNum,
572  FwEventIdType id,
573  Fw::Time& timeTag,
574  const Fw::LogSeverity& severity,
575  Fw::TextLogString& text
576  ) const;
577 
578 #endif
579 
581  void timeCaller_out(
582  FwIndexType portNum,
583  Fw::Time& time
584  ) const;
585 
586 #if !FW_DIRECT_PORT_CALLS
587 
588  private:
589 
590  // ----------------------------------------------------------------------
591  // Special input ports
592  // ----------------------------------------------------------------------
593 
595  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
596 
597 #endif
598 
599 #if !FW_DIRECT_PORT_CALLS
600 
601  private:
602 
603  // ----------------------------------------------------------------------
604  // Typed input ports
605  // ----------------------------------------------------------------------
606 
609 
611  Fw::InputTimePort m_timeGetPort_InputPort[NUM_TIMEGETPORT_INPUT_PORTS];
612 
613 #endif
614 
615 #if !FW_DIRECT_PORT_CALLS
616 
617  private:
618 
619  // ----------------------------------------------------------------------
620  // Special output ports
621  // ----------------------------------------------------------------------
622 
624  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
625 
628 
630  Fw::OutputLogPort m_EventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
631 
632 #if FW_ENABLE_TEXT_LOGGING == 1
633 
635  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
636 
637 #endif
638 
640  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
641 
642 #endif
643 
644  };
645 
646 }
647 
648 #endif
static constexpr FwIndexType getNum_setEpoch_InputPorts()
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_EventOut_OutputPorts()
Svc::InputOsTimeEpochPort * get_setEpoch_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
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
void CmdDisp_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port CmdDisp.
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.
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIdType FwEventIdType
The type of an event identifier.
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.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
Enum representing event severity.
bool isConnected_EventOut_OutputPort(FwIndexType portNum) const
void timeGetPort_handlerBase(FwIndexType portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.
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.
An error occurred while attempting to set the current time.
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.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_CmdReg_OutputPorts()