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
23 #if !FW_DIRECT_PORT_CALLS
25 #endif
26 #if !FW_DIRECT_PORT_CALLS
28 #endif
29 #include "Fw/Time/TimePortAc.hpp"
31 
32 namespace Svc {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
47  friend class OsTimeTesterBase;
49  friend class OsTimeTester;
50 
51  protected:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
60  };
61 
63  enum {
66  };
67 
69  enum {
75  };
76 
78  enum {
80  };
81 
83  enum {
85  };
86 
87  public:
88 
89  // ----------------------------------------------------------------------
90  // Component initialization
91  // ----------------------------------------------------------------------
92 
94  void init(
95  FwEnumStoreType instance = 0
96  );
97 
98 #if !FW_DIRECT_PORT_CALLS
99 
100  public:
101 
102  // ----------------------------------------------------------------------
103  // Getters for special input ports
104  // ----------------------------------------------------------------------
105 
110  FwIndexType portNum
111  );
112 
113 #endif
114 
115 #if !FW_DIRECT_PORT_CALLS
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Getters for typed input ports
121  // ----------------------------------------------------------------------
122 
127  FwIndexType portNum
128  );
129 
134  FwIndexType portNum
135  );
136 
137 #endif
138 
139 #if !FW_DIRECT_PORT_CALLS
140 
141  public:
142 
143  // ----------------------------------------------------------------------
144  // Connect input ports to special output ports
145  // ----------------------------------------------------------------------
146 
149  FwIndexType portNum,
150  Fw::InputCmdRegPort* port
151  );
152 
155  FwIndexType portNum,
157  );
158 
161  FwIndexType portNum,
162  Fw::InputLogPort* port
163  );
164 
165 #if FW_ENABLE_TEXT_LOGGING == 1
166 
168  void set_LogText_OutputPort(
169  FwIndexType portNum,
170  Fw::InputLogTextPort* port
171  );
172 
173 #endif
174 
177  FwIndexType portNum,
178  Fw::InputTimePort* port
179  );
180 
181 #endif
182 
183 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
184 
185  public:
186 
187  // ----------------------------------------------------------------------
188  // Connect serial input ports to special output ports
189  // ----------------------------------------------------------------------
190 
193  FwIndexType portNum,
194  Fw::InputSerializePort* port
195  );
196 
199  FwIndexType portNum,
200  Fw::InputSerializePort* port
201  );
202 
205  FwIndexType portNum,
206  Fw::InputSerializePort* port
207  );
208 
209 #if FW_ENABLE_TEXT_LOGGING == 1
210 
212  void set_LogText_OutputPort(
213  FwIndexType portNum,
214  Fw::InputSerializePort* port
215  );
216 
217 #endif
218 
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
225 #endif
226 
227  public:
228 
229  // ----------------------------------------------------------------------
230  // Command registration
231  // ----------------------------------------------------------------------
232 
236  void regCommands();
237 
238  protected:
239 
240  // ----------------------------------------------------------------------
241  // Component construction and destruction
242  // ----------------------------------------------------------------------
243 
246  const char* compName = ""
247  );
248 
250  virtual ~OsTimeComponentBase();
251 
252  protected:
253 
254  // ----------------------------------------------------------------------
255  // Getters for numbers of special input ports
256  // ----------------------------------------------------------------------
257 
263  }
264 
265  protected:
266 
267  // ----------------------------------------------------------------------
268  // Getters for numbers of typed input ports
269  // ----------------------------------------------------------------------
270 
276  }
277 
283  }
284 
285  protected:
286 
287  // ----------------------------------------------------------------------
288  // Getters for numbers of special output ports
289  // ----------------------------------------------------------------------
290 
296  }
297 
303  }
304 
310  }
311 
312 #if FW_ENABLE_TEXT_LOGGING == 1
313 
317  static constexpr FwIndexType getNum_LogText_OutputPorts() {
319  }
320 
321 #endif
322 
328  }
329 
330  protected:
331 
332  // ----------------------------------------------------------------------
333  // Connection status queries for special output ports
334  // ----------------------------------------------------------------------
335 
340  FwIndexType portNum
341  ) const;
342 
347  FwIndexType portNum
348  ) const;
349 
354  FwIndexType portNum
355  ) const;
356 
357 #if FW_ENABLE_TEXT_LOGGING == 1
358 
362  bool isConnected_LogText_OutputPort(
363  FwIndexType portNum
364  ) const;
365 
366 #endif
367 
372  FwIndexType portNum
373  ) const;
374 
375 #if FW_DIRECT_PORT_CALLS
376  public:
377 #else
378  protected:
379 #endif
380 
381  // ----------------------------------------------------------------------
382  // Port handler base-class functions for special input ports
383  //
384  // Call these functions directly to bypass the corresponding ports
385  // ----------------------------------------------------------------------
386 
388  void CmdDisp_handlerBase(
389  FwIndexType portNum,
390  FwOpcodeType opCode,
391  U32 cmdSeq,
392  Fw::CmdArgBuffer& args
393  );
394 
395  protected:
396 
397  // ----------------------------------------------------------------------
398  // Handlers to implement for typed input ports
399  // ----------------------------------------------------------------------
400 
402  virtual void setEpoch_handler(
403  FwIndexType portNum,
404  const Fw::Time& fw_time,
405  const Os::RawTime& os_time
406  ) = 0;
407 
409  virtual void timeGetPort_handler(
410  FwIndexType portNum,
411  Fw::Time& time
412  ) = 0;
413 
414 #if FW_DIRECT_PORT_CALLS
415  public:
416 #else
417  protected:
418 #endif
419 
420  // ----------------------------------------------------------------------
421  // Port handler base-class functions for typed input ports
422  //
423  // Call these functions directly to bypass the corresponding ports
424  // ----------------------------------------------------------------------
425 
428  FwIndexType portNum,
429  const Fw::Time& fw_time,
430  const Os::RawTime& os_time
431  );
432 
435  FwIndexType portNum,
436  Fw::Time& time
437  );
438 
439  protected:
440 
441  // ----------------------------------------------------------------------
442  // Command response
443  // ----------------------------------------------------------------------
444 
446  void cmdResponse_out(
447  FwOpcodeType opCode,
448  U32 cmdSeq,
449  Fw::CmdResponse response
450  );
451 
452  protected:
453 
454  // ----------------------------------------------------------------------
455  // Command handlers to implement
456  // ----------------------------------------------------------------------
457 
459  virtual void SetCurrentTime_cmdHandler(
460  FwOpcodeType opCode,
461  U32 cmdSeq,
462  U32 seconds_now
463  ) = 0;
464 
465  protected:
466 
467  // ----------------------------------------------------------------------
468  // Command handler base-class functions
469  //
470  // Call these functions directly to bypass the command input port
471  // ----------------------------------------------------------------------
472 
475  FwOpcodeType opCode,
476  U32 cmdSeq,
477  Fw::CmdArgBuffer& args
478  );
479 
480  protected:
481 
482  // ----------------------------------------------------------------------
483  // Event logging functions
484  // ----------------------------------------------------------------------
485 
490  U32 status
491  ) const;
492 
493  protected:
494 
495  // ----------------------------------------------------------------------
496  // Time
497  // ----------------------------------------------------------------------
498 
502  Fw::Time getTime() const;
503 
504  private:
505 
506  // ----------------------------------------------------------------------
507  // Calls for messages received on special input ports
508  // ----------------------------------------------------------------------
509 
511  static void m_p_CmdDisp_in(
512  Fw::PassiveComponentBase* callComp,
513  FwIndexType portNum,
514  FwOpcodeType opCode,
515  U32 cmdSeq,
516  Fw::CmdArgBuffer& args
517  );
518 
519  private:
520 
521  // ----------------------------------------------------------------------
522  // Calls for messages received on typed input ports
523  // ----------------------------------------------------------------------
524 
526  static void m_p_setEpoch_in(
527  Fw::PassiveComponentBase* callComp,
528  FwIndexType portNum,
529  const Fw::Time& fw_time,
530  const Os::RawTime& os_time
531  );
532 
534  static void m_p_timeGetPort_in(
535  Fw::PassiveComponentBase* callComp,
536  FwIndexType portNum,
537  Fw::Time& time
538  );
539 
540  private:
541 
542  // ----------------------------------------------------------------------
543  // Invocation functions for special output ports
544  // ----------------------------------------------------------------------
545 
547  void CmdReg_out(
548  FwIndexType portNum,
549  FwOpcodeType opCode
550  ) const;
551 
553  void CmdStatus_out(
554  FwIndexType portNum,
555  FwOpcodeType opCode,
556  U32 cmdSeq,
557  const Fw::CmdResponse& response
558  ) const;
559 
561  void EventOut_out(
562  FwIndexType portNum,
563  FwEventIdType id,
564  Fw::Time& timeTag,
565  const Fw::LogSeverity& severity,
566  Fw::LogBuffer& args
567  ) const;
568 
569 #if FW_ENABLE_TEXT_LOGGING
570 
572  void LogText_out(
573  FwIndexType portNum,
574  FwEventIdType id,
575  Fw::Time& timeTag,
576  const Fw::LogSeverity& severity,
577  Fw::TextLogString& text
578  ) const;
579 
580 #endif
581 
583  void timeCaller_out(
584  FwIndexType portNum,
585  Fw::Time& time
586  ) const;
587 
588 #if !FW_DIRECT_PORT_CALLS
589 
590  private:
591 
592  // ----------------------------------------------------------------------
593  // Special input ports
594  // ----------------------------------------------------------------------
595 
597  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
598 
599 #endif
600 
601 #if !FW_DIRECT_PORT_CALLS
602 
603  private:
604 
605  // ----------------------------------------------------------------------
606  // Typed input ports
607  // ----------------------------------------------------------------------
608 
611 
613  Fw::InputTimePort m_timeGetPort_InputPort[NUM_TIMEGETPORT_INPUT_PORTS];
614 
615 #endif
616 
617 #if !FW_DIRECT_PORT_CALLS
618 
619  private:
620 
621  // ----------------------------------------------------------------------
622  // Special output ports
623  // ----------------------------------------------------------------------
624 
626  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
627 
630 
632  Fw::OutputLogPort m_EventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
633 
634 #if FW_ENABLE_TEXT_LOGGING == 1
635 
637  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
638 
639 #endif
640 
642  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
643 
644 #endif
645 
646  };
647 
648 }
649 
650 #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
An error occurred while attempting to set the current time.
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.
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()