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  // Connection status queries for special output ports
598  // ----------------------------------------------------------------------
599 
602  {
603  FW_ASSERT(
604  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
605  static_cast<FwAssertArgType>(portNum)
606  );
607 
608  return this->m_logOut_OutputPort[portNum].isConnected();
609  }
610 
611 #if FW_ENABLE_TEXT_LOGGING == 1
612 
613  bool SpacePacketDeframerComponentBase ::
614  isConnected_logTextOut_OutputPort(FwIndexType portNum)
615  {
616  FW_ASSERT(
617  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
618  static_cast<FwAssertArgType>(portNum)
619  );
620 
621  return this->m_logTextOut_OutputPort[portNum].isConnected();
622  }
623 
624 #endif
625 
628  {
629  FW_ASSERT(
630  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
631  static_cast<FwAssertArgType>(portNum)
632  );
633 
634  return this->m_prmGetOut_OutputPort[portNum].isConnected();
635  }
636 
639  {
640  FW_ASSERT(
641  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
642  static_cast<FwAssertArgType>(portNum)
643  );
644 
645  return this->m_prmSetOut_OutputPort[portNum].isConnected();
646  }
647 
650  {
651  FW_ASSERT(
652  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
653  static_cast<FwAssertArgType>(portNum)
654  );
655 
656  return this->m_timeCaller_OutputPort[portNum].isConnected();
657  }
658 
661  {
662  FW_ASSERT(
663  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
664  static_cast<FwAssertArgType>(portNum)
665  );
666 
667  return this->m_tlmOut_OutputPort[portNum].isConnected();
668  }
669 
670  // ----------------------------------------------------------------------
671  // Connection status queries for typed output ports
672  // ----------------------------------------------------------------------
673 
676  {
677  FW_ASSERT(
678  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
679  static_cast<FwAssertArgType>(portNum)
680  );
681 
682  return this->m_dataOut_OutputPort[portNum].isConnected();
683  }
684 
687  {
688  FW_ASSERT(
689  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
690  static_cast<FwAssertArgType>(portNum)
691  );
692 
693  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
694  }
695 
698  {
699  FW_ASSERT(
700  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
701  static_cast<FwAssertArgType>(portNum)
702  );
703 
704  return this->m_errorNotify_OutputPort[portNum].isConnected();
705  }
706 
709  {
710  FW_ASSERT(
711  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
712  static_cast<FwAssertArgType>(portNum)
713  );
714 
715  return this->m_validateApidSeqCount_OutputPort[portNum].isConnected();
716  }
717 
718  // ----------------------------------------------------------------------
719  // Port handler base-class functions for typed input ports
720  //
721  // Call these functions directly to bypass the corresponding ports
722  // ----------------------------------------------------------------------
723 
726  FwIndexType portNum,
727  Fw::Buffer& data,
728  const ComCfg::FrameContext& context
729  )
730  {
731  // Make sure port number is valid
732  FW_ASSERT(
733  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
734  static_cast<FwAssertArgType>(portNum)
735  );
736 
737  // Lock guard mutex before calling
738  this->lock();
739 
740  // Call handler function
741  this->dataIn_handler(
742  portNum,
743  data,
744  context
745  );
746 
747  // Unlock guard mutex
748  this->unLock();
749  }
750 
753  FwIndexType portNum,
754  Fw::Buffer& data,
755  const ComCfg::FrameContext& context
756  )
757  {
758  // Make sure port number is valid
759  FW_ASSERT(
760  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
761  static_cast<FwAssertArgType>(portNum)
762  );
763 
764  // Call handler function
765  this->dataReturnIn_handler(
766  portNum,
767  data,
768  context
769  );
770  }
771 
772  // ----------------------------------------------------------------------
773  // Invocation functions for typed output ports
774  // ----------------------------------------------------------------------
775 
778  FwIndexType portNum,
779  Fw::Buffer& data,
780  const ComCfg::FrameContext& context
781  )
782  {
783  FW_ASSERT(
784  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
785  static_cast<FwAssertArgType>(portNum)
786  );
787 
788  FW_ASSERT(
789  this->m_dataOut_OutputPort[portNum].isConnected(),
790  static_cast<FwAssertArgType>(portNum)
791  );
792  this->m_dataOut_OutputPort[portNum].invoke(
793  data,
794  context
795  );
796  }
797 
800  FwIndexType portNum,
801  Fw::Buffer& data,
802  const ComCfg::FrameContext& context
803  )
804  {
805  FW_ASSERT(
806  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
807  static_cast<FwAssertArgType>(portNum)
808  );
809 
810  FW_ASSERT(
811  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
812  static_cast<FwAssertArgType>(portNum)
813  );
814  this->m_dataReturnOut_OutputPort[portNum].invoke(
815  data,
816  context
817  );
818  }
819 
822  FwIndexType portNum,
823  const Svc::Ccsds::FrameError& errorCode
824  )
825  {
826  FW_ASSERT(
827  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
828  static_cast<FwAssertArgType>(portNum)
829  );
830 
831  FW_ASSERT(
832  this->m_errorNotify_OutputPort[portNum].isConnected(),
833  static_cast<FwAssertArgType>(portNum)
834  );
835  this->m_errorNotify_OutputPort[portNum].invoke(
836  errorCode
837  );
838  }
839 
842  FwIndexType portNum,
843  const ComCfg::Apid& apid,
844  U16 sequenceCount
845  )
846  {
847  FW_ASSERT(
848  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
849  static_cast<FwAssertArgType>(portNum)
850  );
851 
852  FW_ASSERT(
853  this->m_validateApidSeqCount_OutputPort[portNum].isConnected(),
854  static_cast<FwAssertArgType>(portNum)
855  );
856  return this->m_validateApidSeqCount_OutputPort[portNum].invoke(
857  apid,
858  sequenceCount
859  );
860  }
861 
862  // ----------------------------------------------------------------------
863  // Event logging functions
864  // ----------------------------------------------------------------------
865 
868  {
869  // Get the time
870  Fw::Time _logTime;
871  if (this->m_timeCaller_OutputPort[0].isConnected()) {
872  this->m_timeCaller_OutputPort[0].invoke(_logTime);
873  }
874 
875  FwEventIdType _id = static_cast<FwEventIdType>(0);
876 
877  _id = this->getIdBase() + EVENTID_INVALIDPACKET;
878 
879  // Emit the event on the log port
880  if (this->m_logOut_OutputPort[0].isConnected()) {
881  Fw::LogBuffer _logBuff;
882 
883 #if FW_AMPCS_COMPATIBLE
885  // Serialize the number of arguments
886  _status = _logBuff.serializeFrom(static_cast<U8>(0));
887  FW_ASSERT(
888  _status == Fw::FW_SERIALIZE_OK,
889  static_cast<FwAssertArgType>(_status)
890  );
891 #endif
892 
893  this->m_logOut_OutputPort[0].invoke(
894  _id,
895  _logTime,
897  _logBuff
898  );
899  }
900 
901  // Emit the event on the text log port
902 #if FW_ENABLE_TEXT_LOGGING
903  if (this->m_logTextOut_OutputPort[0].isConnected()) {
904 #if FW_OBJECT_NAMES == 1
905  const char* _formatString =
906  "(%s) %s: Malformed packet received refusing to deframe";
907 #else
908  const char* _formatString =
909  "%s: Malformed packet received refusing to deframe";
910 #endif
911 
912  Fw::TextLogString _logString;
913  _logString.format(
914  _formatString,
915 #if FW_OBJECT_NAMES == 1
916  this->m_objName.toChar(),
917 #endif
918  "InvalidPacket "
919  );
920 
921  this->m_logTextOut_OutputPort[0].invoke(
922  _id,
923  _logTime,
925  _logString
926  );
927  }
928 #endif
929  }
930 
933  U16 transmitted,
934  FwSizeType actual
935  ) const
936  {
937  // Get the time
938  Fw::Time _logTime;
939  if (this->m_timeCaller_OutputPort[0].isConnected()) {
940  this->m_timeCaller_OutputPort[0].invoke(_logTime);
941  }
942 
943  FwEventIdType _id = static_cast<FwEventIdType>(0);
944 
945  _id = this->getIdBase() + EVENTID_INVALIDLENGTH;
946 
947  // Emit the event on the log port
948  if (this->m_logOut_OutputPort[0].isConnected()) {
949  Fw::LogBuffer _logBuff;
951 
952 #if FW_AMPCS_COMPATIBLE
953  // Serialize the number of arguments
954  _status = _logBuff.serializeFrom(static_cast<U8>(2));
955  FW_ASSERT(
956  _status == Fw::FW_SERIALIZE_OK,
957  static_cast<FwAssertArgType>(_status)
958  );
959 #endif
960 
961 #if FW_AMPCS_COMPATIBLE
962  // Serialize the argument size
963  _status = _logBuff.serializeFrom(
964  static_cast<U8>(sizeof(U16))
965  );
966  FW_ASSERT(
967  _status == Fw::FW_SERIALIZE_OK,
968  static_cast<FwAssertArgType>(_status)
969  );
970 #endif
971  _status = _logBuff.serializeFrom(transmitted);
972  FW_ASSERT(
973  _status == Fw::FW_SERIALIZE_OK,
974  static_cast<FwAssertArgType>(_status)
975  );
976 
977 #if FW_AMPCS_COMPATIBLE
978  // Serialize the argument size
979  _status = _logBuff.serializeFrom(
980  static_cast<U8>(sizeof(FwSizeType))
981  );
982  FW_ASSERT(
983  _status == Fw::FW_SERIALIZE_OK,
984  static_cast<FwAssertArgType>(_status)
985  );
986 #endif
987  _status = _logBuff.serializeFrom(actual);
988  FW_ASSERT(
989  _status == Fw::FW_SERIALIZE_OK,
990  static_cast<FwAssertArgType>(_status)
991  );
992 
993  this->m_logOut_OutputPort[0].invoke(
994  _id,
995  _logTime,
997  _logBuff
998  );
999  }
1000 
1001  // Emit the event on the text log port
1002 #if FW_ENABLE_TEXT_LOGGING
1003  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1004 #if FW_OBJECT_NAMES == 1
1005  const char* _formatString =
1006  "(%s) %s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu64 "";
1007 #else
1008  const char* _formatString =
1009  "%s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu64 "";
1010 #endif
1011 
1012  Fw::TextLogString _logString;
1013  _logString.format(
1014  _formatString,
1015 #if FW_OBJECT_NAMES == 1
1016  this->m_objName.toChar(),
1017 #endif
1018  "InvalidLength ",
1019  transmitted,
1020  actual
1021  );
1022 
1023  this->m_logTextOut_OutputPort[0].invoke(
1024  _id,
1025  _logTime,
1027  _logString
1028  );
1029  }
1030 #endif
1031  }
1032 
1033  // ----------------------------------------------------------------------
1034  // Time
1035  // ----------------------------------------------------------------------
1036 
1038  getTime() const
1039  {
1040  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1041  Fw::Time _time;
1042  this->m_timeCaller_OutputPort[0].invoke(_time);
1043  return _time;
1044  }
1045  else {
1046  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1047  }
1048  }
1049 
1050  // ----------------------------------------------------------------------
1051  // Mutex operations for guarded ports
1052  //
1053  // You can override these operations to provide more sophisticated
1054  // synchronization
1055  // ----------------------------------------------------------------------
1056 
1059  {
1060  this->m_guardedPortMutex.lock();
1061  }
1062 
1065  {
1066  this->m_guardedPortMutex.unLock();
1067  }
1068 
1069  // ----------------------------------------------------------------------
1070  // Calls for messages received on typed input ports
1071  // ----------------------------------------------------------------------
1072 
1073  void SpacePacketDeframerComponentBase ::
1074  m_p_dataIn_in(
1075  Fw::PassiveComponentBase* callComp,
1076  FwIndexType portNum,
1077  Fw::Buffer& data,
1078  const ComCfg::FrameContext& context
1079  )
1080  {
1081  FW_ASSERT(callComp);
1082  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1083  compPtr->dataIn_handlerBase(
1084  portNum,
1085  data,
1086  context
1087  );
1088  }
1089 
1090  void SpacePacketDeframerComponentBase ::
1091  m_p_dataReturnIn_in(
1092  Fw::PassiveComponentBase* callComp,
1093  FwIndexType portNum,
1094  Fw::Buffer& data,
1095  const ComCfg::FrameContext& context
1096  )
1097  {
1098  FW_ASSERT(callComp);
1099  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1100  compPtr->dataReturnIn_handlerBase(
1101  portNum,
1102  data,
1103  context
1104  );
1105  }
1106 
1107  }
1108 
1109 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
static constexpr FwIndexType getNum_validateApidSeqCount_OutputPorts()
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
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:31
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
Convert to a C-style char*.
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:39
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
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.
Implementation of malloc based allocator.
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.