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  // 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 
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 TcDeframerComponentBase ::
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_errorNotify_OutputPorts()),
408  static_cast<FwAssertArgType>(portNum)
409  );
410 
411  this->m_errorNotify_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 TcDeframerComponentBase ::
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 
532  FwIndexType portNum,
533  Fw::InputSerializePort* port
534  )
535  {
536  FW_ASSERT(
537  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
538  static_cast<FwAssertArgType>(portNum)
539  );
540 
541  this->m_errorNotify_OutputPort[portNum].registerSerialPort(port);
542  }
543 
544 #endif
545 
546  // ----------------------------------------------------------------------
547  // Component construction and destruction
548  // ----------------------------------------------------------------------
549 
551  TcDeframerComponentBase(const char* compName) :
552  Fw::PassiveComponentBase(compName)
553  {
554 
555  }
556 
559  {
560 
561  }
562 
563  // ----------------------------------------------------------------------
564  // Connection status queries for special output ports
565  // ----------------------------------------------------------------------
566 
569  {
570  FW_ASSERT(
571  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
572  static_cast<FwAssertArgType>(portNum)
573  );
574 
575  return this->m_logOut_OutputPort[portNum].isConnected();
576  }
577 
578 #if FW_ENABLE_TEXT_LOGGING == 1
579 
580  bool TcDeframerComponentBase ::
581  isConnected_logTextOut_OutputPort(FwIndexType portNum)
582  {
583  FW_ASSERT(
584  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
585  static_cast<FwAssertArgType>(portNum)
586  );
587 
588  return this->m_logTextOut_OutputPort[portNum].isConnected();
589  }
590 
591 #endif
592 
595  {
596  FW_ASSERT(
597  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
598  static_cast<FwAssertArgType>(portNum)
599  );
600 
601  return this->m_prmGetOut_OutputPort[portNum].isConnected();
602  }
603 
606  {
607  FW_ASSERT(
608  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
609  static_cast<FwAssertArgType>(portNum)
610  );
611 
612  return this->m_prmSetOut_OutputPort[portNum].isConnected();
613  }
614 
617  {
618  FW_ASSERT(
619  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
620  static_cast<FwAssertArgType>(portNum)
621  );
622 
623  return this->m_timeCaller_OutputPort[portNum].isConnected();
624  }
625 
628  {
629  FW_ASSERT(
630  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
631  static_cast<FwAssertArgType>(portNum)
632  );
633 
634  return this->m_tlmOut_OutputPort[portNum].isConnected();
635  }
636 
637  // ----------------------------------------------------------------------
638  // Connection status queries for typed output ports
639  // ----------------------------------------------------------------------
640 
643  {
644  FW_ASSERT(
645  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
646  static_cast<FwAssertArgType>(portNum)
647  );
648 
649  return this->m_dataOut_OutputPort[portNum].isConnected();
650  }
651 
654  {
655  FW_ASSERT(
656  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
657  static_cast<FwAssertArgType>(portNum)
658  );
659 
660  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
661  }
662 
665  {
666  FW_ASSERT(
667  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
668  static_cast<FwAssertArgType>(portNum)
669  );
670 
671  return this->m_errorNotify_OutputPort[portNum].isConnected();
672  }
673 
674  // ----------------------------------------------------------------------
675  // Port handler base-class functions for typed input ports
676  //
677  // Call these functions directly to bypass the corresponding ports
678  // ----------------------------------------------------------------------
679 
682  FwIndexType portNum,
683  Fw::Buffer& data,
684  const ComCfg::FrameContext& context
685  )
686  {
687  // Make sure port number is valid
688  FW_ASSERT(
689  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
690  static_cast<FwAssertArgType>(portNum)
691  );
692 
693  // Lock guard mutex before calling
694  this->lock();
695 
696  // Call handler function
697  this->dataIn_handler(
698  portNum,
699  data,
700  context
701  );
702 
703  // Unlock guard mutex
704  this->unLock();
705  }
706 
709  FwIndexType portNum,
710  Fw::Buffer& data,
711  const ComCfg::FrameContext& context
712  )
713  {
714  // Make sure port number is valid
715  FW_ASSERT(
716  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
717  static_cast<FwAssertArgType>(portNum)
718  );
719 
720  // Call handler function
721  this->dataReturnIn_handler(
722  portNum,
723  data,
724  context
725  );
726  }
727 
728  // ----------------------------------------------------------------------
729  // Invocation functions for typed output ports
730  // ----------------------------------------------------------------------
731 
734  FwIndexType portNum,
735  Fw::Buffer& data,
736  const ComCfg::FrameContext& context
737  )
738  {
739  FW_ASSERT(
740  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
741  static_cast<FwAssertArgType>(portNum)
742  );
743 
744  FW_ASSERT(
745  this->m_dataOut_OutputPort[portNum].isConnected(),
746  static_cast<FwAssertArgType>(portNum)
747  );
748  this->m_dataOut_OutputPort[portNum].invoke(
749  data,
750  context
751  );
752  }
753 
756  FwIndexType portNum,
757  Fw::Buffer& data,
758  const ComCfg::FrameContext& context
759  )
760  {
761  FW_ASSERT(
762  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
763  static_cast<FwAssertArgType>(portNum)
764  );
765 
766  FW_ASSERT(
767  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
768  static_cast<FwAssertArgType>(portNum)
769  );
770  this->m_dataReturnOut_OutputPort[portNum].invoke(
771  data,
772  context
773  );
774  }
775 
778  FwIndexType portNum,
779  const Svc::Ccsds::FrameError& errorCode
780  )
781  {
782  FW_ASSERT(
783  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
784  static_cast<FwAssertArgType>(portNum)
785  );
786 
787  FW_ASSERT(
788  this->m_errorNotify_OutputPort[portNum].isConnected(),
789  static_cast<FwAssertArgType>(portNum)
790  );
791  this->m_errorNotify_OutputPort[portNum].invoke(
792  errorCode
793  );
794  }
795 
796  // ----------------------------------------------------------------------
797  // Event logging functions
798  // ----------------------------------------------------------------------
799 
802  U16 transmitted,
803  U16 configured
804  ) const
805  {
806  // Get the time
807  Fw::Time _logTime;
808  if (this->m_timeCaller_OutputPort[0].isConnected()) {
809  this->m_timeCaller_OutputPort[0].invoke(_logTime);
810  }
811 
812  FwEventIdType _id = static_cast<FwEventIdType>(0);
813 
814  _id = this->getIdBase() + EVENTID_INVALIDSPACECRAFTID;
815 
816  // Emit the event on the log port
817  if (this->m_logOut_OutputPort[0].isConnected()) {
818  Fw::LogBuffer _logBuff;
820 
821 #if FW_AMPCS_COMPATIBLE
822  // Serialize the number of arguments
823  _status = _logBuff.serializeFrom(static_cast<U8>(2));
824  FW_ASSERT(
825  _status == Fw::FW_SERIALIZE_OK,
826  static_cast<FwAssertArgType>(_status)
827  );
828 #endif
829 
830 #if FW_AMPCS_COMPATIBLE
831  // Serialize the argument size
832  _status = _logBuff.serializeFrom(
833  static_cast<U8>(sizeof(U16))
834  );
835  FW_ASSERT(
836  _status == Fw::FW_SERIALIZE_OK,
837  static_cast<FwAssertArgType>(_status)
838  );
839 #endif
840  _status = _logBuff.serializeFrom(transmitted);
841  FW_ASSERT(
842  _status == Fw::FW_SERIALIZE_OK,
843  static_cast<FwAssertArgType>(_status)
844  );
845 
846 #if FW_AMPCS_COMPATIBLE
847  // Serialize the argument size
848  _status = _logBuff.serializeFrom(
849  static_cast<U8>(sizeof(U16))
850  );
851  FW_ASSERT(
852  _status == Fw::FW_SERIALIZE_OK,
853  static_cast<FwAssertArgType>(_status)
854  );
855 #endif
856  _status = _logBuff.serializeFrom(configured);
857  FW_ASSERT(
858  _status == Fw::FW_SERIALIZE_OK,
859  static_cast<FwAssertArgType>(_status)
860  );
861 
862  this->m_logOut_OutputPort[0].invoke(
863  _id,
864  _logTime,
866  _logBuff
867  );
868  }
869 
870  // Emit the event on the text log port
871 #if FW_ENABLE_TEXT_LOGGING
872  if (this->m_logTextOut_OutputPort[0].isConnected()) {
873 #if FW_OBJECT_NAMES == 1
874  const char* _formatString =
875  "(%s) %s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
876 #else
877  const char* _formatString =
878  "%s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
879 #endif
880 
881  Fw::TextLogString _logString;
882  _logString.format(
883  _formatString,
884 #if FW_OBJECT_NAMES == 1
885  this->m_objName.toChar(),
886 #endif
887  "InvalidSpacecraftId ",
888  transmitted,
889  configured
890  );
891 
892  this->m_logTextOut_OutputPort[0].invoke(
893  _id,
894  _logTime,
896  _logString
897  );
898  }
899 #endif
900  }
901 
904  U16 transmitted,
905  FwSizeType actual
906  ) const
907  {
908  // Get the time
909  Fw::Time _logTime;
910  if (this->m_timeCaller_OutputPort[0].isConnected()) {
911  this->m_timeCaller_OutputPort[0].invoke(_logTime);
912  }
913 
914  FwEventIdType _id = static_cast<FwEventIdType>(0);
915 
916  _id = this->getIdBase() + EVENTID_INVALIDFRAMELENGTH;
917 
918  // Emit the event on the log port
919  if (this->m_logOut_OutputPort[0].isConnected()) {
920  Fw::LogBuffer _logBuff;
922 
923 #if FW_AMPCS_COMPATIBLE
924  // Serialize the number of arguments
925  _status = _logBuff.serializeFrom(static_cast<U8>(2));
926  FW_ASSERT(
927  _status == Fw::FW_SERIALIZE_OK,
928  static_cast<FwAssertArgType>(_status)
929  );
930 #endif
931 
932 #if FW_AMPCS_COMPATIBLE
933  // Serialize the argument size
934  _status = _logBuff.serializeFrom(
935  static_cast<U8>(sizeof(U16))
936  );
937  FW_ASSERT(
938  _status == Fw::FW_SERIALIZE_OK,
939  static_cast<FwAssertArgType>(_status)
940  );
941 #endif
942  _status = _logBuff.serializeFrom(transmitted);
943  FW_ASSERT(
944  _status == Fw::FW_SERIALIZE_OK,
945  static_cast<FwAssertArgType>(_status)
946  );
947 
948 #if FW_AMPCS_COMPATIBLE
949  // Serialize the argument size
950  _status = _logBuff.serializeFrom(
951  static_cast<U8>(sizeof(FwSizeType))
952  );
953  FW_ASSERT(
954  _status == Fw::FW_SERIALIZE_OK,
955  static_cast<FwAssertArgType>(_status)
956  );
957 #endif
958  _status = _logBuff.serializeFrom(actual);
959  FW_ASSERT(
960  _status == Fw::FW_SERIALIZE_OK,
961  static_cast<FwAssertArgType>(_status)
962  );
963 
964  this->m_logOut_OutputPort[0].invoke(
965  _id,
966  _logTime,
968  _logBuff
969  );
970  }
971 
972  // Emit the event on the text log port
973 #if FW_ENABLE_TEXT_LOGGING
974  if (this->m_logTextOut_OutputPort[0].isConnected()) {
975 #if FW_OBJECT_NAMES == 1
976  const char* _formatString =
977  "(%s) %s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
978 #else
979  const char* _formatString =
980  "%s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
981 #endif
982 
983  Fw::TextLogString _logString;
984  _logString.format(
985  _formatString,
986 #if FW_OBJECT_NAMES == 1
987  this->m_objName.toChar(),
988 #endif
989  "InvalidFrameLength ",
990  transmitted,
991  actual
992  );
993 
994  this->m_logTextOut_OutputPort[0].invoke(
995  _id,
996  _logTime,
998  _logString
999  );
1000  }
1001 #endif
1002  }
1003 
1006  U16 transmitted,
1007  U16 configured
1008  ) const
1009  {
1010  // Get the time
1011  Fw::Time _logTime;
1012  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1013  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1014  }
1015 
1016  FwEventIdType _id = static_cast<FwEventIdType>(0);
1017 
1018  _id = this->getIdBase() + EVENTID_INVALIDVCID;
1019 
1020  // Emit the event on the log port
1021  if (this->m_logOut_OutputPort[0].isConnected()) {
1022  Fw::LogBuffer _logBuff;
1024 
1025 #if FW_AMPCS_COMPATIBLE
1026  // Serialize the number of arguments
1027  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1028  FW_ASSERT(
1029  _status == Fw::FW_SERIALIZE_OK,
1030  static_cast<FwAssertArgType>(_status)
1031  );
1032 #endif
1033 
1034 #if FW_AMPCS_COMPATIBLE
1035  // Serialize the argument size
1036  _status = _logBuff.serializeFrom(
1037  static_cast<U8>(sizeof(U16))
1038  );
1039  FW_ASSERT(
1040  _status == Fw::FW_SERIALIZE_OK,
1041  static_cast<FwAssertArgType>(_status)
1042  );
1043 #endif
1044  _status = _logBuff.serializeFrom(transmitted);
1045  FW_ASSERT(
1046  _status == Fw::FW_SERIALIZE_OK,
1047  static_cast<FwAssertArgType>(_status)
1048  );
1049 
1050 #if FW_AMPCS_COMPATIBLE
1051  // Serialize the argument size
1052  _status = _logBuff.serializeFrom(
1053  static_cast<U8>(sizeof(U16))
1054  );
1055  FW_ASSERT(
1056  _status == Fw::FW_SERIALIZE_OK,
1057  static_cast<FwAssertArgType>(_status)
1058  );
1059 #endif
1060  _status = _logBuff.serializeFrom(configured);
1061  FW_ASSERT(
1062  _status == Fw::FW_SERIALIZE_OK,
1063  static_cast<FwAssertArgType>(_status)
1064  );
1065 
1066  this->m_logOut_OutputPort[0].invoke(
1067  _id,
1068  _logTime,
1070  _logBuff
1071  );
1072  }
1073 
1074  // Emit the event on the text log port
1075 #if FW_ENABLE_TEXT_LOGGING
1076  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1077 #if FW_OBJECT_NAMES == 1
1078  const char* _formatString =
1079  "(%s) %s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1080 #else
1081  const char* _formatString =
1082  "%s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1083 #endif
1084 
1085  Fw::TextLogString _logString;
1086  _logString.format(
1087  _formatString,
1088 #if FW_OBJECT_NAMES == 1
1089  this->m_objName.toChar(),
1090 #endif
1091  "InvalidVcId ",
1092  transmitted,
1093  configured
1094  );
1095 
1096  this->m_logTextOut_OutputPort[0].invoke(
1097  _id,
1098  _logTime,
1100  _logString
1101  );
1102  }
1103 #endif
1104  }
1105 
1108  U16 transmitted,
1109  U16 computed
1110  ) const
1111  {
1112  // Get the time
1113  Fw::Time _logTime;
1114  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1115  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1116  }
1117 
1118  FwEventIdType _id = static_cast<FwEventIdType>(0);
1119 
1120  _id = this->getIdBase() + EVENTID_INVALIDCRC;
1121 
1122  // Emit the event on the log port
1123  if (this->m_logOut_OutputPort[0].isConnected()) {
1124  Fw::LogBuffer _logBuff;
1126 
1127 #if FW_AMPCS_COMPATIBLE
1128  // Serialize the number of arguments
1129  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1130  FW_ASSERT(
1131  _status == Fw::FW_SERIALIZE_OK,
1132  static_cast<FwAssertArgType>(_status)
1133  );
1134 #endif
1135 
1136 #if FW_AMPCS_COMPATIBLE
1137  // Serialize the argument size
1138  _status = _logBuff.serializeFrom(
1139  static_cast<U8>(sizeof(U16))
1140  );
1141  FW_ASSERT(
1142  _status == Fw::FW_SERIALIZE_OK,
1143  static_cast<FwAssertArgType>(_status)
1144  );
1145 #endif
1146  _status = _logBuff.serializeFrom(transmitted);
1147  FW_ASSERT(
1148  _status == Fw::FW_SERIALIZE_OK,
1149  static_cast<FwAssertArgType>(_status)
1150  );
1151 
1152 #if FW_AMPCS_COMPATIBLE
1153  // Serialize the argument size
1154  _status = _logBuff.serializeFrom(
1155  static_cast<U8>(sizeof(U16))
1156  );
1157  FW_ASSERT(
1158  _status == Fw::FW_SERIALIZE_OK,
1159  static_cast<FwAssertArgType>(_status)
1160  );
1161 #endif
1162  _status = _logBuff.serializeFrom(computed);
1163  FW_ASSERT(
1164  _status == Fw::FW_SERIALIZE_OK,
1165  static_cast<FwAssertArgType>(_status)
1166  );
1167 
1168  this->m_logOut_OutputPort[0].invoke(
1169  _id,
1170  _logTime,
1172  _logBuff
1173  );
1174  }
1175 
1176  // Emit the event on the text log port
1177 #if FW_ENABLE_TEXT_LOGGING
1178  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1179 #if FW_OBJECT_NAMES == 1
1180  const char* _formatString =
1181  "(%s) %s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1182 #else
1183  const char* _formatString =
1184  "%s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1185 #endif
1186 
1187  Fw::TextLogString _logString;
1188  _logString.format(
1189  _formatString,
1190 #if FW_OBJECT_NAMES == 1
1191  this->m_objName.toChar(),
1192 #endif
1193  "InvalidCrc ",
1194  transmitted,
1195  computed
1196  );
1197 
1198  this->m_logTextOut_OutputPort[0].invoke(
1199  _id,
1200  _logTime,
1202  _logString
1203  );
1204  }
1205 #endif
1206  }
1207 
1208  // ----------------------------------------------------------------------
1209  // Time
1210  // ----------------------------------------------------------------------
1211 
1213  getTime() const
1214  {
1215  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1216  Fw::Time _time;
1217  this->m_timeCaller_OutputPort[0].invoke(_time);
1218  return _time;
1219  }
1220  else {
1221  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1222  }
1223  }
1224 
1225  // ----------------------------------------------------------------------
1226  // Mutex operations for guarded ports
1227  //
1228  // You can override these operations to provide more sophisticated
1229  // synchronization
1230  // ----------------------------------------------------------------------
1231 
1234  {
1235  this->m_guardedPortMutex.lock();
1236  }
1237 
1240  {
1241  this->m_guardedPortMutex.unLock();
1242  }
1243 
1244  // ----------------------------------------------------------------------
1245  // Calls for messages received on typed input ports
1246  // ----------------------------------------------------------------------
1247 
1248  void TcDeframerComponentBase ::
1249  m_p_dataIn_in(
1250  Fw::PassiveComponentBase* callComp,
1251  FwIndexType portNum,
1252  Fw::Buffer& data,
1253  const ComCfg::FrameContext& context
1254  )
1255  {
1256  FW_ASSERT(callComp);
1257  TcDeframerComponentBase* compPtr = static_cast<TcDeframerComponentBase*>(callComp);
1258  compPtr->dataIn_handlerBase(
1259  portNum,
1260  data,
1261  context
1262  );
1263  }
1264 
1265  void TcDeframerComponentBase ::
1266  m_p_dataReturnIn_in(
1267  Fw::PassiveComponentBase* callComp,
1268  FwIndexType portNum,
1269  Fw::Buffer& data,
1270  const ComCfg::FrameContext& context
1271  )
1272  {
1273  FW_ASSERT(callComp);
1274  TcDeframerComponentBase* compPtr = static_cast<TcDeframerComponentBase*>(callComp);
1275  compPtr->dataReturnIn_handlerBase(
1276  portNum,
1277  data,
1278  context
1279  );
1280  }
1281 
1282  }
1283 
1284 }
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
Serialization/Deserialization operation was successful.
bool isConnected_prmSetOut_OutputPort(FwIndexType portNum)
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
bool isConnected_errorNotify_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
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
I32 FwEnumStoreType
void init()
Initialization function.
bool isConnected_prmGetOut_OutputPort(FwIndexType portNum)
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
static constexpr FwIndexType getNum_logOut_OutputPorts()
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_dataIn_InputPorts()
bool isConnected_logOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_errorNotify_OutputPorts()
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
static constexpr FwIndexType getNum_prmSetOut_OutputPorts()
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
No time base has been established (Required)
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
virtual void lock()
Lock the guarded mutex.
void init()
Initialization function.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
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
SerializeStatus
forward declaration for string
void log_ACTIVITY_LO_InvalidVcId(U16 transmitted, U16 configured) const
void addCallPort(InputErrorNotifyPort *callPort)
Register an input port.
void log_WARNING_HI_InvalidCrc(U16 transmitted, U16 computed) const
FwIdType FwEventIdType
The type of an event identifier.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void invoke(const Svc::Ccsds::FrameError &errorCode) const
Invoke a port interface.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Less important informational events.
virtual ~TcDeframerComponentBase()
Destroy TcDeframerComponentBase object.
A less serious but recoverable event.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
TcDeframerComponentBase(const char *compName="")
Construct TcDeframerComponentBase object.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
static constexpr FwIndexType getNum_prmGetOut_OutputPorts()
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
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:38
#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 set_errorNotify_OutputPort(FwIndexType portNum, Svc::Ccsds::InputErrorNotifyPort *port)
Connect port to errorNotify[portNum].
void log_WARNING_LO_InvalidSpacecraftId(U16 transmitted, U16 configured) const
void init()
Initialization function.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[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 errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode)
Invoke output port errorNotify.
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
PlatformIndexType FwIndexType
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
Type used to pass context info between components during framing/deframing.
RateGroupDivider component implementation.
static constexpr FwIndexType getNum_dataOut_OutputPorts()
Implementation of malloc based allocator.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataReturnOut.
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
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
virtual void unLock()
Unlock the guarded mutex.
Auto-generated base for TcDeframer component.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
void log_WARNING_HI_InvalidFrameLength(U16 transmitted, FwSizeType actual) const