F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FprimeRouterComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FprimeRouterComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FprimeRouter 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 cmdResponseIn
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_cmdResponseIn_InputPorts());
31  port++
32  ) {
33  this->m_cmdResponseIn_InputPort[port].init();
34  this->m_cmdResponseIn_InputPort[port].addCallComp(
35  this,
36  m_p_cmdResponseIn_in
37  );
38  this->m_cmdResponseIn_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_cmdResponseIn_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_cmdResponseIn_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51 
52 #if !FW_DIRECT_PORT_CALLS
53  // Connect input port dataIn
54  for (
55  FwIndexType port = 0;
56  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
57  port++
58  ) {
59  this->m_dataIn_InputPort[port].init();
60  this->m_dataIn_InputPort[port].addCallComp(
61  this,
62  m_p_dataIn_in
63  );
64  this->m_dataIn_InputPort[port].setPortNum(port);
65 
66 #if FW_OBJECT_NAMES == 1
67  Fw::ObjectName portName;
68  portName.format(
69  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
70  this->m_objName.toChar(),
71  port
72  );
73  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
74 #endif
75  }
76 #endif
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect input port fileBufferReturnIn
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_fileBufferReturnIn_InputPorts());
83  port++
84  ) {
85  this->m_fileBufferReturnIn_InputPort[port].init();
86  this->m_fileBufferReturnIn_InputPort[port].addCallComp(
87  this,
88  m_p_fileBufferReturnIn_in
89  );
90  this->m_fileBufferReturnIn_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  Fw::ObjectName portName;
94  portName.format(
95  "%s_fileBufferReturnIn_InputPort[%" PRI_FwIndexType "]",
96  this->m_objName.toChar(),
97  port
98  );
99  this->m_fileBufferReturnIn_InputPort[port].setObjName(portName.toChar());
100 #endif
101  }
102 #endif
103 
104 #if !FW_DIRECT_PORT_CALLS
105  // Connect output port logOut
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
109  port++
110  ) {
111  this->m_logOut_OutputPort[port].init();
112 
113 #if FW_OBJECT_NAMES == 1
114  Fw::ObjectName portName;
115  portName.format(
116  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
117  this->m_objName.toChar(),
118  port
119  );
120  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
121 #endif
122  }
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
126  // Connect output port logTextOut
127  for (
128  FwIndexType port = 0;
129  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
130  port++
131  ) {
132  this->m_logTextOut_OutputPort[port].init();
133 
134 #if FW_OBJECT_NAMES == 1
135  Fw::ObjectName portName;
136  portName.format(
137  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
138  this->m_objName.toChar(),
139  port
140  );
141  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
142 #endif
143  }
144 #endif
145 
146 #if !FW_DIRECT_PORT_CALLS
147  // Connect output port timeCaller
148  for (
149  FwIndexType port = 0;
150  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
151  port++
152  ) {
153  this->m_timeCaller_OutputPort[port].init();
154 
155 #if FW_OBJECT_NAMES == 1
156  Fw::ObjectName portName;
157  portName.format(
158  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
159  this->m_objName.toChar(),
160  port
161  );
162  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
163 #endif
164  }
165 #endif
166 
167 #if !FW_DIRECT_PORT_CALLS
168  // Connect output port commandOut
169  for (
170  FwIndexType port = 0;
171  port < static_cast<FwIndexType>(this->getNum_commandOut_OutputPorts());
172  port++
173  ) {
174  this->m_commandOut_OutputPort[port].init();
175 
176 #if FW_OBJECT_NAMES == 1
177  Fw::ObjectName portName;
178  portName.format(
179  "%s_commandOut_OutputPort[%" PRI_FwIndexType "]",
180  this->m_objName.toChar(),
181  port
182  );
183  this->m_commandOut_OutputPort[port].setObjName(portName.toChar());
184 #endif
185  }
186 #endif
187 
188 #if !FW_DIRECT_PORT_CALLS
189  // Connect output port dataReturnOut
190  for (
191  FwIndexType port = 0;
192  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
193  port++
194  ) {
195  this->m_dataReturnOut_OutputPort[port].init();
196 
197 #if FW_OBJECT_NAMES == 1
198  Fw::ObjectName portName;
199  portName.format(
200  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
201  this->m_objName.toChar(),
202  port
203  );
204  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
205 #endif
206  }
207 #endif
208 
209 #if !FW_DIRECT_PORT_CALLS
210  // Connect output port fileOut
211  for (
212  FwIndexType port = 0;
213  port < static_cast<FwIndexType>(this->getNum_fileOut_OutputPorts());
214  port++
215  ) {
216  this->m_fileOut_OutputPort[port].init();
217 
218 #if FW_OBJECT_NAMES == 1
219  Fw::ObjectName portName;
220  portName.format(
221  "%s_fileOut_OutputPort[%" PRI_FwIndexType "]",
222  this->m_objName.toChar(),
223  port
224  );
225  this->m_fileOut_OutputPort[port].setObjName(portName.toChar());
226 #endif
227  }
228 #endif
229 
230 #if !FW_DIRECT_PORT_CALLS
231  // Connect output port unknownDataOut
232  for (
233  FwIndexType port = 0;
234  port < static_cast<FwIndexType>(this->getNum_unknownDataOut_OutputPorts());
235  port++
236  ) {
237  this->m_unknownDataOut_OutputPort[port].init();
238 
239 #if FW_OBJECT_NAMES == 1
240  Fw::ObjectName portName;
241  portName.format(
242  "%s_unknownDataOut_OutputPort[%" PRI_FwIndexType "]",
243  this->m_objName.toChar(),
244  port
245  );
246  this->m_unknownDataOut_OutputPort[port].setObjName(portName.toChar());
247 #endif
248  }
249 #endif
250  }
251 
252 #if !FW_DIRECT_PORT_CALLS
253 
254  // ----------------------------------------------------------------------
255  // Getters for typed input ports
256  // ----------------------------------------------------------------------
257 
260  {
261  FW_ASSERT(
262  (0 <= portNum) && (portNum < this->getNum_cmdResponseIn_InputPorts()),
263  static_cast<FwAssertArgType>(portNum)
264  );
265 
266  return &this->m_cmdResponseIn_InputPort[portNum];
267  }
268 
271  {
272  FW_ASSERT(
273  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
274  static_cast<FwAssertArgType>(portNum)
275  );
276 
277  return &this->m_dataIn_InputPort[portNum];
278  }
279 
282  {
283  FW_ASSERT(
284  (0 <= portNum) && (portNum < this->getNum_fileBufferReturnIn_InputPorts()),
285  static_cast<FwAssertArgType>(portNum)
286  );
287 
288  return &this->m_fileBufferReturnIn_InputPort[portNum];
289  }
290 
291 #endif
292 
293 #if !FW_DIRECT_PORT_CALLS
294 
295  // ----------------------------------------------------------------------
296  // Connect input ports to special output ports
297  // ----------------------------------------------------------------------
298 
301  FwIndexType portNum,
302  Fw::InputLogPort* port
303  )
304  {
305  FW_ASSERT(
306  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
307  static_cast<FwAssertArgType>(portNum)
308  );
309 
310  this->m_logOut_OutputPort[portNum].addCallPort(port);
311  }
312 
313 #if FW_ENABLE_TEXT_LOGGING == 1
314 
315  void FprimeRouterComponentBase ::
316  set_logTextOut_OutputPort(
317  FwIndexType portNum,
319  )
320  {
321  FW_ASSERT(
322  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
323  static_cast<FwAssertArgType>(portNum)
324  );
325 
326  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
327  }
328 
329 #endif
330 
333  FwIndexType portNum,
334  Fw::InputTimePort* port
335  )
336  {
337  FW_ASSERT(
338  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
339  static_cast<FwAssertArgType>(portNum)
340  );
341 
342  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
343  }
344 
345 #endif
346 
347 #if !FW_DIRECT_PORT_CALLS
348 
349  // ----------------------------------------------------------------------
350  // Connect typed input ports to typed output ports
351  // ----------------------------------------------------------------------
352 
355  FwIndexType portNum,
356  Fw::InputComPort* port
357  )
358  {
359  FW_ASSERT(
360  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
361  static_cast<FwAssertArgType>(portNum)
362  );
363 
364  this->m_commandOut_OutputPort[portNum].addCallPort(port);
365  }
366 
369  FwIndexType portNum,
371  )
372  {
373  FW_ASSERT(
374  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
375  static_cast<FwAssertArgType>(portNum)
376  );
377 
378  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
379  }
380 
383  FwIndexType portNum,
385  )
386  {
387  FW_ASSERT(
388  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
389  static_cast<FwAssertArgType>(portNum)
390  );
391 
392  this->m_fileOut_OutputPort[portNum].addCallPort(port);
393  }
394 
397  FwIndexType portNum,
399  )
400  {
401  FW_ASSERT(
402  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
403  static_cast<FwAssertArgType>(portNum)
404  );
405 
406  this->m_unknownDataOut_OutputPort[portNum].addCallPort(port);
407  }
408 
409 #endif
410 
411 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
412 
413  // ----------------------------------------------------------------------
414  // Connect serial input ports to special output ports
415  // ----------------------------------------------------------------------
416 
419  FwIndexType portNum,
420  Fw::InputSerializePort* port
421  )
422  {
423  FW_ASSERT(
424  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
425  static_cast<FwAssertArgType>(portNum)
426  );
427 
428  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
429  }
430 
431 #if FW_ENABLE_TEXT_LOGGING == 1
432 
433  void FprimeRouterComponentBase ::
434  set_logTextOut_OutputPort(
435  FwIndexType portNum,
436  Fw::InputSerializePort* port
437  )
438  {
439  FW_ASSERT(
440  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
441  static_cast<FwAssertArgType>(portNum)
442  );
443 
444  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
445  }
446 
447 #endif
448 
451  FwIndexType portNum,
452  Fw::InputSerializePort* port
453  )
454  {
455  FW_ASSERT(
456  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
457  static_cast<FwAssertArgType>(portNum)
458  );
459 
460  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
461  }
462 
463 #endif
464 
465 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
466 
467  // ----------------------------------------------------------------------
468  // Connect serial input ports to typed output ports
469  // ----------------------------------------------------------------------
470 
473  FwIndexType portNum,
474  Fw::InputSerializePort* port
475  )
476  {
477  FW_ASSERT(
478  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
479  static_cast<FwAssertArgType>(portNum)
480  );
481 
482  this->m_commandOut_OutputPort[portNum].registerSerialPort(port);
483  }
484 
487  FwIndexType portNum,
488  Fw::InputSerializePort* port
489  )
490  {
491  FW_ASSERT(
492  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
493  static_cast<FwAssertArgType>(portNum)
494  );
495 
496  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
497  }
498 
501  FwIndexType portNum,
502  Fw::InputSerializePort* port
503  )
504  {
505  FW_ASSERT(
506  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
507  static_cast<FwAssertArgType>(portNum)
508  );
509 
510  this->m_fileOut_OutputPort[portNum].registerSerialPort(port);
511  }
512 
515  FwIndexType portNum,
516  Fw::InputSerializePort* port
517  )
518  {
519  FW_ASSERT(
520  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
521  static_cast<FwAssertArgType>(portNum)
522  );
523 
524  this->m_unknownDataOut_OutputPort[portNum].registerSerialPort(port);
525  }
526 
527 #endif
528 
529  // ----------------------------------------------------------------------
530  // Component construction and destruction
531  // ----------------------------------------------------------------------
532 
534  FprimeRouterComponentBase(const char* compName) :
535  Fw::PassiveComponentBase(compName)
536  {
537 
538  }
539 
542  {
543 
544  }
545 
546 #if !FW_DIRECT_PORT_CALLS
547 
548  // ----------------------------------------------------------------------
549  // Connection status queries for special output ports
550  // ----------------------------------------------------------------------
551 
554  {
555  FW_ASSERT(
556  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
557  static_cast<FwAssertArgType>(portNum)
558  );
559 
560  return this->m_logOut_OutputPort[portNum].isConnected();
561  }
562 
563 #if FW_ENABLE_TEXT_LOGGING == 1
564 
565  bool FprimeRouterComponentBase ::
566  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
567  {
568  FW_ASSERT(
569  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
570  static_cast<FwAssertArgType>(portNum)
571  );
572 
573  return this->m_logTextOut_OutputPort[portNum].isConnected();
574  }
575 
576 #endif
577 
580  {
581  FW_ASSERT(
582  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
583  static_cast<FwAssertArgType>(portNum)
584  );
585 
586  return this->m_timeCaller_OutputPort[portNum].isConnected();
587  }
588 
589 #endif
590 
591 #if !FW_DIRECT_PORT_CALLS
592 
593  // ----------------------------------------------------------------------
594  // Connection status queries for typed output ports
595  // ----------------------------------------------------------------------
596 
599  {
600  FW_ASSERT(
601  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
602  static_cast<FwAssertArgType>(portNum)
603  );
604 
605  return this->m_commandOut_OutputPort[portNum].isConnected();
606  }
607 
610  {
611  FW_ASSERT(
612  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
613  static_cast<FwAssertArgType>(portNum)
614  );
615 
616  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
617  }
618 
621  {
622  FW_ASSERT(
623  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
624  static_cast<FwAssertArgType>(portNum)
625  );
626 
627  return this->m_fileOut_OutputPort[portNum].isConnected();
628  }
629 
632  {
633  FW_ASSERT(
634  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
635  static_cast<FwAssertArgType>(portNum)
636  );
637 
638  return this->m_unknownDataOut_OutputPort[portNum].isConnected();
639  }
640 
641 #endif
642 
643  // ----------------------------------------------------------------------
644  // Port handler base-class functions for typed input ports
645  //
646  // Call these functions directly to bypass the corresponding ports
647  // ----------------------------------------------------------------------
648 
651  FwIndexType portNum,
652  FwOpcodeType opCode,
653  U32 cmdSeq,
654  const Fw::CmdResponse& response
655  )
656  {
657  // Make sure port number is valid
658  FW_ASSERT(
659  (0 <= portNum) && (portNum < this->getNum_cmdResponseIn_InputPorts()),
660  static_cast<FwAssertArgType>(portNum)
661  );
662 
663  // Call handler function
664  this->cmdResponseIn_handler(
665  portNum,
666  opCode,
667  cmdSeq,
668  response
669  );
670  }
671 
674  FwIndexType portNum,
675  Fw::Buffer& data,
676  const ComCfg::FrameContext& context
677  )
678  {
679  // Make sure port number is valid
680  FW_ASSERT(
681  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
682  static_cast<FwAssertArgType>(portNum)
683  );
684 
685  // Call handler function
686  this->dataIn_handler(
687  portNum,
688  data,
689  context
690  );
691  }
692 
695  FwIndexType portNum,
696  Fw::Buffer& fwBuffer
697  )
698  {
699  // Make sure port number is valid
700  FW_ASSERT(
701  (0 <= portNum) && (portNum < this->getNum_fileBufferReturnIn_InputPorts()),
702  static_cast<FwAssertArgType>(portNum)
703  );
704 
705  // Call handler function
707  portNum,
708  fwBuffer
709  );
710  }
711 
712 #if !FW_DIRECT_PORT_CALLS
713 
714  // ----------------------------------------------------------------------
715  // Invocation functions for typed output ports
716  // ----------------------------------------------------------------------
717 
720  FwIndexType portNum,
721  Fw::ComBuffer& data,
722  U32 context
723  ) const
724  {
725  FW_ASSERT(
726  (0 <= portNum) && (portNum < this->getNum_commandOut_OutputPorts()),
727  static_cast<FwAssertArgType>(portNum)
728  );
729 
730  FW_ASSERT(
731  this->m_commandOut_OutputPort[portNum].isConnected(),
732  static_cast<FwAssertArgType>(portNum)
733  );
734  this->m_commandOut_OutputPort[portNum].invoke(
735  data,
736  context
737  );
738  }
739 
742  FwIndexType portNum,
743  Fw::Buffer& data,
744  const ComCfg::FrameContext& context
745  ) const
746  {
747  FW_ASSERT(
748  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
749  static_cast<FwAssertArgType>(portNum)
750  );
751 
752  FW_ASSERT(
753  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
754  static_cast<FwAssertArgType>(portNum)
755  );
756  this->m_dataReturnOut_OutputPort[portNum].invoke(
757  data,
758  context
759  );
760  }
761 
764  FwIndexType portNum,
765  Fw::Buffer& fwBuffer
766  ) const
767  {
768  FW_ASSERT(
769  (0 <= portNum) && (portNum < this->getNum_fileOut_OutputPorts()),
770  static_cast<FwAssertArgType>(portNum)
771  );
772 
773  FW_ASSERT(
774  this->m_fileOut_OutputPort[portNum].isConnected(),
775  static_cast<FwAssertArgType>(portNum)
776  );
777  this->m_fileOut_OutputPort[portNum].invoke(
778  fwBuffer
779  );
780  }
781 
784  FwIndexType portNum,
785  Fw::Buffer& data,
786  const ComCfg::FrameContext& context
787  ) const
788  {
789  FW_ASSERT(
790  (0 <= portNum) && (portNum < this->getNum_unknownDataOut_OutputPorts()),
791  static_cast<FwAssertArgType>(portNum)
792  );
793 
794  FW_ASSERT(
795  this->m_unknownDataOut_OutputPort[portNum].isConnected(),
796  static_cast<FwAssertArgType>(portNum)
797  );
798  this->m_unknownDataOut_OutputPort[portNum].invoke(
799  data,
800  context
801  );
802  }
803 
804 #endif
805 
806  // ----------------------------------------------------------------------
807  // Event logging functions
808  // ----------------------------------------------------------------------
809 
812  {
813  // Get the time
814  Fw::Time _logTime;
815  if (this->isConnected_timeCaller_OutputPort(0)) {
816  this->timeCaller_out(0, _logTime);
817  }
818 
819  const FwEventIdType _id = this->getIdBase() + EVENTID_SERIALIZATIONERROR;
820 
821  // Emit the event on the log port
822  if (this->isConnected_logOut_OutputPort(0)) {
823  Fw::LogBuffer _logBuff;
825 
826 #if FW_AMPCS_COMPATIBLE
827  // Serialize the number of arguments
828  _status = _logBuff.serializeFrom(static_cast<U8>(1));
829  FW_ASSERT(
830  _status == Fw::FW_SERIALIZE_OK,
831  static_cast<FwAssertArgType>(_status)
832  );
833 #endif
834 
835 #if FW_AMPCS_COMPATIBLE
836  // Serialize the argument size
837  _status = _logBuff.serializeFrom(
838  static_cast<U8>(sizeof(U32))
839  );
840  FW_ASSERT(
841  _status == Fw::FW_SERIALIZE_OK,
842  static_cast<FwAssertArgType>(_status)
843  );
844 #endif
845  _status = _logBuff.serializeFrom(status);
846  FW_ASSERT(
847  _status == Fw::FW_SERIALIZE_OK,
848  static_cast<FwAssertArgType>(_status)
849  );
850 
851  this->logOut_out(
852  0,
853  _id,
854  _logTime,
856  _logBuff
857  );
858  }
859 
860  // Emit the event on the text log port
861 #if FW_ENABLE_TEXT_LOGGING
862  if (this->isConnected_logTextOut_OutputPort(0)) {
863 #if FW_OBJECT_NAMES == 1
864  const char* _formatString =
865  "(%s) %s: Serializing com buffer failed with status %" PRIu32 "";
866 #else
867  const char* _formatString =
868  "%s: Serializing com buffer failed with status %" PRIu32 "";
869 #endif
870 
871  Fw::TextLogString _logString;
872  _logString.format(
873  _formatString,
874 #if FW_OBJECT_NAMES == 1
875  this->m_objName.toChar(),
876 #endif
877  "SerializationError ",
878  status
879  );
880 
881  this->logTextOut_out(
882  0,
883  _id,
884  _logTime,
886  _logString
887  );
888  }
889 #endif
890  }
891 
894  {
895  // Get the time
896  Fw::Time _logTime;
897  if (this->isConnected_timeCaller_OutputPort(0)) {
898  this->timeCaller_out(0, _logTime);
899  }
900 
902 
903  // Emit the event on the log port
904  if (this->isConnected_logOut_OutputPort(0)) {
905  Fw::LogBuffer _logBuff;
907 
908 #if FW_AMPCS_COMPATIBLE
909  // Serialize the number of arguments
910  _status = _logBuff.serializeFrom(static_cast<U8>(1));
911  FW_ASSERT(
912  _status == Fw::FW_SERIALIZE_OK,
913  static_cast<FwAssertArgType>(_status)
914  );
915 #endif
916 
917 #if FW_AMPCS_COMPATIBLE
918  // Serialize the argument size
919  _status = _logBuff.serializeFrom(
920  static_cast<U8>(sizeof(U32))
921  );
922  FW_ASSERT(
923  _status == Fw::FW_SERIALIZE_OK,
924  static_cast<FwAssertArgType>(_status)
925  );
926 #endif
927  _status = _logBuff.serializeFrom(status);
928  FW_ASSERT(
929  _status == Fw::FW_SERIALIZE_OK,
930  static_cast<FwAssertArgType>(_status)
931  );
932 
933  this->logOut_out(
934  0,
935  _id,
936  _logTime,
938  _logBuff
939  );
940  }
941 
942  // Emit the event on the text log port
943 #if FW_ENABLE_TEXT_LOGGING
944  if (this->isConnected_logTextOut_OutputPort(0)) {
945 #if FW_OBJECT_NAMES == 1
946  const char* _formatString =
947  "(%s) %s: Deserializing packet type failed with status %" PRIu32 "";
948 #else
949  const char* _formatString =
950  "%s: Deserializing packet type failed with status %" PRIu32 "";
951 #endif
952 
953  Fw::TextLogString _logString;
954  _logString.format(
955  _formatString,
956 #if FW_OBJECT_NAMES == 1
957  this->m_objName.toChar(),
958 #endif
959  "DeserializationError ",
960  status
961  );
962 
963  this->logTextOut_out(
964  0,
965  _id,
966  _logTime,
968  _logString
969  );
970  }
971 #endif
972  }
973 
974  // ----------------------------------------------------------------------
975  // Time
976  // ----------------------------------------------------------------------
977 
979  getTime() const
980  {
981  if (this->isConnected_timeCaller_OutputPort(0)) {
982  Fw::Time _time;
983  this->timeCaller_out(0, _time);
984  return _time;
985  }
986  else {
987  return Fw::Time(TimeBase::TB_NONE, 0, 0);
988  }
989  }
990 
991  // ----------------------------------------------------------------------
992  // Calls for messages received on typed input ports
993  // ----------------------------------------------------------------------
994 
995  void FprimeRouterComponentBase ::
996  m_p_cmdResponseIn_in(
997  Fw::PassiveComponentBase* callComp,
998  FwIndexType portNum,
999  FwOpcodeType opCode,
1000  U32 cmdSeq,
1001  const Fw::CmdResponse& response
1002  )
1003  {
1004  FW_ASSERT(callComp);
1005  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1006  compPtr->cmdResponseIn_handlerBase(
1007  portNum,
1008  opCode,
1009  cmdSeq,
1010  response
1011  );
1012  }
1013 
1014  void FprimeRouterComponentBase ::
1015  m_p_dataIn_in(
1016  Fw::PassiveComponentBase* callComp,
1017  FwIndexType portNum,
1018  Fw::Buffer& data,
1019  const ComCfg::FrameContext& context
1020  )
1021  {
1022  FW_ASSERT(callComp);
1023  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1024  compPtr->dataIn_handlerBase(
1025  portNum,
1026  data,
1027  context
1028  );
1029  }
1030 
1031  void FprimeRouterComponentBase ::
1032  m_p_fileBufferReturnIn_in(
1033  Fw::PassiveComponentBase* callComp,
1034  FwIndexType portNum,
1035  Fw::Buffer& fwBuffer
1036  )
1037  {
1038  FW_ASSERT(callComp);
1039  FprimeRouterComponentBase* compPtr = static_cast<FprimeRouterComponentBase*>(callComp);
1040  compPtr->fileBufferReturnIn_handlerBase(
1041  portNum,
1042  fwBuffer
1043  );
1044  }
1045 
1046 #if !FW_DIRECT_PORT_CALLS
1047 
1048  // ----------------------------------------------------------------------
1049  // Invocation functions for special output ports
1050  // ----------------------------------------------------------------------
1051 
1052  void FprimeRouterComponentBase ::
1053  logOut_out(
1054  FwIndexType portNum,
1055  FwEventIdType id,
1056  Fw::Time& timeTag,
1057  const Fw::LogSeverity& severity,
1058  Fw::LogBuffer& args
1059  ) const
1060  {
1061  FW_ASSERT(
1062  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1063  static_cast<FwAssertArgType>(portNum)
1064  );
1065 
1066  FW_ASSERT(
1067  this->m_logOut_OutputPort[portNum].isConnected(),
1068  static_cast<FwAssertArgType>(portNum)
1069  );
1070  this->m_logOut_OutputPort[portNum].invoke(
1071  id,
1072  timeTag,
1073  severity,
1074  args
1075  );
1076  }
1077 
1078 #if FW_ENABLE_TEXT_LOGGING
1079 
1080  void FprimeRouterComponentBase ::
1081  logTextOut_out(
1082  FwIndexType portNum,
1083  FwEventIdType id,
1084  Fw::Time& timeTag,
1085  const Fw::LogSeverity& severity,
1086  Fw::TextLogString& text
1087  ) const
1088  {
1089  FW_ASSERT(
1090  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1091  static_cast<FwAssertArgType>(portNum)
1092  );
1093 
1094  FW_ASSERT(
1095  this->m_logTextOut_OutputPort[portNum].isConnected(),
1096  static_cast<FwAssertArgType>(portNum)
1097  );
1098  this->m_logTextOut_OutputPort[portNum].invoke(
1099  id,
1100  timeTag,
1101  severity,
1102  text
1103  );
1104  }
1105 
1106 #endif
1107 
1108  void FprimeRouterComponentBase ::
1109  timeCaller_out(
1110  FwIndexType portNum,
1111  Fw::Time& time
1112  ) const
1113  {
1114  FW_ASSERT(
1115  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1116  static_cast<FwAssertArgType>(portNum)
1117  );
1118 
1119  FW_ASSERT(
1120  this->m_timeCaller_OutputPort[portNum].isConnected(),
1121  static_cast<FwAssertArgType>(portNum)
1122  );
1123  this->m_timeCaller_OutputPort[portNum].invoke(
1124  time
1125  );
1126  }
1127 
1128 #endif
1129 
1130 }
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void invoke(Fw::ComBuffer &data, U32 context) const
Invoke a port connection.
Definition: ComPortAc.cpp:181
void init()
Initialization function.
Definition: ComPortAc.cpp:162
static constexpr FwIndexType getNum_dataIn_InputPorts()
virtual ~FprimeRouterComponentBase()
Destroy FprimeRouterComponentBase object.
static constexpr FwIndexType getNum_fileBufferReturnIn_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 dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void fileBufferReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port fileBufferReturnIn.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
void unknownDataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port unknownDataOut.
I32 FwEnumStoreType
bool isConnected_commandOut_OutputPort(FwIndexType portNum) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
FprimeRouterComponentBase(const char *compName="")
Construct FprimeRouterComponentBase object.
static constexpr FwIndexType getNum_unknownDataOut_OutputPorts()
void fileOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port fileOut.
Enum representing a command response.
No time base has been established (Required)
void commandOut_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context) const
Invoke output port commandOut.
Fw::InputCmdResponsePort * get_cmdResponseIn_InputPort(FwIndexType portNum)
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_commandOut_OutputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
FwIdType FwEventIdType
The type of an event identifier.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
Fw::InputBufferSendPort * get_fileBufferReturnIn_InputPort(FwIndexType portNum)
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void init()
Initialization function.
Definition: TimePortAc.cpp:151
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
void cmdResponseIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)
Handler base-class function for input port cmdResponseIn.
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
An error occurred while deserializing a packet.
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
A serious but recoverable event.
void init()
Initialization function.
Auto-generated base for FprimeRouter component.
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
void set_fileOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to fileOut[portNum].
#define PRI_FwIndexType
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
static constexpr FwIndexType getNum_logOut_OutputPorts()
static constexpr FwIndexType getNum_fileOut_OutputPorts()
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void init()
Initialization function.
void init()
Initialization function.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
void init()
Initialization function.
void set_unknownDataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to unknownDataOut[portNum].
bool isConnected_unknownDataOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_cmdResponseIn_InputPorts()
PlatformIndexType FwIndexType
void log_WARNING_HI_DeserializationError(U32 status) const
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void log_WARNING_HI_SerializationError(U32 status) const
Type used to pass context info between components during framing/deframing.
bool isConnected_fileOut_OutputPort(FwIndexType portNum) const
RateGroupDivider component implementation.
void set_commandOut_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to commandOut[portNum].
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:168
virtual void cmdResponseIn_handler(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response)=0
Handler for input port cmdResponseIn.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
Implementation of malloc based allocator.
An error occurred while serializing a com buffer.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
virtual void fileBufferReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port fileBufferReturnIn.