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  U16 transmitted,
869  FwSizeType actual
870  ) const
871  {
872  // Get the time
873  Fw::Time _logTime;
874  if (this->m_timeCaller_OutputPort[0].isConnected()) {
875  this->m_timeCaller_OutputPort[0].invoke(_logTime);
876  }
877 
878  FwEventIdType _id = static_cast<FwEventIdType>(0);
879 
880  _id = this->getIdBase() + EVENTID_INVALIDLENGTH;
881 
882  // Emit the event on the log port
883  if (this->m_logOut_OutputPort[0].isConnected()) {
884  Fw::LogBuffer _logBuff;
886 
887 #if FW_AMPCS_COMPATIBLE
888  // Serialize the number of arguments
889  _status = _logBuff.serializeFrom(static_cast<U8>(2));
890  FW_ASSERT(
891  _status == Fw::FW_SERIALIZE_OK,
892  static_cast<FwAssertArgType>(_status)
893  );
894 #endif
895 
896 #if FW_AMPCS_COMPATIBLE
897  // Serialize the argument size
898  _status = _logBuff.serializeFrom(
899  static_cast<U8>(sizeof(U16))
900  );
901  FW_ASSERT(
902  _status == Fw::FW_SERIALIZE_OK,
903  static_cast<FwAssertArgType>(_status)
904  );
905 #endif
906  _status = _logBuff.serializeFrom(transmitted);
907  FW_ASSERT(
908  _status == Fw::FW_SERIALIZE_OK,
909  static_cast<FwAssertArgType>(_status)
910  );
911 
912 #if FW_AMPCS_COMPATIBLE
913  // Serialize the argument size
914  _status = _logBuff.serializeFrom(
915  static_cast<U8>(sizeof(FwSizeType))
916  );
917  FW_ASSERT(
918  _status == Fw::FW_SERIALIZE_OK,
919  static_cast<FwAssertArgType>(_status)
920  );
921 #endif
922  _status = _logBuff.serializeFrom(actual);
923  FW_ASSERT(
924  _status == Fw::FW_SERIALIZE_OK,
925  static_cast<FwAssertArgType>(_status)
926  );
927 
928  this->m_logOut_OutputPort[0].invoke(
929  _id,
930  _logTime,
932  _logBuff
933  );
934  }
935 
936  // Emit the event on the text log port
937 #if FW_ENABLE_TEXT_LOGGING
938  if (this->m_logTextOut_OutputPort[0].isConnected()) {
939 #if FW_OBJECT_NAMES == 1
940  const char* _formatString =
941  "(%s) %s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu64 "";
942 #else
943  const char* _formatString =
944  "%s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu64 "";
945 #endif
946 
947  Fw::TextLogString _logString;
948  _logString.format(
949  _formatString,
950 #if FW_OBJECT_NAMES == 1
951  this->m_objName.toChar(),
952 #endif
953  "InvalidLength ",
954  transmitted,
955  actual
956  );
957 
958  this->m_logTextOut_OutputPort[0].invoke(
959  _id,
960  _logTime,
962  _logString
963  );
964  }
965 #endif
966  }
967 
968  // ----------------------------------------------------------------------
969  // Time
970  // ----------------------------------------------------------------------
971 
973  getTime() const
974  {
975  if (this->m_timeCaller_OutputPort[0].isConnected()) {
976  Fw::Time _time;
977  this->m_timeCaller_OutputPort[0].invoke(_time);
978  return _time;
979  }
980  else {
981  return Fw::Time(TimeBase::TB_NONE, 0, 0);
982  }
983  }
984 
985  // ----------------------------------------------------------------------
986  // Mutex operations for guarded ports
987  //
988  // You can override these operations to provide more sophisticated
989  // synchronization
990  // ----------------------------------------------------------------------
991 
994  {
995  this->m_guardedPortMutex.lock();
996  }
997 
1000  {
1001  this->m_guardedPortMutex.unLock();
1002  }
1003 
1004  // ----------------------------------------------------------------------
1005  // Calls for messages received on typed input ports
1006  // ----------------------------------------------------------------------
1007 
1008  void SpacePacketDeframerComponentBase ::
1009  m_p_dataIn_in(
1010  Fw::PassiveComponentBase* callComp,
1011  FwIndexType portNum,
1012  Fw::Buffer& data,
1013  const ComCfg::FrameContext& context
1014  )
1015  {
1016  FW_ASSERT(callComp);
1017  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1018  compPtr->dataIn_handlerBase(
1019  portNum,
1020  data,
1021  context
1022  );
1023  }
1024 
1025  void SpacePacketDeframerComponentBase ::
1026  m_p_dataReturnIn_in(
1027  Fw::PassiveComponentBase* callComp,
1028  FwIndexType portNum,
1029  Fw::Buffer& data,
1030  const ComCfg::FrameContext& context
1031  )
1032  {
1033  FW_ASSERT(callComp);
1034  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1035  compPtr->dataReturnIn_handlerBase(
1036  portNum,
1037  data,
1038  context
1039  );
1040  }
1041 
1042  }
1043 
1044 }
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:26
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.