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  // Getters for numbers of typed input ports
565  // ----------------------------------------------------------------------
566 
569  {
570  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataIn_InputPort));
571  }
572 
575  {
576  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnIn_InputPort));
577  }
578 
579  // ----------------------------------------------------------------------
580  // Getters for numbers of special output ports
581  // ----------------------------------------------------------------------
582 
585  {
586  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
587  }
588 
589 #if FW_ENABLE_TEXT_LOGGING == 1
590 
591  FwIndexType TcDeframerComponentBase ::
592  getNum_logTextOut_OutputPorts() const
593  {
594  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logTextOut_OutputPort));
595  }
596 
597 #endif
598 
601  {
602  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmGetOut_OutputPort));
603  }
604 
607  {
608  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_prmSetOut_OutputPort));
609  }
610 
613  {
614  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
615  }
616 
619  {
620  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
621  }
622 
623  // ----------------------------------------------------------------------
624  // Getters for numbers of typed output ports
625  // ----------------------------------------------------------------------
626 
629  {
630  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataOut_OutputPort));
631  }
632 
635  {
636  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_dataReturnOut_OutputPort));
637  }
638 
641  {
642  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_errorNotify_OutputPort));
643  }
644 
645  // ----------------------------------------------------------------------
646  // Connection status queries for special output ports
647  // ----------------------------------------------------------------------
648 
651  {
652  FW_ASSERT(
653  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
654  static_cast<FwAssertArgType>(portNum)
655  );
656 
657  return this->m_logOut_OutputPort[portNum].isConnected();
658  }
659 
660 #if FW_ENABLE_TEXT_LOGGING == 1
661 
662  bool TcDeframerComponentBase ::
663  isConnected_logTextOut_OutputPort(FwIndexType portNum)
664  {
665  FW_ASSERT(
666  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
667  static_cast<FwAssertArgType>(portNum)
668  );
669 
670  return this->m_logTextOut_OutputPort[portNum].isConnected();
671  }
672 
673 #endif
674 
677  {
678  FW_ASSERT(
679  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
680  static_cast<FwAssertArgType>(portNum)
681  );
682 
683  return this->m_prmGetOut_OutputPort[portNum].isConnected();
684  }
685 
688  {
689  FW_ASSERT(
690  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
691  static_cast<FwAssertArgType>(portNum)
692  );
693 
694  return this->m_prmSetOut_OutputPort[portNum].isConnected();
695  }
696 
699  {
700  FW_ASSERT(
701  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
702  static_cast<FwAssertArgType>(portNum)
703  );
704 
705  return this->m_timeCaller_OutputPort[portNum].isConnected();
706  }
707 
710  {
711  FW_ASSERT(
712  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
713  static_cast<FwAssertArgType>(portNum)
714  );
715 
716  return this->m_tlmOut_OutputPort[portNum].isConnected();
717  }
718 
719  // ----------------------------------------------------------------------
720  // Connection status queries for typed output ports
721  // ----------------------------------------------------------------------
722 
725  {
726  FW_ASSERT(
727  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
728  static_cast<FwAssertArgType>(portNum)
729  );
730 
731  return this->m_dataOut_OutputPort[portNum].isConnected();
732  }
733 
736  {
737  FW_ASSERT(
738  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
739  static_cast<FwAssertArgType>(portNum)
740  );
741 
742  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
743  }
744 
747  {
748  FW_ASSERT(
749  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
750  static_cast<FwAssertArgType>(portNum)
751  );
752 
753  return this->m_errorNotify_OutputPort[portNum].isConnected();
754  }
755 
756  // ----------------------------------------------------------------------
757  // Port handler base-class functions for typed input ports
758  //
759  // Call these functions directly to bypass the corresponding ports
760  // ----------------------------------------------------------------------
761 
764  FwIndexType portNum,
765  Fw::Buffer& data,
766  const ComCfg::FrameContext& context
767  )
768  {
769  // Make sure port number is valid
770  FW_ASSERT(
771  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
772  static_cast<FwAssertArgType>(portNum)
773  );
774 
775  // Lock guard mutex before calling
776  this->lock();
777 
778  // Call handler function
779  this->dataIn_handler(
780  portNum,
781  data,
782  context
783  );
784 
785  // Unlock guard mutex
786  this->unLock();
787  }
788 
791  FwIndexType portNum,
792  Fw::Buffer& data,
793  const ComCfg::FrameContext& context
794  )
795  {
796  // Make sure port number is valid
797  FW_ASSERT(
798  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
799  static_cast<FwAssertArgType>(portNum)
800  );
801 
802  // Call handler function
803  this->dataReturnIn_handler(
804  portNum,
805  data,
806  context
807  );
808  }
809 
810  // ----------------------------------------------------------------------
811  // Invocation functions for typed output ports
812  // ----------------------------------------------------------------------
813 
816  FwIndexType portNum,
817  Fw::Buffer& data,
818  const ComCfg::FrameContext& context
819  )
820  {
821  FW_ASSERT(
822  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
823  static_cast<FwAssertArgType>(portNum)
824  );
825 
826  FW_ASSERT(
827  this->m_dataOut_OutputPort[portNum].isConnected(),
828  static_cast<FwAssertArgType>(portNum)
829  );
830  this->m_dataOut_OutputPort[portNum].invoke(
831  data,
832  context
833  );
834  }
835 
838  FwIndexType portNum,
839  Fw::Buffer& data,
840  const ComCfg::FrameContext& context
841  )
842  {
843  FW_ASSERT(
844  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
845  static_cast<FwAssertArgType>(portNum)
846  );
847 
848  FW_ASSERT(
849  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
850  static_cast<FwAssertArgType>(portNum)
851  );
852  this->m_dataReturnOut_OutputPort[portNum].invoke(
853  data,
854  context
855  );
856  }
857 
860  FwIndexType portNum,
861  const Svc::Ccsds::FrameError& errorCode
862  )
863  {
864  FW_ASSERT(
865  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
866  static_cast<FwAssertArgType>(portNum)
867  );
868 
869  FW_ASSERT(
870  this->m_errorNotify_OutputPort[portNum].isConnected(),
871  static_cast<FwAssertArgType>(portNum)
872  );
873  this->m_errorNotify_OutputPort[portNum].invoke(
874  errorCode
875  );
876  }
877 
878  // ----------------------------------------------------------------------
879  // Event logging functions
880  // ----------------------------------------------------------------------
881 
884  U16 transmitted,
885  U16 configured
886  ) const
887  {
888  // Get the time
889  Fw::Time _logTime;
890  if (this->m_timeCaller_OutputPort[0].isConnected()) {
891  this->m_timeCaller_OutputPort[0].invoke(_logTime);
892  }
893 
894  FwEventIdType _id = static_cast<FwEventIdType>(0);
895 
896  _id = this->getIdBase() + EVENTID_INVALIDSPACECRAFTID;
897 
898  // Emit the event on the log port
899  if (this->m_logOut_OutputPort[0].isConnected()) {
900  Fw::LogBuffer _logBuff;
902 
903 #if FW_AMPCS_COMPATIBLE
904  // Serialize the number of arguments
905  _status = _logBuff.serializeFrom(static_cast<U8>(2));
906  FW_ASSERT(
907  _status == Fw::FW_SERIALIZE_OK,
908  static_cast<FwAssertArgType>(_status)
909  );
910 #endif
911 
912 #if FW_AMPCS_COMPATIBLE
913  // Serialize the argument size
914  _status = _logBuff.serializeFrom(
915  static_cast<U8>(sizeof(U16))
916  );
917  FW_ASSERT(
918  _status == Fw::FW_SERIALIZE_OK,
919  static_cast<FwAssertArgType>(_status)
920  );
921 #endif
922  _status = _logBuff.serializeFrom(transmitted);
923  FW_ASSERT(
924  _status == Fw::FW_SERIALIZE_OK,
925  static_cast<FwAssertArgType>(_status)
926  );
927 
928 #if FW_AMPCS_COMPATIBLE
929  // Serialize the argument size
930  _status = _logBuff.serializeFrom(
931  static_cast<U8>(sizeof(U16))
932  );
933  FW_ASSERT(
934  _status == Fw::FW_SERIALIZE_OK,
935  static_cast<FwAssertArgType>(_status)
936  );
937 #endif
938  _status = _logBuff.serializeFrom(configured);
939  FW_ASSERT(
940  _status == Fw::FW_SERIALIZE_OK,
941  static_cast<FwAssertArgType>(_status)
942  );
943 
944  this->m_logOut_OutputPort[0].invoke(
945  _id,
946  _logTime,
948  _logBuff
949  );
950  }
951 
952  // Emit the event on the text log port
953 #if FW_ENABLE_TEXT_LOGGING
954  if (this->m_logTextOut_OutputPort[0].isConnected()) {
955 #if FW_OBJECT_NAMES == 1
956  const char* _formatString =
957  "(%s) %s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
958 #else
959  const char* _formatString =
960  "%s: Invalid Spacecraft ID Received. Received: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
961 #endif
962 
963  Fw::TextLogString _logString;
964  _logString.format(
965  _formatString,
966 #if FW_OBJECT_NAMES == 1
967  this->m_objName.toChar(),
968 #endif
969  "InvalidSpacecraftId ",
970  transmitted,
971  configured
972  );
973 
974  this->m_logTextOut_OutputPort[0].invoke(
975  _id,
976  _logTime,
978  _logString
979  );
980  }
981 #endif
982  }
983 
986  U16 transmitted,
987  FwSizeType actual
988  ) const
989  {
990  // Get the time
991  Fw::Time _logTime;
992  if (this->m_timeCaller_OutputPort[0].isConnected()) {
993  this->m_timeCaller_OutputPort[0].invoke(_logTime);
994  }
995 
996  FwEventIdType _id = static_cast<FwEventIdType>(0);
997 
998  _id = this->getIdBase() + EVENTID_INVALIDFRAMELENGTH;
999 
1000  // Emit the event on the log port
1001  if (this->m_logOut_OutputPort[0].isConnected()) {
1002  Fw::LogBuffer _logBuff;
1004 
1005 #if FW_AMPCS_COMPATIBLE
1006  // Serialize the number of arguments
1007  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1008  FW_ASSERT(
1009  _status == Fw::FW_SERIALIZE_OK,
1010  static_cast<FwAssertArgType>(_status)
1011  );
1012 #endif
1013 
1014 #if FW_AMPCS_COMPATIBLE
1015  // Serialize the argument size
1016  _status = _logBuff.serializeFrom(
1017  static_cast<U8>(sizeof(U16))
1018  );
1019  FW_ASSERT(
1020  _status == Fw::FW_SERIALIZE_OK,
1021  static_cast<FwAssertArgType>(_status)
1022  );
1023 #endif
1024  _status = _logBuff.serializeFrom(transmitted);
1025  FW_ASSERT(
1026  _status == Fw::FW_SERIALIZE_OK,
1027  static_cast<FwAssertArgType>(_status)
1028  );
1029 
1030 #if FW_AMPCS_COMPATIBLE
1031  // Serialize the argument size
1032  _status = _logBuff.serializeFrom(
1033  static_cast<U8>(sizeof(FwSizeType))
1034  );
1035  FW_ASSERT(
1036  _status == Fw::FW_SERIALIZE_OK,
1037  static_cast<FwAssertArgType>(_status)
1038  );
1039 #endif
1040  _status = _logBuff.serializeFrom(actual);
1041  FW_ASSERT(
1042  _status == Fw::FW_SERIALIZE_OK,
1043  static_cast<FwAssertArgType>(_status)
1044  );
1045 
1046  this->m_logOut_OutputPort[0].invoke(
1047  _id,
1048  _logTime,
1050  _logBuff
1051  );
1052  }
1053 
1054  // Emit the event on the text log port
1055 #if FW_ENABLE_TEXT_LOGGING
1056  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1057 #if FW_OBJECT_NAMES == 1
1058  const char* _formatString =
1059  "(%s) %s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
1060 #else
1061  const char* _formatString =
1062  "%s: Not enough data received. Header length specified: %" PRIu16 " | Received data length: %" PRIu64 "";
1063 #endif
1064 
1065  Fw::TextLogString _logString;
1066  _logString.format(
1067  _formatString,
1068 #if FW_OBJECT_NAMES == 1
1069  this->m_objName.toChar(),
1070 #endif
1071  "InvalidFrameLength ",
1072  transmitted,
1073  actual
1074  );
1075 
1076  this->m_logTextOut_OutputPort[0].invoke(
1077  _id,
1078  _logTime,
1080  _logString
1081  );
1082  }
1083 #endif
1084  }
1085 
1088  U16 transmitted,
1089  U16 configured
1090  ) const
1091  {
1092  // Get the time
1093  Fw::Time _logTime;
1094  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1095  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1096  }
1097 
1098  FwEventIdType _id = static_cast<FwEventIdType>(0);
1099 
1100  _id = this->getIdBase() + EVENTID_INVALIDVCID;
1101 
1102  // Emit the event on the log port
1103  if (this->m_logOut_OutputPort[0].isConnected()) {
1104  Fw::LogBuffer _logBuff;
1106 
1107 #if FW_AMPCS_COMPATIBLE
1108  // Serialize the number of arguments
1109  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1110  FW_ASSERT(
1111  _status == Fw::FW_SERIALIZE_OK,
1112  static_cast<FwAssertArgType>(_status)
1113  );
1114 #endif
1115 
1116 #if FW_AMPCS_COMPATIBLE
1117  // Serialize the argument size
1118  _status = _logBuff.serializeFrom(
1119  static_cast<U8>(sizeof(U16))
1120  );
1121  FW_ASSERT(
1122  _status == Fw::FW_SERIALIZE_OK,
1123  static_cast<FwAssertArgType>(_status)
1124  );
1125 #endif
1126  _status = _logBuff.serializeFrom(transmitted);
1127  FW_ASSERT(
1128  _status == Fw::FW_SERIALIZE_OK,
1129  static_cast<FwAssertArgType>(_status)
1130  );
1131 
1132 #if FW_AMPCS_COMPATIBLE
1133  // Serialize the argument size
1134  _status = _logBuff.serializeFrom(
1135  static_cast<U8>(sizeof(U16))
1136  );
1137  FW_ASSERT(
1138  _status == Fw::FW_SERIALIZE_OK,
1139  static_cast<FwAssertArgType>(_status)
1140  );
1141 #endif
1142  _status = _logBuff.serializeFrom(configured);
1143  FW_ASSERT(
1144  _status == Fw::FW_SERIALIZE_OK,
1145  static_cast<FwAssertArgType>(_status)
1146  );
1147 
1148  this->m_logOut_OutputPort[0].invoke(
1149  _id,
1150  _logTime,
1152  _logBuff
1153  );
1154  }
1155 
1156  // Emit the event on the text log port
1157 #if FW_ENABLE_TEXT_LOGGING
1158  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1159 #if FW_OBJECT_NAMES == 1
1160  const char* _formatString =
1161  "(%s) %s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1162 #else
1163  const char* _formatString =
1164  "%s: Invalid Virtual Channel ID Received. Header token specified: %" PRIu16 " | Deframer configured with: %" PRIu16 "";
1165 #endif
1166 
1167  Fw::TextLogString _logString;
1168  _logString.format(
1169  _formatString,
1170 #if FW_OBJECT_NAMES == 1
1171  this->m_objName.toChar(),
1172 #endif
1173  "InvalidVcId ",
1174  transmitted,
1175  configured
1176  );
1177 
1178  this->m_logTextOut_OutputPort[0].invoke(
1179  _id,
1180  _logTime,
1182  _logString
1183  );
1184  }
1185 #endif
1186  }
1187 
1190  U16 transmitted,
1191  U16 computed
1192  ) const
1193  {
1194  // Get the time
1195  Fw::Time _logTime;
1196  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1197  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1198  }
1199 
1200  FwEventIdType _id = static_cast<FwEventIdType>(0);
1201 
1202  _id = this->getIdBase() + EVENTID_INVALIDCRC;
1203 
1204  // Emit the event on the log port
1205  if (this->m_logOut_OutputPort[0].isConnected()) {
1206  Fw::LogBuffer _logBuff;
1208 
1209 #if FW_AMPCS_COMPATIBLE
1210  // Serialize the number of arguments
1211  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1212  FW_ASSERT(
1213  _status == Fw::FW_SERIALIZE_OK,
1214  static_cast<FwAssertArgType>(_status)
1215  );
1216 #endif
1217 
1218 #if FW_AMPCS_COMPATIBLE
1219  // Serialize the argument size
1220  _status = _logBuff.serializeFrom(
1221  static_cast<U8>(sizeof(U16))
1222  );
1223  FW_ASSERT(
1224  _status == Fw::FW_SERIALIZE_OK,
1225  static_cast<FwAssertArgType>(_status)
1226  );
1227 #endif
1228  _status = _logBuff.serializeFrom(transmitted);
1229  FW_ASSERT(
1230  _status == Fw::FW_SERIALIZE_OK,
1231  static_cast<FwAssertArgType>(_status)
1232  );
1233 
1234 #if FW_AMPCS_COMPATIBLE
1235  // Serialize the argument size
1236  _status = _logBuff.serializeFrom(
1237  static_cast<U8>(sizeof(U16))
1238  );
1239  FW_ASSERT(
1240  _status == Fw::FW_SERIALIZE_OK,
1241  static_cast<FwAssertArgType>(_status)
1242  );
1243 #endif
1244  _status = _logBuff.serializeFrom(computed);
1245  FW_ASSERT(
1246  _status == Fw::FW_SERIALIZE_OK,
1247  static_cast<FwAssertArgType>(_status)
1248  );
1249 
1250  this->m_logOut_OutputPort[0].invoke(
1251  _id,
1252  _logTime,
1254  _logBuff
1255  );
1256  }
1257 
1258  // Emit the event on the text log port
1259 #if FW_ENABLE_TEXT_LOGGING
1260  if (this->m_logTextOut_OutputPort[0].isConnected()) {
1261 #if FW_OBJECT_NAMES == 1
1262  const char* _formatString =
1263  "(%s) %s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1264 #else
1265  const char* _formatString =
1266  "%s: Invalid checksum received. Trailer specified: %" PRIu16 " | Computed on board: %" PRIu16 "";
1267 #endif
1268 
1269  Fw::TextLogString _logString;
1270  _logString.format(
1271  _formatString,
1272 #if FW_OBJECT_NAMES == 1
1273  this->m_objName.toChar(),
1274 #endif
1275  "InvalidCrc ",
1276  transmitted,
1277  computed
1278  );
1279 
1280  this->m_logTextOut_OutputPort[0].invoke(
1281  _id,
1282  _logTime,
1284  _logString
1285  );
1286  }
1287 #endif
1288  }
1289 
1290  // ----------------------------------------------------------------------
1291  // Time
1292  // ----------------------------------------------------------------------
1293 
1295  getTime() const
1296  {
1297  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1298  Fw::Time _time;
1299  this->m_timeCaller_OutputPort[0].invoke(_time);
1300  return _time;
1301  }
1302  else {
1303  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1304  }
1305  }
1306 
1307  // ----------------------------------------------------------------------
1308  // Mutex operations for guarded ports
1309  //
1310  // You can override these operations to provide more sophisticated
1311  // synchronization
1312  // ----------------------------------------------------------------------
1313 
1316  {
1317  this->m_guardedPortMutex.lock();
1318  }
1319 
1322  {
1323  this->m_guardedPortMutex.unLock();
1324  }
1325 
1326  // ----------------------------------------------------------------------
1327  // Calls for messages received on typed input ports
1328  // ----------------------------------------------------------------------
1329 
1330  void TcDeframerComponentBase ::
1331  m_p_dataIn_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->dataIn_handlerBase(
1341  portNum,
1342  data,
1343  context
1344  );
1345  }
1346 
1347  void TcDeframerComponentBase ::
1348  m_p_dataReturnIn_in(
1349  Fw::PassiveComponentBase* callComp,
1350  FwIndexType portNum,
1351  Fw::Buffer& data,
1352  const ComCfg::FrameContext& context
1353  )
1354  {
1355  FW_ASSERT(callComp);
1356  TcDeframerComponentBase* compPtr = static_cast<TcDeframerComponentBase*>(callComp);
1357  compPtr->dataReturnIn_handlerBase(
1358  portNum,
1359  data,
1360  context
1361  );
1362  }
1363 
1364  }
1365 
1366 }
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)
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
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.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
bool isConnected_logOut_OutputPort(FwIndexType portNum)
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum)
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
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.
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:40
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
const char * toChar() const
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:55
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.
PlatformIndexType FwIndexType
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:90
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.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
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