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 validateApidSeqCount
231  for (
232  FwIndexType port = 0;
233  port < static_cast<FwIndexType>(this->getNum_validateApidSeqCount_OutputPorts());
234  port++
235  ) {
236  this->m_validateApidSeqCount_OutputPort[port].init();
237 
238 #if FW_OBJECT_NAMES == 1
239  Fw::ObjectName portName;
240  portName.format(
241  "%s_validateApidSeqCount_OutputPort[%" PRI_FwIndexType "]",
242  this->m_objName.toChar(),
243  port
244  );
245  this->m_validateApidSeqCount_OutputPort[port].setObjName(portName.toChar());
246 #endif
247  }
248  }
249 
250  // ----------------------------------------------------------------------
251  // Getters for typed input ports
252  // ----------------------------------------------------------------------
253 
256  {
257  FW_ASSERT(
258  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
259  static_cast<FwAssertArgType>(portNum)
260  );
261 
262  return &this->m_dataIn_InputPort[portNum];
263  }
264 
267  {
268  FW_ASSERT(
269  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
270  static_cast<FwAssertArgType>(portNum)
271  );
272 
273  return &this->m_dataReturnIn_InputPort[portNum];
274  }
275 
276  // ----------------------------------------------------------------------
277  // Connect input ports to special output ports
278  // ----------------------------------------------------------------------
279 
282  FwIndexType portNum,
283  Fw::InputLogPort* port
284  )
285  {
286  FW_ASSERT(
287  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
288  static_cast<FwAssertArgType>(portNum)
289  );
290 
291  this->m_logOut_OutputPort[portNum].addCallPort(port);
292  }
293 
294 #if FW_ENABLE_TEXT_LOGGING == 1
295 
296  void SpacePacketDeframerComponentBase ::
297  set_logTextOut_OutputPort(
298  FwIndexType portNum,
300  )
301  {
302  FW_ASSERT(
303  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
304  static_cast<FwAssertArgType>(portNum)
305  );
306 
307  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
308  }
309 
310 #endif
311 
314  FwIndexType portNum,
315  Fw::InputPrmGetPort* port
316  )
317  {
318  FW_ASSERT(
319  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
320  static_cast<FwAssertArgType>(portNum)
321  );
322 
323  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
324  }
325 
328  FwIndexType portNum,
329  Fw::InputPrmSetPort* port
330  )
331  {
332  FW_ASSERT(
333  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
334  static_cast<FwAssertArgType>(portNum)
335  );
336 
337  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
338  }
339 
342  FwIndexType portNum,
343  Fw::InputTimePort* port
344  )
345  {
346  FW_ASSERT(
347  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
348  static_cast<FwAssertArgType>(portNum)
349  );
350 
351  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
352  }
353 
356  FwIndexType portNum,
357  Fw::InputTlmPort* port
358  )
359  {
360  FW_ASSERT(
361  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
362  static_cast<FwAssertArgType>(portNum)
363  );
364 
365  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
366  }
367 
368  // ----------------------------------------------------------------------
369  // Connect typed input ports to typed output ports
370  // ----------------------------------------------------------------------
371 
374  FwIndexType portNum,
376  )
377  {
378  FW_ASSERT(
379  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
380  static_cast<FwAssertArgType>(portNum)
381  );
382 
383  this->m_dataOut_OutputPort[portNum].addCallPort(port);
384  }
385 
388  FwIndexType portNum,
390  )
391  {
392  FW_ASSERT(
393  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
394  static_cast<FwAssertArgType>(portNum)
395  );
396 
397  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
398  }
399 
402  FwIndexType portNum,
404  )
405  {
406  FW_ASSERT(
407  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
408  static_cast<FwAssertArgType>(portNum)
409  );
410 
411  this->m_validateApidSeqCount_OutputPort[portNum].addCallPort(port);
412  }
413 
414 #if FW_PORT_SERIALIZATION
415 
416  // ----------------------------------------------------------------------
417  // Connect serial input ports to special output ports
418  // ----------------------------------------------------------------------
419 
422  FwIndexType portNum,
423  Fw::InputSerializePort* port
424  )
425  {
426  FW_ASSERT(
427  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
428  static_cast<FwAssertArgType>(portNum)
429  );
430 
431  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
432  }
433 
434 #if FW_ENABLE_TEXT_LOGGING == 1
435 
436  void SpacePacketDeframerComponentBase ::
437  set_logTextOut_OutputPort(
438  FwIndexType portNum,
439  Fw::InputSerializePort* port
440  )
441  {
442  FW_ASSERT(
443  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
444  static_cast<FwAssertArgType>(portNum)
445  );
446 
447  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
448  }
449 
450 #endif
451 
454  FwIndexType portNum,
455  Fw::InputSerializePort* port
456  )
457  {
458  FW_ASSERT(
459  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
460  static_cast<FwAssertArgType>(portNum)
461  );
462 
463  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
464  }
465 
468  FwIndexType portNum,
469  Fw::InputSerializePort* port
470  )
471  {
472  FW_ASSERT(
473  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
474  static_cast<FwAssertArgType>(portNum)
475  );
476 
477  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
478  }
479 
482  FwIndexType portNum,
483  Fw::InputSerializePort* port
484  )
485  {
486  FW_ASSERT(
487  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
488  static_cast<FwAssertArgType>(portNum)
489  );
490 
491  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
492  }
493 
494 #endif
495 
496 #if FW_PORT_SERIALIZATION
497 
498  // ----------------------------------------------------------------------
499  // Connect serial input ports to typed output ports
500  // ----------------------------------------------------------------------
501 
504  FwIndexType portNum,
505  Fw::InputSerializePort* port
506  )
507  {
508  FW_ASSERT(
509  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
510  static_cast<FwAssertArgType>(portNum)
511  );
512 
513  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
514  }
515 
518  FwIndexType portNum,
519  Fw::InputSerializePort* port
520  )
521  {
522  FW_ASSERT(
523  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
524  static_cast<FwAssertArgType>(portNum)
525  );
526 
527  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
528  }
529 
530 #endif
531 
532  // ----------------------------------------------------------------------
533  // Component construction and destruction
534  // ----------------------------------------------------------------------
535 
537  SpacePacketDeframerComponentBase(const char* compName) :
538  Fw::PassiveComponentBase(compName)
539  {
540 
541  }
542 
545  {
546 
547  }
548 
549  // ----------------------------------------------------------------------
550  // Getters for numbers of typed input ports
551  // ----------------------------------------------------------------------
552 
555  {
556  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataIn_InputPort));
557  }
558 
561  {
562  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnIn_InputPort));
563  }
564 
565  // ----------------------------------------------------------------------
566  // Getters for numbers of special output ports
567  // ----------------------------------------------------------------------
568 
571  {
572  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
573  }
574 
575 #if FW_ENABLE_TEXT_LOGGING == 1
576 
577  FwIndexType SpacePacketDeframerComponentBase ::
578  getNum_logTextOut_OutputPorts() const
579  {
580  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logTextOut_OutputPort));
581  }
582 
583 #endif
584 
587  {
588  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort));
589  }
590 
593  {
594  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort));
595  }
596 
599  {
600  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
601  }
602 
605  {
606  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
607  }
608 
609  // ----------------------------------------------------------------------
610  // Getters for numbers of typed output ports
611  // ----------------------------------------------------------------------
612 
615  {
616  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataOut_OutputPort));
617  }
618 
621  {
622  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnOut_OutputPort));
623  }
624 
627  {
628  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_validateApidSeqCount_OutputPort));
629  }
630 
631  // ----------------------------------------------------------------------
632  // Connection status queries for special output ports
633  // ----------------------------------------------------------------------
634 
637  {
638  FW_ASSERT(
639  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
640  static_cast<FwAssertArgType>(portNum)
641  );
642 
643  return this->m_logOut_OutputPort[portNum].isConnected();
644  }
645 
646 #if FW_ENABLE_TEXT_LOGGING == 1
647 
648  bool SpacePacketDeframerComponentBase ::
649  isConnected_logTextOut_OutputPort(FwIndexType portNum)
650  {
651  FW_ASSERT(
652  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
653  static_cast<FwAssertArgType>(portNum)
654  );
655 
656  return this->m_logTextOut_OutputPort[portNum].isConnected();
657  }
658 
659 #endif
660 
663  {
664  FW_ASSERT(
665  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
666  static_cast<FwAssertArgType>(portNum)
667  );
668 
669  return this->m_prmGetOut_OutputPort[portNum].isConnected();
670  }
671 
674  {
675  FW_ASSERT(
676  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
677  static_cast<FwAssertArgType>(portNum)
678  );
679 
680  return this->m_prmSetOut_OutputPort[portNum].isConnected();
681  }
682 
685  {
686  FW_ASSERT(
687  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
688  static_cast<FwAssertArgType>(portNum)
689  );
690 
691  return this->m_timeCaller_OutputPort[portNum].isConnected();
692  }
693 
696  {
697  FW_ASSERT(
698  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
699  static_cast<FwAssertArgType>(portNum)
700  );
701 
702  return this->m_tlmOut_OutputPort[portNum].isConnected();
703  }
704 
705  // ----------------------------------------------------------------------
706  // Connection status queries for typed output ports
707  // ----------------------------------------------------------------------
708 
711  {
712  FW_ASSERT(
713  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
714  static_cast<FwAssertArgType>(portNum)
715  );
716 
717  return this->m_dataOut_OutputPort[portNum].isConnected();
718  }
719 
722  {
723  FW_ASSERT(
724  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
725  static_cast<FwAssertArgType>(portNum)
726  );
727 
728  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
729  }
730 
733  {
734  FW_ASSERT(
735  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
736  static_cast<FwAssertArgType>(portNum)
737  );
738 
739  return this->m_validateApidSeqCount_OutputPort[portNum].isConnected();
740  }
741 
742  // ----------------------------------------------------------------------
743  // Port handler base-class functions for typed input ports
744  //
745  // Call these functions directly to bypass the corresponding ports
746  // ----------------------------------------------------------------------
747 
750  FwIndexType portNum,
751  Fw::Buffer& data,
752  const ComCfg::FrameContext& context
753  )
754  {
755  // Make sure port number is valid
756  FW_ASSERT(
757  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
758  static_cast<FwAssertArgType>(portNum)
759  );
760 
761  // Lock guard mutex before calling
762  this->lock();
763 
764  // Call handler function
765  this->dataIn_handler(
766  portNum,
767  data,
768  context
769  );
770 
771  // Unlock guard mutex
772  this->unLock();
773  }
774 
777  FwIndexType portNum,
778  Fw::Buffer& data,
779  const ComCfg::FrameContext& context
780  )
781  {
782  // Make sure port number is valid
783  FW_ASSERT(
784  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
785  static_cast<FwAssertArgType>(portNum)
786  );
787 
788  // Call handler function
789  this->dataReturnIn_handler(
790  portNum,
791  data,
792  context
793  );
794  }
795 
796  // ----------------------------------------------------------------------
797  // Invocation functions for typed output ports
798  // ----------------------------------------------------------------------
799 
802  FwIndexType portNum,
803  Fw::Buffer& data,
804  const ComCfg::FrameContext& context
805  )
806  {
807  FW_ASSERT(
808  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
809  static_cast<FwAssertArgType>(portNum)
810  );
811 
812  FW_ASSERT(
813  this->m_dataOut_OutputPort[portNum].isConnected(),
814  static_cast<FwAssertArgType>(portNum)
815  );
816  this->m_dataOut_OutputPort[portNum].invoke(
817  data,
818  context
819  );
820  }
821 
824  FwIndexType portNum,
825  Fw::Buffer& data,
826  const ComCfg::FrameContext& context
827  )
828  {
829  FW_ASSERT(
830  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
831  static_cast<FwAssertArgType>(portNum)
832  );
833 
834  FW_ASSERT(
835  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
836  static_cast<FwAssertArgType>(portNum)
837  );
838  this->m_dataReturnOut_OutputPort[portNum].invoke(
839  data,
840  context
841  );
842  }
843 
846  FwIndexType portNum,
847  const ComCfg::APID& apid,
848  U16 sequenceCount
849  )
850  {
851  FW_ASSERT(
852  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
853  static_cast<FwAssertArgType>(portNum)
854  );
855 
856  FW_ASSERT(
857  this->m_validateApidSeqCount_OutputPort[portNum].isConnected(),
858  static_cast<FwAssertArgType>(portNum)
859  );
860  return this->m_validateApidSeqCount_OutputPort[portNum].invoke(
861  apid,
862  sequenceCount
863  );
864  }
865 
866  // ----------------------------------------------------------------------
867  // Event logging functions
868  // ----------------------------------------------------------------------
869 
872  U16 transmitted,
873  U32 actual
874  ) const
875  {
876  // Get the time
877  Fw::Time _logTime;
878  if (this->m_timeCaller_OutputPort[0].isConnected()) {
879  this->m_timeCaller_OutputPort[0].invoke(_logTime);
880  }
881 
882  FwEventIdType _id = static_cast<FwEventIdType>(0);
883 
884  _id = this->getIdBase() + EVENTID_INVALIDLENGTH;
885 
886  // Emit the event on the log port
887  if (this->m_logOut_OutputPort[0].isConnected()) {
888  Fw::LogBuffer _logBuff;
890 
891 #if FW_AMPCS_COMPATIBLE
892  // Serialize the number of arguments
893  _status = _logBuff.serialize(static_cast<U8>(2));
894  FW_ASSERT(
895  _status == Fw::FW_SERIALIZE_OK,
896  static_cast<FwAssertArgType>(_status)
897  );
898 #endif
899 
900 #if FW_AMPCS_COMPATIBLE
901  // Serialize the argument size
902  _status = _logBuff.serialize(
903  static_cast<U8>(sizeof(U16))
904  );
905  FW_ASSERT(
906  _status == Fw::FW_SERIALIZE_OK,
907  static_cast<FwAssertArgType>(_status)
908  );
909 #endif
910  _status = _logBuff.serialize(transmitted);
911  FW_ASSERT(
912  _status == Fw::FW_SERIALIZE_OK,
913  static_cast<FwAssertArgType>(_status)
914  );
915 
916 #if FW_AMPCS_COMPATIBLE
917  // Serialize the argument size
918  _status = _logBuff.serialize(
919  static_cast<U8>(sizeof(U32))
920  );
921  FW_ASSERT(
922  _status == Fw::FW_SERIALIZE_OK,
923  static_cast<FwAssertArgType>(_status)
924  );
925 #endif
926  _status = _logBuff.serialize(actual);
927  FW_ASSERT(
928  _status == Fw::FW_SERIALIZE_OK,
929  static_cast<FwAssertArgType>(_status)
930  );
931 
932  this->m_logOut_OutputPort[0].invoke(
933  _id,
934  _logTime,
936  _logBuff
937  );
938  }
939 
940  // Emit the event on the text log port
941 #if FW_ENABLE_TEXT_LOGGING
942  if (this->m_logTextOut_OutputPort[0].isConnected()) {
943 #if FW_OBJECT_NAMES == 1
944  const char* _formatString =
945  "(%s) %s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu32 "";
946 #else
947  const char* _formatString =
948  "%s: Invalid length received. Header specified packet byte size of %" PRIu16 " | Actual received data length: %" PRIu32 "";
949 #endif
950 
951  Fw::TextLogString _logString;
952  _logString.format(
953  _formatString,
954 #if FW_OBJECT_NAMES == 1
955  this->m_objName.toChar(),
956 #endif
957  "InvalidLength ",
958  transmitted,
959  actual
960  );
961 
962  this->m_logTextOut_OutputPort[0].invoke(
963  _id,
964  _logTime,
966  _logString
967  );
968  }
969 #endif
970  }
971 
972  // ----------------------------------------------------------------------
973  // Time
974  // ----------------------------------------------------------------------
975 
977  getTime() const
978  {
979  if (this->m_timeCaller_OutputPort[0].isConnected()) {
980  Fw::Time _time;
981  this->m_timeCaller_OutputPort[0].invoke(_time);
982  return _time;
983  }
984  else {
985  return Fw::Time(TB_NONE, 0, 0);
986  }
987  }
988 
989  // ----------------------------------------------------------------------
990  // Mutex operations for guarded ports
991  //
992  // You can override these operations to provide more sophisticated
993  // synchronization
994  // ----------------------------------------------------------------------
995 
998  {
999  this->m_guardedPortMutex.lock();
1000  }
1001 
1004  {
1005  this->m_guardedPortMutex.unLock();
1006  }
1007 
1008  // ----------------------------------------------------------------------
1009  // Calls for messages received on typed input ports
1010  // ----------------------------------------------------------------------
1011 
1012  void SpacePacketDeframerComponentBase ::
1013  m_p_dataIn_in(
1014  Fw::PassiveComponentBase* callComp,
1015  FwIndexType portNum,
1016  Fw::Buffer& data,
1017  const ComCfg::FrameContext& context
1018  )
1019  {
1020  FW_ASSERT(callComp);
1021  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1022  compPtr->dataIn_handlerBase(
1023  portNum,
1024  data,
1025  context
1026  );
1027  }
1028 
1029  void SpacePacketDeframerComponentBase ::
1030  m_p_dataReturnIn_in(
1031  Fw::PassiveComponentBase* callComp,
1032  FwIndexType portNum,
1033  Fw::Buffer& data,
1034  const ComCfg::FrameContext& context
1035  )
1036  {
1037  FW_ASSERT(callComp);
1038  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1039  compPtr->dataReturnIn_handlerBase(
1040  portNum,
1041  data,
1042  context
1043  );
1044  }
1045 
1046  }
1047 
1048 }
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
Definition: Time.hpp:9
U16 invoke(const ComCfg::APID &apid, U16 sequenceCount) const
Invoke a port interface.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
I32 FwEnumStoreType
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Auto-generated base for SpacePacketDeframer component.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:40
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
void init()
Initialization function.
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:26
U16 validateApidSeqCount_out(FwIndexType portNum, const ComCfg::APID &apid, U16 sequenceCount)
Invoke output port validateApidSeqCount.
SerializeStatus
forward declaration for string
FwIdType FwEventIdType
The type of an event identifier.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:53
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void log_WARNING_HI_InvalidLength(U16 transmitted, U32 actual) const
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port interface.
void addCallPort(InputApidSequenceCountPort *callPort)
Register an input port.
A serious but recoverable event.
void init()
Initialization function.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
bool isConnected() const
Definition: PortBase.cpp:42
#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 invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
No time base has been established.
Definition: FpConfig.h:30
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
SpacePacketDeframerComponentBase(const char *compName="")
Construct SpacePacketDeframerComponentBase object.
PlatformIndexType FwIndexType
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: APIDEnumAc.hpp:17
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:93
virtual ~SpacePacketDeframerComponentBase()
Destroy SpacePacketDeframerComponentBase object.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
void set_validateApidSeqCount_OutputPort(FwIndexType portNum, Svc::CCSDS::InputApidSequenceCountPort *port)
Connect port to validateApidSeqCount[portNum].
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void init()
Initialization function.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34