F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SpacePacketDeframerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SpacePacketDeframerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SpacePacketDeframer component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  namespace Ccsds {
17 
18  // ----------------------------------------------------------------------
19  // Component initialization
20  // ----------------------------------------------------------------------
21 
24  {
25  // Initialize base class
27 
28 #if !FW_DIRECT_PORT_CALLS
29  // Connect input port dataIn
30  for (
31  FwIndexType port = 0;
32  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
33  port++
34  ) {
35  this->m_dataIn_InputPort[port].init();
36  this->m_dataIn_InputPort[port].addCallComp(
37  this,
38  m_p_dataIn_in
39  );
40  this->m_dataIn_InputPort[port].setPortNum(port);
41 
42 #if FW_OBJECT_NAMES == 1
43  Fw::ObjectName portName;
44  portName.format(
45  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
46  this->m_objName.toChar(),
47  port
48  );
49  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
50 #endif
51  }
52 #endif
53 
54 #if !FW_DIRECT_PORT_CALLS
55  // Connect input port dataReturnIn
56  for (
57  FwIndexType port = 0;
58  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
59  port++
60  ) {
61  this->m_dataReturnIn_InputPort[port].init();
62  this->m_dataReturnIn_InputPort[port].addCallComp(
63  this,
64  m_p_dataReturnIn_in
65  );
66  this->m_dataReturnIn_InputPort[port].setPortNum(port);
67 
68 #if FW_OBJECT_NAMES == 1
69  Fw::ObjectName portName;
70  portName.format(
71  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
72  this->m_objName.toChar(),
73  port
74  );
75  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
76 #endif
77  }
78 #endif
79 
80 #if !FW_DIRECT_PORT_CALLS
81  // Connect output port logOut
82  for (
83  FwIndexType port = 0;
84  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
85  port++
86  ) {
87  this->m_logOut_OutputPort[port].init();
88 
89 #if FW_OBJECT_NAMES == 1
90  Fw::ObjectName portName;
91  portName.format(
92  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
93  this->m_objName.toChar(),
94  port
95  );
96  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
97 #endif
98  }
99 #endif
100 
101 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
102  // Connect output port logTextOut
103  for (
104  FwIndexType port = 0;
105  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
106  port++
107  ) {
108  this->m_logTextOut_OutputPort[port].init();
109 
110 #if FW_OBJECT_NAMES == 1
111  Fw::ObjectName portName;
112  portName.format(
113  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
114  this->m_objName.toChar(),
115  port
116  );
117  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
118 #endif
119  }
120 #endif
121 
122 #if !FW_DIRECT_PORT_CALLS
123  // Connect output port prmGetOut
124  for (
125  FwIndexType port = 0;
126  port < static_cast<FwIndexType>(this->getNum_prmGetOut_OutputPorts());
127  port++
128  ) {
129  this->m_prmGetOut_OutputPort[port].init();
130 
131 #if FW_OBJECT_NAMES == 1
132  Fw::ObjectName portName;
133  portName.format(
134  "%s_prmGetOut_OutputPort[%" PRI_FwIndexType "]",
135  this->m_objName.toChar(),
136  port
137  );
138  this->m_prmGetOut_OutputPort[port].setObjName(portName.toChar());
139 #endif
140  }
141 #endif
142 
143 #if !FW_DIRECT_PORT_CALLS
144  // Connect output port prmSetOut
145  for (
146  FwIndexType port = 0;
147  port < static_cast<FwIndexType>(this->getNum_prmSetOut_OutputPorts());
148  port++
149  ) {
150  this->m_prmSetOut_OutputPort[port].init();
151 
152 #if FW_OBJECT_NAMES == 1
153  Fw::ObjectName portName;
154  portName.format(
155  "%s_prmSetOut_OutputPort[%" PRI_FwIndexType "]",
156  this->m_objName.toChar(),
157  port
158  );
159  this->m_prmSetOut_OutputPort[port].setObjName(portName.toChar());
160 #endif
161  }
162 #endif
163 
164 #if !FW_DIRECT_PORT_CALLS
165  // Connect output port timeCaller
166  for (
167  FwIndexType port = 0;
168  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
169  port++
170  ) {
171  this->m_timeCaller_OutputPort[port].init();
172 
173 #if FW_OBJECT_NAMES == 1
174  Fw::ObjectName portName;
175  portName.format(
176  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
177  this->m_objName.toChar(),
178  port
179  );
180  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
181 #endif
182  }
183 #endif
184 
185 #if !FW_DIRECT_PORT_CALLS
186  // Connect output port tlmOut
187  for (
188  FwIndexType port = 0;
189  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
190  port++
191  ) {
192  this->m_tlmOut_OutputPort[port].init();
193 
194 #if FW_OBJECT_NAMES == 1
195  Fw::ObjectName portName;
196  portName.format(
197  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
198  this->m_objName.toChar(),
199  port
200  );
201  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
202 #endif
203  }
204 #endif
205 
206 #if !FW_DIRECT_PORT_CALLS
207  // Connect output port dataOut
208  for (
209  FwIndexType port = 0;
210  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
211  port++
212  ) {
213  this->m_dataOut_OutputPort[port].init();
214 
215 #if FW_OBJECT_NAMES == 1
216  Fw::ObjectName portName;
217  portName.format(
218  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
219  this->m_objName.toChar(),
220  port
221  );
222  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
223 #endif
224  }
225 #endif
226 
227 #if !FW_DIRECT_PORT_CALLS
228  // Connect output port dataReturnOut
229  for (
230  FwIndexType port = 0;
231  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
232  port++
233  ) {
234  this->m_dataReturnOut_OutputPort[port].init();
235 
236 #if FW_OBJECT_NAMES == 1
237  Fw::ObjectName portName;
238  portName.format(
239  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
240  this->m_objName.toChar(),
241  port
242  );
243  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
244 #endif
245  }
246 #endif
247 
248 #if !FW_DIRECT_PORT_CALLS
249  // Connect output port errorNotify
250  for (
251  FwIndexType port = 0;
252  port < static_cast<FwIndexType>(this->getNum_errorNotify_OutputPorts());
253  port++
254  ) {
255  this->m_errorNotify_OutputPort[port].init();
256 
257 #if FW_OBJECT_NAMES == 1
258  Fw::ObjectName portName;
259  portName.format(
260  "%s_errorNotify_OutputPort[%" PRI_FwIndexType "]",
261  this->m_objName.toChar(),
262  port
263  );
264  this->m_errorNotify_OutputPort[port].setObjName(portName.toChar());
265 #endif
266  }
267 #endif
268 
269 #if !FW_DIRECT_PORT_CALLS
270  // Connect output port validateApidSeqCount
271  for (
272  FwIndexType port = 0;
273  port < static_cast<FwIndexType>(this->getNum_validateApidSeqCount_OutputPorts());
274  port++
275  ) {
276  this->m_validateApidSeqCount_OutputPort[port].init();
277 
278 #if FW_OBJECT_NAMES == 1
279  Fw::ObjectName portName;
280  portName.format(
281  "%s_validateApidSeqCount_OutputPort[%" PRI_FwIndexType "]",
282  this->m_objName.toChar(),
283  port
284  );
285  this->m_validateApidSeqCount_OutputPort[port].setObjName(portName.toChar());
286 #endif
287  }
288 #endif
289  }
290 
291 #if !FW_DIRECT_PORT_CALLS
292 
293  // ----------------------------------------------------------------------
294  // Getters for typed input ports
295  // ----------------------------------------------------------------------
296 
299  {
300  FW_ASSERT(
301  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
302  static_cast<FwAssertArgType>(portNum)
303  );
304 
305  return &this->m_dataIn_InputPort[portNum];
306  }
307 
310  {
311  FW_ASSERT(
312  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
313  static_cast<FwAssertArgType>(portNum)
314  );
315 
316  return &this->m_dataReturnIn_InputPort[portNum];
317  }
318 
319 #endif
320 
321 #if !FW_DIRECT_PORT_CALLS
322 
323  // ----------------------------------------------------------------------
324  // Connect input ports to special output ports
325  // ----------------------------------------------------------------------
326 
329  FwIndexType portNum,
330  Fw::InputLogPort* port
331  )
332  {
333  FW_ASSERT(
334  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
335  static_cast<FwAssertArgType>(portNum)
336  );
337 
338  this->m_logOut_OutputPort[portNum].addCallPort(port);
339  }
340 
341 #if FW_ENABLE_TEXT_LOGGING == 1
342 
343  void SpacePacketDeframerComponentBase ::
344  set_logTextOut_OutputPort(
345  FwIndexType portNum,
347  )
348  {
349  FW_ASSERT(
350  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
351  static_cast<FwAssertArgType>(portNum)
352  );
353 
354  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
355  }
356 
357 #endif
358 
361  FwIndexType portNum,
362  Fw::InputPrmGetPort* port
363  )
364  {
365  FW_ASSERT(
366  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
367  static_cast<FwAssertArgType>(portNum)
368  );
369 
370  this->m_prmGetOut_OutputPort[portNum].addCallPort(port);
371  }
372 
375  FwIndexType portNum,
376  Fw::InputPrmSetPort* port
377  )
378  {
379  FW_ASSERT(
380  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
381  static_cast<FwAssertArgType>(portNum)
382  );
383 
384  this->m_prmSetOut_OutputPort[portNum].addCallPort(port);
385  }
386 
389  FwIndexType portNum,
390  Fw::InputTimePort* port
391  )
392  {
393  FW_ASSERT(
394  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
395  static_cast<FwAssertArgType>(portNum)
396  );
397 
398  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
399  }
400 
403  FwIndexType portNum,
404  Fw::InputTlmPort* port
405  )
406  {
407  FW_ASSERT(
408  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
409  static_cast<FwAssertArgType>(portNum)
410  );
411 
412  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
413  }
414 
415 #endif
416 
417 #if !FW_DIRECT_PORT_CALLS
418 
419  // ----------------------------------------------------------------------
420  // Connect typed input ports to typed output ports
421  // ----------------------------------------------------------------------
422 
425  FwIndexType portNum,
427  )
428  {
429  FW_ASSERT(
430  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
431  static_cast<FwAssertArgType>(portNum)
432  );
433 
434  this->m_dataOut_OutputPort[portNum].addCallPort(port);
435  }
436 
439  FwIndexType portNum,
441  )
442  {
443  FW_ASSERT(
444  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
445  static_cast<FwAssertArgType>(portNum)
446  );
447 
448  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
449  }
450 
453  FwIndexType portNum,
455  )
456  {
457  FW_ASSERT(
458  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
459  static_cast<FwAssertArgType>(portNum)
460  );
461 
462  this->m_errorNotify_OutputPort[portNum].addCallPort(port);
463  }
464 
467  FwIndexType portNum,
469  )
470  {
471  FW_ASSERT(
472  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
473  static_cast<FwAssertArgType>(portNum)
474  );
475 
476  this->m_validateApidSeqCount_OutputPort[portNum].addCallPort(port);
477  }
478 
479 #endif
480 
481 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
482 
483  // ----------------------------------------------------------------------
484  // Connect serial input ports to special output ports
485  // ----------------------------------------------------------------------
486 
489  FwIndexType portNum,
490  Fw::InputSerializePort* port
491  )
492  {
493  FW_ASSERT(
494  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
495  static_cast<FwAssertArgType>(portNum)
496  );
497 
498  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
499  }
500 
501 #if FW_ENABLE_TEXT_LOGGING == 1
502 
503  void SpacePacketDeframerComponentBase ::
504  set_logTextOut_OutputPort(
505  FwIndexType portNum,
506  Fw::InputSerializePort* port
507  )
508  {
509  FW_ASSERT(
510  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
511  static_cast<FwAssertArgType>(portNum)
512  );
513 
514  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
515  }
516 
517 #endif
518 
521  FwIndexType portNum,
522  Fw::InputSerializePort* port
523  )
524  {
525  FW_ASSERT(
526  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
527  static_cast<FwAssertArgType>(portNum)
528  );
529 
530  this->m_prmSetOut_OutputPort[portNum].registerSerialPort(port);
531  }
532 
535  FwIndexType portNum,
536  Fw::InputSerializePort* port
537  )
538  {
539  FW_ASSERT(
540  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
541  static_cast<FwAssertArgType>(portNum)
542  );
543 
544  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
545  }
546 
549  FwIndexType portNum,
550  Fw::InputSerializePort* port
551  )
552  {
553  FW_ASSERT(
554  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
555  static_cast<FwAssertArgType>(portNum)
556  );
557 
558  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
559  }
560 
561 #endif
562 
563 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
564 
565  // ----------------------------------------------------------------------
566  // Connect serial input ports to typed output ports
567  // ----------------------------------------------------------------------
568 
571  FwIndexType portNum,
572  Fw::InputSerializePort* port
573  )
574  {
575  FW_ASSERT(
576  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
577  static_cast<FwAssertArgType>(portNum)
578  );
579 
580  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
581  }
582 
585  FwIndexType portNum,
586  Fw::InputSerializePort* port
587  )
588  {
589  FW_ASSERT(
590  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
591  static_cast<FwAssertArgType>(portNum)
592  );
593 
594  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
595  }
596 
599  FwIndexType portNum,
600  Fw::InputSerializePort* port
601  )
602  {
603  FW_ASSERT(
604  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
605  static_cast<FwAssertArgType>(portNum)
606  );
607 
608  this->m_errorNotify_OutputPort[portNum].registerSerialPort(port);
609  }
610 
611 #endif
612 
613  // ----------------------------------------------------------------------
614  // Component construction and destruction
615  // ----------------------------------------------------------------------
616 
618  SpacePacketDeframerComponentBase(const char* compName) :
619  Fw::PassiveComponentBase(compName)
620  {
621 
622  }
623 
626  {
627 
628  }
629 
630 #if !FW_DIRECT_PORT_CALLS
631 
632  // ----------------------------------------------------------------------
633  // Connection status queries for special output ports
634  // ----------------------------------------------------------------------
635 
638  {
639  FW_ASSERT(
640  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
641  static_cast<FwAssertArgType>(portNum)
642  );
643 
644  return this->m_logOut_OutputPort[portNum].isConnected();
645  }
646 
647 #if FW_ENABLE_TEXT_LOGGING == 1
648 
649  bool SpacePacketDeframerComponentBase ::
650  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
651  {
652  FW_ASSERT(
653  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
654  static_cast<FwAssertArgType>(portNum)
655  );
656 
657  return this->m_logTextOut_OutputPort[portNum].isConnected();
658  }
659 
660 #endif
661 
664  {
665  FW_ASSERT(
666  (0 <= portNum) && (portNum < this->getNum_prmGetOut_OutputPorts()),
667  static_cast<FwAssertArgType>(portNum)
668  );
669 
670  return this->m_prmGetOut_OutputPort[portNum].isConnected();
671  }
672 
675  {
676  FW_ASSERT(
677  (0 <= portNum) && (portNum < this->getNum_prmSetOut_OutputPorts()),
678  static_cast<FwAssertArgType>(portNum)
679  );
680 
681  return this->m_prmSetOut_OutputPort[portNum].isConnected();
682  }
683 
686  {
687  FW_ASSERT(
688  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
689  static_cast<FwAssertArgType>(portNum)
690  );
691 
692  return this->m_timeCaller_OutputPort[portNum].isConnected();
693  }
694 
697  {
698  FW_ASSERT(
699  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
700  static_cast<FwAssertArgType>(portNum)
701  );
702 
703  return this->m_tlmOut_OutputPort[portNum].isConnected();
704  }
705 
706 #endif
707 
708 #if !FW_DIRECT_PORT_CALLS
709 
710  // ----------------------------------------------------------------------
711  // Connection status queries for typed output ports
712  // ----------------------------------------------------------------------
713 
716  {
717  FW_ASSERT(
718  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
719  static_cast<FwAssertArgType>(portNum)
720  );
721 
722  return this->m_dataOut_OutputPort[portNum].isConnected();
723  }
724 
727  {
728  FW_ASSERT(
729  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
730  static_cast<FwAssertArgType>(portNum)
731  );
732 
733  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
734  }
735 
738  {
739  FW_ASSERT(
740  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
741  static_cast<FwAssertArgType>(portNum)
742  );
743 
744  return this->m_errorNotify_OutputPort[portNum].isConnected();
745  }
746 
749  {
750  FW_ASSERT(
751  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
752  static_cast<FwAssertArgType>(portNum)
753  );
754 
755  return this->m_validateApidSeqCount_OutputPort[portNum].isConnected();
756  }
757 
758 #endif
759 
760  // ----------------------------------------------------------------------
761  // Port handler base-class functions for typed input ports
762  //
763  // Call these functions directly to bypass the corresponding ports
764  // ----------------------------------------------------------------------
765 
768  FwIndexType portNum,
769  Fw::Buffer& data,
770  const ComCfg::FrameContext& context
771  )
772  {
773  // Make sure port number is valid
774  FW_ASSERT(
775  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
776  static_cast<FwAssertArgType>(portNum)
777  );
778 
779  // Lock guard mutex before calling
780  this->lock();
781 
782  // Call handler function
783  this->dataIn_handler(
784  portNum,
785  data,
786  context
787  );
788 
789  // Unlock guard mutex
790  this->unLock();
791  }
792 
795  FwIndexType portNum,
796  Fw::Buffer& data,
797  const ComCfg::FrameContext& context
798  )
799  {
800  // Make sure port number is valid
801  FW_ASSERT(
802  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
803  static_cast<FwAssertArgType>(portNum)
804  );
805 
806  // Call handler function
807  this->dataReturnIn_handler(
808  portNum,
809  data,
810  context
811  );
812  }
813 
814 #if !FW_DIRECT_PORT_CALLS
815 
816  // ----------------------------------------------------------------------
817  // Invocation functions for typed output ports
818  // ----------------------------------------------------------------------
819 
822  FwIndexType portNum,
823  Fw::Buffer& data,
824  const ComCfg::FrameContext& context
825  ) const
826  {
827  FW_ASSERT(
828  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
829  static_cast<FwAssertArgType>(portNum)
830  );
831 
832  FW_ASSERT(
833  this->m_dataOut_OutputPort[portNum].isConnected(),
834  static_cast<FwAssertArgType>(portNum)
835  );
836  this->m_dataOut_OutputPort[portNum].invoke(
837  data,
838  context
839  );
840  }
841 
844  FwIndexType portNum,
845  Fw::Buffer& data,
846  const ComCfg::FrameContext& context
847  ) const
848  {
849  FW_ASSERT(
850  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
851  static_cast<FwAssertArgType>(portNum)
852  );
853 
854  FW_ASSERT(
855  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
856  static_cast<FwAssertArgType>(portNum)
857  );
858  this->m_dataReturnOut_OutputPort[portNum].invoke(
859  data,
860  context
861  );
862  }
863 
866  FwIndexType portNum,
867  const Svc::Ccsds::FrameError& errorCode
868  ) const
869  {
870  FW_ASSERT(
871  (0 <= portNum) && (portNum < this->getNum_errorNotify_OutputPorts()),
872  static_cast<FwAssertArgType>(portNum)
873  );
874 
875  FW_ASSERT(
876  this->m_errorNotify_OutputPort[portNum].isConnected(),
877  static_cast<FwAssertArgType>(portNum)
878  );
879  this->m_errorNotify_OutputPort[portNum].invoke(
880  errorCode
881  );
882  }
883 
886  FwIndexType portNum,
887  const ComCfg::Apid& apid,
888  U16 sequenceCount
889  ) const
890  {
891  FW_ASSERT(
892  (0 <= portNum) && (portNum < this->getNum_validateApidSeqCount_OutputPorts()),
893  static_cast<FwAssertArgType>(portNum)
894  );
895 
896  FW_ASSERT(
897  this->m_validateApidSeqCount_OutputPort[portNum].isConnected(),
898  static_cast<FwAssertArgType>(portNum)
899  );
900  return this->m_validateApidSeqCount_OutputPort[portNum].invoke(
901  apid,
902  sequenceCount
903  );
904  }
905 
906 #endif
907 
908  // ----------------------------------------------------------------------
909  // Event logging functions
910  // ----------------------------------------------------------------------
911 
914  {
915  // Get the time
916  Fw::Time _logTime;
917  if (this->isConnected_timeCaller_OutputPort(0)) {
918  this->timeCaller_out(0, _logTime);
919  }
920 
921  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDPACKET;
922 
923  // Emit the event on the log port
924  if (this->isConnected_logOut_OutputPort(0)) {
925  Fw::LogBuffer _logBuff;
926 
927 #if FW_AMPCS_COMPATIBLE
929  // Serialize the number of arguments
930  _status = _logBuff.serializeFrom(static_cast<U8>(0));
931  FW_ASSERT(
932  _status == Fw::FW_SERIALIZE_OK,
933  static_cast<FwAssertArgType>(_status)
934  );
935 #endif
936 
937  this->logOut_out(
938  0,
939  _id,
940  _logTime,
942  _logBuff
943  );
944  }
945 
946  // Emit the event on the text log port
947 #if FW_ENABLE_TEXT_LOGGING
948  if (this->isConnected_logTextOut_OutputPort(0)) {
949 #if FW_OBJECT_NAMES == 1
950  const char* _formatString =
951  "(%s) %s: Malformed packet received refusing to deframe";
952 #else
953  const char* _formatString =
954  "%s: Malformed packet received refusing to deframe";
955 #endif
956 
957  Fw::TextLogString _logString;
958  _logString.format(
959  _formatString,
960 #if FW_OBJECT_NAMES == 1
961  this->m_objName.toChar(),
962 #endif
963  "InvalidPacket "
964  );
965 
966  this->logTextOut_out(
967  0,
968  _id,
969  _logTime,
971  _logString
972  );
973  }
974 #endif
975  }
976 
979  FwSizeType transmitted,
980  FwSizeType actual
981  ) const
982  {
983  // Get the time
984  Fw::Time _logTime;
985  if (this->isConnected_timeCaller_OutputPort(0)) {
986  this->timeCaller_out(0, _logTime);
987  }
988 
989  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDLENGTH;
990 
991  // Emit the event on the log port
992  if (this->isConnected_logOut_OutputPort(0)) {
993  Fw::LogBuffer _logBuff;
995 
996 #if FW_AMPCS_COMPATIBLE
997  // Serialize the number of arguments
998  _status = _logBuff.serializeFrom(static_cast<U8>(2));
999  FW_ASSERT(
1000  _status == Fw::FW_SERIALIZE_OK,
1001  static_cast<FwAssertArgType>(_status)
1002  );
1003 #endif
1004 
1005 #if FW_AMPCS_COMPATIBLE
1006  // Serialize the argument size
1007  _status = _logBuff.serializeFrom(
1008  static_cast<U8>(sizeof(FwSizeType))
1009  );
1010  FW_ASSERT(
1011  _status == Fw::FW_SERIALIZE_OK,
1012  static_cast<FwAssertArgType>(_status)
1013  );
1014 #endif
1015  _status = _logBuff.serializeFrom(transmitted);
1016  FW_ASSERT(
1017  _status == Fw::FW_SERIALIZE_OK,
1018  static_cast<FwAssertArgType>(_status)
1019  );
1020 
1021 #if FW_AMPCS_COMPATIBLE
1022  // Serialize the argument size
1023  _status = _logBuff.serializeFrom(
1024  static_cast<U8>(sizeof(FwSizeType))
1025  );
1026  FW_ASSERT(
1027  _status == Fw::FW_SERIALIZE_OK,
1028  static_cast<FwAssertArgType>(_status)
1029  );
1030 #endif
1031  _status = _logBuff.serializeFrom(actual);
1032  FW_ASSERT(
1033  _status == Fw::FW_SERIALIZE_OK,
1034  static_cast<FwAssertArgType>(_status)
1035  );
1036 
1037  this->logOut_out(
1038  0,
1039  _id,
1040  _logTime,
1042  _logBuff
1043  );
1044  }
1045 
1046  // Emit the event on the text log port
1047 #if FW_ENABLE_TEXT_LOGGING
1048  if (this->isConnected_logTextOut_OutputPort(0)) {
1049 #if FW_OBJECT_NAMES == 1
1050  const char* _formatString =
1051  "(%s) %s: Invalid length received. Header specified packet byte size of %" PRIu64 " | Actual received data length: %" PRIu64 "";
1052 #else
1053  const char* _formatString =
1054  "%s: Invalid length received. Header specified packet byte size of %" PRIu64 " | Actual received data length: %" PRIu64 "";
1055 #endif
1056 
1057  Fw::TextLogString _logString;
1058  _logString.format(
1059  _formatString,
1060 #if FW_OBJECT_NAMES == 1
1061  this->m_objName.toChar(),
1062 #endif
1063  "InvalidLength ",
1064  transmitted,
1065  actual
1066  );
1067 
1068  this->logTextOut_out(
1069  0,
1070  _id,
1071  _logTime,
1073  _logString
1074  );
1075  }
1076 #endif
1077  }
1078 
1079  // ----------------------------------------------------------------------
1080  // Time
1081  // ----------------------------------------------------------------------
1082 
1084  getTime() const
1085  {
1086  if (this->isConnected_timeCaller_OutputPort(0)) {
1087  Fw::Time _time;
1088  this->timeCaller_out(0, _time);
1089  return _time;
1090  }
1091  else {
1092  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1093  }
1094  }
1095 
1096  // ----------------------------------------------------------------------
1097  // Mutex operations for guarded ports
1098  //
1099  // You can override these operations to provide more sophisticated
1100  // synchronization
1101  // ----------------------------------------------------------------------
1102 
1105  {
1106  this->m_guardedPortMutex.lock();
1107  }
1108 
1111  {
1112  this->m_guardedPortMutex.unLock();
1113  }
1114 
1115  // ----------------------------------------------------------------------
1116  // Calls for messages received on typed input ports
1117  // ----------------------------------------------------------------------
1118 
1119  void SpacePacketDeframerComponentBase ::
1120  m_p_dataIn_in(
1121  Fw::PassiveComponentBase* callComp,
1122  FwIndexType portNum,
1123  Fw::Buffer& data,
1124  const ComCfg::FrameContext& context
1125  )
1126  {
1127  FW_ASSERT(callComp);
1128  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1129  compPtr->dataIn_handlerBase(
1130  portNum,
1131  data,
1132  context
1133  );
1134  }
1135 
1136  void SpacePacketDeframerComponentBase ::
1137  m_p_dataReturnIn_in(
1138  Fw::PassiveComponentBase* callComp,
1139  FwIndexType portNum,
1140  Fw::Buffer& data,
1141  const ComCfg::FrameContext& context
1142  )
1143  {
1144  FW_ASSERT(callComp);
1145  SpacePacketDeframerComponentBase* compPtr = static_cast<SpacePacketDeframerComponentBase*>(callComp);
1146  compPtr->dataReturnIn_handlerBase(
1147  portNum,
1148  data,
1149  context
1150  );
1151  }
1152 
1153 #if !FW_DIRECT_PORT_CALLS
1154 
1155  // ----------------------------------------------------------------------
1156  // Invocation functions for special output ports
1157  // ----------------------------------------------------------------------
1158 
1159  void SpacePacketDeframerComponentBase ::
1160  logOut_out(
1161  FwIndexType portNum,
1162  FwEventIdType id,
1163  Fw::Time& timeTag,
1164  const Fw::LogSeverity& severity,
1165  Fw::LogBuffer& args
1166  ) const
1167  {
1168  FW_ASSERT(
1169  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1170  static_cast<FwAssertArgType>(portNum)
1171  );
1172 
1173  FW_ASSERT(
1174  this->m_logOut_OutputPort[portNum].isConnected(),
1175  static_cast<FwAssertArgType>(portNum)
1176  );
1177  this->m_logOut_OutputPort[portNum].invoke(
1178  id,
1179  timeTag,
1180  severity,
1181  args
1182  );
1183  }
1184 
1185 #if FW_ENABLE_TEXT_LOGGING
1186 
1187  void SpacePacketDeframerComponentBase ::
1188  logTextOut_out(
1189  FwIndexType portNum,
1190  FwEventIdType id,
1191  Fw::Time& timeTag,
1192  const Fw::LogSeverity& severity,
1193  Fw::TextLogString& text
1194  ) const
1195  {
1196  FW_ASSERT(
1197  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1198  static_cast<FwAssertArgType>(portNum)
1199  );
1200 
1201  FW_ASSERT(
1202  this->m_logTextOut_OutputPort[portNum].isConnected(),
1203  static_cast<FwAssertArgType>(portNum)
1204  );
1205  this->m_logTextOut_OutputPort[portNum].invoke(
1206  id,
1207  timeTag,
1208  severity,
1209  text
1210  );
1211  }
1212 
1213 #endif
1214 
1215  void SpacePacketDeframerComponentBase ::
1216  timeCaller_out(
1217  FwIndexType portNum,
1218  Fw::Time& time
1219  ) const
1220  {
1221  FW_ASSERT(
1222  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1223  static_cast<FwAssertArgType>(portNum)
1224  );
1225 
1226  FW_ASSERT(
1227  this->m_timeCaller_OutputPort[portNum].isConnected(),
1228  static_cast<FwAssertArgType>(portNum)
1229  );
1230  this->m_timeCaller_OutputPort[portNum].invoke(
1231  time
1232  );
1233  }
1234 
1235 #endif
1236 
1237  }
1238 
1239 }
Serialization/Deserialization operation was successful.
void errorNotify_out(FwIndexType portNum, const Svc::Ccsds::FrameError &errorCode) const
Invoke output port errorNotify.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
static constexpr FwIndexType getNum_validateApidSeqCount_OutputPorts()
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
void set_errorNotify_OutputPort(FwIndexType portNum, Svc::Ccsds::InputErrorNotifyPort *port)
Connect port to errorNotify[portNum].
I32 FwEnumStoreType
void init()
Initialization function.
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void addCallPort(InputPrmSetPort *callPort)
Register an input port.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
U16 validateApidSeqCount_out(FwIndexType portNum, const ComCfg::Apid &apid, U16 sequenceCount) const
Invoke output port validateApidSeqCount.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
No time base has been established (Required)
void init()
Initialization function.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void addCallPort(InputPrmGetPort *callPort)
Register an input port.
void init()
Object initializer.
Definition: ObjBase.cpp:24
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
SerializeStatus
forward declaration for string
void addCallPort(InputErrorNotifyPort *callPort)
Register an input port.
FwIdType FwEventIdType
The type of an event identifier.
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
void invoke(const Svc::Ccsds::FrameError &errorCode) const
Invoke a port connection.
void set_prmGetOut_OutputPort(FwIndexType portNum, Fw::InputPrmGetPort *port)
Connect port to prmGetOut[portNum].
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
SpacePacketDeframerComponentBase(const char *compName="")
Construct SpacePacketDeframerComponentBase object.
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
A serious but recoverable event.
void init()
Initialization function.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
#define PRI_FwIndexType
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
void init()
Initialization function.
void set_prmSetOut_OutputPort(FwIndexType portNum, Fw::InputPrmSetPort *port)
Connect port to prmSetOut[portNum].
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
PlatformIndexType FwIndexType
U16 invoke(const ComCfg::Apid &apid, U16 sequenceCount) const
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
Type used to pass context info between components during framing/deframing.
void set_validateApidSeqCount_OutputPort(FwIndexType portNum, Svc::Ccsds::InputApidSequenceCountPort *port)
Connect port to validateApidSeqCount[portNum].
RateGroupDivider component implementation.
Auto-generated base for SpacePacketDeframer component.
bool isConnected_validateApidSeqCount_OutputPort(FwIndexType portNum) const
Implementation of malloc based allocator.
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
APIDs are 11 bits in the Space Packet protocol, so we use U16. Max value 7FF.
Definition: ApidEnumAc.hpp:17
void log_WARNING_HI_InvalidLength(FwSizeType transmitted, FwSizeType actual) const
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
void addCallPort(InputApidSequenceCountPort *callPort)
Register an input port.
virtual ~SpacePacketDeframerComponentBase()
Destroy SpacePacketDeframerComponentBase object.