F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SpacePacketFramerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SpacePacketFramerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SpacePacketFramer 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  namespace Ccsds {
17 
18  // ----------------------------------------------------------------------
19  // Component initialization
20  // ----------------------------------------------------------------------
21 
24  {
25  // Initialize base class
27 
28 #if !FW_DIRECT_PORT_CALLS
29  // Connect input port comStatusIn
30  for (
31  FwIndexType port = 0;
32  port < static_cast<FwIndexType>(this->getNum_comStatusIn_InputPorts());
33  port++
34  ) {
35  this->m_comStatusIn_InputPort[port].init();
36  this->m_comStatusIn_InputPort[port].addCallComp(
37  this,
38  m_p_comStatusIn_in
39  );
40  this->m_comStatusIn_InputPort[port].setPortNum(port);
41 
42 #if FW_OBJECT_NAMES == 1
43  Fw::ObjectName portName;
44  portName.format(
45  "%s_comStatusIn_InputPort[%" PRI_FwIndexType "]",
46  this->m_objName.toChar(),
47  port
48  );
49  this->m_comStatusIn_InputPort[port].setObjName(portName.toChar());
50 #endif
51  }
52 #endif
53 
54 #if !FW_DIRECT_PORT_CALLS
55  // Connect input port dataIn
56  for (
57  FwIndexType port = 0;
58  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
59  port++
60  ) {
61  this->m_dataIn_InputPort[port].init();
62  this->m_dataIn_InputPort[port].addCallComp(
63  this,
64  m_p_dataIn_in
65  );
66  this->m_dataIn_InputPort[port].setPortNum(port);
67 
68 #if FW_OBJECT_NAMES == 1
69  Fw::ObjectName portName;
70  portName.format(
71  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
72  this->m_objName.toChar(),
73  port
74  );
75  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
76 #endif
77  }
78 #endif
79 
80 #if !FW_DIRECT_PORT_CALLS
81  // Connect input port dataReturnIn
82  for (
83  FwIndexType port = 0;
84  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
85  port++
86  ) {
87  this->m_dataReturnIn_InputPort[port].init();
88  this->m_dataReturnIn_InputPort[port].addCallComp(
89  this,
90  m_p_dataReturnIn_in
91  );
92  this->m_dataReturnIn_InputPort[port].setPortNum(port);
93 
94 #if FW_OBJECT_NAMES == 1
95  Fw::ObjectName portName;
96  portName.format(
97  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
98  this->m_objName.toChar(),
99  port
100  );
101  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
102 #endif
103  }
104 #endif
105 
106 #if !FW_DIRECT_PORT_CALLS
107  // Connect output port logOut
108  for (
109  FwIndexType port = 0;
110  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
111  port++
112  ) {
113  this->m_logOut_OutputPort[port].init();
114 
115 #if FW_OBJECT_NAMES == 1
116  Fw::ObjectName portName;
117  portName.format(
118  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
119  this->m_objName.toChar(),
120  port
121  );
122  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
123 #endif
124  }
125 #endif
126 
127 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
128  // Connect output port logTextOut
129  for (
130  FwIndexType port = 0;
131  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
132  port++
133  ) {
134  this->m_logTextOut_OutputPort[port].init();
135 
136 #if FW_OBJECT_NAMES == 1
137  Fw::ObjectName portName;
138  portName.format(
139  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
140  this->m_objName.toChar(),
141  port
142  );
143  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
144 #endif
145  }
146 #endif
147 
148 #if !FW_DIRECT_PORT_CALLS
149  // Connect output port prmGetOut
150  for (
151  FwIndexType port = 0;
152  port < static_cast<FwIndexType>(this->getNum_prmGetOut_OutputPorts());
153  port++
154  ) {
155  this->m_prmGetOut_OutputPort[port].init();
156 
157 #if FW_OBJECT_NAMES == 1
158  Fw::ObjectName portName;
159  portName.format(
160  "%s_prmGetOut_OutputPort[%" PRI_FwIndexType "]",
161  this->m_objName.toChar(),
162  port
163  );
164  this->m_prmGetOut_OutputPort[port].setObjName(portName.toChar());
165 #endif
166  }
167 #endif
168 
169 #if !FW_DIRECT_PORT_CALLS
170  // Connect output port prmSetOut
171  for (
172  FwIndexType port = 0;
173  port < static_cast<FwIndexType>(this->getNum_prmSetOut_OutputPorts());
174  port++
175  ) {
176  this->m_prmSetOut_OutputPort[port].init();
177 
178 #if FW_OBJECT_NAMES == 1
179  Fw::ObjectName portName;
180  portName.format(
181  "%s_prmSetOut_OutputPort[%" PRI_FwIndexType "]",
182  this->m_objName.toChar(),
183  port
184  );
185  this->m_prmSetOut_OutputPort[port].setObjName(portName.toChar());
186 #endif
187  }
188 #endif
189 
190 #if !FW_DIRECT_PORT_CALLS
191  // Connect output port timeCaller
192  for (
193  FwIndexType port = 0;
194  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
195  port++
196  ) {
197  this->m_timeCaller_OutputPort[port].init();
198 
199 #if FW_OBJECT_NAMES == 1
200  Fw::ObjectName portName;
201  portName.format(
202  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
203  this->m_objName.toChar(),
204  port
205  );
206  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
207 #endif
208  }
209 #endif
210 
211 #if !FW_DIRECT_PORT_CALLS
212  // Connect output port tlmOut
213  for (
214  FwIndexType port = 0;
215  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
216  port++
217  ) {
218  this->m_tlmOut_OutputPort[port].init();
219 
220 #if FW_OBJECT_NAMES == 1
221  Fw::ObjectName portName;
222  portName.format(
223  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
224  this->m_objName.toChar(),
225  port
226  );
227  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
228 #endif
229  }
230 #endif
231 
232 #if !FW_DIRECT_PORT_CALLS
233  // Connect output port bufferAllocate
234  for (
235  FwIndexType port = 0;
236  port < static_cast<FwIndexType>(this->getNum_bufferAllocate_OutputPorts());
237  port++
238  ) {
239  this->m_bufferAllocate_OutputPort[port].init();
240 
241 #if FW_OBJECT_NAMES == 1
242  Fw::ObjectName portName;
243  portName.format(
244  "%s_bufferAllocate_OutputPort[%" PRI_FwIndexType "]",
245  this->m_objName.toChar(),
246  port
247  );
248  this->m_bufferAllocate_OutputPort[port].setObjName(portName.toChar());
249 #endif
250  }
251 #endif
252 
253 #if !FW_DIRECT_PORT_CALLS
254  // Connect output port bufferDeallocate
255  for (
256  FwIndexType port = 0;
257  port < static_cast<FwIndexType>(this->getNum_bufferDeallocate_OutputPorts());
258  port++
259  ) {
260  this->m_bufferDeallocate_OutputPort[port].init();
261 
262 #if FW_OBJECT_NAMES == 1
263  Fw::ObjectName portName;
264  portName.format(
265  "%s_bufferDeallocate_OutputPort[%" PRI_FwIndexType "]",
266  this->m_objName.toChar(),
267  port
268  );
269  this->m_bufferDeallocate_OutputPort[port].setObjName(portName.toChar());
270 #endif
271  }
272 #endif
273 
274 #if !FW_DIRECT_PORT_CALLS
275  // Connect output port comStatusOut
276  for (
277  FwIndexType port = 0;
278  port < static_cast<FwIndexType>(this->getNum_comStatusOut_OutputPorts());
279  port++
280  ) {
281  this->m_comStatusOut_OutputPort[port].init();
282 
283 #if FW_OBJECT_NAMES == 1
284  Fw::ObjectName portName;
285  portName.format(
286  "%s_comStatusOut_OutputPort[%" PRI_FwIndexType "]",
287  this->m_objName.toChar(),
288  port
289  );
290  this->m_comStatusOut_OutputPort[port].setObjName(portName.toChar());
291 #endif
292  }
293 #endif
294 
295 #if !FW_DIRECT_PORT_CALLS
296  // Connect output port dataOut
297  for (
298  FwIndexType port = 0;
299  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
300  port++
301  ) {
302  this->m_dataOut_OutputPort[port].init();
303 
304 #if FW_OBJECT_NAMES == 1
305  Fw::ObjectName portName;
306  portName.format(
307  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
308  this->m_objName.toChar(),
309  port
310  );
311  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
312 #endif
313  }
314 #endif
315 
316 #if !FW_DIRECT_PORT_CALLS
317  // Connect output port dataReturnOut
318  for (
319  FwIndexType port = 0;
320  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
321  port++
322  ) {
323  this->m_dataReturnOut_OutputPort[port].init();
324 
325 #if FW_OBJECT_NAMES == 1
326  Fw::ObjectName portName;
327  portName.format(
328  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
329  this->m_objName.toChar(),
330  port
331  );
332  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
333 #endif
334  }
335 #endif
336 
337 #if !FW_DIRECT_PORT_CALLS
338  // Connect output port getApidSeqCount
339  for (
340  FwIndexType port = 0;
341  port < static_cast<FwIndexType>(this->getNum_getApidSeqCount_OutputPorts());
342  port++
343  ) {
344  this->m_getApidSeqCount_OutputPort[port].init();
345 
346 #if FW_OBJECT_NAMES == 1
347  Fw::ObjectName portName;
348  portName.format(
349  "%s_getApidSeqCount_OutputPort[%" PRI_FwIndexType "]",
350  this->m_objName.toChar(),
351  port
352  );
353  this->m_getApidSeqCount_OutputPort[port].setObjName(portName.toChar());
354 #endif
355  }
356 #endif
357  }
358 
359 #if !FW_DIRECT_PORT_CALLS
360 
361  // ----------------------------------------------------------------------
362  // Getters for typed input ports
363  // ----------------------------------------------------------------------
364 
367  {
368  FW_ASSERT(
369  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
370  static_cast<FwAssertArgType>(portNum)
371  );
372 
373  return &this->m_comStatusIn_InputPort[portNum];
374  }
375 
378  {
379  FW_ASSERT(
380  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
381  static_cast<FwAssertArgType>(portNum)
382  );
383 
384  return &this->m_dataIn_InputPort[portNum];
385  }
386 
389  {
390  FW_ASSERT(
391  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
392  static_cast<FwAssertArgType>(portNum)
393  );
394 
395  return &this->m_dataReturnIn_InputPort[portNum];
396  }
397 
398 #endif
399 
400 #if !FW_DIRECT_PORT_CALLS
401 
402  // ----------------------------------------------------------------------
403  // Connect input ports to special output ports
404  // ----------------------------------------------------------------------
405 
408  FwIndexType portNum,
409  Fw::InputLogPort* port
410  )
411  {
412  FW_ASSERT(
413  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
414  static_cast<FwAssertArgType>(portNum)
415  );
416 
417  this->m_logOut_OutputPort[portNum].addCallPort(port);
418  }
419 
420 #if FW_ENABLE_TEXT_LOGGING == 1
421 
422  void SpacePacketFramerComponentBase ::
423  set_logTextOut_OutputPort(
424  FwIndexType portNum,
426  )
427  {
428  FW_ASSERT(
429  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
430  static_cast<FwAssertArgType>(portNum)
431  );
432 
433  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
434  }
435 
436 #endif
437 
440  FwIndexType portNum,
441  Fw::InputPrmGetPort* port
442  )
443  {
444  FW_ASSERT(
445  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
446  static_cast<FwAssertArgType>(portNum)
447  );
448 
449  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
450  }
451 
454  FwIndexType portNum,
455  Fw::InputPrmSetPort* port
456  )
457  {
458  FW_ASSERT(
459  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
460  static_cast<FwAssertArgType>(portNum)
461  );
462 
463  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
464  }
465 
468  FwIndexType portNum,
469  Fw::InputTimePort* port
470  )
471  {
472  FW_ASSERT(
473  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
474  static_cast<FwAssertArgType>(portNum)
475  );
476 
477  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
478  }
479 
482  FwIndexType portNum,
483  Fw::InputTlmPort* port
484  )
485  {
486  FW_ASSERT(
487  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
488  static_cast<FwAssertArgType>(portNum)
489  );
490 
491  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
492  }
493 
494 #endif
495 
496 #if !FW_DIRECT_PORT_CALLS
497 
498  // ----------------------------------------------------------------------
499  // Connect typed input ports to typed output ports
500  // ----------------------------------------------------------------------
501 
504  FwIndexType portNum,
506  )
507  {
508  FW_ASSERT(
509  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
510  static_cast<FwAssertArgType>(portNum)
511  );
512 
513  this->m_bufferAllocate_OutputPort[portNum].addCallPort(port);
514  }
515 
518  FwIndexType portNum,
520  )
521  {
522  FW_ASSERT(
523  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
524  static_cast<FwAssertArgType>(portNum)
525  );
526 
527  this->m_bufferDeallocate_OutputPort[portNum].addCallPort(port);
528  }
529 
532  FwIndexType portNum,
534  )
535  {
536  FW_ASSERT(
537  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
538  static_cast<FwAssertArgType>(portNum)
539  );
540 
541  this->m_comStatusOut_OutputPort[portNum].addCallPort(port);
542  }
543 
546  FwIndexType portNum,
548  )
549  {
550  FW_ASSERT(
551  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
552  static_cast<FwAssertArgType>(portNum)
553  );
554 
555  this->m_dataOut_OutputPort[portNum].addCallPort(port);
556  }
557 
560  FwIndexType portNum,
562  )
563  {
564  FW_ASSERT(
565  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
566  static_cast<FwAssertArgType>(portNum)
567  );
568 
569  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
570  }
571 
574  FwIndexType portNum,
576  )
577  {
578  FW_ASSERT(
579  (0 <= portNum) && (portNum < this->getNum_getApidSeqCount_OutputPorts()),
580  static_cast<FwAssertArgType>(portNum)
581  );
582 
583  this->m_getApidSeqCount_OutputPort[portNum].addCallPort(port);
584  }
585 
586 #endif
587 
588 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
589 
590  // ----------------------------------------------------------------------
591  // Connect serial input ports to special output ports
592  // ----------------------------------------------------------------------
593 
596  FwIndexType portNum,
597  Fw::InputSerializePort* port
598  )
599  {
600  FW_ASSERT(
601  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
602  static_cast<FwAssertArgType>(portNum)
603  );
604 
605  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
606  }
607 
608 #if FW_ENABLE_TEXT_LOGGING == 1
609 
610  void SpacePacketFramerComponentBase ::
611  set_logTextOut_OutputPort(
612  FwIndexType portNum,
613  Fw::InputSerializePort* port
614  )
615  {
616  FW_ASSERT(
617  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
618  static_cast<FwAssertArgType>(portNum)
619  );
620 
621  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
622  }
623 
624 #endif
625 
628  FwIndexType portNum,
629  Fw::InputSerializePort* port
630  )
631  {
632  FW_ASSERT(
633  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
634  static_cast<FwAssertArgType>(portNum)
635  );
636 
637  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
638  }
639 
642  FwIndexType portNum,
643  Fw::InputSerializePort* port
644  )
645  {
646  FW_ASSERT(
647  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
648  static_cast<FwAssertArgType>(portNum)
649  );
650 
651  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
652  }
653 
656  FwIndexType portNum,
657  Fw::InputSerializePort* port
658  )
659  {
660  FW_ASSERT(
661  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
662  static_cast<FwAssertArgType>(portNum)
663  );
664 
665  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
666  }
667 
668 #endif
669 
670 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
671 
672  // ----------------------------------------------------------------------
673  // Connect serial input ports to typed output ports
674  // ----------------------------------------------------------------------
675 
678  FwIndexType portNum,
679  Fw::InputSerializePort* port
680  )
681  {
682  FW_ASSERT(
683  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
684  static_cast<FwAssertArgType>(portNum)
685  );
686 
687  this->m_bufferDeallocate_OutputPort[portNum].registerSerialPort(port);
688  }
689 
692  FwIndexType portNum,
693  Fw::InputSerializePort* port
694  )
695  {
696  FW_ASSERT(
697  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
698  static_cast<FwAssertArgType>(portNum)
699  );
700 
701  this->m_comStatusOut_OutputPort[portNum].registerSerialPort(port);
702  }
703 
706  FwIndexType portNum,
707  Fw::InputSerializePort* port
708  )
709  {
710  FW_ASSERT(
711  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
712  static_cast<FwAssertArgType>(portNum)
713  );
714 
715  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
716  }
717 
720  FwIndexType portNum,
721  Fw::InputSerializePort* port
722  )
723  {
724  FW_ASSERT(
725  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
726  static_cast<FwAssertArgType>(portNum)
727  );
728 
729  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
730  }
731 
732 #endif
733 
734  // ----------------------------------------------------------------------
735  // Component construction and destruction
736  // ----------------------------------------------------------------------
737 
739  SpacePacketFramerComponentBase(const char* compName) :
740  Fw::PassiveComponentBase(compName)
741  {
742  this->m_NoBufferAvailableThrottle = 0;
743  }
744 
747  {
748 
749  }
750 
751 #if !FW_DIRECT_PORT_CALLS
752 
753  // ----------------------------------------------------------------------
754  // Connection status queries for special output ports
755  // ----------------------------------------------------------------------
756 
759  {
760  FW_ASSERT(
761  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
762  static_cast<FwAssertArgType>(portNum)
763  );
764 
765  return this->m_logOut_OutputPort[portNum].isConnected();
766  }
767 
768 #if FW_ENABLE_TEXT_LOGGING == 1
769 
770  bool SpacePacketFramerComponentBase ::
771  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
772  {
773  FW_ASSERT(
774  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
775  static_cast<FwAssertArgType>(portNum)
776  );
777 
778  return this->m_logTextOut_OutputPort[portNum].isConnected();
779  }
780 
781 #endif
782 
785  {
786  FW_ASSERT(
787  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
788  static_cast<FwAssertArgType>(portNum)
789  );
790 
791  return this->m_prmGetOut_OutputPort[portNum].isConnected();
792  }
793 
796  {
797  FW_ASSERT(
798  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
799  static_cast<FwAssertArgType>(portNum)
800  );
801 
802  return this->m_prmSetOut_OutputPort[portNum].isConnected();
803  }
804 
807  {
808  FW_ASSERT(
809  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
810  static_cast<FwAssertArgType>(portNum)
811  );
812 
813  return this->m_timeCaller_OutputPort[portNum].isConnected();
814  }
815 
818  {
819  FW_ASSERT(
820  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
821  static_cast<FwAssertArgType>(portNum)
822  );
823 
824  return this->m_tlmOut_OutputPort[portNum].isConnected();
825  }
826 
827 #endif
828 
829 #if !FW_DIRECT_PORT_CALLS
830 
831  // ----------------------------------------------------------------------
832  // Connection status queries for typed output ports
833  // ----------------------------------------------------------------------
834 
837  {
838  FW_ASSERT(
839  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
840  static_cast<FwAssertArgType>(portNum)
841  );
842 
843  return this->m_bufferAllocate_OutputPort[portNum].isConnected();
844  }
845 
848  {
849  FW_ASSERT(
850  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
851  static_cast<FwAssertArgType>(portNum)
852  );
853 
854  return this->m_bufferDeallocate_OutputPort[portNum].isConnected();
855  }
856 
859  {
860  FW_ASSERT(
861  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
862  static_cast<FwAssertArgType>(portNum)
863  );
864 
865  return this->m_comStatusOut_OutputPort[portNum].isConnected();
866  }
867 
870  {
871  FW_ASSERT(
872  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
873  static_cast<FwAssertArgType>(portNum)
874  );
875 
876  return this->m_dataOut_OutputPort[portNum].isConnected();
877  }
878 
881  {
882  FW_ASSERT(
883  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
884  static_cast<FwAssertArgType>(portNum)
885  );
886 
887  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
888  }
889 
892  {
893  FW_ASSERT(
894  (0 <= portNum) && (portNum < this->getNum_getApidSeqCount_OutputPorts()),
895  static_cast<FwAssertArgType>(portNum)
896  );
897 
898  return this->m_getApidSeqCount_OutputPort[portNum].isConnected();
899  }
900 
901 #endif
902 
903  // ----------------------------------------------------------------------
904  // Port handler base-class functions for typed input ports
905  //
906  // Call these functions directly to bypass the corresponding ports
907  // ----------------------------------------------------------------------
908 
911  FwIndexType portNum,
912  Fw::Success& condition
913  )
914  {
915  // Make sure port number is valid
916  FW_ASSERT(
917  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
918  static_cast<FwAssertArgType>(portNum)
919  );
920 
921  // Call handler function
922  this->comStatusIn_handler(
923  portNum,
924  condition
925  );
926  }
927 
930  FwIndexType portNum,
931  Fw::Buffer& data,
932  const ComCfg::FrameContext& context
933  )
934  {
935  // Make sure port number is valid
936  FW_ASSERT(
937  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
938  static_cast<FwAssertArgType>(portNum)
939  );
940 
941  // Call handler function
942  this->dataIn_handler(
943  portNum,
944  data,
945  context
946  );
947  }
948 
951  FwIndexType portNum,
952  Fw::Buffer& data,
953  const ComCfg::FrameContext& context
954  )
955  {
956  // Make sure port number is valid
957  FW_ASSERT(
958  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
959  static_cast<FwAssertArgType>(portNum)
960  );
961 
962  // Call handler function
963  this->dataReturnIn_handler(
964  portNum,
965  data,
966  context
967  );
968  }
969 
970 #if !FW_DIRECT_PORT_CALLS
971 
972  // ----------------------------------------------------------------------
973  // Invocation functions for typed output ports
974  // ----------------------------------------------------------------------
975 
978  FwIndexType portNum,
979  FwSizeType size
980  ) const
981  {
982  FW_ASSERT(
983  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
984  static_cast<FwAssertArgType>(portNum)
985  );
986 
987  FW_ASSERT(
988  this->m_bufferAllocate_OutputPort[portNum].isConnected(),
989  static_cast<FwAssertArgType>(portNum)
990  );
991  return this->m_bufferAllocate_OutputPort[portNum].invoke(
992  size
993  );
994  }
995 
998  FwIndexType portNum,
999  Fw::Buffer& fwBuffer
1000  ) const
1001  {
1002  FW_ASSERT(
1003  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
1004  static_cast<FwAssertArgType>(portNum)
1005  );
1006 
1007  FW_ASSERT(
1008  this->m_bufferDeallocate_OutputPort[portNum].isConnected(),
1009  static_cast<FwAssertArgType>(portNum)
1010  );
1011  this->m_bufferDeallocate_OutputPort[portNum].invoke(
1012  fwBuffer
1013  );
1014  }
1015 
1018  FwIndexType portNum,
1019  Fw::Success& condition
1020  ) const
1021  {
1022  FW_ASSERT(
1023  (0 <= portNum) && (portNum < this->getNum_comStatusOut_OutputPorts()),
1024  static_cast<FwAssertArgType>(portNum)
1025  );
1026 
1027  FW_ASSERT(
1028  this->m_comStatusOut_OutputPort[portNum].isConnected(),
1029  static_cast<FwAssertArgType>(portNum)
1030  );
1031  this->m_comStatusOut_OutputPort[portNum].invoke(
1032  condition
1033  );
1034  }
1035 
1038  FwIndexType portNum,
1039  Fw::Buffer& data,
1040  const ComCfg::FrameContext& context
1041  ) const
1042  {
1043  FW_ASSERT(
1044  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
1045  static_cast<FwAssertArgType>(portNum)
1046  );
1047 
1048  FW_ASSERT(
1049  this->m_dataOut_OutputPort[portNum].isConnected(),
1050  static_cast<FwAssertArgType>(portNum)
1051  );
1052  this->m_dataOut_OutputPort[portNum].invoke(
1053  data,
1054  context
1055  );
1056  }
1057 
1060  FwIndexType portNum,
1061  Fw::Buffer& data,
1062  const ComCfg::FrameContext& context
1063  ) const
1064  {
1065  FW_ASSERT(
1066  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
1067  static_cast<FwAssertArgType>(portNum)
1068  );
1069 
1070  FW_ASSERT(
1071  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
1072  static_cast<FwAssertArgType>(portNum)
1073  );
1074  this->m_dataReturnOut_OutputPort[portNum].invoke(
1075  data,
1076  context
1077  );
1078  }
1079 
1082  FwIndexType portNum,
1083  const ComCfg::Apid& apid,
1084  U16 sequenceCount
1085  ) const
1086  {
1087  FW_ASSERT(
1088  (0 <= portNum) && (portNum < this->getNum_getApidSeqCount_OutputPorts()),
1089  static_cast<FwAssertArgType>(portNum)
1090  );
1091 
1092  FW_ASSERT(
1093  this->m_getApidSeqCount_OutputPort[portNum].isConnected(),
1094  static_cast<FwAssertArgType>(portNum)
1095  );
1096  return this->m_getApidSeqCount_OutputPort[portNum].invoke(
1097  apid,
1098  sequenceCount
1099  );
1100  }
1101 
1102 #endif
1103 
1104  // ----------------------------------------------------------------------
1105  // Event logging functions
1106  // ----------------------------------------------------------------------
1107 
1110  {
1111  // Check throttle value
1112  if (this->m_NoBufferAvailableThrottle >= EVENTID_NOBUFFERAVAILABLE_THROTTLE) {
1113  return;
1114  }
1115  else {
1116  this->m_NoBufferAvailableThrottle++;
1117  }
1118 
1119  // Get the time
1120  Fw::Time _logTime;
1121  if (this->isConnected_timeCaller_OutputPort(0)) {
1122  this->timeCaller_out(0, _logTime);
1123  }
1124 
1125  const FwEventIdType _id = this->getIdBase() + EVENTID_NOBUFFERAVAILABLE;
1126 
1127  // Emit the event on the log port
1128  if (this->isConnected_logOut_OutputPort(0)) {
1129  Fw::LogBuffer _logBuff;
1130 
1131 #if FW_AMPCS_COMPATIBLE
1133  // Serialize the number of arguments
1134  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1135  FW_ASSERT(
1136  _status == Fw::FW_SERIALIZE_OK,
1137  static_cast<FwAssertArgType>(_status)
1138  );
1139 #endif
1140 
1141  this->logOut_out(
1142  0,
1143  _id,
1144  _logTime,
1146  _logBuff
1147  );
1148  }
1149 
1150  // Emit the event on the text log port
1151 #if FW_ENABLE_TEXT_LOGGING
1152  if (this->isConnected_logTextOut_OutputPort(0)) {
1153 #if FW_OBJECT_NAMES == 1
1154  const char* _formatString =
1155  "(%s) %s: Failed to allocate a packet buffer: packet dropped";
1156 #else
1157  const char* _formatString =
1158  "%s: Failed to allocate a packet buffer: packet dropped";
1159 #endif
1160 
1161  Fw::TextLogString _logString;
1162  (void) _logString.format(
1163  _formatString,
1164 #if FW_OBJECT_NAMES == 1
1165  this->m_objName.toChar(),
1166 #endif
1167  "NoBufferAvailable "
1168  );
1169 
1170  this->logTextOut_out(
1171  0,
1172  _id,
1173  _logTime,
1175  _logString
1176  );
1177  }
1178 #endif
1179  }
1180 
1181  // ----------------------------------------------------------------------
1182  // Event throttle reset functions
1183  // ----------------------------------------------------------------------
1184 
1187  {
1188  // Reset throttle counter
1189  this->m_NoBufferAvailableThrottle = 0;
1190  }
1191 
1192  // ----------------------------------------------------------------------
1193  // Time
1194  // ----------------------------------------------------------------------
1195 
1197  getTime() const
1198  {
1199  if (this->isConnected_timeCaller_OutputPort(0)) {
1200  Fw::Time _time;
1201  this->timeCaller_out(0, _time);
1202  return _time;
1203  }
1204  else {
1205  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1206  }
1207  }
1208 
1209  // ----------------------------------------------------------------------
1210  // Calls for messages received on typed input ports
1211  // ----------------------------------------------------------------------
1212 
1213  void SpacePacketFramerComponentBase ::
1214  m_p_comStatusIn_in(
1215  Fw::PassiveComponentBase* callComp,
1216  FwIndexType portNum,
1217  Fw::Success& condition
1218  )
1219  {
1220  FW_ASSERT(callComp != nullptr);
1221  SpacePacketFramerComponentBase* compPtr = static_cast<SpacePacketFramerComponentBase*>(callComp);
1222  compPtr->comStatusIn_handlerBase(
1223  portNum,
1224  condition
1225  );
1226  }
1227 
1228  void SpacePacketFramerComponentBase ::
1229  m_p_dataIn_in(
1230  Fw::PassiveComponentBase* callComp,
1231  FwIndexType portNum,
1232  Fw::Buffer& data,
1233  const ComCfg::FrameContext& context
1234  )
1235  {
1236  FW_ASSERT(callComp != nullptr);
1237  SpacePacketFramerComponentBase* compPtr = static_cast<SpacePacketFramerComponentBase*>(callComp);
1238  compPtr->dataIn_handlerBase(
1239  portNum,
1240  data,
1241  context
1242  );
1243  }
1244 
1245  void SpacePacketFramerComponentBase ::
1246  m_p_dataReturnIn_in(
1247  Fw::PassiveComponentBase* callComp,
1248  FwIndexType portNum,
1249  Fw::Buffer& data,
1250  const ComCfg::FrameContext& context
1251  )
1252  {
1253  FW_ASSERT(callComp != nullptr);
1254  SpacePacketFramerComponentBase* compPtr = static_cast<SpacePacketFramerComponentBase*>(callComp);
1255  compPtr->dataReturnIn_handlerBase(
1256  portNum,
1257  data,
1258  context
1259  );
1260  }
1261 
1262 #if !FW_DIRECT_PORT_CALLS
1263 
1264  // ----------------------------------------------------------------------
1265  // Invocation functions for special output ports
1266  // ----------------------------------------------------------------------
1267 
1268  void SpacePacketFramerComponentBase ::
1269  logOut_out(
1270  FwIndexType portNum,
1271  FwEventIdType id,
1272  Fw::Time& timeTag,
1273  const Fw::LogSeverity& severity,
1274  Fw::LogBuffer& args
1275  ) const
1276  {
1277  FW_ASSERT(
1278  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1279  static_cast<FwAssertArgType>(portNum)
1280  );
1281 
1282  FW_ASSERT(
1283  this->m_logOut_OutputPort[portNum].isConnected(),
1284  static_cast<FwAssertArgType>(portNum)
1285  );
1286  this->m_logOut_OutputPort[portNum].invoke(
1287  id,
1288  timeTag,
1289  severity,
1290  args
1291  );
1292  }
1293 
1294 #if FW_ENABLE_TEXT_LOGGING
1295 
1296  void SpacePacketFramerComponentBase ::
1297  logTextOut_out(
1298  FwIndexType portNum,
1299  FwEventIdType id,
1300  Fw::Time& timeTag,
1301  const Fw::LogSeverity& severity,
1302  Fw::TextLogString& text
1303  ) const
1304  {
1305  FW_ASSERT(
1306  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1307  static_cast<FwAssertArgType>(portNum)
1308  );
1309 
1310  FW_ASSERT(
1311  this->m_logTextOut_OutputPort[portNum].isConnected(),
1312  static_cast<FwAssertArgType>(portNum)
1313  );
1314  this->m_logTextOut_OutputPort[portNum].invoke(
1315  id,
1316  timeTag,
1317  severity,
1318  text
1319  );
1320  }
1321 
1322 #endif
1323 
1324  void SpacePacketFramerComponentBase ::
1325  timeCaller_out(
1326  FwIndexType portNum,
1327  Fw::Time& time
1328  ) const
1329  {
1330  FW_ASSERT(
1331  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1332  static_cast<FwAssertArgType>(portNum)
1333  );
1334 
1335  FW_ASSERT(
1336  this->m_timeCaller_OutputPort[portNum].isConnected(),
1337  static_cast<FwAssertArgType>(portNum)
1338  );
1339  this->m_timeCaller_OutputPort[portNum].invoke(
1340  time
1341  );
1342  }
1343 
1344 #endif
1345 
1346  }
1347 
1348 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
SpacePacketFramerComponentBase(const char *compName="")
Construct SpacePacketFramerComponentBase object.
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum) const
PlatformSizeType FwSizeType
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
I32 FwEnumStoreType
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum) const
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
No buffer was available to hold the packet, which was dropped.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
No time base has been established (Required)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void addCallPort(InputSuccessConditionPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_getApidSeqCount_OutputPorts()
void comStatusIn_handlerBase(FwIndexType portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
void init()
Initialization function.
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void addCallPort(InputPrmGetPort *callPort)
Register an input port.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
FwIdType FwEventIdType
The type of an event identifier.
void log_WARNING_HI_NoBufferAvailable_ThrottleClear()
Reset throttle value for NoBufferAvailable.
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferDeallocate.
void comStatusOut_out(FwIndexType portNum, Fw::Success &condition) const
Invoke output port comStatusOut.
static constexpr FwIndexType getNum_comStatusOut_OutputPorts()
bool isConnected_comStatusOut_OutputPort(FwIndexType portNum) const
void set_getApidSeqCount_OutputPort(FwIndexType portNum, Svc::Ccsds::InputApidSequenceCountPort *port)
Connect port to getApidSeqCount[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
void init()
Initialization function.
Definition: TimePortAc.cpp:151
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
static constexpr FwIndexType getNum_bufferAllocate_OutputPorts()
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void invoke(Fw::Success &condition) const
Invoke a port connection.
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
A serious but recoverable event.
void init()
Initialization function.
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
static constexpr FwIndexType getNum_bufferDeallocate_OutputPorts()
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
Fw::Buffer bufferAllocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port bufferAllocate.
Auto-generated base for SpacePacketFramer component.
void setPortNum(FwIndexType portNum)
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
bool isConnected_getApidSeqCount_OutputPort(FwIndexType portNum) const
Fw::Buffer invoke(FwSizeType size) const
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
U16 getApidSeqCount_out(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount) const
Invoke output port getApidSeqCount.
void init()
Initialization function.
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum) const
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
U16 invoke(const ComCfg::Apid &apid, U16 sequenceCount) const
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
Type used to pass context info between components during framing/deframing.
void init()
Initialization function.
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
RateGroupDivider component implementation.
Implementation of malloc based allocator.
virtual ~SpacePacketFramerComponentBase()
Destroy SpacePacketFramerComponentBase object.
void init()
Initialization function.
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
void init()
Initialization function.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
#define FW_ASSERT(...)
Definition: Assert.hpp:14
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:18
Success/Failure.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
void init()
Initialization function.
void addCallPort(InputApidSequenceCountPort *callPort)
Register an input port.