F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
VersionComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title VersionComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Version 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 cmdIn
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
31  port++
32  ) {
33  this->m_cmdIn_InputPort[port].init();
34  this->m_cmdIn_InputPort[port].addCallComp(
35  this,
36  m_p_cmdIn_in
37  );
38  this->m_cmdIn_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51 
52 #if !FW_DIRECT_PORT_CALLS
53  // Connect input port getVersion
54  for (
55  FwIndexType port = 0;
56  port < static_cast<FwIndexType>(this->getNum_getVersion_InputPorts());
57  port++
58  ) {
59  this->m_getVersion_InputPort[port].init();
60  this->m_getVersion_InputPort[port].addCallComp(
61  this,
62  m_p_getVersion_in
63  );
64  this->m_getVersion_InputPort[port].setPortNum(port);
65 
66 #if FW_OBJECT_NAMES == 1
67  Fw::ObjectName portName;
68  portName.format(
69  "%s_getVersion_InputPort[%" PRI_FwIndexType "]",
70  this->m_objName.toChar(),
71  port
72  );
73  this->m_getVersion_InputPort[port].setObjName(portName.toChar());
74 #endif
75  }
76 #endif
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect input port setVersion
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_setVersion_InputPorts());
83  port++
84  ) {
85  this->m_setVersion_InputPort[port].init();
86  this->m_setVersion_InputPort[port].addCallComp(
87  this,
88  m_p_setVersion_in
89  );
90  this->m_setVersion_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  Fw::ObjectName portName;
94  portName.format(
95  "%s_setVersion_InputPort[%" PRI_FwIndexType "]",
96  this->m_objName.toChar(),
97  port
98  );
99  this->m_setVersion_InputPort[port].setObjName(portName.toChar());
100 #endif
101  }
102 #endif
103 
104 #if !FW_DIRECT_PORT_CALLS
105  // Connect output port cmdRegOut
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
109  port++
110  ) {
111  this->m_cmdRegOut_OutputPort[port].init();
112 
113 #if FW_OBJECT_NAMES == 1
114  Fw::ObjectName portName;
115  portName.format(
116  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
117  this->m_objName.toChar(),
118  port
119  );
120  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
121 #endif
122  }
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS
126  // Connect output port cmdResponseOut
127  for (
128  FwIndexType port = 0;
129  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
130  port++
131  ) {
132  this->m_cmdResponseOut_OutputPort[port].init();
133 
134 #if FW_OBJECT_NAMES == 1
135  Fw::ObjectName portName;
136  portName.format(
137  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
138  this->m_objName.toChar(),
139  port
140  );
141  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
142 #endif
143  }
144 #endif
145 
146 #if !FW_DIRECT_PORT_CALLS
147  // Connect output port logOut
148  for (
149  FwIndexType port = 0;
150  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
151  port++
152  ) {
153  this->m_logOut_OutputPort[port].init();
154 
155 #if FW_OBJECT_NAMES == 1
156  Fw::ObjectName portName;
157  portName.format(
158  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
159  this->m_objName.toChar(),
160  port
161  );
162  this->m_logOut_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 logTextOut
169  for (
170  FwIndexType port = 0;
171  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
172  port++
173  ) {
174  this->m_logTextOut_OutputPort[port].init();
175 
176 #if FW_OBJECT_NAMES == 1
177  Fw::ObjectName portName;
178  portName.format(
179  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
180  this->m_objName.toChar(),
181  port
182  );
183  this->m_logTextOut_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 #if !FW_DIRECT_PORT_CALLS
210  // Connect output port tlmOut
211  for (
212  FwIndexType port = 0;
213  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
214  port++
215  ) {
216  this->m_tlmOut_OutputPort[port].init();
217 
218 #if FW_OBJECT_NAMES == 1
219  Fw::ObjectName portName;
220  portName.format(
221  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
222  this->m_objName.toChar(),
223  port
224  );
225  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
226 #endif
227  }
228 #endif
229  }
230 
231 #if !FW_DIRECT_PORT_CALLS
232 
233  // ----------------------------------------------------------------------
234  // Getters for special input ports
235  // ----------------------------------------------------------------------
236 
239  {
240  FW_ASSERT(
241  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
242  static_cast<FwAssertArgType>(portNum)
243  );
244 
245  return &this->m_cmdIn_InputPort[portNum];
246  }
247 
248 #endif
249 
250 #if !FW_DIRECT_PORT_CALLS
251 
252  // ----------------------------------------------------------------------
253  // Getters for typed input ports
254  // ----------------------------------------------------------------------
255 
258  {
259  FW_ASSERT(
260  (0 <= portNum) && (portNum < this->getNum_getVersion_InputPorts()),
261  static_cast<FwAssertArgType>(portNum)
262  );
263 
264  return &this->m_getVersion_InputPort[portNum];
265  }
266 
269  {
270  FW_ASSERT(
271  (0 <= portNum) && (portNum < this->getNum_setVersion_InputPorts()),
272  static_cast<FwAssertArgType>(portNum)
273  );
274 
275  return &this->m_setVersion_InputPort[portNum];
276  }
277 
278 #endif
279 
280 #if !FW_DIRECT_PORT_CALLS
281 
282  // ----------------------------------------------------------------------
283  // Connect input ports to special output ports
284  // ----------------------------------------------------------------------
285 
288  FwIndexType portNum,
289  Fw::InputCmdRegPort* port
290  )
291  {
292  FW_ASSERT(
293  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
294  static_cast<FwAssertArgType>(portNum)
295  );
296 
297  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
298  }
299 
302  FwIndexType portNum,
304  )
305  {
306  FW_ASSERT(
307  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
308  static_cast<FwAssertArgType>(portNum)
309  );
310 
311  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
312  }
313 
316  FwIndexType portNum,
317  Fw::InputLogPort* port
318  )
319  {
320  FW_ASSERT(
321  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
322  static_cast<FwAssertArgType>(portNum)
323  );
324 
325  this->m_logOut_OutputPort[portNum].addCallPort(port);
326  }
327 
328 #if FW_ENABLE_TEXT_LOGGING == 1
329 
330  void VersionComponentBase ::
331  set_logTextOut_OutputPort(
332  FwIndexType portNum,
334  )
335  {
336  FW_ASSERT(
337  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
338  static_cast<FwAssertArgType>(portNum)
339  );
340 
341  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
342  }
343 
344 #endif
345 
348  FwIndexType portNum,
349  Fw::InputTimePort* port
350  )
351  {
352  FW_ASSERT(
353  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
354  static_cast<FwAssertArgType>(portNum)
355  );
356 
357  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
358  }
359 
362  FwIndexType portNum,
363  Fw::InputTlmPort* port
364  )
365  {
366  FW_ASSERT(
367  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
368  static_cast<FwAssertArgType>(portNum)
369  );
370 
371  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
372  }
373 
374 #endif
375 
376 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
377 
378  // ----------------------------------------------------------------------
379  // Connect serial input ports to special output ports
380  // ----------------------------------------------------------------------
381 
384  FwIndexType portNum,
385  Fw::InputSerializePort* port
386  )
387  {
388  FW_ASSERT(
389  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
390  static_cast<FwAssertArgType>(portNum)
391  );
392 
393  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
394  }
395 
398  FwIndexType portNum,
399  Fw::InputSerializePort* port
400  )
401  {
402  FW_ASSERT(
403  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
404  static_cast<FwAssertArgType>(portNum)
405  );
406 
407  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
408  }
409 
412  FwIndexType portNum,
413  Fw::InputSerializePort* port
414  )
415  {
416  FW_ASSERT(
417  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
418  static_cast<FwAssertArgType>(portNum)
419  );
420 
421  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
422  }
423 
424 #if FW_ENABLE_TEXT_LOGGING == 1
425 
426  void VersionComponentBase ::
427  set_logTextOut_OutputPort(
428  FwIndexType portNum,
429  Fw::InputSerializePort* port
430  )
431  {
432  FW_ASSERT(
433  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
434  static_cast<FwAssertArgType>(portNum)
435  );
436 
437  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
438  }
439 
440 #endif
441 
444  FwIndexType portNum,
445  Fw::InputSerializePort* port
446  )
447  {
448  FW_ASSERT(
449  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
450  static_cast<FwAssertArgType>(portNum)
451  );
452 
453  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
454  }
455 
458  FwIndexType portNum,
459  Fw::InputSerializePort* port
460  )
461  {
462  FW_ASSERT(
463  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
464  static_cast<FwAssertArgType>(portNum)
465  );
466 
467  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
468  }
469 
470 #endif
471 
472  // ----------------------------------------------------------------------
473  // Command registration
474  // ----------------------------------------------------------------------
475 
478  {
480 
481  this->cmdRegOut_out(
482  0,
483  this->getIdBase() + OPCODE_ENABLE
484  );
485 
486  this->cmdRegOut_out(
487  0,
488  this->getIdBase() + OPCODE_VERSION
489  );
490  }
491 
492  // ----------------------------------------------------------------------
493  // Component construction and destruction
494  // ----------------------------------------------------------------------
495 
497  VersionComponentBase(const char* compName) :
498  Fw::PassiveComponentBase(compName)
499  {
500 
501  }
502 
505  {
506 
507  }
508 
509 #if !FW_DIRECT_PORT_CALLS
510 
511  // ----------------------------------------------------------------------
512  // Connection status queries for special output ports
513  // ----------------------------------------------------------------------
514 
517  {
518  FW_ASSERT(
519  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
520  static_cast<FwAssertArgType>(portNum)
521  );
522 
523  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
524  }
525 
528  {
529  FW_ASSERT(
530  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
531  static_cast<FwAssertArgType>(portNum)
532  );
533 
534  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
535  }
536 
539  {
540  FW_ASSERT(
541  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
542  static_cast<FwAssertArgType>(portNum)
543  );
544 
545  return this->m_logOut_OutputPort[portNum].isConnected();
546  }
547 
548 #if FW_ENABLE_TEXT_LOGGING == 1
549 
550  bool VersionComponentBase ::
551  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
552  {
553  FW_ASSERT(
554  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
555  static_cast<FwAssertArgType>(portNum)
556  );
557 
558  return this->m_logTextOut_OutputPort[portNum].isConnected();
559  }
560 
561 #endif
562 
565  {
566  FW_ASSERT(
567  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
568  static_cast<FwAssertArgType>(portNum)
569  );
570 
571  return this->m_timeCaller_OutputPort[portNum].isConnected();
572  }
573 
576  {
577  FW_ASSERT(
578  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
579  static_cast<FwAssertArgType>(portNum)
580  );
581 
582  return this->m_tlmOut_OutputPort[portNum].isConnected();
583  }
584 
585 #endif
586 
587  // ----------------------------------------------------------------------
588  // Port handler base-class functions for special input ports
589  //
590  // Call these functions directly to bypass the corresponding ports
591  // ----------------------------------------------------------------------
592 
595  FwIndexType portNum,
596  FwOpcodeType opCode,
597  U32 cmdSeq,
598  Fw::CmdArgBuffer& args
599  )
600  {
601 
602  const U32 idBase = this->getIdBase();
603  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
604 
605  // Select base class function based on opcode
606  switch (opCode - idBase) {
607  case OPCODE_ENABLE: {
608  this->ENABLE_cmdHandlerBase(
609  opCode,
610  cmdSeq,
611  args
612  );
613  break;
614  }
615 
616  case OPCODE_VERSION: {
618  opCode,
619  cmdSeq,
620  args
621  );
622  break;
623  }
624  default:
625  // Unknown opcode: ignore it
626  break;
627  }
628  }
629 
630  // ----------------------------------------------------------------------
631  // Port handler base-class functions for typed input ports
632  //
633  // Call these functions directly to bypass the corresponding ports
634  // ----------------------------------------------------------------------
635 
638  FwIndexType portNum,
639  const Svc::VersionCfg::VersionEnum& version_id,
640  Fw::StringBase& version_string,
641  Svc::VersionStatus& status
642  )
643  {
644  // Make sure port number is valid
645  FW_ASSERT(
646  (0 <= portNum) && (portNum < this->getNum_getVersion_InputPorts()),
647  static_cast<FwAssertArgType>(portNum)
648  );
649 
650  // Lock guard mutex before calling
651  this->lock();
652 
653  // Call handler function
654  this->getVersion_handler(
655  portNum,
656  version_id,
657  version_string,
658  status
659  );
660 
661  // Unlock guard mutex
662  this->unLock();
663  }
664 
667  FwIndexType portNum,
668  const Svc::VersionCfg::VersionEnum& version_id,
669  Fw::StringBase& version_string,
670  Svc::VersionStatus& status
671  )
672  {
673  // Make sure port number is valid
674  FW_ASSERT(
675  (0 <= portNum) && (portNum < this->getNum_setVersion_InputPorts()),
676  static_cast<FwAssertArgType>(portNum)
677  );
678 
679  // Lock guard mutex before calling
680  this->lock();
681 
682  // Call handler function
683  this->setVersion_handler(
684  portNum,
685  version_id,
686  version_string,
687  status
688  );
689 
690  // Unlock guard mutex
691  this->unLock();
692  }
693 
694  // ----------------------------------------------------------------------
695  // Command response
696  // ----------------------------------------------------------------------
697 
700  FwOpcodeType opCode,
701  U32 cmdSeq,
702  Fw::CmdResponse response
703  )
704  {
706  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
707  }
708 
709  // ----------------------------------------------------------------------
710  // Command handler base-class functions
711  //
712  // Call these functions directly to bypass the command input port
713  // ----------------------------------------------------------------------
714 
717  FwOpcodeType opCode,
718  U32 cmdSeq,
719  Fw::CmdArgBuffer& args
720  )
721  {
722  // Deserialize the arguments
724 
725  // Reset the buffer
726  args.resetDeser();
727 
728  Svc::VersionEnabled enable;
729  _status = args.deserializeTo(enable);
730  if (_status != Fw::FW_SERIALIZE_OK) {
732  this->cmdResponseOut_out(
733  0,
734  opCode,
735  cmdSeq,
737  );
738  }
739  return;
740  }
741 
742 #if FW_CMD_CHECK_RESIDUAL
743  // Make sure there was no data left over.
744  // That means the argument buffer size was incorrect.
745  if (args.getDeserializeSizeLeft() != 0) {
747  this->cmdResponseOut_out(
748  0,
749  opCode,
750  cmdSeq,
752  );
753  }
754  return;
755  }
756 #endif
757 
758  this->lock();
759 
760  this->ENABLE_cmdHandler(
761  opCode, cmdSeq,
762  enable
763  );
764 
765  this->unLock();
766  }
767 
770  FwOpcodeType opCode,
771  U32 cmdSeq,
772  Fw::CmdArgBuffer& args
773  )
774  {
775  // Deserialize the arguments
777 
778  // Reset the buffer
779  args.resetDeser();
780 
781  Svc::VersionType version_type;
782  _status = args.deserializeTo(version_type);
783  if (_status != Fw::FW_SERIALIZE_OK) {
785  this->cmdResponseOut_out(
786  0,
787  opCode,
788  cmdSeq,
790  );
791  }
792  return;
793  }
794 
795 #if FW_CMD_CHECK_RESIDUAL
796  // Make sure there was no data left over.
797  // That means the argument buffer size was incorrect.
798  if (args.getDeserializeSizeLeft() != 0) {
800  this->cmdResponseOut_out(
801  0,
802  opCode,
803  cmdSeq,
805  );
806  }
807  return;
808  }
809 #endif
810 
811  this->lock();
812 
813  this->VERSION_cmdHandler(
814  opCode, cmdSeq,
815  version_type
816  );
817 
818  this->unLock();
819  }
820 
821  // ----------------------------------------------------------------------
822  // Event logging functions
823  // ----------------------------------------------------------------------
824 
827  {
828  // Get the time
829  Fw::Time _logTime;
830  if (this->isConnected_timeCaller_OutputPort(0)) {
831  this->timeCaller_out(0, _logTime);
832  }
833 
834  const FwEventIdType _id = this->getIdBase() + EVENTID_FRAMEWORKVERSION;
835 
836  // Emit the event on the log port
837  if (this->isConnected_logOut_OutputPort(0)) {
838  Fw::LogBuffer _logBuff;
840 
841 #if FW_AMPCS_COMPATIBLE
842  // Serialize the number of arguments
843  _status = _logBuff.serializeFrom(static_cast<U8>(1));
844  FW_ASSERT(
845  _status == Fw::FW_SERIALIZE_OK,
846  static_cast<FwAssertArgType>(_status)
847  );
848 #endif
849 
850  _status = version.serializeTo(
851  _logBuff,
852  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
853  );
854  FW_ASSERT(
855  _status == Fw::FW_SERIALIZE_OK,
856  static_cast<FwAssertArgType>(_status)
857  );
858 
859  this->logOut_out(
860  0,
861  _id,
862  _logTime,
864  _logBuff
865  );
866  }
867 
868  // Emit the event on the text log port
869 #if FW_ENABLE_TEXT_LOGGING
870  if (this->isConnected_logTextOut_OutputPort(0)) {
871 #if FW_OBJECT_NAMES == 1
872  const char* _formatString =
873  "(%s) %s: Framework Version: [%s]";
874 #else
875  const char* _formatString =
876  "%s: Framework Version: [%s]";
877 #endif
878 
879  Fw::TextLogString _logString;
880  _logString.format(
881  _formatString,
882 #if FW_OBJECT_NAMES == 1
883  this->m_objName.toChar(),
884 #endif
885  "FrameworkVersion ",
886  version.toChar()
887  );
888 
889  this->logTextOut_out(
890  0,
891  _id,
892  _logTime,
894  _logString
895  );
896  }
897 #endif
898  }
899 
902  {
903  // Get the time
904  Fw::Time _logTime;
905  if (this->isConnected_timeCaller_OutputPort(0)) {
906  this->timeCaller_out(0, _logTime);
907  }
908 
909  const FwEventIdType _id = this->getIdBase() + EVENTID_PROJECTVERSION;
910 
911  // Emit the event on the log port
912  if (this->isConnected_logOut_OutputPort(0)) {
913  Fw::LogBuffer _logBuff;
915 
916 #if FW_AMPCS_COMPATIBLE
917  // Serialize the number of arguments
918  _status = _logBuff.serializeFrom(static_cast<U8>(1));
919  FW_ASSERT(
920  _status == Fw::FW_SERIALIZE_OK,
921  static_cast<FwAssertArgType>(_status)
922  );
923 #endif
924 
925  _status = version.serializeTo(
926  _logBuff,
927  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
928  );
929  FW_ASSERT(
930  _status == Fw::FW_SERIALIZE_OK,
931  static_cast<FwAssertArgType>(_status)
932  );
933 
934  this->logOut_out(
935  0,
936  _id,
937  _logTime,
939  _logBuff
940  );
941  }
942 
943  // Emit the event on the text log port
944 #if FW_ENABLE_TEXT_LOGGING
945  if (this->isConnected_logTextOut_OutputPort(0)) {
946 #if FW_OBJECT_NAMES == 1
947  const char* _formatString =
948  "(%s) %s: Project Version: [%s]";
949 #else
950  const char* _formatString =
951  "%s: Project Version: [%s]";
952 #endif
953 
954  Fw::TextLogString _logString;
955  _logString.format(
956  _formatString,
957 #if FW_OBJECT_NAMES == 1
958  this->m_objName.toChar(),
959 #endif
960  "ProjectVersion ",
961  version.toChar()
962  );
963 
964  this->logTextOut_out(
965  0,
966  _id,
967  _logTime,
969  _logString
970  );
971  }
972 #endif
973  }
974 
977  {
978  // Get the time
979  Fw::Time _logTime;
980  if (this->isConnected_timeCaller_OutputPort(0)) {
981  this->timeCaller_out(0, _logTime);
982  }
983 
984  const FwEventIdType _id = this->getIdBase() + EVENTID_LIBRARYVERSIONS;
985 
986  // Emit the event on the log port
987  if (this->isConnected_logOut_OutputPort(0)) {
988  Fw::LogBuffer _logBuff;
990 
991 #if FW_AMPCS_COMPATIBLE
992  // Serialize the number of arguments
993  _status = _logBuff.serializeFrom(static_cast<U8>(1));
994  FW_ASSERT(
995  _status == Fw::FW_SERIALIZE_OK,
996  static_cast<FwAssertArgType>(_status)
997  );
998 #endif
999 
1000  _status = version.serializeTo(
1001  _logBuff,
1002  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1003  );
1004  FW_ASSERT(
1005  _status == Fw::FW_SERIALIZE_OK,
1006  static_cast<FwAssertArgType>(_status)
1007  );
1008 
1009  this->logOut_out(
1010  0,
1011  _id,
1012  _logTime,
1014  _logBuff
1015  );
1016  }
1017 
1018  // Emit the event on the text log port
1019 #if FW_ENABLE_TEXT_LOGGING
1020  if (this->isConnected_logTextOut_OutputPort(0)) {
1021 #if FW_OBJECT_NAMES == 1
1022  const char* _formatString =
1023  "(%s) %s: Library Versions: [%s]";
1024 #else
1025  const char* _formatString =
1026  "%s: Library Versions: [%s]";
1027 #endif
1028 
1029  Fw::TextLogString _logString;
1030  _logString.format(
1031  _formatString,
1032 #if FW_OBJECT_NAMES == 1
1033  this->m_objName.toChar(),
1034 #endif
1035  "LibraryVersions ",
1036  version.toChar()
1037  );
1038 
1039  this->logTextOut_out(
1040  0,
1041  _id,
1042  _logTime,
1044  _logString
1045  );
1046  }
1047 #endif
1048  }
1049 
1052  Svc::VersionCfg::VersionEnum version_enum,
1053  const Fw::StringBase& version_value
1054  ) const
1055  {
1056  // Get the time
1057  Fw::Time _logTime;
1058  if (this->isConnected_timeCaller_OutputPort(0)) {
1059  this->timeCaller_out(0, _logTime);
1060  }
1061 
1062  const FwEventIdType _id = this->getIdBase() + EVENTID_CUSTOMVERSIONS;
1063 
1064  // Emit the event on the log port
1065  if (this->isConnected_logOut_OutputPort(0)) {
1066  Fw::LogBuffer _logBuff;
1068 
1069 #if FW_AMPCS_COMPATIBLE
1070  // Serialize the number of arguments
1071  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1072  FW_ASSERT(
1073  _status == Fw::FW_SERIALIZE_OK,
1074  static_cast<FwAssertArgType>(_status)
1075  );
1076 #endif
1077 
1078 #if FW_AMPCS_COMPATIBLE
1079  // Serialize the argument size
1080  _status = _logBuff.serializeFrom(
1082  );
1083  FW_ASSERT(
1084  _status == Fw::FW_SERIALIZE_OK,
1085  static_cast<FwAssertArgType>(_status)
1086  );
1087 #endif
1088  _status = _logBuff.serializeFrom(version_enum);
1089  FW_ASSERT(
1090  _status == Fw::FW_SERIALIZE_OK,
1091  static_cast<FwAssertArgType>(_status)
1092  );
1093 
1094  _status = version_value.serializeTo(
1095  _logBuff,
1096  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1097  );
1098  FW_ASSERT(
1099  _status == Fw::FW_SERIALIZE_OK,
1100  static_cast<FwAssertArgType>(_status)
1101  );
1102 
1103  this->logOut_out(
1104  0,
1105  _id,
1106  _logTime,
1108  _logBuff
1109  );
1110  }
1111 
1112  // Emit the event on the text log port
1113 #if FW_ENABLE_TEXT_LOGGING
1114  if (this->isConnected_logTextOut_OutputPort(0)) {
1115 #if FW_OBJECT_NAMES == 1
1116  const char* _formatString =
1117  "(%s) %s: Custom Versions: [%s] [%s]";
1118 #else
1119  const char* _formatString =
1120  "%s: Custom Versions: [%s] [%s]";
1121 #endif
1122 
1123  Fw::String version_enumStr;
1124  version_enum.toString(version_enumStr);
1125 
1126  Fw::TextLogString _logString;
1127  _logString.format(
1128  _formatString,
1129 #if FW_OBJECT_NAMES == 1
1130  this->m_objName.toChar(),
1131 #endif
1132  "CustomVersions ",
1133  version_enumStr.toChar(),
1134  version_value.toChar()
1135  );
1136 
1137  this->logTextOut_out(
1138  0,
1139  _id,
1140  _logTime,
1142  _logString
1143  );
1144  }
1145 #endif
1146  }
1147 
1148  // ----------------------------------------------------------------------
1149  // Telemetry serialized write
1150  // ----------------------------------------------------------------------
1151 
1154  FwChanIdType id,
1155  Fw::TlmBuffer& _tlmBuff,
1156  Fw::Time _tlmTime
1157  ) const
1158  {
1159  if (this->isConnected_tlmOut_OutputPort(0)) {
1160  if (
1162  (_tlmTime == Fw::ZERO_TIME)
1163  ) {
1164  this->timeCaller_out(0, _tlmTime);
1165  }
1166 
1167  FwChanIdType _id;
1168  _id = this->getIdBase() + id;
1169 
1170  this->tlmOut_out(
1171  0,
1172  _id,
1173  _tlmTime,
1174  _tlmBuff
1175  );
1176  }
1177  }
1178 
1179  // ----------------------------------------------------------------------
1180  // Telemetry write functions
1181  // ----------------------------------------------------------------------
1182 
1185  const Fw::StringBase& arg,
1186  Fw::Time _tlmTime
1187  ) const
1188  {
1189  if (this->isConnected_tlmOut_OutputPort(0)) {
1190  Fw::TlmBuffer _tlmBuff;
1191  Fw::SerializeStatus _stat = arg.serializeTo(
1192  _tlmBuff,
1193  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1194  );
1195  FW_ASSERT(
1196  _stat == Fw::FW_SERIALIZE_OK,
1197  static_cast<FwAssertArgType>(_stat)
1198  );
1199 
1200  this->tlmWrite(
1202  _tlmBuff,
1203  _tlmTime
1204  );
1205  }
1206  }
1207 
1210  const Fw::StringBase& arg,
1211  Fw::Time _tlmTime
1212  ) const
1213  {
1214  if (this->isConnected_tlmOut_OutputPort(0)) {
1215  Fw::TlmBuffer _tlmBuff;
1216  Fw::SerializeStatus _stat = arg.serializeTo(
1217  _tlmBuff,
1218  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1219  );
1220  FW_ASSERT(
1221  _stat == Fw::FW_SERIALIZE_OK,
1222  static_cast<FwAssertArgType>(_stat)
1223  );
1224 
1225  this->tlmWrite(
1227  _tlmBuff,
1228  _tlmTime
1229  );
1230  }
1231  }
1232 
1235  const Svc::CustomVersionDb& arg,
1236  Fw::Time _tlmTime
1237  ) const
1238  {
1239  if (this->isConnected_tlmOut_OutputPort(0)) {
1240  Fw::TlmBuffer _tlmBuff;
1241  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1242  FW_ASSERT(
1243  _stat == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_stat)
1245  );
1246 
1247  this->tlmWrite(
1249  _tlmBuff,
1250  _tlmTime
1251  );
1252  }
1253  }
1254 
1257  const Svc::CustomVersionDb& arg,
1258  Fw::Time _tlmTime
1259  ) const
1260  {
1261  if (this->isConnected_tlmOut_OutputPort(0)) {
1262  Fw::TlmBuffer _tlmBuff;
1263  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1264  FW_ASSERT(
1265  _stat == Fw::FW_SERIALIZE_OK,
1266  static_cast<FwAssertArgType>(_stat)
1267  );
1268 
1269  this->tlmWrite(
1271  _tlmBuff,
1272  _tlmTime
1273  );
1274  }
1275  }
1276 
1279  const Svc::CustomVersionDb& arg,
1280  Fw::Time _tlmTime
1281  ) const
1282  {
1283  if (this->isConnected_tlmOut_OutputPort(0)) {
1284  Fw::TlmBuffer _tlmBuff;
1285  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1286  FW_ASSERT(
1287  _stat == Fw::FW_SERIALIZE_OK,
1288  static_cast<FwAssertArgType>(_stat)
1289  );
1290 
1291  this->tlmWrite(
1293  _tlmBuff,
1294  _tlmTime
1295  );
1296  }
1297  }
1298 
1301  const Svc::CustomVersionDb& arg,
1302  Fw::Time _tlmTime
1303  ) const
1304  {
1305  if (this->isConnected_tlmOut_OutputPort(0)) {
1306  Fw::TlmBuffer _tlmBuff;
1307  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1308  FW_ASSERT(
1309  _stat == Fw::FW_SERIALIZE_OK,
1310  static_cast<FwAssertArgType>(_stat)
1311  );
1312 
1313  this->tlmWrite(
1315  _tlmBuff,
1316  _tlmTime
1317  );
1318  }
1319  }
1320 
1323  const Svc::CustomVersionDb& arg,
1324  Fw::Time _tlmTime
1325  ) const
1326  {
1327  if (this->isConnected_tlmOut_OutputPort(0)) {
1328  Fw::TlmBuffer _tlmBuff;
1329  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1330  FW_ASSERT(
1331  _stat == Fw::FW_SERIALIZE_OK,
1332  static_cast<FwAssertArgType>(_stat)
1333  );
1334 
1335  this->tlmWrite(
1337  _tlmBuff,
1338  _tlmTime
1339  );
1340  }
1341  }
1342 
1345  const Svc::CustomVersionDb& arg,
1346  Fw::Time _tlmTime
1347  ) const
1348  {
1349  if (this->isConnected_tlmOut_OutputPort(0)) {
1350  Fw::TlmBuffer _tlmBuff;
1351  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1352  FW_ASSERT(
1353  _stat == Fw::FW_SERIALIZE_OK,
1354  static_cast<FwAssertArgType>(_stat)
1355  );
1356 
1357  this->tlmWrite(
1359  _tlmBuff,
1360  _tlmTime
1361  );
1362  }
1363  }
1364 
1367  const Svc::CustomVersionDb& arg,
1368  Fw::Time _tlmTime
1369  ) const
1370  {
1371  if (this->isConnected_tlmOut_OutputPort(0)) {
1372  Fw::TlmBuffer _tlmBuff;
1373  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1374  FW_ASSERT(
1375  _stat == Fw::FW_SERIALIZE_OK,
1376  static_cast<FwAssertArgType>(_stat)
1377  );
1378 
1379  this->tlmWrite(
1381  _tlmBuff,
1382  _tlmTime
1383  );
1384  }
1385  }
1386 
1389  const Svc::CustomVersionDb& arg,
1390  Fw::Time _tlmTime
1391  ) const
1392  {
1393  if (this->isConnected_tlmOut_OutputPort(0)) {
1394  Fw::TlmBuffer _tlmBuff;
1395  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1396  FW_ASSERT(
1397  _stat == Fw::FW_SERIALIZE_OK,
1398  static_cast<FwAssertArgType>(_stat)
1399  );
1400 
1401  this->tlmWrite(
1403  _tlmBuff,
1404  _tlmTime
1405  );
1406  }
1407  }
1408 
1411  const Svc::CustomVersionDb& arg,
1412  Fw::Time _tlmTime
1413  ) const
1414  {
1415  if (this->isConnected_tlmOut_OutputPort(0)) {
1416  Fw::TlmBuffer _tlmBuff;
1417  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1418  FW_ASSERT(
1419  _stat == Fw::FW_SERIALIZE_OK,
1420  static_cast<FwAssertArgType>(_stat)
1421  );
1422 
1423  this->tlmWrite(
1425  _tlmBuff,
1426  _tlmTime
1427  );
1428  }
1429  }
1430 
1433  const Svc::CustomVersionDb& arg,
1434  Fw::Time _tlmTime
1435  ) const
1436  {
1437  if (this->isConnected_tlmOut_OutputPort(0)) {
1438  Fw::TlmBuffer _tlmBuff;
1439  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1440  FW_ASSERT(
1441  _stat == Fw::FW_SERIALIZE_OK,
1442  static_cast<FwAssertArgType>(_stat)
1443  );
1444 
1445  this->tlmWrite(
1447  _tlmBuff,
1448  _tlmTime
1449  );
1450  }
1451  }
1452 
1455  const Fw::StringBase& arg,
1456  Fw::Time _tlmTime
1457  ) const
1458  {
1459  if (this->isConnected_tlmOut_OutputPort(0)) {
1460  Fw::TlmBuffer _tlmBuff;
1461  Fw::SerializeStatus _stat = arg.serializeTo(
1462  _tlmBuff,
1463  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1464  );
1465  FW_ASSERT(
1466  _stat == Fw::FW_SERIALIZE_OK,
1467  static_cast<FwAssertArgType>(_stat)
1468  );
1469 
1470  this->tlmWrite(
1472  _tlmBuff,
1473  _tlmTime
1474  );
1475  }
1476  }
1477 
1480  const Fw::StringBase& arg,
1481  Fw::Time _tlmTime
1482  ) const
1483  {
1484  if (this->isConnected_tlmOut_OutputPort(0)) {
1485  Fw::TlmBuffer _tlmBuff;
1486  Fw::SerializeStatus _stat = arg.serializeTo(
1487  _tlmBuff,
1488  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1489  );
1490  FW_ASSERT(
1491  _stat == Fw::FW_SERIALIZE_OK,
1492  static_cast<FwAssertArgType>(_stat)
1493  );
1494 
1495  this->tlmWrite(
1497  _tlmBuff,
1498  _tlmTime
1499  );
1500  }
1501  }
1502 
1505  const Fw::StringBase& arg,
1506  Fw::Time _tlmTime
1507  ) const
1508  {
1509  if (this->isConnected_tlmOut_OutputPort(0)) {
1510  Fw::TlmBuffer _tlmBuff;
1511  Fw::SerializeStatus _stat = arg.serializeTo(
1512  _tlmBuff,
1513  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1514  );
1515  FW_ASSERT(
1516  _stat == Fw::FW_SERIALIZE_OK,
1517  static_cast<FwAssertArgType>(_stat)
1518  );
1519 
1520  this->tlmWrite(
1522  _tlmBuff,
1523  _tlmTime
1524  );
1525  }
1526  }
1527 
1530  const Fw::StringBase& arg,
1531  Fw::Time _tlmTime
1532  ) const
1533  {
1534  if (this->isConnected_tlmOut_OutputPort(0)) {
1535  Fw::TlmBuffer _tlmBuff;
1536  Fw::SerializeStatus _stat = arg.serializeTo(
1537  _tlmBuff,
1538  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1539  );
1540  FW_ASSERT(
1541  _stat == Fw::FW_SERIALIZE_OK,
1542  static_cast<FwAssertArgType>(_stat)
1543  );
1544 
1545  this->tlmWrite(
1547  _tlmBuff,
1548  _tlmTime
1549  );
1550  }
1551  }
1552 
1555  const Fw::StringBase& arg,
1556  Fw::Time _tlmTime
1557  ) const
1558  {
1559  if (this->isConnected_tlmOut_OutputPort(0)) {
1560  Fw::TlmBuffer _tlmBuff;
1561  Fw::SerializeStatus _stat = arg.serializeTo(
1562  _tlmBuff,
1563  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1564  );
1565  FW_ASSERT(
1566  _stat == Fw::FW_SERIALIZE_OK,
1567  static_cast<FwAssertArgType>(_stat)
1568  );
1569 
1570  this->tlmWrite(
1572  _tlmBuff,
1573  _tlmTime
1574  );
1575  }
1576  }
1577 
1580  const Fw::StringBase& arg,
1581  Fw::Time _tlmTime
1582  ) const
1583  {
1584  if (this->isConnected_tlmOut_OutputPort(0)) {
1585  Fw::TlmBuffer _tlmBuff;
1586  Fw::SerializeStatus _stat = arg.serializeTo(
1587  _tlmBuff,
1588  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1589  );
1590  FW_ASSERT(
1591  _stat == Fw::FW_SERIALIZE_OK,
1592  static_cast<FwAssertArgType>(_stat)
1593  );
1594 
1595  this->tlmWrite(
1597  _tlmBuff,
1598  _tlmTime
1599  );
1600  }
1601  }
1602 
1605  const Fw::StringBase& arg,
1606  Fw::Time _tlmTime
1607  ) const
1608  {
1609  if (this->isConnected_tlmOut_OutputPort(0)) {
1610  Fw::TlmBuffer _tlmBuff;
1611  Fw::SerializeStatus _stat = arg.serializeTo(
1612  _tlmBuff,
1613  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1614  );
1615  FW_ASSERT(
1616  _stat == Fw::FW_SERIALIZE_OK,
1617  static_cast<FwAssertArgType>(_stat)
1618  );
1619 
1620  this->tlmWrite(
1622  _tlmBuff,
1623  _tlmTime
1624  );
1625  }
1626  }
1627 
1630  const Fw::StringBase& arg,
1631  Fw::Time _tlmTime
1632  ) const
1633  {
1634  if (this->isConnected_tlmOut_OutputPort(0)) {
1635  Fw::TlmBuffer _tlmBuff;
1636  Fw::SerializeStatus _stat = arg.serializeTo(
1637  _tlmBuff,
1638  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1639  );
1640  FW_ASSERT(
1641  _stat == Fw::FW_SERIALIZE_OK,
1642  static_cast<FwAssertArgType>(_stat)
1643  );
1644 
1645  this->tlmWrite(
1647  _tlmBuff,
1648  _tlmTime
1649  );
1650  }
1651  }
1652 
1655  const Fw::StringBase& arg,
1656  Fw::Time _tlmTime
1657  ) const
1658  {
1659  if (this->isConnected_tlmOut_OutputPort(0)) {
1660  Fw::TlmBuffer _tlmBuff;
1661  Fw::SerializeStatus _stat = arg.serializeTo(
1662  _tlmBuff,
1663  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1664  );
1665  FW_ASSERT(
1666  _stat == Fw::FW_SERIALIZE_OK,
1667  static_cast<FwAssertArgType>(_stat)
1668  );
1669 
1670  this->tlmWrite(
1672  _tlmBuff,
1673  _tlmTime
1674  );
1675  }
1676  }
1677 
1680  const Fw::StringBase& arg,
1681  Fw::Time _tlmTime
1682  ) const
1683  {
1684  if (this->isConnected_tlmOut_OutputPort(0)) {
1685  Fw::TlmBuffer _tlmBuff;
1686  Fw::SerializeStatus _stat = arg.serializeTo(
1687  _tlmBuff,
1688  FW_MIN(static_cast<FwSizeType>(FW_TLM_STRING_MAX_SIZE), 40)
1689  );
1690  FW_ASSERT(
1691  _stat == Fw::FW_SERIALIZE_OK,
1692  static_cast<FwAssertArgType>(_stat)
1693  );
1694 
1695  this->tlmWrite(
1697  _tlmBuff,
1698  _tlmTime
1699  );
1700  }
1701  }
1702 
1703  // ----------------------------------------------------------------------
1704  // Time
1705  // ----------------------------------------------------------------------
1706 
1708  getTime() const
1709  {
1710  if (this->isConnected_timeCaller_OutputPort(0)) {
1711  Fw::Time _time;
1712  this->timeCaller_out(0, _time);
1713  return _time;
1714  }
1715  else {
1716  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1717  }
1718  }
1719 
1720  // ----------------------------------------------------------------------
1721  // Mutex operations for guarded ports
1722  //
1723  // You can override these operations to provide more sophisticated
1724  // synchronization
1725  // ----------------------------------------------------------------------
1726 
1729  {
1730  this->m_guardedPortMutex.lock();
1731  }
1732 
1735  {
1736  this->m_guardedPortMutex.unLock();
1737  }
1738 
1739  // ----------------------------------------------------------------------
1740  // Calls for messages received on special input ports
1741  // ----------------------------------------------------------------------
1742 
1743  void VersionComponentBase ::
1744  m_p_cmdIn_in(
1745  Fw::PassiveComponentBase* callComp,
1746  FwIndexType portNum,
1747  FwOpcodeType opCode,
1748  U32 cmdSeq,
1749  Fw::CmdArgBuffer& args
1750  )
1751  {
1752  FW_ASSERT(callComp);
1753  VersionComponentBase* compPtr = static_cast<VersionComponentBase*>(callComp);
1754  compPtr->cmdIn_handlerBase(
1755  portNum,
1756  opCode,
1757  cmdSeq,
1758  args
1759  );
1760  }
1761 
1762  // ----------------------------------------------------------------------
1763  // Calls for messages received on typed input ports
1764  // ----------------------------------------------------------------------
1765 
1766  void VersionComponentBase ::
1767  m_p_getVersion_in(
1768  Fw::PassiveComponentBase* callComp,
1769  FwIndexType portNum,
1770  const Svc::VersionCfg::VersionEnum& version_id,
1771  Fw::StringBase& version_string,
1772  Svc::VersionStatus& status
1773  )
1774  {
1775  FW_ASSERT(callComp);
1776  VersionComponentBase* compPtr = static_cast<VersionComponentBase*>(callComp);
1777  compPtr->getVersion_handlerBase(
1778  portNum,
1779  version_id,
1780  version_string,
1781  status
1782  );
1783  }
1784 
1785  void VersionComponentBase ::
1786  m_p_setVersion_in(
1787  Fw::PassiveComponentBase* callComp,
1788  FwIndexType portNum,
1789  const Svc::VersionCfg::VersionEnum& version_id,
1790  Fw::StringBase& version_string,
1791  Svc::VersionStatus& status
1792  )
1793  {
1794  FW_ASSERT(callComp);
1795  VersionComponentBase* compPtr = static_cast<VersionComponentBase*>(callComp);
1796  compPtr->setVersion_handlerBase(
1797  portNum,
1798  version_id,
1799  version_string,
1800  status
1801  );
1802  }
1803 
1804 #if !FW_DIRECT_PORT_CALLS
1805 
1806  // ----------------------------------------------------------------------
1807  // Invocation functions for special output ports
1808  // ----------------------------------------------------------------------
1809 
1810  void VersionComponentBase ::
1811  cmdRegOut_out(
1812  FwIndexType portNum,
1813  FwOpcodeType opCode
1814  ) const
1815  {
1816  FW_ASSERT(
1817  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
1818  static_cast<FwAssertArgType>(portNum)
1819  );
1820 
1821  FW_ASSERT(
1822  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
1823  static_cast<FwAssertArgType>(portNum)
1824  );
1825  this->m_cmdRegOut_OutputPort[portNum].invoke(
1826  opCode
1827  );
1828  }
1829 
1830  void VersionComponentBase ::
1831  cmdResponseOut_out(
1832  FwIndexType portNum,
1833  FwOpcodeType opCode,
1834  U32 cmdSeq,
1835  const Fw::CmdResponse& response
1836  ) const
1837  {
1838  FW_ASSERT(
1839  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
1840  static_cast<FwAssertArgType>(portNum)
1841  );
1842 
1843  FW_ASSERT(
1844  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
1845  static_cast<FwAssertArgType>(portNum)
1846  );
1847  this->m_cmdResponseOut_OutputPort[portNum].invoke(
1848  opCode,
1849  cmdSeq,
1850  response
1851  );
1852  }
1853 
1854  void VersionComponentBase ::
1855  logOut_out(
1856  FwIndexType portNum,
1857  FwEventIdType id,
1858  Fw::Time& timeTag,
1859  const Fw::LogSeverity& severity,
1860  Fw::LogBuffer& args
1861  ) const
1862  {
1863  FW_ASSERT(
1864  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1865  static_cast<FwAssertArgType>(portNum)
1866  );
1867 
1868  FW_ASSERT(
1869  this->m_logOut_OutputPort[portNum].isConnected(),
1870  static_cast<FwAssertArgType>(portNum)
1871  );
1872  this->m_logOut_OutputPort[portNum].invoke(
1873  id,
1874  timeTag,
1875  severity,
1876  args
1877  );
1878  }
1879 
1880 #if FW_ENABLE_TEXT_LOGGING
1881 
1882  void VersionComponentBase ::
1883  logTextOut_out(
1884  FwIndexType portNum,
1885  FwEventIdType id,
1886  Fw::Time& timeTag,
1887  const Fw::LogSeverity& severity,
1888  Fw::TextLogString& text
1889  ) const
1890  {
1891  FW_ASSERT(
1892  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1893  static_cast<FwAssertArgType>(portNum)
1894  );
1895 
1896  FW_ASSERT(
1897  this->m_logTextOut_OutputPort[portNum].isConnected(),
1898  static_cast<FwAssertArgType>(portNum)
1899  );
1900  this->m_logTextOut_OutputPort[portNum].invoke(
1901  id,
1902  timeTag,
1903  severity,
1904  text
1905  );
1906  }
1907 
1908 #endif
1909 
1910  void VersionComponentBase ::
1911  timeCaller_out(
1912  FwIndexType portNum,
1913  Fw::Time& time
1914  ) const
1915  {
1916  FW_ASSERT(
1917  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1918  static_cast<FwAssertArgType>(portNum)
1919  );
1920 
1921  FW_ASSERT(
1922  this->m_timeCaller_OutputPort[portNum].isConnected(),
1923  static_cast<FwAssertArgType>(portNum)
1924  );
1925  this->m_timeCaller_OutputPort[portNum].invoke(
1926  time
1927  );
1928  }
1929 
1930  void VersionComponentBase ::
1931  tlmOut_out(
1932  FwIndexType portNum,
1933  FwChanIdType id,
1934  Fw::Time& timeTag,
1935  Fw::TlmBuffer& val
1936  ) const
1937  {
1938  FW_ASSERT(
1939  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
1940  static_cast<FwAssertArgType>(portNum)
1941  );
1942 
1943  FW_ASSERT(
1944  this->m_tlmOut_OutputPort[portNum].isConnected(),
1945  static_cast<FwAssertArgType>(portNum)
1946  );
1947  this->m_tlmOut_OutputPort[portNum].invoke(
1948  id,
1949  timeTag,
1950  val
1951  );
1952  }
1953 
1954 #endif
1955 
1956 }
Serialization/Deserialization operation was successful.
void tlmWrite_LibraryVersion10(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion10.
void tlmWrite_CustomVersion07(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion07.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void tlmWrite_LibraryVersion04(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion04.
void regCommands()
Register commands with the Command Dispatcher.
FwIdType FwOpcodeType
The type of a command opcode.
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_LibraryVersion01(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
virtual void getVersion_handler(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)=0
Handler for input port getVersion.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
void tlmWrite_CustomVersion02(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion02.
I32 FwEnumStoreType
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
void tlmWrite_CustomVersion10(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion10.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void tlmWrite_LibraryVersion06(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion06.
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
static constexpr FwIndexType getNum_cmdIn_InputPorts()
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
virtual void setVersion_handler(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)=0
Handler for input port setVersion.
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void tlmWrite_CustomVersion03(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion03.
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
A command to enable or disable Event verbosity and Telemetry.
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
const Time ZERO_TIME
Definition: Time.cpp:5
void VERSION_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
virtual void unLock()
Unlock the guarded mutex.
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
void tlmWrite_LibraryVersion03(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion03.
Enum representing a command response.
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_getVersion_InputPorts()
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::VersionEnabled enable)=0
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
void tlmWrite_LibraryVersion08(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion08.
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void init()
Object initializer.
Definition: ObjBase.cpp:24
virtual ~VersionComponentBase()
Destroy VersionComponentBase object.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
void setVersion_handlerBase(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)
Handler base-class function for input port setVersion.
void tlmWrite_CustomVersion05(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion05.
FwIdType FwEventIdType
The type of an event identifier.
Auto-generated base for Version component.
void log_ACTIVITY_LO_ProjectVersion(const Fw::StringBase &version) const
An enumeration for version status.
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
Svc::InputVersionPort * get_getVersion_InputPort(FwIndexType portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Less important informational events.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:94
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
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.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
void tlmWrite_LibraryVersion05(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion05.
Svc::InputVersionPort * get_setVersion_InputPort(FwIndexType portNum)
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
void getVersion_handlerBase(FwIndexType portNum, const Svc::VersionCfg::VersionEnum &version_id, Fw::StringBase &version_string, Svc::VersionStatus &status)
Handler base-class function for input port getVersion.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
Data Structure for custom version Tlm.
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void setPortNum(FwIndexType portNum)
The size of the serial representation.
virtual void lock()
Lock the guarded mutex.
Command failed to deserialize.
void log_ACTIVITY_LO_CustomVersions(Svc::VersionCfg::VersionEnum version_enum, const Fw::StringBase &version_value) const
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
void tlmWrite_CustomVersion09(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion09.
PlatformIndexType FwIndexType
void tlmWrite_CustomVersion06(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion06.
void tlmWrite_LibraryVersion07(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion07.
static constexpr FwIndexType getNum_logOut_OutputPorts()
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
void init()
Initialization function.
RateGroupDivider component implementation.
An enumeration for Version Type.
void tlmWrite_LibraryVersion02(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion02.
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void init()
Initialization function.
void tlmWrite_CustomVersion04(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion04.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
void tlmWrite_CustomVersion01(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Implementation of malloc based allocator.
void log_ACTIVITY_LO_FrameworkVersion(const Fw::StringBase &version) const
VersionComponentBase(const char *compName="")
Construct VersionComponentBase object.
void init()
Initialization function.
void log_ACTIVITY_LO_LibraryVersions(const Fw::StringBase &version) const
Tracks versions for project, framework and user defined versions etc.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void tlmWrite_CustomVersion08(const Svc::CustomVersionDb &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel CustomVersion08.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
void tlmWrite_LibraryVersion09(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
Write telemetry channel LibraryVersion09.
static constexpr FwIndexType getNum_setVersion_InputPorts()
void tlmWrite_FrameworkVersion(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
virtual void VERSION_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::VersionType version_type)=0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.
void tlmWrite_ProjectVersion(const Fw::StringBase &arg, Fw::Time _tlmTime=Fw::Time()) const