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  {
803  // Get the time
804  Fw::Time _logTime;
805  if (this->m_timeCaller_OutputPort[0].isConnected()) {
806  this->m_timeCaller_OutputPort[0].invoke(_logTime);
807  }
808 
809  FwEventIdType _id = static_cast<FwEventIdType>(0);
810 
811  _id = this->getIdBase() + EVENTID_INVALIDPACKET;
812 
813  // Emit the event on the log port
814  if (this->m_logOut_OutputPort[0].isConnected()) {
815  Fw::LogBuffer _logBuff;
816 
817 #if FW_AMPCS_COMPATIBLE
819  // Serialize the number of arguments
820  _status = _logBuff.serializeFrom(static_cast<U8>(0));
821  FW_ASSERT(
822  _status == Fw::FW_SERIALIZE_OK,
823  static_cast<FwAssertArgType>(_status)
824  );
825 #endif
826 
827  this->m_logOut_OutputPort[0].invoke(
828  _id,
829  _logTime,
831  _logBuff
832  );
833  }
834 
835  // Emit the event on the text log port
836 #if FW_ENABLE_TEXT_LOGGING
837  if (this->m_logTextOut_OutputPort[0].isConnected()) {
838 #if FW_OBJECT_NAMES == 1
839  const char* _formatString =
840  "(%s) %s: Invalid packet received refusing to deframe";
841 #else
842  const char* _formatString =
843  "%s: Invalid packet received refusing to deframe";
844 #endif
845 
846  Fw::TextLogString _logString;
847  _logString.format(
848  _formatString,
849 #if FW_OBJECT_NAMES == 1
850  this->m_objName.toChar(),
851 #endif
852  "InvalidPacket "
853  );
854 
855  this->m_logTextOut_OutputPort[0].invoke(
856  _id,
857  _logTime,
859  _logString
860  );
861  }
862 #endif
863  }
864 
867  U16 transmitted,
868  U16 configured
869  ) const
870  {
871  // Get the time
872  Fw::Time _logTime;
873  if (this->m_timeCaller_OutputPort[0].isConnected()) {
874  this->m_timeCaller_OutputPort[0].invoke(_logTime);
875  }
876 
877  FwEventIdType _id = static_cast<FwEventIdType>(0);
878 
879  _id = this->getIdBase() + EVENTID_INVALIDSPACECRAFTID;
880 
881  // Emit the event on the log port
882  if (this->m_logOut_OutputPort[0].isConnected()) {
883  Fw::LogBuffer _logBuff;
885 
886 #if FW_AMPCS_COMPATIBLE
887  // Serialize the number of arguments
888  _status = _logBuff.serializeFrom(static_cast<U8>(2));
889  FW_ASSERT(
890  _status == Fw::FW_SERIALIZE_OK,
891  static_cast<FwAssertArgType>(_status)
892  );
893 #endif
894 
895 #if FW_AMPCS_COMPATIBLE
896  // Serialize the argument size
897  _status = _logBuff.serializeFrom(
898  static_cast<U8>(sizeof(U16))
899  );
900  FW_ASSERT(
901  _status == Fw::FW_SERIALIZE_OK,
902  static_cast<FwAssertArgType>(_status)
903  );
904 #endif
905  _status = _logBuff.serializeFrom(transmitted);
906  FW_ASSERT(
907  _status == Fw::FW_SERIALIZE_OK,
908  static_cast<FwAssertArgType>(_status)
909  );
910 
911 #if FW_AMPCS_COMPATIBLE
912  // Serialize the argument size
913  _status = _logBuff.serializeFrom(
914  static_cast<U8>(sizeof(U16))
915  );
916  FW_ASSERT(
917  _status == Fw::FW_SERIALIZE_OK,
918  static_cast<FwAssertArgType>(_status)
919  );
920 #endif
921  _status = _logBuff.serializeFrom(configured);
922  FW_ASSERT(
923  _status == Fw::FW_SERIALIZE_OK,
924  static_cast<FwAssertArgType>(_status)
925  );
926 
927  this->m_logOut_OutputPort[0].invoke(
928  _id,
929  _logTime,
931  _logBuff
932  );
933  }
934 
935  // Emit the event on the text log port
936 #if FW_ENABLE_TEXT_LOGGING
937  if (this->m_logTextOut_OutputPort[0].isConnected()) {
938 #if FW_OBJECT_NAMES == 1
939  const char* _formatString =
940  "(%s) %s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
941 #else
942  const char* _formatString =
943  "%s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
944 #endif
945 
946  Fw::TextLogString _logString;
947  _logString.format(
948  _formatString,
949 #if FW_OBJECT_NAMES == 1
950  this->m_objName.toChar(),
951 #endif
952  "InvalidSpacecraftId ",
953  transmitted,
954  configured
955  );
956 
957  this->m_logTextOut_OutputPort[0].invoke(
958  _id,
959  _logTime,
961  _logString
962  );
963  }
964 #endif
965  }
966 
969  U16 transmitted,
970  FwSizeType actual
971  ) const
972  {
973  // Get the time
974  Fw::Time _logTime;
975  if (this->m_timeCaller_OutputPort[0].isConnected()) {
976  this->m_timeCaller_OutputPort[0].invoke(_logTime);
977  }
978 
979  FwEventIdType _id = static_cast<FwEventIdType>(0);
980 
981  _id = this->getIdBase() + EVENTID_INVALIDFRAMELENGTH;
982 
983  // Emit the event on the log port
984  if (this->m_logOut_OutputPort[0].isConnected()) {
985  Fw::LogBuffer _logBuff;
987 
988 #if FW_AMPCS_COMPATIBLE
989  // Serialize the number of arguments
990  _status = _logBuff.serializeFrom(static_cast<U8>(2));
991  FW_ASSERT(
992  _status == Fw::FW_SERIALIZE_OK,
993  static_cast<FwAssertArgType>(_status)
994  );
995 #endif
996 
997 #if FW_AMPCS_COMPATIBLE
998  // Serialize the argument size
999  _status = _logBuff.serializeFrom(
1000  static_cast<U8>(sizeof(U16))
1001  );
1002  FW_ASSERT(
1003  _status == Fw::FW_SERIALIZE_OK,
1004  static_cast<FwAssertArgType>(_status)
1005  );
1006 #endif
1007  _status = _logBuff.serializeFrom(transmitted);
1008  FW_ASSERT(
1009  _status == Fw::FW_SERIALIZE_OK,
1010  static_cast<FwAssertArgType>(_status)
1011  );
1012 
1013 #if FW_AMPCS_COMPATIBLE
1014  // Serialize the argument size
1015  _status = _logBuff.serializeFrom(
1016  static_cast<U8>(sizeof(FwSizeType))
1017  );
1018  FW_ASSERT(
1019  _status == Fw::FW_SERIALIZE_OK,
1020  static_cast<FwAssertArgType>(_status)
1021  );
1022 #endif
1023  _status = _logBuff.serializeFrom(actual);
1024  FW_ASSERT(
1025  _status == Fw::FW_SERIALIZE_OK,
1026  static_cast<FwAssertArgType>(_status)
1027  );
1028 
1029  this->m_logOut_OutputPort[0].invoke(
1030  _id,
1031  _logTime,
1033  _logBuff
1034  );
1035  }
1036 
1037  // Emit the event on the text log port
1038 #if FW_ENABLE_TEXT_LOGGING
1039  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1040 #if FW_OBJECT_NAMES == 1
1041  const char* _formatString =
1042  "(%s) %s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
1043 #else
1044  const char* _formatString =
1045  "%s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
1046 #endif
1047 
1048  Fw::TextLogString _logString;
1049  _logString.format(
1050  _formatString,
1051 #if FW_OBJECT_NAMES == 1
1052  this->m_objName.toChar(),
1053 #endif
1054  "InvalidFrameLength ",
1055  transmitted,
1056  actual
1057  );
1058 
1059  this->m_logTextOut_OutputPort[0].invoke(
1060  _id,
1061  _logTime,
1063  _logString
1064  );
1065  }
1066 #endif
1067  }
1068 
1071  U16 transmitted,
1072  U16 configured
1073  ) const
1074  {
1075  // Get the time
1076  Fw::Time _logTime;
1077  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1078  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1079  }
1080 
1081  FwEventIdType _id = static_cast<FwEventIdType>(0);
1082 
1083  _id = this->getIdBase() + EVENTID_INVALIDVCID;
1084 
1085  // Emit the event on the log port
1086  if (this->m_logOut_OutputPort[0].isConnected()) {
1087  Fw::LogBuffer _logBuff;
1089 
1090 #if FW_AMPCS_COMPATIBLE
1091  // Serialize the number of arguments
1092  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1093  FW_ASSERT(
1094  _status == Fw::FW_SERIALIZE_OK,
1095  static_cast<FwAssertArgType>(_status)
1096  );
1097 #endif
1098 
1099 #if FW_AMPCS_COMPATIBLE
1100  // Serialize the argument size
1101  _status = _logBuff.serializeFrom(
1102  static_cast<U8>(sizeof(U16))
1103  );
1104  FW_ASSERT(
1105  _status == Fw::FW_SERIALIZE_OK,
1106  static_cast<FwAssertArgType>(_status)
1107  );
1108 #endif
1109  _status = _logBuff.serializeFrom(transmitted);
1110  FW_ASSERT(
1111  _status == Fw::FW_SERIALIZE_OK,
1112  static_cast<FwAssertArgType>(_status)
1113  );
1114 
1115 #if FW_AMPCS_COMPATIBLE
1116  // Serialize the argument size
1117  _status = _logBuff.serializeFrom(
1118  static_cast<U8>(sizeof(U16))
1119  );
1120  FW_ASSERT(
1121  _status == Fw::FW_SERIALIZE_OK,
1122  static_cast<FwAssertArgType>(_status)
1123  );
1124 #endif
1125  _status = _logBuff.serializeFrom(configured);
1126  FW_ASSERT(
1127  _status == Fw::FW_SERIALIZE_OK,
1128  static_cast<FwAssertArgType>(_status)
1129  );
1130 
1131  this->m_logOut_OutputPort[0].invoke(
1132  _id,
1133  _logTime,
1135  _logBuff
1136  );
1137  }
1138 
1139  // Emit the event on the text log port
1140 #if FW_ENABLE_TEXT_LOGGING
1141  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1142 #if FW_OBJECT_NAMES == 1
1143  const char* _formatString =
1144  "(%s) %s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1145 #else
1146  const char* _formatString =
1147  "%s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1148 #endif
1149 
1150  Fw::TextLogString _logString;
1151  _logString.format(
1152  _formatString,
1153 #if FW_OBJECT_NAMES == 1
1154  this->m_objName.toChar(),
1155 #endif
1156  "InvalidVcId ",
1157  transmitted,
1158  configured
1159  );
1160 
1161  this->m_logTextOut_OutputPort[0].invoke(
1162  _id,
1163  _logTime,
1165  _logString
1166  );
1167  }
1168 #endif
1169  }
1170 
1173  U16 transmitted,
1174  U16 computed
1175  ) const
1176  {
1177  // Get the time
1178  Fw::Time _logTime;
1179  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1180  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1181  }
1182 
1183  FwEventIdType _id = static_cast<FwEventIdType>(0);
1184 
1185  _id = this->getIdBase() + EVENTID_INVALIDCRC;
1186 
1187  // Emit the event on the log port
1188  if (this->m_logOut_OutputPort[0].isConnected()) {
1189  Fw::LogBuffer _logBuff;
1191 
1192 #if FW_AMPCS_COMPATIBLE
1193  // Serialize the number of arguments
1194  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1195  FW_ASSERT(
1196  _status == Fw::FW_SERIALIZE_OK,
1197  static_cast<FwAssertArgType>(_status)
1198  );
1199 #endif
1200 
1201 #if FW_AMPCS_COMPATIBLE
1202  // Serialize the argument size
1203  _status = _logBuff.serializeFrom(
1204  static_cast<U8>(sizeof(U16))
1205  );
1206  FW_ASSERT(
1207  _status == Fw::FW_SERIALIZE_OK,
1208  static_cast<FwAssertArgType>(_status)
1209  );
1210 #endif
1211  _status = _logBuff.serializeFrom(transmitted);
1212  FW_ASSERT(
1213  _status == Fw::FW_SERIALIZE_OK,
1214  static_cast<FwAssertArgType>(_status)
1215  );
1216 
1217 #if FW_AMPCS_COMPATIBLE
1218  // Serialize the argument size
1219  _status = _logBuff.serializeFrom(
1220  static_cast<U8>(sizeof(U16))
1221  );
1222  FW_ASSERT(
1223  _status == Fw::FW_SERIALIZE_OK,
1224  static_cast<FwAssertArgType>(_status)
1225  );
1226 #endif
1227  _status = _logBuff.serializeFrom(computed);
1228  FW_ASSERT(
1229  _status == Fw::FW_SERIALIZE_OK,
1230  static_cast<FwAssertArgType>(_status)
1231  );
1232 
1233  this->m_logOut_OutputPort[0].invoke(
1234  _id,
1235  _logTime,
1237  _logBuff
1238  );
1239  }
1240 
1241  // Emit the event on the text log port
1242 #if FW_ENABLE_TEXT_LOGGING
1243  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1244 #if FW_OBJECT_NAMES == 1
1245  const char* _formatString =
1246  "(%s) %s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1247 #else
1248  const char* _formatString =
1249  "%s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1250 #endif
1251 
1252  Fw::TextLogString _logString;
1253  _logString.format(
1254  _formatString,
1255 #if FW_OBJECT_NAMES == 1
1256  this->m_objName.toChar(),
1257 #endif
1258  "InvalidCrc ",
1259  transmitted,
1260  computed
1261  );
1262 
1263  this->m_logTextOut_OutputPort[0].invoke(
1264  _id,
1265  _logTime,
1267  _logString
1268  );
1269  }
1270 #endif
1271  }
1272 
1273  // ----------------------------------------------------------------------
1274  // Time
1275  // ----------------------------------------------------------------------
1276 
1278  getTime() const
1279  {
1280  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1281  Fw::Time _time;
1282  this->m_timeCaller_OutputPort[0].invoke(_time);
1283  return _time;
1284  }
1285  else {
1286  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1287  }
1288  }
1289 
1290  // ----------------------------------------------------------------------
1291  // Mutex operations for guarded ports
1292  //
1293  // You can override these operations to provide more sophisticated
1294  // synchronization
1295  // ----------------------------------------------------------------------
1296 
1299  {
1300  this->m_guardedPortMutex.lock();
1301  }
1302 
1305  {
1306  this->m_guardedPortMutex.unLock();
1307  }
1308 
1309  // ----------------------------------------------------------------------
1310  // Calls for messages received on typed input ports
1311  // ----------------------------------------------------------------------
1312 
1313  void TcDeframerComponentBase ::
1314  m_p_dataIn_in(
1315  Fw::PassiveComponentBase* callComp,
1316  FwIndexType portNum,
1317  Fw::Buffer& data,
1318  const ComCfg::FrameContext& context
1319  )
1320  {
1321  FW_ASSERT(callComp);
1322  TcDeframerComponentBase* compPtr = static_cast<TcDeframerComponentBase*>(callComp);
1323  compPtr->dataIn_handlerBase(
1324  portNum,
1325  data,
1326  context
1327  );
1328  }
1329 
1330  void TcDeframerComponentBase ::
1331  m_p_dataReturnIn_in(
1332  Fw::PassiveComponentBase* callComp,
1333  FwIndexType portNum,
1334  Fw::Buffer& data,
1335  const ComCfg::FrameContext& context
1336  )
1337  {
1338  FW_ASSERT(callComp);
1339  TcDeframerComponentBase* compPtr = static_cast<TcDeframerComponentBase*>(callComp);
1340  compPtr->dataReturnIn_handlerBase(
1341  portNum,
1342  data,
1343  context
1344  );
1345  }
1346 
1347  }
1348 
1349 }
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:31
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()
Invalid packet received that will be dropped.
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