F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SpacePacketDeframerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SpacePacketDeframerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SpacePacketDeframer 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  // Connect input port dataIn
29  for (
30  FwIndexType port = 0;
31  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
32  port++
33  ) {
34  this->m_dataIn_InputPort[port].init();
35  this->m_dataIn_InputPort[port].addCallComp(
36  this,
37  m_p_dataIn_in
38  );
39  this->m_dataIn_InputPort[port].setPortNum(port);
40 
41 #if FW_OBJECT_NAMES == 1
42  Fw::ObjectName portName;
43  portName.format(
44  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
45  this->m_objName.toChar(),
46  port
47  );
48  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
49 #endif
50  }
51 
52  // Connect input port dataReturnIn
53  for (
54  FwIndexType port = 0;
55  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
56  port++
57  ) {
58  this->m_dataReturnIn_InputPort[port].init();
59  this->m_dataReturnIn_InputPort[port].addCallComp(
60  this,
61  m_p_dataReturnIn_in
62  );
63  this->m_dataReturnIn_InputPort[port].setPortNum(port);
64 
65 #if FW_OBJECT_NAMES == 1
66  Fw::ObjectName portName;
67  portName.format(
68  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
69  this->m_objName.toChar(),
70  port
71  );
72  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
73 #endif
74  }
75 
76  // Connect output port logOut
77  for (
78  FwIndexType port = 0;
79  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
80  port++
81  ) {
82  this->m_logOut_OutputPort[port].init();
83 
84 #if FW_OBJECT_NAMES == 1
85  Fw::ObjectName portName;
86  portName.format(
87  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
88  this->m_objName.toChar(),
89  port
90  );
91  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
92 #endif
93  }
94 
95 #if FW_ENABLE_TEXT_LOGGING == 1
96  // Connect output port logTextOut
97  for (
98  FwIndexType port = 0;
99  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
100  port++
101  ) {
102  this->m_logTextOut_OutputPort[port].init();
103 
104 #if FW_OBJECT_NAMES == 1
105  Fw::ObjectName portName;
106  portName.format(
107  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
108  this->m_objName.toChar(),
109  port
110  );
111  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
112 #endif
113  }
114 #endif
115 
116  // Connect output port prmGetOut
117  for (
118  FwIndexType port = 0;
119  port < static_cast<FwIndexType>(this->getNum_prmGetOut_OutputPorts());
120  port++
121  ) {
122  this->m_prmGetOut_OutputPort[port].init();
123 
124 #if FW_OBJECT_NAMES == 1
125  Fw::ObjectName portName;
126  portName.format(
127  "%s_prmGetOut_OutputPort[%" PRI_FwIndexType "]",
128  this->m_objName.toChar(),
129  port
130  );
131  this->m_prmGetOut_OutputPort[port].setObjName(portName.toChar());
132 #endif
133  }
134 
135  // Connect output port prmSetOut
136  for (
137  FwIndexType port = 0;
138  port < static_cast<FwIndexType>(this->getNum_prmSetOut_OutputPorts());
139  port++
140  ) {
141  this->m_prmSetOut_OutputPort[port].init();
142 
143 #if FW_OBJECT_NAMES == 1
144  Fw::ObjectName portName;
145  portName.format(
146  "%s_prmSetOut_OutputPort[%" PRI_FwIndexType "]",
147  this->m_objName.toChar(),
148  port
149  );
150  this->m_prmSetOut_OutputPort[port].setObjName(portName.toChar());
151 #endif
152  }
153 
154  // Connect output port timeCaller
155  for (
156  FwIndexType port = 0;
157  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
158  port++
159  ) {
160  this->m_timeCaller_OutputPort[port].init();
161 
162 #if FW_OBJECT_NAMES == 1
163  Fw::ObjectName portName;
164  portName.format(
165  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
166  this->m_objName.toChar(),
167  port
168  );
169  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
170 #endif
171  }
172 
173  // Connect output port tlmOut
174  for (
175  FwIndexType port = 0;
176  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
177  port++
178  ) {
179  this->m_tlmOut_OutputPort[port].init();
180 
181 #if FW_OBJECT_NAMES == 1
182  Fw::ObjectName portName;
183  portName.format(
184  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
185  this->m_objName.toChar(),
186  port
187  );
188  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
189 #endif
190  }
191 
192  // Connect output port dataOut
193  for (
194  FwIndexType port = 0;
195  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
196  port++
197  ) {
198  this->m_dataOut_OutputPort[port].init();
199 
200 #if FW_OBJECT_NAMES == 1
201  Fw::ObjectName portName;
202  portName.format(
203  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
204  this->m_objName.toChar(),
205  port
206  );
207  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
208 #endif
209  }
210 
211  // Connect output port dataReturnOut
212  for (
213  FwIndexType port = 0;
214  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
215  port++
216  ) {
217  this->m_dataReturnOut_OutputPort[port].init();
218 
219 #if FW_OBJECT_NAMES == 1
220  Fw::ObjectName portName;
221  portName.format(
222  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
223  this->m_objName.toChar(),
224  port
225  );
226  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
227 #endif
228  }
229 
230  // Connect output port errorNotify
231  for (
232  FwIndexType port = 0;
233  port < static_cast<FwIndexType>(this->getNum_errorNotify_OutputPorts());
234  port++
235  ) {
236  this->m_errorNotify_OutputPort[port].init();
237 
238 #if FW_OBJECT_NAMES == 1
239  Fw::ObjectName portName;
240  portName.format(
241  "%s_errorNotify_OutputPort[%" PRI_FwIndexType "]",
242  this->m_objName.toChar(),
243  port
244  );
245  this->m_errorNotify_OutputPort[port].setObjName(portName.toChar());
246 #endif
247  }
248 
249  // Connect output port validateApidSeqCount
250  for (
251  FwIndexType port = 0;
252  port < static_cast<FwIndexType>(this->getNum_validateApidSeqCount_OutputPorts());
253  port++
254  ) {
255  this->m_validateApidSeqCount_OutputPort[port].init();
256 
257 #if FW_OBJECT_NAMES == 1
258  Fw::ObjectName portName;
259  portName.format(
260  "%s_validateApidSeqCount_OutputPort[%" PRI_FwIndexType "]",
261  this->m_objName.toChar(),
262  port
263  );
264  this->m_validateApidSeqCount_OutputPort[port].setObjName(portName.toChar());
265 #endif
266  }
267  }
268 
269  // ----------------------------------------------------------------------
270  // Getters for typed input ports
271  // ----------------------------------------------------------------------
272 
275  {
276  FW_ASSERT(
277  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
278  static_cast<FwAssertArgType>(portNum)
279  );
280 
281  return &this->m_dataIn_InputPort[portNum];
282  }
283 
286  {
287  FW_ASSERT(
288  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
289  static_cast<FwAssertArgType>(portNum)
290  );
291 
292  return &this->m_dataReturnIn_InputPort[portNum];
293  }
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 SpacePacketDeframerComponentBase ::
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::InputPrmGetPort* port
335  )
336  {
337  FW_ASSERT(
338  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
339  static_cast<FwAssertArgType>(portNum)
340  );
341 
342  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
343  }
344 
347  FwIndexType portNum,
348  Fw::InputPrmSetPort* port
349  )
350  {
351  FW_ASSERT(
352  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
353  static_cast<FwAssertArgType>(portNum)
354  );
355 
356  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
357  }
358 
361  FwIndexType portNum,
362  Fw::InputTimePort* port
363  )
364  {
365  FW_ASSERT(
366  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
367  static_cast<FwAssertArgType>(portNum)
368  );
369 
370  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
371  }
372 
375  FwIndexType portNum,
376  Fw::InputTlmPort* port
377  )
378  {
379  FW_ASSERT(
380  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
381  static_cast<FwAssertArgType>(portNum)
382  );
383 
384  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
385  }
386 
387  // ----------------------------------------------------------------------
388  // Connect typed input ports to typed output ports
389  // ----------------------------------------------------------------------
390 
393  FwIndexType portNum,
395  )
396  {
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  this->m_dataOut_OutputPort[portNum].addCallPort(port);
403  }
404 
407  FwIndexType portNum,
409  )
410  {
411  FW_ASSERT(
412  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
413  static_cast<FwAssertArgType>(portNum)
414  );
415 
416  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
417  }
418 
421  FwIndexType portNum,
423  )
424  {
425  FW_ASSERT(
426  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
427  static_cast<FwAssertArgType>(portNum)
428  );
429 
430  this->m_errorNotify_OutputPort[portNum].addCallPort(port);
431  }
432 
435  FwIndexType portNum,
437  )
438  {
439  FW_ASSERT(
440  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
441  static_cast<FwAssertArgType>(portNum)
442  );
443 
444  this->m_validateApidSeqCount_OutputPort[portNum].addCallPort(port);
445  }
446 
447 #if FW_PORT_SERIALIZATION
448 
449  // ----------------------------------------------------------------------
450  // Connect serial input ports to special output ports
451  // ----------------------------------------------------------------------
452 
455  FwIndexType portNum,
456  Fw::InputSerializePort* port
457  )
458  {
459  FW_ASSERT(
460  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
461  static_cast<FwAssertArgType>(portNum)
462  );
463 
464  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
465  }
466 
467 #if FW_ENABLE_TEXT_LOGGING == 1
468 
469  void SpacePacketDeframerComponentBase ::
470  set_logTextOut_OutputPort(
471  FwIndexType portNum,
472  Fw::InputSerializePort* port
473  )
474  {
475  FW_ASSERT(
476  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
481  }
482 
483 #endif
484 
487  FwIndexType portNum,
488  Fw::InputSerializePort* port
489  )
490  {
491  FW_ASSERT(
492  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
493  static_cast<FwAssertArgType>(portNum)
494  );
495 
496  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
497  }
498 
501  FwIndexType portNum,
502  Fw::InputSerializePort* port
503  )
504  {
505  FW_ASSERT(
506  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
507  static_cast<FwAssertArgType>(portNum)
508  );
509 
510  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
511  }
512 
515  FwIndexType portNum,
516  Fw::InputSerializePort* port
517  )
518  {
519  FW_ASSERT(
520  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
521  static_cast<FwAssertArgType>(portNum)
522  );
523 
524  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
525  }
526 
527 #endif
528 
529 #if FW_PORT_SERIALIZATION
530 
531  // ----------------------------------------------------------------------
532  // Connect serial input ports to typed output ports
533  // ----------------------------------------------------------------------
534 
537  FwIndexType portNum,
538  Fw::InputSerializePort* port
539  )
540  {
541  FW_ASSERT(
542  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
543  static_cast<FwAssertArgType>(portNum)
544  );
545 
546  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
547  }
548 
551  FwIndexType portNum,
552  Fw::InputSerializePort* port
553  )
554  {
555  FW_ASSERT(
556  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
557  static_cast<FwAssertArgType>(portNum)
558  );
559 
560  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
561  }
562 
565  FwIndexType portNum,
566  Fw::InputSerializePort* port
567  )
568  {
569  FW_ASSERT(
570  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
571  static_cast<FwAssertArgType>(portNum)
572  );
573 
574  this->m_errorNotify_OutputPort[portNum].registerSerialPort(port);
575  }
576 
577 #endif
578 
579  // ----------------------------------------------------------------------
580  // Component construction and destruction
581  // ----------------------------------------------------------------------
582 
584  SpacePacketDeframerComponentBase(const char* compName) :
585  Fw::PassiveComponentBase(compName)
586  {
587 
588  }
589 
592  {
593 
594  }
595 
596  // ----------------------------------------------------------------------
597  // Getters for numbers of typed input ports
598  // ----------------------------------------------------------------------
599 
602  {
603  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataIn_InputPort));
604  }
605 
608  {
609  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnIn_InputPort));
610  }
611 
612  // ----------------------------------------------------------------------
613  // Getters for numbers of special output ports
614  // ----------------------------------------------------------------------
615 
618  {
619  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
620  }
621 
622 #if FW_ENABLE_TEXT_LOGGING == 1
623 
624  FwIndexType SpacePacketDeframerComponentBase ::
625  getNum_logTextOut_OutputPorts() const
626  {
627  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logTextOut_OutputPort));
628  }
629 
630 #endif
631 
634  {
635  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort));
636  }
637 
640  {
641  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort));
642  }
643 
646  {
647  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
648  }
649 
652  {
653  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
654  }
655 
656  // ----------------------------------------------------------------------
657  // Getters for numbers of typed output ports
658  // ----------------------------------------------------------------------
659 
662  {
663  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataOut_OutputPort));
664  }
665 
668  {
669  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnOut_OutputPort));
670  }
671 
674  {
675  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_errorNotify_OutputPort));
676  }
677 
680  {
681  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_validateApidSeqCount_OutputPort));
682  }
683 
684  // ----------------------------------------------------------------------
685  // Connection status queries for special output ports
686  // ----------------------------------------------------------------------
687 
690  {
691  FW_ASSERT(
692  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
693  static_cast<FwAssertArgType>(portNum)
694  );
695 
696  return this->m_logOut_OutputPort[portNum].isConnected();
697  }
698 
699 #if FW_ENABLE_TEXT_LOGGING == 1
700 
701  bool SpacePacketDeframerComponentBase ::
702  isConnected_logTextOut_OutputPort(FwIndexType portNum)
703  {
704  FW_ASSERT(
705  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
706  static_cast<FwAssertArgType>(portNum)
707  );
708 
709  return this->m_logTextOut_OutputPort[portNum].isConnected();
710  }
711 
712 #endif
713 
716  {
717  FW_ASSERT(
718  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
719  static_cast<FwAssertArgType>(portNum)
720  );
721 
722  return this->m_prmGetOut_OutputPort[portNum].isConnected();
723  }
724 
727  {
728  FW_ASSERT(
729  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
730  static_cast<FwAssertArgType>(portNum)
731  );
732 
733  return this->m_prmSetOut_OutputPort[portNum].isConnected();
734  }
735 
738  {
739  FW_ASSERT(
740  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
741  static_cast<FwAssertArgType>(portNum)
742  );
743 
744  return this->m_timeCaller_OutputPort[portNum].isConnected();
745  }
746 
749  {
750  FW_ASSERT(
751  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
752  static_cast<FwAssertArgType>(portNum)
753  );
754 
755  return this->m_tlmOut_OutputPort[portNum].isConnected();
756  }
757 
758  // ----------------------------------------------------------------------
759  // Connection status queries for typed output ports
760  // ----------------------------------------------------------------------
761 
764  {
765  FW_ASSERT(
766  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
767  static_cast<FwAssertArgType>(portNum)
768  );
769 
770  return this->m_dataOut_OutputPort[portNum].isConnected();
771  }
772 
775  {
776  FW_ASSERT(
777  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
778  static_cast<FwAssertArgType>(portNum)
779  );
780 
781  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
782  }
783 
786  {
787  FW_ASSERT(
788  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
789  static_cast<FwAssertArgType>(portNum)
790  );
791 
792  return this->m_errorNotify_OutputPort[portNum].isConnected();
793  }
794 
797  {
798  FW_ASSERT(
799  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
800  static_cast<FwAssertArgType>(portNum)
801  );
802 
803  return this->m_validateApidSeqCount_OutputPort[portNum].isConnected();
804  }
805 
806  // ----------------------------------------------------------------------
807  // Port handler base-class functions for typed input ports
808  //
809  // Call these functions directly to bypass the corresponding ports
810  // ----------------------------------------------------------------------
811 
814  FwIndexType portNum,
815  Fw::Buffer& data,
816  const ComCfg::FrameContext& context
817  )
818  {
819  // Make sure port number is valid
820  FW_ASSERT(
821  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
822  static_cast<FwAssertArgType>(portNum)
823  );
824 
825  // Lock guard mutex before calling
826  this->lock();
827 
828  // Call handler function
829  this->dataIn_handler(
830  portNum,
831  data,
832  context
833  );
834 
835  // Unlock guard mutex
836  this->unLock();
837  }
838 
841  FwIndexType portNum,
842  Fw::Buffer& data,
843  const ComCfg::FrameContext& context
844  )
845  {
846  // Make sure port number is valid
847  FW_ASSERT(
848  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
849  static_cast<FwAssertArgType>(portNum)
850  );
851 
852  // Call handler function
853  this->dataReturnIn_handler(
854  portNum,
855  data,
856  context
857  );
858  }
859 
860  // ----------------------------------------------------------------------
861  // Invocation functions for typed output ports
862  // ----------------------------------------------------------------------
863 
866  FwIndexType portNum,
867  Fw::Buffer& data,
868  const ComCfg::FrameContext& context
869  )
870  {
871  FW_ASSERT(
872  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
873  static_cast<FwAssertArgType>(portNum)
874  );
875 
876  FW_ASSERT(
877  this->m_dataOut_OutputPort[portNum].isConnected(),
878  static_cast<FwAssertArgType>(portNum)
879  );
880  this->m_dataOut_OutputPort[portNum].invoke(
881  data,
882  context
883  );
884  }
885 
888  FwIndexType portNum,
889  Fw::Buffer& data,
890  const ComCfg::FrameContext& context
891  )
892  {
893  FW_ASSERT(
894  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
895  static_cast<FwAssertArgType>(portNum)
896  );
897 
898  FW_ASSERT(
899  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
900  static_cast<FwAssertArgType>(portNum)
901  );
902  this->m_dataReturnOut_OutputPort[portNum].invoke(
903  data,
904  context
905  );
906  }
907 
910  FwIndexType portNum,
911  const Svc::Ccsds::FrameError& errorCode
912  )
913  {
914  FW_ASSERT(
915  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
916  static_cast<FwAssertArgType>(portNum)
917  );
918 
919  FW_ASSERT(
920  this->m_errorNotify_OutputPort[portNum].isConnected(),
921  static_cast<FwAssertArgType>(portNum)
922  );
923  this->m_errorNotify_OutputPort[portNum].invoke(
924  errorCode
925  );
926  }
927 
930  FwIndexType portNum,
931  const ComCfg::Apid& apid,
932  U16 sequenceCount
933  )
934  {
935  FW_ASSERT(
936  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
937  static_cast<FwAssertArgType>(portNum)
938  );
939 
940  FW_ASSERT(
941  this->m_validateApidSeqCount_OutputPort[portNum].isConnected(),
942  static_cast<FwAssertArgType>(portNum)
943  );
944  return this->m_validateApidSeqCount_OutputPort[portNum].invoke(
945  apid,
946  sequenceCount
947  );
948  }
949 
950  // ----------------------------------------------------------------------
951  // Event logging functions
952  // ----------------------------------------------------------------------
953 
956  U16 transmitted,
957  FwSizeType actual
958  ) const
959  {
960  // Get the time
961  Fw::Time _logTime;
962  if (this->m_timeCaller_OutputPort[0].isConnected()) {
963  this->m_timeCaller_OutputPort[0].invoke(_logTime);
964  }
965 
966  FwEventIdType _id = static_cast<FwEventIdType>(0);
967 
968  _id = this->getIdBase() + EVENTID_INVALIDLENGTH;
969 
970  // Emit the event on the log port
971  if (this->m_logOut_OutputPort[0].isConnected()) {
972  Fw::LogBuffer _logBuff;
974 
975 #if FW_AMPCS_COMPATIBLE
976  // Serialize the number of arguments
977  _status = _logBuff.serializeFrom(static_cast<U8>(2));
978  FW_ASSERT(
979  _status == Fw::FW_SERIALIZE_OK,
980  static_cast<FwAssertArgType>(_status)
981  );
982 #endif
983 
984 #if FW_AMPCS_COMPATIBLE
985  // Serialize the argument size
986  _status = _logBuff.serializeFrom(
987  static_cast<U8>(sizeof(U16))
988  );
989  FW_ASSERT(
990  _status == Fw::FW_SERIALIZE_OK,
991  static_cast<FwAssertArgType>(_status)
992  );
993 #endif
994  _status = _logBuff.serializeFrom(transmitted);
995  FW_ASSERT(
996  _status == Fw::FW_SERIALIZE_OK,
997  static_cast<FwAssertArgType>(_status)
998  );
999 
1000 #if FW_AMPCS_COMPATIBLE
1001  // Serialize the argument size
1002  _status = _logBuff.serializeFrom(
1003  static_cast<U8>(sizeof(FwSizeType))
1004  );
1005  FW_ASSERT(
1006  _status == Fw::FW_SERIALIZE_OK,
1007  static_cast<FwAssertArgType>(_status)
1008  );
1009 #endif
1010  _status = _logBuff.serializeFrom(actual);
1011  FW_ASSERT(
1012  _status == Fw::FW_SERIALIZE_OK,
1013  static_cast<FwAssertArgType>(_status)
1014  );
1015 
1016  this->m_logOut_OutputPort[0].invoke(
1017  _id,
1018  _logTime,
1020  _logBuff
1021  );
1022  }
1023 
1024  // Emit the event on the text log port
1025 #if FW_ENABLE_TEXT_LOGGING
1026  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1027 #if FW_OBJECT_NAMES == 1
1028  const char* _formatString =
1029  "(%s) %s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu64 "";
1030 #else
1031  const char* _formatString =
1032  "%s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu64 "";
1033 #endif
1034 
1035  Fw::TextLogString _logString;
1036  _logString.format(
1037  _formatString,
1038 #if FW_OBJECT_NAMES == 1
1039  this->m_objName.toChar(),
1040 #endif
1041  "InvalidLength ",
1042  transmitted,
1043  actual
1044  );
1045 
1046  this->m_logTextOut_OutputPort[0].invoke(
1047  _id,
1048  _logTime,
1050  _logString
1051  );
1052  }
1053 #endif
1054  }
1055 
1056  // ----------------------------------------------------------------------
1057  // Time
1058  // ----------------------------------------------------------------------
1059 
1061  getTime() const
1062  {
1063  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1064  Fw::Time _time;
1065  this->m_timeCaller_OutputPort[0].invoke(_time);
1066  return _time;
1067  }
1068  else {
1069  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1070  }
1071  }
1072 
1073  // ----------------------------------------------------------------------
1074  // Mutex operations for guarded ports
1075  //
1076  // You can override these operations to provide more sophisticated
1077  // synchronization
1078  // ----------------------------------------------------------------------
1079 
1082  {
1083  this->m_guardedPortMutex.lock();
1084  }
1085 
1088  {
1089  this->m_guardedPortMutex.unLock();
1090  }
1091 
1092  // ----------------------------------------------------------------------
1093  // Calls for messages received on typed input ports
1094  // ----------------------------------------------------------------------
1095 
1096  void SpacePacketDeframerComponentBase ::
1097  m_p_dataIn_in(
1098  Fw::PassiveComponentBase* callComp,
1099  FwIndexType portNum,
1100  Fw::Buffer& data,
1101  const ComCfg::FrameContext& context
1102  )
1103  {
1104  FW_ASSERT(callComp);
1105  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1106  compPtr->dataIn_handlerBase(
1107  portNum,
1108  data,
1109  context
1110  );
1111  }
1112 
1113  void SpacePacketDeframerComponentBase ::
1114  m_p_dataReturnIn_in(
1115  Fw::PassiveComponentBase* callComp,
1116  FwIndexType portNum,
1117  Fw::Buffer& data,
1118  const ComCfg::FrameContext& context
1119  )
1120  {
1121  FW_ASSERT(callComp);
1122  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1123  compPtr->dataReturnIn_handlerBase(
1124  portNum,
1125  data,
1126  context
1127  );
1128  }
1129 
1130  }
1131 
1132 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
Enum representing an error during framing/deframing in the CCSDS protocols.
PlatformSizeType FwSizeType
void set_errorNotify_OutputPort(FwIndexType portNum, Svc::Ccsds::InputErrorNotifyPort *port)
Connect port to errorNotify[portNum].
I32 FwEnumStoreType
void init()
Initialization function.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void log_WARNING_HI_InvalidLength(U16 transmitted, FwSizeType actual) const
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
No time base has been established (Required)
void init()
Initialization function.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void addCallPort(InputPrmGetPort *callPort)
Register an input port.
void init()
Object initializer.
Definition: ObjBase.cpp:24
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
SerializeStatus
forward declaration for string
void addCallPort(InputErrorNotifyPort *callPort)
Register an input port.
FwIdType FwEventIdType
The type of an event identifier.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
#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:128
void invoke(const Svc::Ccsds::FrameError &errorCode) const
Invoke a port interface.
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
const char * toChar() const
Definition: ObjectName.hpp:50
SpacePacketDeframerComponentBase(const char *compName="")
Construct SpacePacketDeframerComponentBase object.
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port interface.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
A serious but recoverable event.
void init()
Initialization function.
bool isConnected() const
Definition: PortBase.cpp:38
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode)
Invoke output port errorNotify.
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void setPortNum(FwIndexType portNum)
void init()
Initialization function.
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
PlatformIndexType FwIndexType
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:90
U16 invoke(const ComCfg::Apid &apid, U16 sequenceCount) const
Invoke a port interface.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
Type used to pass context info between components during framing/deframing.
void set_validateApidSeqCount_OutputPort(FwIndexType portNum, Svc::Ccsds::InputApidSequenceCountPort *port)
Connect port to validateApidSeqCount[portNum].
RateGroupDivider component implementation.
Auto-generated base for SpacePacketDeframer component.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
void init()
Initialization function.
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
#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:17
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
void addCallPort(InputApidSequenceCountPort *callPort)
Register an input port.
virtual ~SpacePacketDeframerComponentBase()
Destroy SpacePacketDeframerComponentBase object.
U16 validateApidSeqCount_out(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount)
Invoke output port validateApidSeqCount.