F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TcDeframerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TcDeframerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for TcDeframer 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 
231  // ----------------------------------------------------------------------
232  // Getters for typed input ports
233  // ----------------------------------------------------------------------
234 
237  {
238  FW_ASSERT(
239  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
240  static_cast<FwAssertArgType>(portNum)
241  );
242 
243  return &this->m_dataIn_InputPort[portNum];
244  }
245 
248  {
249  FW_ASSERT(
250  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
251  static_cast<FwAssertArgType>(portNum)
252  );
253 
254  return &this->m_dataReturnIn_InputPort[portNum];
255  }
256 
257  // ----------------------------------------------------------------------
258  // Connect input ports to special output ports
259  // ----------------------------------------------------------------------
260 
263  FwIndexType portNum,
264  Fw::InputLogPort* port
265  )
266  {
267  FW_ASSERT(
268  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
269  static_cast<FwAssertArgType>(portNum)
270  );
271 
272  this->m_logOut_OutputPort[portNum].addCallPort(port);
273  }
274 
275 #if FW_ENABLE_TEXT_LOGGING == 1
276 
277  void TcDeframerComponentBase ::
278  set_logTextOut_OutputPort(
279  FwIndexType portNum,
281  )
282  {
283  FW_ASSERT(
284  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
285  static_cast<FwAssertArgType>(portNum)
286  );
287 
288  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
289  }
290 
291 #endif
292 
295  FwIndexType portNum,
296  Fw::InputPrmGetPort* port
297  )
298  {
299  FW_ASSERT(
300  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
301  static_cast<FwAssertArgType>(portNum)
302  );
303 
304  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
305  }
306 
309  FwIndexType portNum,
310  Fw::InputPrmSetPort* port
311  )
312  {
313  FW_ASSERT(
314  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
315  static_cast<FwAssertArgType>(portNum)
316  );
317 
318  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
319  }
320 
323  FwIndexType portNum,
324  Fw::InputTimePort* port
325  )
326  {
327  FW_ASSERT(
328  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
329  static_cast<FwAssertArgType>(portNum)
330  );
331 
332  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
333  }
334 
337  FwIndexType portNum,
338  Fw::InputTlmPort* port
339  )
340  {
341  FW_ASSERT(
342  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
343  static_cast<FwAssertArgType>(portNum)
344  );
345 
346  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
347  }
348 
349  // ----------------------------------------------------------------------
350  // Connect typed input ports to typed output ports
351  // ----------------------------------------------------------------------
352 
355  FwIndexType portNum,
357  )
358  {
359  FW_ASSERT(
360  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
361  static_cast<FwAssertArgType>(portNum)
362  );
363 
364  this->m_dataOut_OutputPort[portNum].addCallPort(port);
365  }
366 
369  FwIndexType portNum,
371  )
372  {
373  FW_ASSERT(
374  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
375  static_cast<FwAssertArgType>(portNum)
376  );
377 
378  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
379  }
380 
381 #if FW_PORT_SERIALIZATION
382 
383  // ----------------------------------------------------------------------
384  // Connect serial input ports to special output ports
385  // ----------------------------------------------------------------------
386 
389  FwIndexType portNum,
390  Fw::InputSerializePort* port
391  )
392  {
393  FW_ASSERT(
394  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
395  static_cast<FwAssertArgType>(portNum)
396  );
397 
398  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
399  }
400 
401 #if FW_ENABLE_TEXT_LOGGING == 1
402 
403  void TcDeframerComponentBase ::
404  set_logTextOut_OutputPort(
405  FwIndexType portNum,
406  Fw::InputSerializePort* port
407  )
408  {
409  FW_ASSERT(
410  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
411  static_cast<FwAssertArgType>(portNum)
412  );
413 
414  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
415  }
416 
417 #endif
418 
421  FwIndexType portNum,
422  Fw::InputSerializePort* port
423  )
424  {
425  FW_ASSERT(
426  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
427  static_cast<FwAssertArgType>(portNum)
428  );
429 
430  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
431  }
432 
435  FwIndexType portNum,
436  Fw::InputSerializePort* port
437  )
438  {
439  FW_ASSERT(
440  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
441  static_cast<FwAssertArgType>(portNum)
442  );
443 
444  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
445  }
446 
449  FwIndexType portNum,
450  Fw::InputSerializePort* port
451  )
452  {
453  FW_ASSERT(
454  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
455  static_cast<FwAssertArgType>(portNum)
456  );
457 
458  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
459  }
460 
461 #endif
462 
463 #if FW_PORT_SERIALIZATION
464 
465  // ----------------------------------------------------------------------
466  // Connect serial input ports to typed output ports
467  // ----------------------------------------------------------------------
468 
471  FwIndexType portNum,
472  Fw::InputSerializePort* port
473  )
474  {
475  FW_ASSERT(
476  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
481  }
482 
485  FwIndexType portNum,
486  Fw::InputSerializePort* port
487  )
488  {
489  FW_ASSERT(
490  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
491  static_cast<FwAssertArgType>(portNum)
492  );
493 
494  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
495  }
496 
497 #endif
498 
499  // ----------------------------------------------------------------------
500  // Component construction and destruction
501  // ----------------------------------------------------------------------
502 
504  TcDeframerComponentBase(const char* compName) :
505  Fw::PassiveComponentBase(compName)
506  {
507 
508  }
509 
512  {
513 
514  }
515 
516  // ----------------------------------------------------------------------
517  // Getters for numbers of typed input ports
518  // ----------------------------------------------------------------------
519 
522  {
523  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataIn_InputPort));
524  }
525 
528  {
529  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnIn_InputPort));
530  }
531 
532  // ----------------------------------------------------------------------
533  // Getters for numbers of special output ports
534  // ----------------------------------------------------------------------
535 
538  {
539  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
540  }
541 
542 #if FW_ENABLE_TEXT_LOGGING == 1
543 
544  FwIndexType TcDeframerComponentBase ::
545  getNum_logTextOut_OutputPorts() const
546  {
547  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logTextOut_OutputPort));
548  }
549 
550 #endif
551 
554  {
555  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort));
556  }
557 
560  {
561  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort));
562  }
563 
566  {
567  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
568  }
569 
572  {
573  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
574  }
575 
576  // ----------------------------------------------------------------------
577  // Getters for numbers of typed output ports
578  // ----------------------------------------------------------------------
579 
582  {
583  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataOut_OutputPort));
584  }
585 
588  {
589  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnOut_OutputPort));
590  }
591 
592  // ----------------------------------------------------------------------
593  // Connection status queries for special output ports
594  // ----------------------------------------------------------------------
595 
598  {
599  FW_ASSERT(
600  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
601  static_cast<FwAssertArgType>(portNum)
602  );
603 
604  return this->m_logOut_OutputPort[portNum].isConnected();
605  }
606 
607 #if FW_ENABLE_TEXT_LOGGING == 1
608 
609  bool TcDeframerComponentBase ::
610  isConnected_logTextOut_OutputPort(FwIndexType portNum)
611  {
612  FW_ASSERT(
613  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
614  static_cast<FwAssertArgType>(portNum)
615  );
616 
617  return this->m_logTextOut_OutputPort[portNum].isConnected();
618  }
619 
620 #endif
621 
624  {
625  FW_ASSERT(
626  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
627  static_cast<FwAssertArgType>(portNum)
628  );
629 
630  return this->m_prmGetOut_OutputPort[portNum].isConnected();
631  }
632 
635  {
636  FW_ASSERT(
637  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
638  static_cast<FwAssertArgType>(portNum)
639  );
640 
641  return this->m_prmSetOut_OutputPort[portNum].isConnected();
642  }
643 
646  {
647  FW_ASSERT(
648  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
649  static_cast<FwAssertArgType>(portNum)
650  );
651 
652  return this->m_timeCaller_OutputPort[portNum].isConnected();
653  }
654 
657  {
658  FW_ASSERT(
659  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
660  static_cast<FwAssertArgType>(portNum)
661  );
662 
663  return this->m_tlmOut_OutputPort[portNum].isConnected();
664  }
665 
666  // ----------------------------------------------------------------------
667  // Connection status queries for typed output ports
668  // ----------------------------------------------------------------------
669 
672  {
673  FW_ASSERT(
674  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
675  static_cast<FwAssertArgType>(portNum)
676  );
677 
678  return this->m_dataOut_OutputPort[portNum].isConnected();
679  }
680 
683  {
684  FW_ASSERT(
685  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
686  static_cast<FwAssertArgType>(portNum)
687  );
688 
689  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
690  }
691 
692  // ----------------------------------------------------------------------
693  // Port handler base-class functions for typed input ports
694  //
695  // Call these functions directly to bypass the corresponding ports
696  // ----------------------------------------------------------------------
697 
700  FwIndexType portNum,
701  Fw::Buffer& data,
702  const ComCfg::FrameContext& context
703  )
704  {
705  // Make sure port number is valid
706  FW_ASSERT(
707  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
708  static_cast<FwAssertArgType>(portNum)
709  );
710 
711  // Lock guard mutex before calling
712  this->lock();
713 
714  // Call handler function
715  this->dataIn_handler(
716  portNum,
717  data,
718  context
719  );
720 
721  // Unlock guard mutex
722  this->unLock();
723  }
724 
727  FwIndexType portNum,
728  Fw::Buffer& data,
729  const ComCfg::FrameContext& context
730  )
731  {
732  // Make sure port number is valid
733  FW_ASSERT(
734  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
735  static_cast<FwAssertArgType>(portNum)
736  );
737 
738  // Call handler function
739  this->dataReturnIn_handler(
740  portNum,
741  data,
742  context
743  );
744  }
745 
746  // ----------------------------------------------------------------------
747  // Invocation functions for typed output ports
748  // ----------------------------------------------------------------------
749 
752  FwIndexType portNum,
753  Fw::Buffer& data,
754  const ComCfg::FrameContext& context
755  )
756  {
757  FW_ASSERT(
758  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
759  static_cast<FwAssertArgType>(portNum)
760  );
761 
762  FW_ASSERT(
763  this->m_dataOut_OutputPort[portNum].isConnected(),
764  static_cast<FwAssertArgType>(portNum)
765  );
766  this->m_dataOut_OutputPort[portNum].invoke(
767  data,
768  context
769  );
770  }
771 
774  FwIndexType portNum,
775  Fw::Buffer& data,
776  const ComCfg::FrameContext& context
777  )
778  {
779  FW_ASSERT(
780  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
781  static_cast<FwAssertArgType>(portNum)
782  );
783 
784  FW_ASSERT(
785  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
786  static_cast<FwAssertArgType>(portNum)
787  );
788  this->m_dataReturnOut_OutputPort[portNum].invoke(
789  data,
790  context
791  );
792  }
793 
794  // ----------------------------------------------------------------------
795  // Event logging functions
796  // ----------------------------------------------------------------------
797 
800  U16 transmitted,
801  U16 configured
802  ) const
803  {
804  // Get the time
805  Fw::Time _logTime;
806  if (this->m_timeCaller_OutputPort[0].isConnected()) {
807  this->m_timeCaller_OutputPort[0].invoke(_logTime);
808  }
809 
810  FwEventIdType _id = static_cast<FwEventIdType>(0);
811 
812  _id = this->getIdBase() + EVENTID_INVALIDSPACECRAFTID;
813 
814  // Emit the event on the log port
815  if (this->m_logOut_OutputPort[0].isConnected()) {
816  Fw::LogBuffer _logBuff;
818 
819 #if FW_AMPCS_COMPATIBLE
820  // Serialize the number of arguments
821  _status = _logBuff.serialize(static_cast<U8>(2));
822  FW_ASSERT(
823  _status == Fw::FW_SERIALIZE_OK,
824  static_cast<FwAssertArgType>(_status)
825  );
826 #endif
827 
828 #if FW_AMPCS_COMPATIBLE
829  // Serialize the argument size
830  _status = _logBuff.serialize(
831  static_cast<U8>(sizeof(U16))
832  );
833  FW_ASSERT(
834  _status == Fw::FW_SERIALIZE_OK,
835  static_cast<FwAssertArgType>(_status)
836  );
837 #endif
838  _status = _logBuff.serialize(transmitted);
839  FW_ASSERT(
840  _status == Fw::FW_SERIALIZE_OK,
841  static_cast<FwAssertArgType>(_status)
842  );
843 
844 #if FW_AMPCS_COMPATIBLE
845  // Serialize the argument size
846  _status = _logBuff.serialize(
847  static_cast<U8>(sizeof(U16))
848  );
849  FW_ASSERT(
850  _status == Fw::FW_SERIALIZE_OK,
851  static_cast<FwAssertArgType>(_status)
852  );
853 #endif
854  _status = _logBuff.serialize(configured);
855  FW_ASSERT(
856  _status == Fw::FW_SERIALIZE_OK,
857  static_cast<FwAssertArgType>(_status)
858  );
859 
860  this->m_logOut_OutputPort[0].invoke(
861  _id,
862  _logTime,
864  _logBuff
865  );
866  }
867 
868  // Emit the event on the text log port
869 #if FW_ENABLE_TEXT_LOGGING
870  if (this->m_logTextOut_OutputPort[0].isConnected()) {
871 #if FW_OBJECT_NAMES == 1
872  const char* _formatString =
873  "(%s) %s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
874 #else
875  const char* _formatString =
876  "%s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
877 #endif
878 
879  Fw::TextLogString _logString;
880  _logString.format(
881  _formatString,
882 #if FW_OBJECT_NAMES == 1
883  this->m_objName.toChar(),
884 #endif
885  "InvalidSpacecraftId ",
886  transmitted,
887  configured
888  );
889 
890  this->m_logTextOut_OutputPort[0].invoke(
891  _id,
892  _logTime,
894  _logString
895  );
896  }
897 #endif
898  }
899 
902  U16 transmitted,
903  FwSizeType actual
904  ) const
905  {
906  // Get the time
907  Fw::Time _logTime;
908  if (this->m_timeCaller_OutputPort[0].isConnected()) {
909  this->m_timeCaller_OutputPort[0].invoke(_logTime);
910  }
911 
912  FwEventIdType _id = static_cast<FwEventIdType>(0);
913 
914  _id = this->getIdBase() + EVENTID_INVALIDFRAMELENGTH;
915 
916  // Emit the event on the log port
917  if (this->m_logOut_OutputPort[0].isConnected()) {
918  Fw::LogBuffer _logBuff;
920 
921 #if FW_AMPCS_COMPATIBLE
922  // Serialize the number of arguments
923  _status = _logBuff.serialize(static_cast<U8>(2));
924  FW_ASSERT(
925  _status == Fw::FW_SERIALIZE_OK,
926  static_cast<FwAssertArgType>(_status)
927  );
928 #endif
929 
930 #if FW_AMPCS_COMPATIBLE
931  // Serialize the argument size
932  _status = _logBuff.serialize(
933  static_cast<U8>(sizeof(U16))
934  );
935  FW_ASSERT(
936  _status == Fw::FW_SERIALIZE_OK,
937  static_cast<FwAssertArgType>(_status)
938  );
939 #endif
940  _status = _logBuff.serialize(transmitted);
941  FW_ASSERT(
942  _status == Fw::FW_SERIALIZE_OK,
943  static_cast<FwAssertArgType>(_status)
944  );
945 
946 #if FW_AMPCS_COMPATIBLE
947  // Serialize the argument size
948  _status = _logBuff.serialize(
949  static_cast<U8>(sizeof(FwSizeType))
950  );
951  FW_ASSERT(
952  _status == Fw::FW_SERIALIZE_OK,
953  static_cast<FwAssertArgType>(_status)
954  );
955 #endif
956  _status = _logBuff.serialize(actual);
957  FW_ASSERT(
958  _status == Fw::FW_SERIALIZE_OK,
959  static_cast<FwAssertArgType>(_status)
960  );
961 
962  this->m_logOut_OutputPort[0].invoke(
963  _id,
964  _logTime,
966  _logBuff
967  );
968  }
969 
970  // Emit the event on the text log port
971 #if FW_ENABLE_TEXT_LOGGING
972  if (this->m_logTextOut_OutputPort[0].isConnected()) {
973 #if FW_OBJECT_NAMES == 1
974  const char* _formatString =
975  "(%s) %s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
976 #else
977  const char* _formatString =
978  "%s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
979 #endif
980 
981  Fw::TextLogString _logString;
982  _logString.format(
983  _formatString,
984 #if FW_OBJECT_NAMES == 1
985  this->m_objName.toChar(),
986 #endif
987  "InvalidFrameLength ",
988  transmitted,
989  actual
990  );
991 
992  this->m_logTextOut_OutputPort[0].invoke(
993  _id,
994  _logTime,
996  _logString
997  );
998  }
999 #endif
1000  }
1001 
1004  U16 transmitted,
1005  U16 configured
1006  ) const
1007  {
1008  // Get the time
1009  Fw::Time _logTime;
1010  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1011  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1012  }
1013 
1014  FwEventIdType _id = static_cast<FwEventIdType>(0);
1015 
1016  _id = this->getIdBase() + EVENTID_INVALIDVCID;
1017 
1018  // Emit the event on the log port
1019  if (this->m_logOut_OutputPort[0].isConnected()) {
1020  Fw::LogBuffer _logBuff;
1022 
1023 #if FW_AMPCS_COMPATIBLE
1024  // Serialize the number of arguments
1025  _status = _logBuff.serialize(static_cast<U8>(2));
1026  FW_ASSERT(
1027  _status == Fw::FW_SERIALIZE_OK,
1028  static_cast<FwAssertArgType>(_status)
1029  );
1030 #endif
1031 
1032 #if FW_AMPCS_COMPATIBLE
1033  // Serialize the argument size
1034  _status = _logBuff.serialize(
1035  static_cast<U8>(sizeof(U16))
1036  );
1037  FW_ASSERT(
1038  _status == Fw::FW_SERIALIZE_OK,
1039  static_cast<FwAssertArgType>(_status)
1040  );
1041 #endif
1042  _status = _logBuff.serialize(transmitted);
1043  FW_ASSERT(
1044  _status == Fw::FW_SERIALIZE_OK,
1045  static_cast<FwAssertArgType>(_status)
1046  );
1047 
1048 #if FW_AMPCS_COMPATIBLE
1049  // Serialize the argument size
1050  _status = _logBuff.serialize(
1051  static_cast<U8>(sizeof(U16))
1052  );
1053  FW_ASSERT(
1054  _status == Fw::FW_SERIALIZE_OK,
1055  static_cast<FwAssertArgType>(_status)
1056  );
1057 #endif
1058  _status = _logBuff.serialize(configured);
1059  FW_ASSERT(
1060  _status == Fw::FW_SERIALIZE_OK,
1061  static_cast<FwAssertArgType>(_status)
1062  );
1063 
1064  this->m_logOut_OutputPort[0].invoke(
1065  _id,
1066  _logTime,
1068  _logBuff
1069  );
1070  }
1071 
1072  // Emit the event on the text log port
1073 #if FW_ENABLE_TEXT_LOGGING
1074  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1075 #if FW_OBJECT_NAMES == 1
1076  const char* _formatString =
1077  "(%s) %s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1078 #else
1079  const char* _formatString =
1080  "%s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1081 #endif
1082 
1083  Fw::TextLogString _logString;
1084  _logString.format(
1085  _formatString,
1086 #if FW_OBJECT_NAMES == 1
1087  this->m_objName.toChar(),
1088 #endif
1089  "InvalidVcId ",
1090  transmitted,
1091  configured
1092  );
1093 
1094  this->m_logTextOut_OutputPort[0].invoke(
1095  _id,
1096  _logTime,
1098  _logString
1099  );
1100  }
1101 #endif
1102  }
1103 
1106  U16 transmitted,
1107  U16 computed
1108  ) const
1109  {
1110  // Get the time
1111  Fw::Time _logTime;
1112  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1113  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1114  }
1115 
1116  FwEventIdType _id = static_cast<FwEventIdType>(0);
1117 
1118  _id = this->getIdBase() + EVENTID_INVALIDCRC;
1119 
1120  // Emit the event on the log port
1121  if (this->m_logOut_OutputPort[0].isConnected()) {
1122  Fw::LogBuffer _logBuff;
1124 
1125 #if FW_AMPCS_COMPATIBLE
1126  // Serialize the number of arguments
1127  _status = _logBuff.serialize(static_cast<U8>(2));
1128  FW_ASSERT(
1129  _status == Fw::FW_SERIALIZE_OK,
1130  static_cast<FwAssertArgType>(_status)
1131  );
1132 #endif
1133 
1134 #if FW_AMPCS_COMPATIBLE
1135  // Serialize the argument size
1136  _status = _logBuff.serialize(
1137  static_cast<U8>(sizeof(U16))
1138  );
1139  FW_ASSERT(
1140  _status == Fw::FW_SERIALIZE_OK,
1141  static_cast<FwAssertArgType>(_status)
1142  );
1143 #endif
1144  _status = _logBuff.serialize(transmitted);
1145  FW_ASSERT(
1146  _status == Fw::FW_SERIALIZE_OK,
1147  static_cast<FwAssertArgType>(_status)
1148  );
1149 
1150 #if FW_AMPCS_COMPATIBLE
1151  // Serialize the argument size
1152  _status = _logBuff.serialize(
1153  static_cast<U8>(sizeof(U16))
1154  );
1155  FW_ASSERT(
1156  _status == Fw::FW_SERIALIZE_OK,
1157  static_cast<FwAssertArgType>(_status)
1158  );
1159 #endif
1160  _status = _logBuff.serialize(computed);
1161  FW_ASSERT(
1162  _status == Fw::FW_SERIALIZE_OK,
1163  static_cast<FwAssertArgType>(_status)
1164  );
1165 
1166  this->m_logOut_OutputPort[0].invoke(
1167  _id,
1168  _logTime,
1170  _logBuff
1171  );
1172  }
1173 
1174  // Emit the event on the text log port
1175 #if FW_ENABLE_TEXT_LOGGING
1176  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1177 #if FW_OBJECT_NAMES == 1
1178  const char* _formatString =
1179  "(%s) %s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1180 #else
1181  const char* _formatString =
1182  "%s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1183 #endif
1184 
1185  Fw::TextLogString _logString;
1186  _logString.format(
1187  _formatString,
1188 #if FW_OBJECT_NAMES == 1
1189  this->m_objName.toChar(),
1190 #endif
1191  "InvalidCrc ",
1192  transmitted,
1193  computed
1194  );
1195 
1196  this->m_logTextOut_OutputPort[0].invoke(
1197  _id,
1198  _logTime,
1200  _logString
1201  );
1202  }
1203 #endif
1204  }
1205 
1206  // ----------------------------------------------------------------------
1207  // Time
1208  // ----------------------------------------------------------------------
1209 
1211  getTime() const
1212  {
1213  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1214  Fw::Time _time;
1215  this->m_timeCaller_OutputPort[0].invoke(_time);
1216  return _time;
1217  }
1218  else {
1219  return Fw::Time(TB_NONE, 0, 0);
1220  }
1221  }
1222 
1223  // ----------------------------------------------------------------------
1224  // Mutex operations for guarded ports
1225  //
1226  // You can override these operations to provide more sophisticated
1227  // synchronization
1228  // ----------------------------------------------------------------------
1229 
1232  {
1233  this->m_guardedPortMutex.lock();
1234  }
1235 
1238  {
1239  this->m_guardedPortMutex.unLock();
1240  }
1241 
1242  // ----------------------------------------------------------------------
1243  // Calls for messages received on typed input ports
1244  // ----------------------------------------------------------------------
1245 
1246  void TcDeframerComponentBase ::
1247  m_p_dataIn_in(
1248  Fw::PassiveComponentBase* callComp,
1249  FwIndexType portNum,
1250  Fw::Buffer& data,
1251  const ComCfg::FrameContext& context
1252  )
1253  {
1254  FW_ASSERT(callComp);
1255  TcDeframerComponentBase* compPtr = static_cast<TcDeframerComponentBase*>(callComp);
1256  compPtr->dataIn_handlerBase(
1257  portNum,
1258  data,
1259  context
1260  );
1261  }
1262 
1263  void TcDeframerComponentBase ::
1264  m_p_dataReturnIn_in(
1265  Fw::PassiveComponentBase* callComp,
1266  FwIndexType portNum,
1267  Fw::Buffer& data,
1268  const ComCfg::FrameContext& context
1269  )
1270  {
1271  FW_ASSERT(callComp);
1272  TcDeframerComponentBase* compPtr = static_cast<TcDeframerComponentBase*>(callComp);
1273  compPtr->dataReturnIn_handlerBase(
1274  portNum,
1275  data,
1276  context
1277  );
1278  }
1279 
1280  }
1281 
1282 }
Serialization/Deserialization operation was successful.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
Definition: Time.hpp:9
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum)
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
PlatformSizeType FwSizeType
I32 FwEnumStoreType
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:40
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
Auto-generated base for TcDeframer component.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum)
void log_WARNING_LO_InvalidSpacecraftId(U16 transmitted, U16 configured) const
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
SerializeStatus
forward declaration for string
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void log_WARNING_HI_InvalidCrc(U16 transmitted, U16 computed) const
FwIdType FwEventIdType
The type of an event identifier.
void log_WARNING_HI_InvalidFrameLength(U16 transmitted, FwSizeType actual) const
virtual void lock()
Lock the guarded mutex.
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
#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 addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Less important informational events.
A less serious but recoverable event.
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
const char * toChar() const
Definition: ObjectName.hpp:50
virtual ~TcDeframerComponentBase()
Destroy TcDeframerComponentBase object.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port interface.
A serious but recoverable event.
void init()
Initialization function.
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 set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Svc::InputComDataWithContextPort * get_dataIn_InputPort(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
PlatformIndexType FwIndexType
virtual void unLock()
Unlock the guarded mutex.
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:93
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.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
TcDeframerComponentBase(const char *compName="")
Construct TcDeframerComponentBase object.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void log_ACTIVITY_LO_InvalidVcId(U16 transmitted, U16 configured) const
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34