F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
OsTimeComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title OsTimeComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for OsTime component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26 #if !FW_DIRECT_PORT_CALLS
27  // Connect input port CmdDisp
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
31  port++
32  ) {
33  this->m_CmdDisp_InputPort[port].init();
34  this->m_CmdDisp_InputPort[port].addCallComp(
35  this,
36  m_p_CmdDisp_in
37  );
38  this->m_CmdDisp_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51 
52 #if !FW_DIRECT_PORT_CALLS
53  // Connect input port setEpoch
54  for (
55  FwIndexType port = 0;
56  port < static_cast<FwIndexType>(this->getNum_setEpoch_InputPorts());
57  port++
58  ) {
59  this->m_setEpoch_InputPort[port].init();
60  this->m_setEpoch_InputPort[port].addCallComp(
61  this,
62  m_p_setEpoch_in
63  );
64  this->m_setEpoch_InputPort[port].setPortNum(port);
65 
66 #if FW_OBJECT_NAMES == 1
67  Fw::ObjectName portName;
68  portName.format(
69  "%s_setEpoch_InputPort[%" PRI_FwIndexType "]",
70  this->m_objName.toChar(),
71  port
72  );
73  this->m_setEpoch_InputPort[port].setObjName(portName.toChar());
74 #endif
75  }
76 #endif
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect input port timeGetPort
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_timeGetPort_InputPorts());
83  port++
84  ) {
85  this->m_timeGetPort_InputPort[port].init();
86  this->m_timeGetPort_InputPort[port].addCallComp(
87  this,
88  m_p_timeGetPort_in
89  );
90  this->m_timeGetPort_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  Fw::ObjectName portName;
94  portName.format(
95  "%s_timeGetPort_InputPort[%" PRI_FwIndexType "]",
96  this->m_objName.toChar(),
97  port
98  );
99  this->m_timeGetPort_InputPort[port].setObjName(portName.toChar());
100 #endif
101  }
102 #endif
103 
104 #if !FW_DIRECT_PORT_CALLS
105  // Connect output port CmdReg
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
109  port++
110  ) {
111  this->m_CmdReg_OutputPort[port].init();
112 
113 #if FW_OBJECT_NAMES == 1
114  Fw::ObjectName portName;
115  portName.format(
116  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
117  this->m_objName.toChar(),
118  port
119  );
120  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
121 #endif
122  }
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS
126  // Connect output port CmdStatus
127  for (
128  FwIndexType port = 0;
129  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
130  port++
131  ) {
132  this->m_CmdStatus_OutputPort[port].init();
133 
134 #if FW_OBJECT_NAMES == 1
135  Fw::ObjectName portName;
136  portName.format(
137  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
138  this->m_objName.toChar(),
139  port
140  );
141  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
142 #endif
143  }
144 #endif
145 
146 #if !FW_DIRECT_PORT_CALLS
147  // Connect output port EventOut
148  for (
149  FwIndexType port = 0;
150  port < static_cast<FwIndexType>(this->getNum_EventOut_OutputPorts());
151  port++
152  ) {
153  this->m_EventOut_OutputPort[port].init();
154 
155 #if FW_OBJECT_NAMES == 1
156  Fw::ObjectName portName;
157  portName.format(
158  "%s_EventOut_OutputPort[%" PRI_FwIndexType "]",
159  this->m_objName.toChar(),
160  port
161  );
162  this->m_EventOut_OutputPort[port].setObjName(portName.toChar());
163 #endif
164  }
165 #endif
166 
167 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
168  // Connect output port LogText
169  for (
170  FwIndexType port = 0;
171  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
172  port++
173  ) {
174  this->m_LogText_OutputPort[port].init();
175 
176 #if FW_OBJECT_NAMES == 1
177  Fw::ObjectName portName;
178  portName.format(
179  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
180  this->m_objName.toChar(),
181  port
182  );
183  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
184 #endif
185  }
186 #endif
187 
188 #if !FW_DIRECT_PORT_CALLS
189  // Connect output port timeCaller
190  for (
191  FwIndexType port = 0;
192  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
193  port++
194  ) {
195  this->m_timeCaller_OutputPort[port].init();
196 
197 #if FW_OBJECT_NAMES == 1
198  Fw::ObjectName portName;
199  portName.format(
200  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
201  this->m_objName.toChar(),
202  port
203  );
204  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
205 #endif
206  }
207 #endif
208  }
209 
210 #if !FW_DIRECT_PORT_CALLS
211 
212  // ----------------------------------------------------------------------
213  // Getters for special input ports
214  // ----------------------------------------------------------------------
215 
218  {
219  FW_ASSERT(
220  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
221  static_cast<FwAssertArgType>(portNum)
222  );
223 
224  return &this->m_CmdDisp_InputPort[portNum];
225  }
226 
227 #endif
228 
229 #if !FW_DIRECT_PORT_CALLS
230 
231  // ----------------------------------------------------------------------
232  // Getters for typed input ports
233  // ----------------------------------------------------------------------
234 
237  {
238  FW_ASSERT(
239  (0 <= portNum) && (portNum < this->getNum_setEpoch_InputPorts()),
240  static_cast<FwAssertArgType>(portNum)
241  );
242 
243  return &this->m_setEpoch_InputPort[portNum];
244  }
245 
248  {
249  FW_ASSERT(
250  (0 <= portNum) && (portNum < this->getNum_timeGetPort_InputPorts()),
251  static_cast<FwAssertArgType>(portNum)
252  );
253 
254  return &this->m_timeGetPort_InputPort[portNum];
255  }
256 
257 #endif
258 
259 #if !FW_DIRECT_PORT_CALLS
260 
261  // ----------------------------------------------------------------------
262  // Connect input ports to special output ports
263  // ----------------------------------------------------------------------
264 
267  FwIndexType portNum,
268  Fw::InputCmdRegPort* port
269  )
270  {
271  FW_ASSERT(
272  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
273  static_cast<FwAssertArgType>(portNum)
274  );
275 
276  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
277  }
278 
281  FwIndexType portNum,
283  )
284  {
285  FW_ASSERT(
286  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
287  static_cast<FwAssertArgType>(portNum)
288  );
289 
290  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
291  }
292 
295  FwIndexType portNum,
296  Fw::InputLogPort* port
297  )
298  {
299  FW_ASSERT(
300  (0 <= portNum) && (portNum < this->getNum_EventOut_OutputPorts()),
301  static_cast<FwAssertArgType>(portNum)
302  );
303 
304  this->m_EventOut_OutputPort[portNum].addCallPort(port);
305  }
306 
307 #if FW_ENABLE_TEXT_LOGGING == 1
308 
309  void OsTimeComponentBase ::
310  set_LogText_OutputPort(
311  FwIndexType portNum,
313  )
314  {
315  FW_ASSERT(
316  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
317  static_cast<FwAssertArgType>(portNum)
318  );
319 
320  this->m_LogText_OutputPort[portNum].addCallPort(port);
321  }
322 
323 #endif
324 
327  FwIndexType portNum,
328  Fw::InputTimePort* port
329  )
330  {
331  FW_ASSERT(
332  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
333  static_cast<FwAssertArgType>(portNum)
334  );
335 
336  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
337  }
338 
339 #endif
340 
341 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
342 
343  // ----------------------------------------------------------------------
344  // Connect serial input ports to special output ports
345  // ----------------------------------------------------------------------
346 
349  FwIndexType portNum,
350  Fw::InputSerializePort* port
351  )
352  {
353  FW_ASSERT(
354  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
355  static_cast<FwAssertArgType>(portNum)
356  );
357 
358  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
359  }
360 
363  FwIndexType portNum,
364  Fw::InputSerializePort* port
365  )
366  {
367  FW_ASSERT(
368  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
369  static_cast<FwAssertArgType>(portNum)
370  );
371 
372  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
373  }
374 
377  FwIndexType portNum,
378  Fw::InputSerializePort* port
379  )
380  {
381  FW_ASSERT(
382  (0 <= portNum) && (portNum < this->getNum_EventOut_OutputPorts()),
383  static_cast<FwAssertArgType>(portNum)
384  );
385 
386  this->m_EventOut_OutputPort[portNum].registerSerialPort(port);
387  }
388 
389 #if FW_ENABLE_TEXT_LOGGING == 1
390 
391  void OsTimeComponentBase ::
392  set_LogText_OutputPort(
393  FwIndexType portNum,
394  Fw::InputSerializePort* port
395  )
396  {
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
403  }
404 
405 #endif
406 
409  FwIndexType portNum,
410  Fw::InputSerializePort* port
411  )
412  {
413  FW_ASSERT(
414  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
415  static_cast<FwAssertArgType>(portNum)
416  );
417 
418  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
419  }
420 
421 #endif
422 
423  // ----------------------------------------------------------------------
424  // Command registration
425  // ----------------------------------------------------------------------
426 
429  {
431 
432  this->CmdReg_out(
433  0,
435  );
436  }
437 
438  // ----------------------------------------------------------------------
439  // Component construction and destruction
440  // ----------------------------------------------------------------------
441 
443  OsTimeComponentBase(const char* compName) :
444  Fw::PassiveComponentBase(compName)
445  {
446 
447  }
448 
451  {
452 
453  }
454 
455 #if !FW_DIRECT_PORT_CALLS
456 
457  // ----------------------------------------------------------------------
458  // Connection status queries for special output ports
459  // ----------------------------------------------------------------------
460 
463  {
464  FW_ASSERT(
465  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
466  static_cast<FwAssertArgType>(portNum)
467  );
468 
469  return this->m_CmdReg_OutputPort[portNum].isConnected();
470  }
471 
474  {
475  FW_ASSERT(
476  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  return this->m_CmdStatus_OutputPort[portNum].isConnected();
481  }
482 
485  {
486  FW_ASSERT(
487  (0 <= portNum) && (portNum < this->getNum_EventOut_OutputPorts()),
488  static_cast<FwAssertArgType>(portNum)
489  );
490 
491  return this->m_EventOut_OutputPort[portNum].isConnected();
492  }
493 
494 #if FW_ENABLE_TEXT_LOGGING == 1
495 
496  bool OsTimeComponentBase ::
497  isConnected_LogText_OutputPort(FwIndexType portNum) const
498  {
499  FW_ASSERT(
500  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
501  static_cast<FwAssertArgType>(portNum)
502  );
503 
504  return this->m_LogText_OutputPort[portNum].isConnected();
505  }
506 
507 #endif
508 
511  {
512  FW_ASSERT(
513  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
514  static_cast<FwAssertArgType>(portNum)
515  );
516 
517  return this->m_timeCaller_OutputPort[portNum].isConnected();
518  }
519 
520 #endif
521 
522  // ----------------------------------------------------------------------
523  // Port handler base-class functions for special input ports
524  //
525  // Call these functions directly to bypass the corresponding ports
526  // ----------------------------------------------------------------------
527 
530  FwIndexType portNum,
531  FwOpcodeType opCode,
532  U32 cmdSeq,
533  Fw::CmdArgBuffer& args
534  )
535  {
536 
537  const U32 idBase = this->getIdBase();
538  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
539 
540  // Select base class function based on opcode
541  switch (opCode - idBase) {
542  case OPCODE_SETCURRENTTIME: {
544  opCode,
545  cmdSeq,
546  args
547  );
548  break;
549  }
550  default:
551  // Unknown opcode: ignore it
552  break;
553  }
554  }
555 
556  // ----------------------------------------------------------------------
557  // Port handler base-class functions for typed input ports
558  //
559  // Call these functions directly to bypass the corresponding ports
560  // ----------------------------------------------------------------------
561 
564  FwIndexType portNum,
565  const Fw::Time& fw_time,
566  const Os::RawTime& os_time
567  )
568  {
569  // Make sure port number is valid
570  FW_ASSERT(
571  (0 <= portNum) && (portNum < this->getNum_setEpoch_InputPorts()),
572  static_cast<FwAssertArgType>(portNum)
573  );
574 
575  // Call handler function
576  this->setEpoch_handler(
577  portNum,
578  fw_time,
579  os_time
580  );
581  }
582 
585  FwIndexType portNum,
586  Fw::Time& time
587  )
588  {
589  // Make sure port number is valid
590  FW_ASSERT(
591  (0 <= portNum) && (portNum < this->getNum_timeGetPort_InputPorts()),
592  static_cast<FwAssertArgType>(portNum)
593  );
594 
595  // Call handler function
596  this->timeGetPort_handler(
597  portNum,
598  time
599  );
600  }
601 
602  // ----------------------------------------------------------------------
603  // Command response
604  // ----------------------------------------------------------------------
605 
608  FwOpcodeType opCode,
609  U32 cmdSeq,
610  Fw::CmdResponse response
611  )
612  {
614  this->CmdStatus_out(0, opCode, cmdSeq, response);
615  }
616 
617  // ----------------------------------------------------------------------
618  // Command handler base-class functions
619  //
620  // Call these functions directly to bypass the command input port
621  // ----------------------------------------------------------------------
622 
625  FwOpcodeType opCode,
626  U32 cmdSeq,
627  Fw::CmdArgBuffer& args
628  )
629  {
630  // Deserialize the arguments
632 
633  // Reset the buffer
634  args.resetDeser();
635 
636  U32 seconds_now;
637  _status = args.deserializeTo(seconds_now);
638  if (_status != Fw::FW_SERIALIZE_OK) {
639  if (this->isConnected_CmdStatus_OutputPort(0)) {
640  this->CmdStatus_out(
641  0,
642  opCode,
643  cmdSeq,
645  );
646  }
647  return;
648  }
649 
650 #if FW_CMD_CHECK_RESIDUAL
651  // Make sure there was no data left over.
652  // That means the argument buffer size was incorrect.
653  if (args.getDeserializeSizeLeft() != 0) {
654  if (this->isConnected_CmdStatus_OutputPort(0)) {
655  this->CmdStatus_out(
656  0,
657  opCode,
658  cmdSeq,
660  );
661  }
662  return;
663  }
664 #endif
665 
667  opCode, cmdSeq,
668  seconds_now
669  );
670  }
671 
672  // ----------------------------------------------------------------------
673  // Event logging functions
674  // ----------------------------------------------------------------------
675 
678  {
679  // Get the time
680  Fw::Time _logTime;
681  if (this->isConnected_timeCaller_OutputPort(0)) {
682  this->timeCaller_out(0, _logTime);
683  }
684 
686 
687  // Emit the event on the log port
688  if (this->isConnected_EventOut_OutputPort(0)) {
689  Fw::LogBuffer _logBuff;
691 
692 #if FW_AMPCS_COMPATIBLE
693  // Serialize the number of arguments
694  _status = _logBuff.serializeFrom(static_cast<U8>(1));
695  FW_ASSERT(
696  _status == Fw::FW_SERIALIZE_OK,
697  static_cast<FwAssertArgType>(_status)
698  );
699 #endif
700 
701 #if FW_AMPCS_COMPATIBLE
702  // Serialize the argument size
703  _status = _logBuff.serializeFrom(
704  static_cast<U8>(sizeof(U32))
705  );
706  FW_ASSERT(
707  _status == Fw::FW_SERIALIZE_OK,
708  static_cast<FwAssertArgType>(_status)
709  );
710 #endif
711  _status = _logBuff.serializeFrom(status);
712  FW_ASSERT(
713  _status == Fw::FW_SERIALIZE_OK,
714  static_cast<FwAssertArgType>(_status)
715  );
716 
717  this->EventOut_out(
718  0,
719  _id,
720  _logTime,
722  _logBuff
723  );
724  }
725 
726  // Emit the event on the text log port
727 #if FW_ENABLE_TEXT_LOGGING
728  if (this->isConnected_LogText_OutputPort(0)) {
729 #if FW_OBJECT_NAMES == 1
730  const char* _formatString =
731  "(%s) %s: Could not set current time due to RawTime error status %" PRIu32 "";
732 #else
733  const char* _formatString =
734  "%s: Could not set current time due to RawTime error status %" PRIu32 "";
735 #endif
736 
737  Fw::TextLogString _logString;
738  _logString.format(
739  _formatString,
740 #if FW_OBJECT_NAMES == 1
741  this->m_objName.toChar(),
742 #endif
743  "SetCurrentTimeError ",
744  status
745  );
746 
747  this->LogText_out(
748  0,
749  _id,
750  _logTime,
752  _logString
753  );
754  }
755 #endif
756  }
757 
758  // ----------------------------------------------------------------------
759  // Time
760  // ----------------------------------------------------------------------
761 
763  getTime() const
764  {
765  if (this->isConnected_timeCaller_OutputPort(0)) {
766  Fw::Time _time;
767  this->timeCaller_out(0, _time);
768  return _time;
769  }
770  else {
771  return Fw::Time(TimeBase::TB_NONE, 0, 0);
772  }
773  }
774 
775  // ----------------------------------------------------------------------
776  // Calls for messages received on special input ports
777  // ----------------------------------------------------------------------
778 
779  void OsTimeComponentBase ::
780  m_p_CmdDisp_in(
781  Fw::PassiveComponentBase* callComp,
782  FwIndexType portNum,
783  FwOpcodeType opCode,
784  U32 cmdSeq,
785  Fw::CmdArgBuffer& args
786  )
787  {
788  FW_ASSERT(callComp);
789  OsTimeComponentBase* compPtr = static_cast<OsTimeComponentBase*>(callComp);
790  compPtr->CmdDisp_handlerBase(
791  portNum,
792  opCode,
793  cmdSeq,
794  args
795  );
796  }
797 
798  // ----------------------------------------------------------------------
799  // Calls for messages received on typed input ports
800  // ----------------------------------------------------------------------
801 
802  void OsTimeComponentBase ::
803  m_p_setEpoch_in(
804  Fw::PassiveComponentBase* callComp,
805  FwIndexType portNum,
806  const Fw::Time& fw_time,
807  const Os::RawTime& os_time
808  )
809  {
810  FW_ASSERT(callComp);
811  OsTimeComponentBase* compPtr = static_cast<OsTimeComponentBase*>(callComp);
812  compPtr->setEpoch_handlerBase(
813  portNum,
814  fw_time,
815  os_time
816  );
817  }
818 
819  void OsTimeComponentBase ::
820  m_p_timeGetPort_in(
821  Fw::PassiveComponentBase* callComp,
822  FwIndexType portNum,
823  Fw::Time& time
824  )
825  {
826  FW_ASSERT(callComp);
827  OsTimeComponentBase* compPtr = static_cast<OsTimeComponentBase*>(callComp);
828  compPtr->timeGetPort_handlerBase(
829  portNum,
830  time
831  );
832  }
833 
834 #if !FW_DIRECT_PORT_CALLS
835 
836  // ----------------------------------------------------------------------
837  // Invocation functions for special output ports
838  // ----------------------------------------------------------------------
839 
840  void OsTimeComponentBase ::
841  CmdReg_out(
842  FwIndexType portNum,
843  FwOpcodeType opCode
844  ) const
845  {
846  FW_ASSERT(
847  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
848  static_cast<FwAssertArgType>(portNum)
849  );
850 
851  FW_ASSERT(
852  this->m_CmdReg_OutputPort[portNum].isConnected(),
853  static_cast<FwAssertArgType>(portNum)
854  );
855  this->m_CmdReg_OutputPort[portNum].invoke(
856  opCode
857  );
858  }
859 
860  void OsTimeComponentBase ::
861  CmdStatus_out(
862  FwIndexType portNum,
863  FwOpcodeType opCode,
864  U32 cmdSeq,
865  const Fw::CmdResponse& response
866  ) const
867  {
868  FW_ASSERT(
869  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
870  static_cast<FwAssertArgType>(portNum)
871  );
872 
873  FW_ASSERT(
874  this->m_CmdStatus_OutputPort[portNum].isConnected(),
875  static_cast<FwAssertArgType>(portNum)
876  );
877  this->m_CmdStatus_OutputPort[portNum].invoke(
878  opCode,
879  cmdSeq,
880  response
881  );
882  }
883 
884  void OsTimeComponentBase ::
885  EventOut_out(
886  FwIndexType portNum,
887  FwEventIdType id,
888  Fw::Time& timeTag,
889  const Fw::LogSeverity& severity,
890  Fw::LogBuffer& args
891  ) const
892  {
893  FW_ASSERT(
894  (0 <= portNum) && (portNum < this->getNum_EventOut_OutputPorts()),
895  static_cast<FwAssertArgType>(portNum)
896  );
897 
898  FW_ASSERT(
899  this->m_EventOut_OutputPort[portNum].isConnected(),
900  static_cast<FwAssertArgType>(portNum)
901  );
902  this->m_EventOut_OutputPort[portNum].invoke(
903  id,
904  timeTag,
905  severity,
906  args
907  );
908  }
909 
910 #if FW_ENABLE_TEXT_LOGGING
911 
912  void OsTimeComponentBase ::
913  LogText_out(
914  FwIndexType portNum,
915  FwEventIdType id,
916  Fw::Time& timeTag,
917  const Fw::LogSeverity& severity,
918  Fw::TextLogString& text
919  ) const
920  {
921  FW_ASSERT(
922  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
923  static_cast<FwAssertArgType>(portNum)
924  );
925 
926  FW_ASSERT(
927  this->m_LogText_OutputPort[portNum].isConnected(),
928  static_cast<FwAssertArgType>(portNum)
929  );
930  this->m_LogText_OutputPort[portNum].invoke(
931  id,
932  timeTag,
933  severity,
934  text
935  );
936  }
937 
938 #endif
939 
940  void OsTimeComponentBase ::
941  timeCaller_out(
942  FwIndexType portNum,
943  Fw::Time& time
944  ) const
945  {
946  FW_ASSERT(
947  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
948  static_cast<FwAssertArgType>(portNum)
949  );
950 
951  FW_ASSERT(
952  this->m_timeCaller_OutputPort[portNum].isConnected(),
953  static_cast<FwAssertArgType>(portNum)
954  );
955  this->m_timeCaller_OutputPort[portNum].invoke(
956  time
957  );
958  }
959 
960 #endif
961 
962 }
static constexpr FwIndexType getNum_setEpoch_InputPorts()
Serialization/Deserialization operation was successful.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
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.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void init()
Initialization function.
Definition: TimePortAc.cpp:73
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].
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
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.
No time base has been established (Required)
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 addCallPort(InputCmdRegPort *callPort)
Register an input port.
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
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.
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
static constexpr FwIndexType getNum_timeGetPort_InputPorts()
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void SetCurrentTime_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Base-class handler function for command SetCurrentTime.
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void init()
Initialization function.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
A serious but recoverable event.
bool isConnected() const
Definition: PortBase.cpp:38
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
Enum representing event severity.
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
bool isConnected_EventOut_OutputPort(FwIndexType portNum) const
void timeGetPort_handlerBase(FwIndexType portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.
void setPortNum(FwIndexType portNum)
Command failed to deserialize.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
Auto-generated base for OsTime component.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TimePortAc.cpp:79
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
PlatformIndexType FwIndexType
void set_EventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to EventOut[portNum].
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
virtual ~OsTimeComponentBase()
Destroy OsTimeComponentBase object.
void init()
Initialization function.
RateGroupDivider component implementation.
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
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.
Implementation of malloc based allocator.
void init()
Initialization function.
OsTimeComponentBase(const char *compName="")
Construct OsTimeComponentBase object.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum) const
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
static constexpr FwIndexType getNum_CmdReg_OutputPorts()