F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SdlsSaRouterComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SdlsSaRouterComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SdlsSaRouter 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 input port saBufferReturnIn
82  for (
83  FwIndexType port = 0;
84  port < static_cast<FwIndexType>(this->getNum_saBufferReturnIn_InputPorts());
85  port++
86  ) {
87  this->m_saBufferReturnIn_InputPort[port].init();
88  this->m_saBufferReturnIn_InputPort[port].addCallComp(
89  this,
90  m_p_saBufferReturnIn_in
91  );
92  this->m_saBufferReturnIn_InputPort[port].setPortNum(port);
93 
94 #if FW_OBJECT_NAMES == 1
95  Fw::ObjectName portName;
96  portName.format(
97  "%s_saBufferReturnIn_InputPort[%" PRI_FwIndexType "]",
98  this->m_objName.toChar(),
99  port
100  );
101  this->m_saBufferReturnIn_InputPort[port].setObjName(portName.toChar());
102 #endif
103  }
104 #endif
105 
106 #if !FW_DIRECT_PORT_CALLS
107  // Connect input port saDataIn
108  for (
109  FwIndexType port = 0;
110  port < static_cast<FwIndexType>(this->getNum_saDataIn_InputPorts());
111  port++
112  ) {
113  this->m_saDataIn_InputPort[port].init();
114  this->m_saDataIn_InputPort[port].addCallComp(
115  this,
116  m_p_saDataIn_in
117  );
118  this->m_saDataIn_InputPort[port].setPortNum(port);
119 
120 #if FW_OBJECT_NAMES == 1
121  Fw::ObjectName portName;
122  portName.format(
123  "%s_saDataIn_InputPort[%" PRI_FwIndexType "]",
124  this->m_objName.toChar(),
125  port
126  );
127  this->m_saDataIn_InputPort[port].setObjName(portName.toChar());
128 #endif
129  }
130 #endif
131 
132 #if !FW_DIRECT_PORT_CALLS
133  // Connect output port logOut
134  for (
135  FwIndexType port = 0;
136  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
137  port++
138  ) {
139  this->m_logOut_OutputPort[port].init();
140 
141 #if FW_OBJECT_NAMES == 1
142  Fw::ObjectName portName;
143  portName.format(
144  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
145  this->m_objName.toChar(),
146  port
147  );
148  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
149 #endif
150  }
151 #endif
152 
153 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
154  // Connect output port logTextOut
155  for (
156  FwIndexType port = 0;
157  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
158  port++
159  ) {
160  this->m_logTextOut_OutputPort[port].init();
161 
162 #if FW_OBJECT_NAMES == 1
163  Fw::ObjectName portName;
164  portName.format(
165  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
166  this->m_objName.toChar(),
167  port
168  );
169  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
170 #endif
171  }
172 #endif
173 
174 #if !FW_DIRECT_PORT_CALLS
175  // Connect output port timeCaller
176  for (
177  FwIndexType port = 0;
178  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
179  port++
180  ) {
181  this->m_timeCaller_OutputPort[port].init();
182 
183 #if FW_OBJECT_NAMES == 1
184  Fw::ObjectName portName;
185  portName.format(
186  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
187  this->m_objName.toChar(),
188  port
189  );
190  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
191 #endif
192  }
193 #endif
194 
195 #if !FW_DIRECT_PORT_CALLS
196  // Connect output port bufferReturnOut
197  for (
198  FwIndexType port = 0;
199  port < static_cast<FwIndexType>(this->getNum_bufferReturnOut_OutputPorts());
200  port++
201  ) {
202  this->m_bufferReturnOut_OutputPort[port].init();
203 
204 #if FW_OBJECT_NAMES == 1
205  Fw::ObjectName portName;
206  portName.format(
207  "%s_bufferReturnOut_OutputPort[%" PRI_FwIndexType "]",
208  this->m_objName.toChar(),
209  port
210  );
211  this->m_bufferReturnOut_OutputPort[port].setObjName(portName.toChar());
212 #endif
213  }
214 #endif
215 
216 #if !FW_DIRECT_PORT_CALLS
217  // Connect output port dataOut
218  for (
219  FwIndexType port = 0;
220  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
221  port++
222  ) {
223  this->m_dataOut_OutputPort[port].init();
224 
225 #if FW_OBJECT_NAMES == 1
226  Fw::ObjectName portName;
227  portName.format(
228  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
229  this->m_objName.toChar(),
230  port
231  );
232  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
233 #endif
234  }
235 #endif
236 
237 #if !FW_DIRECT_PORT_CALLS
238  // Connect output port saDataOut
239  for (
240  FwIndexType port = 0;
241  port < static_cast<FwIndexType>(this->getNum_saDataOut_OutputPorts());
242  port++
243  ) {
244  this->m_saDataOut_OutputPort[port].init();
245 
246 #if FW_OBJECT_NAMES == 1
247  Fw::ObjectName portName;
248  portName.format(
249  "%s_saDataOut_OutputPort[%" PRI_FwIndexType "]",
250  this->m_objName.toChar(),
251  port
252  );
253  this->m_saDataOut_OutputPort[port].setObjName(portName.toChar());
254 #endif
255  }
256 #endif
257 
258 #if !FW_DIRECT_PORT_CALLS
259  // Connect output port saDataReturnOut
260  for (
261  FwIndexType port = 0;
262  port < static_cast<FwIndexType>(this->getNum_saDataReturnOut_OutputPorts());
263  port++
264  ) {
265  this->m_saDataReturnOut_OutputPort[port].init();
266 
267 #if FW_OBJECT_NAMES == 1
268  Fw::ObjectName portName;
269  portName.format(
270  "%s_saDataReturnOut_OutputPort[%" PRI_FwIndexType "]",
271  this->m_objName.toChar(),
272  port
273  );
274  this->m_saDataReturnOut_OutputPort[port].setObjName(portName.toChar());
275 #endif
276  }
277 #endif
278  }
279 
280 #if !FW_DIRECT_PORT_CALLS
281 
282  // ----------------------------------------------------------------------
283  // Getters for typed input ports
284  // ----------------------------------------------------------------------
285 
288  {
289  FW_ASSERT(
290  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
291  static_cast<FwAssertArgType>(portNum)
292  );
293 
294  return &this->m_dataIn_InputPort[portNum];
295  }
296 
299  {
300  FW_ASSERT(
301  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
302  static_cast<FwAssertArgType>(portNum)
303  );
304 
305  return &this->m_dataReturnIn_InputPort[portNum];
306  }
307 
310  {
311  FW_ASSERT(
312  (0 <= portNum) && (portNum < this->getNum_saBufferReturnIn_InputPorts()),
313  static_cast<FwAssertArgType>(portNum)
314  );
315 
316  return &this->m_saBufferReturnIn_InputPort[portNum];
317  }
318 
321  {
322  FW_ASSERT(
323  (0 <= portNum) && (portNum < this->getNum_saDataIn_InputPorts()),
324  static_cast<FwAssertArgType>(portNum)
325  );
326 
327  return &this->m_saDataIn_InputPort[portNum];
328  }
329 
330 #endif
331 
332 #if !FW_DIRECT_PORT_CALLS
333 
334  // ----------------------------------------------------------------------
335  // Connect input ports to special output ports
336  // ----------------------------------------------------------------------
337 
340  FwIndexType portNum,
341  Fw::InputLogPort* port
342  )
343  {
344  FW_ASSERT(
345  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
346  static_cast<FwAssertArgType>(portNum)
347  );
348 
349  this->m_logOut_OutputPort[portNum].addCallPort(port);
350  }
351 
352 #if FW_ENABLE_TEXT_LOGGING == 1
353 
354  void SdlsSaRouterComponentBase ::
355  set_logTextOut_OutputPort(
356  FwIndexType portNum,
358  )
359  {
360  FW_ASSERT(
361  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
362  static_cast<FwAssertArgType>(portNum)
363  );
364 
365  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
366  }
367 
368 #endif
369 
372  FwIndexType portNum,
373  Fw::InputTimePort* port
374  )
375  {
376  FW_ASSERT(
377  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
378  static_cast<FwAssertArgType>(portNum)
379  );
380 
381  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
382  }
383 
384 #endif
385 
386 #if !FW_DIRECT_PORT_CALLS
387 
388  // ----------------------------------------------------------------------
389  // Connect typed input ports to typed output ports
390  // ----------------------------------------------------------------------
391 
394  FwIndexType portNum,
396  )
397  {
398  FW_ASSERT(
399  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
400  static_cast<FwAssertArgType>(portNum)
401  );
402 
403  this->m_bufferReturnOut_OutputPort[portNum].addCallPort(port);
404  }
405 
408  FwIndexType portNum,
410  )
411  {
412  FW_ASSERT(
413  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
414  static_cast<FwAssertArgType>(portNum)
415  );
416 
417  this->m_dataOut_OutputPort[portNum].addCallPort(port);
418  }
419 
422  FwIndexType portNum,
424  )
425  {
426  FW_ASSERT(
427  (0 <= portNum) && (portNum < this->getNum_saDataOut_OutputPorts()),
428  static_cast<FwAssertArgType>(portNum)
429  );
430 
431  this->m_saDataOut_OutputPort[portNum].addCallPort(port);
432  }
433 
436  FwIndexType portNum,
438  )
439  {
440  FW_ASSERT(
441  (0 <= portNum) && (portNum < this->getNum_saDataReturnOut_OutputPorts()),
442  static_cast<FwAssertArgType>(portNum)
443  );
444 
445  this->m_saDataReturnOut_OutputPort[portNum].addCallPort(port);
446  }
447 
448 #endif
449 
450 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
451 
452  // ----------------------------------------------------------------------
453  // Connect serial input ports to special output ports
454  // ----------------------------------------------------------------------
455 
458  FwIndexType portNum,
459  Fw::InputSerializePort* port
460  )
461  {
462  FW_ASSERT(
463  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
464  static_cast<FwAssertArgType>(portNum)
465  );
466 
467  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
468  }
469 
470 #if FW_ENABLE_TEXT_LOGGING == 1
471 
472  void SdlsSaRouterComponentBase ::
473  set_logTextOut_OutputPort(
474  FwIndexType portNum,
475  Fw::InputSerializePort* port
476  )
477  {
478  FW_ASSERT(
479  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
480  static_cast<FwAssertArgType>(portNum)
481  );
482 
483  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
484  }
485 
486 #endif
487 
490  FwIndexType portNum,
491  Fw::InputSerializePort* port
492  )
493  {
494  FW_ASSERT(
495  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
496  static_cast<FwAssertArgType>(portNum)
497  );
498 
499  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
500  }
501 
502 #endif
503 
504 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
505 
506  // ----------------------------------------------------------------------
507  // Connect serial input ports to typed output ports
508  // ----------------------------------------------------------------------
509 
512  FwIndexType portNum,
513  Fw::InputSerializePort* port
514  )
515  {
516  FW_ASSERT(
517  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
518  static_cast<FwAssertArgType>(portNum)
519  );
520 
521  this->m_bufferReturnOut_OutputPort[portNum].registerSerialPort(port);
522  }
523 
526  FwIndexType portNum,
527  Fw::InputSerializePort* port
528  )
529  {
530  FW_ASSERT(
531  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
532  static_cast<FwAssertArgType>(portNum)
533  );
534 
535  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
536  }
537 
540  FwIndexType portNum,
541  Fw::InputSerializePort* port
542  )
543  {
544  FW_ASSERT(
545  (0 <= portNum) && (portNum < this->getNum_saDataOut_OutputPorts()),
546  static_cast<FwAssertArgType>(portNum)
547  );
548 
549  this->m_saDataOut_OutputPort[portNum].registerSerialPort(port);
550  }
551 
554  FwIndexType portNum,
555  Fw::InputSerializePort* port
556  )
557  {
558  FW_ASSERT(
559  (0 <= portNum) && (portNum < this->getNum_saDataReturnOut_OutputPorts()),
560  static_cast<FwAssertArgType>(portNum)
561  );
562 
563  this->m_saDataReturnOut_OutputPort[portNum].registerSerialPort(port);
564  }
565 
566 #endif
567 
568  // ----------------------------------------------------------------------
569  // Component construction and destruction
570  // ----------------------------------------------------------------------
571 
573  SdlsSaRouterComponentBase(const char* compName) :
574  Fw::PassiveComponentBase(compName)
575  {
576 
577  }
578 
581  {
582 
583  }
584 
585 #if !FW_DIRECT_PORT_CALLS
586 
587  // ----------------------------------------------------------------------
588  // Connection status queries for special output ports
589  // ----------------------------------------------------------------------
590 
593  {
594  FW_ASSERT(
595  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
596  static_cast<FwAssertArgType>(portNum)
597  );
598 
599  return this->m_logOut_OutputPort[portNum].isConnected();
600  }
601 
602 #if FW_ENABLE_TEXT_LOGGING == 1
603 
604  bool SdlsSaRouterComponentBase ::
605  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
606  {
607  FW_ASSERT(
608  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
609  static_cast<FwAssertArgType>(portNum)
610  );
611 
612  return this->m_logTextOut_OutputPort[portNum].isConnected();
613  }
614 
615 #endif
616 
619  {
620  FW_ASSERT(
621  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
622  static_cast<FwAssertArgType>(portNum)
623  );
624 
625  return this->m_timeCaller_OutputPort[portNum].isConnected();
626  }
627 
628 #endif
629 
630 #if !FW_DIRECT_PORT_CALLS
631 
632  // ----------------------------------------------------------------------
633  // Connection status queries for typed output ports
634  // ----------------------------------------------------------------------
635 
638  {
639  FW_ASSERT(
640  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
641  static_cast<FwAssertArgType>(portNum)
642  );
643 
644  return this->m_bufferReturnOut_OutputPort[portNum].isConnected();
645  }
646 
649  {
650  FW_ASSERT(
651  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
652  static_cast<FwAssertArgType>(portNum)
653  );
654 
655  return this->m_dataOut_OutputPort[portNum].isConnected();
656  }
657 
660  {
661  FW_ASSERT(
662  (0 <= portNum) && (portNum < this->getNum_saDataOut_OutputPorts()),
663  static_cast<FwAssertArgType>(portNum)
664  );
665 
666  return this->m_saDataOut_OutputPort[portNum].isConnected();
667  }
668 
671  {
672  FW_ASSERT(
673  (0 <= portNum) && (portNum < this->getNum_saDataReturnOut_OutputPorts()),
674  static_cast<FwAssertArgType>(portNum)
675  );
676 
677  return this->m_saDataReturnOut_OutputPort[portNum].isConnected();
678  }
679 
680 #endif
681 
682  // ----------------------------------------------------------------------
683  // Port handler base-class functions for typed input ports
684  //
685  // Call these functions directly to bypass the corresponding ports
686  // ----------------------------------------------------------------------
687 
690  FwIndexType portNum,
691  U16 securityAssociationIndex,
692  Fw::Buffer& data,
693  const ComCfg::FrameContext& context
694  )
695  {
696  // Make sure port number is valid
697  FW_ASSERT(
698  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
699  static_cast<FwAssertArgType>(portNum)
700  );
701 
702  // Lock guard mutex before calling
703  this->lock();
704 
705  // Call handler function
706  this->dataIn_handler(
707  portNum,
708  securityAssociationIndex,
709  data,
710  context
711  );
712 
713  // Unlock guard mutex
714  this->unLock();
715  }
716 
719  FwIndexType portNum,
720  Fw::Buffer& data,
721  const ComCfg::FrameContext& context
722  )
723  {
724  // Make sure port number is valid
725  FW_ASSERT(
726  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
727  static_cast<FwAssertArgType>(portNum)
728  );
729 
730  // Call handler function
731  this->dataReturnIn_handler(
732  portNum,
733  data,
734  context
735  );
736  }
737 
740  FwIndexType portNum,
741  Fw::Buffer& data,
742  const ComCfg::FrameContext& context
743  )
744  {
745  // Make sure port number is valid
746  FW_ASSERT(
747  (0 <= portNum) && (portNum < this->getNum_saBufferReturnIn_InputPorts()),
748  static_cast<FwAssertArgType>(portNum)
749  );
750 
751  // Call handler function
753  portNum,
754  data,
755  context
756  );
757  }
758 
761  FwIndexType portNum,
762  const Svc::Ccsds::SdlsStatus& status,
763  Fw::Buffer& data,
764  const ComCfg::FrameContext& context
765  )
766  {
767  // Make sure port number is valid
768  FW_ASSERT(
769  (0 <= portNum) && (portNum < this->getNum_saDataIn_InputPorts()),
770  static_cast<FwAssertArgType>(portNum)
771  );
772 
773  // Call handler function
774  this->saDataIn_handler(
775  portNum,
776  status,
777  data,
778  context
779  );
780  }
781 
782 #if !FW_DIRECT_PORT_CALLS
783 
784  // ----------------------------------------------------------------------
785  // Invocation functions for typed output ports
786  // ----------------------------------------------------------------------
787 
790  FwIndexType portNum,
791  Fw::Buffer& data,
792  const ComCfg::FrameContext& context
793  ) const
794  {
795  FW_ASSERT(
796  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
797  static_cast<FwAssertArgType>(portNum)
798  );
799 
800  FW_ASSERT(
801  this->m_bufferReturnOut_OutputPort[portNum].isConnected(),
802  static_cast<FwAssertArgType>(portNum)
803  );
804  this->m_bufferReturnOut_OutputPort[portNum].invoke(
805  data,
806  context
807  );
808  }
809 
812  FwIndexType portNum,
813  const Svc::Ccsds::SdlsStatus& status,
814  Fw::Buffer& data,
815  const ComCfg::FrameContext& context
816  ) const
817  {
818  FW_ASSERT(
819  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
820  static_cast<FwAssertArgType>(portNum)
821  );
822 
823  FW_ASSERT(
824  this->m_dataOut_OutputPort[portNum].isConnected(),
825  static_cast<FwAssertArgType>(portNum)
826  );
827  this->m_dataOut_OutputPort[portNum].invoke(
828  status,
829  data,
830  context
831  );
832  }
833 
836  FwIndexType portNum,
837  U16 securityAssociationIndex,
838  Fw::Buffer& data,
839  const ComCfg::FrameContext& context
840  ) const
841  {
842  FW_ASSERT(
843  (0 <= portNum) && (portNum < this->getNum_saDataOut_OutputPorts()),
844  static_cast<FwAssertArgType>(portNum)
845  );
846 
847  FW_ASSERT(
848  this->m_saDataOut_OutputPort[portNum].isConnected(),
849  static_cast<FwAssertArgType>(portNum)
850  );
851  this->m_saDataOut_OutputPort[portNum].invoke(
852  securityAssociationIndex,
853  data,
854  context
855  );
856  }
857 
860  FwIndexType portNum,
861  Fw::Buffer& data,
862  const ComCfg::FrameContext& context
863  ) const
864  {
865  FW_ASSERT(
866  (0 <= portNum) && (portNum < this->getNum_saDataReturnOut_OutputPorts()),
867  static_cast<FwAssertArgType>(portNum)
868  );
869 
870  FW_ASSERT(
871  this->m_saDataReturnOut_OutputPort[portNum].isConnected(),
872  static_cast<FwAssertArgType>(portNum)
873  );
874  this->m_saDataReturnOut_OutputPort[portNum].invoke(
875  data,
876  context
877  );
878  }
879 
880 #endif
881 
882  // ----------------------------------------------------------------------
883  // Event logging functions
884  // ----------------------------------------------------------------------
885 
888  {
889  // Get the time
890  Fw::Time _logTime;
891  if (this->isConnected_timeCaller_OutputPort(0)) {
892  this->timeCaller_out(0, _logTime);
893  }
894 
895  const FwEventIdType _id = this->getIdBase() + EVENTID_TRACKINGTABLEFULL;
896 
897  // Emit the event on the log port
898  if (this->isConnected_logOut_OutputPort(0)) {
899  Fw::LogBuffer _logBuff;
900 
901 #if FW_AMPCS_COMPATIBLE
903  // Serialize the number of arguments
904  _status = _logBuff.serializeFrom(static_cast<U8>(0));
905  FW_ASSERT(
906  _status == Fw::FW_SERIALIZE_OK,
907  static_cast<FwAssertArgType>(_status)
908  );
909 #endif
910 
911  this->logOut_out(
912  0,
913  _id,
914  _logTime,
916  _logBuff
917  );
918  }
919 
920  // Emit the event on the text log port
921 #if FW_ENABLE_TEXT_LOGGING
922  if (this->isConnected_logTextOut_OutputPort(0)) {
923 #if FW_OBJECT_NAMES == 1
924  const char* _formatString =
925  "(%s) %s: SA router tracking table full: data dropped and buffer returned";
926 #else
927  const char* _formatString =
928  "%s: SA router tracking table full: data dropped and buffer returned";
929 #endif
930 
931  Fw::TextLogString _logString;
932  (void) _logString.format(
933  _formatString,
934 #if FW_OBJECT_NAMES == 1
935  this->m_objName.toChar(),
936 #endif
937  "TrackingTableFull "
938  );
939 
940  this->logTextOut_out(
941  0,
942  _id,
943  _logTime,
945  _logString
946  );
947  }
948 #endif
949  }
950 
953  {
954  // Get the time
955  Fw::Time _logTime;
956  if (this->isConnected_timeCaller_OutputPort(0)) {
957  this->timeCaller_out(0, _logTime);
958  }
959 
961 
962  // Emit the event on the log port
963  if (this->isConnected_logOut_OutputPort(0)) {
964  Fw::LogBuffer _logBuff;
965 
966 #if FW_AMPCS_COMPATIBLE
968  // Serialize the number of arguments
969  _status = _logBuff.serializeFrom(static_cast<U8>(0));
970  FW_ASSERT(
971  _status == Fw::FW_SERIALIZE_OK,
972  static_cast<FwAssertArgType>(_status)
973  );
974 #endif
975 
976  this->logOut_out(
977  0,
978  _id,
979  _logTime,
981  _logBuff
982  );
983  }
984 
985  // Emit the event on the text log port
986 #if FW_ENABLE_TEXT_LOGGING
987  if (this->isConnected_logTextOut_OutputPort(0)) {
988 #if FW_OBJECT_NAMES == 1
989  const char* _formatString =
990  "(%s) %s: SA router received an untracked buffer return";
991 #else
992  const char* _formatString =
993  "%s: SA router received an untracked buffer return";
994 #endif
995 
996  Fw::TextLogString _logString;
997  (void) _logString.format(
998  _formatString,
999 #if FW_OBJECT_NAMES == 1
1000  this->m_objName.toChar(),
1001 #endif
1002  "UntrackedBufferReturned "
1003  );
1004 
1005  this->logTextOut_out(
1006  0,
1007  _id,
1008  _logTime,
1010  _logString
1011  );
1012  }
1013 #endif
1014  }
1015 
1016  // ----------------------------------------------------------------------
1017  // Time
1018  // ----------------------------------------------------------------------
1019 
1021  getTime() const
1022  {
1023  if (this->isConnected_timeCaller_OutputPort(0)) {
1024  Fw::Time _time;
1025  this->timeCaller_out(0, _time);
1026  return _time;
1027  }
1028  else {
1029  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1030  }
1031  }
1032 
1033  // ----------------------------------------------------------------------
1034  // Mutex operations for guarded ports
1035  //
1036  // You can override these operations to provide more sophisticated
1037  // synchronization
1038  // ----------------------------------------------------------------------
1039 
1042  {
1043  this->m_guardedPortMutex.lock();
1044  }
1045 
1048  {
1049  this->m_guardedPortMutex.unLock();
1050  }
1051 
1052  // ----------------------------------------------------------------------
1053  // Calls for messages received on typed input ports
1054  // ----------------------------------------------------------------------
1055 
1056  void SdlsSaRouterComponentBase ::
1057  m_p_dataIn_in(
1058  Fw::PassiveComponentBase* callComp,
1059  FwIndexType portNum,
1060  U16 securityAssociationIndex,
1061  Fw::Buffer& data,
1062  const ComCfg::FrameContext& context
1063  )
1064  {
1065  FW_ASSERT(callComp != nullptr);
1066  SdlsSaRouterComponentBase* compPtr = static_cast<SdlsSaRouterComponentBase*>(callComp);
1067  compPtr->dataIn_handlerBase(
1068  portNum,
1069  securityAssociationIndex,
1070  data,
1071  context
1072  );
1073  }
1074 
1075  void SdlsSaRouterComponentBase ::
1076  m_p_dataReturnIn_in(
1077  Fw::PassiveComponentBase* callComp,
1078  FwIndexType portNum,
1079  Fw::Buffer& data,
1080  const ComCfg::FrameContext& context
1081  )
1082  {
1083  FW_ASSERT(callComp != nullptr);
1084  SdlsSaRouterComponentBase* compPtr = static_cast<SdlsSaRouterComponentBase*>(callComp);
1085  compPtr->dataReturnIn_handlerBase(
1086  portNum,
1087  data,
1088  context
1089  );
1090  }
1091 
1092  void SdlsSaRouterComponentBase ::
1093  m_p_saBufferReturnIn_in(
1094  Fw::PassiveComponentBase* callComp,
1095  FwIndexType portNum,
1096  Fw::Buffer& data,
1097  const ComCfg::FrameContext& context
1098  )
1099  {
1100  FW_ASSERT(callComp != nullptr);
1101  SdlsSaRouterComponentBase* compPtr = static_cast<SdlsSaRouterComponentBase*>(callComp);
1102  compPtr->saBufferReturnIn_handlerBase(
1103  portNum,
1104  data,
1105  context
1106  );
1107  }
1108 
1109  void SdlsSaRouterComponentBase ::
1110  m_p_saDataIn_in(
1111  Fw::PassiveComponentBase* callComp,
1112  FwIndexType portNum,
1113  const Svc::Ccsds::SdlsStatus& status,
1114  Fw::Buffer& data,
1115  const ComCfg::FrameContext& context
1116  )
1117  {
1118  FW_ASSERT(callComp != nullptr);
1119  SdlsSaRouterComponentBase* compPtr = static_cast<SdlsSaRouterComponentBase*>(callComp);
1120  compPtr->saDataIn_handlerBase(
1121  portNum,
1122  status,
1123  data,
1124  context
1125  );
1126  }
1127 
1128 #if !FW_DIRECT_PORT_CALLS
1129 
1130  // ----------------------------------------------------------------------
1131  // Invocation functions for special output ports
1132  // ----------------------------------------------------------------------
1133 
1134  void SdlsSaRouterComponentBase ::
1135  logOut_out(
1136  FwIndexType portNum,
1137  FwEventIdType id,
1138  Fw::Time& timeTag,
1139  const Fw::LogSeverity& severity,
1140  Fw::LogBuffer& args
1141  ) const
1142  {
1143  FW_ASSERT(
1144  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1145  static_cast<FwAssertArgType>(portNum)
1146  );
1147 
1148  FW_ASSERT(
1149  this->m_logOut_OutputPort[portNum].isConnected(),
1150  static_cast<FwAssertArgType>(portNum)
1151  );
1152  this->m_logOut_OutputPort[portNum].invoke(
1153  id,
1154  timeTag,
1155  severity,
1156  args
1157  );
1158  }
1159 
1160 #if FW_ENABLE_TEXT_LOGGING
1161 
1162  void SdlsSaRouterComponentBase ::
1163  logTextOut_out(
1164  FwIndexType portNum,
1165  FwEventIdType id,
1166  Fw::Time& timeTag,
1167  const Fw::LogSeverity& severity,
1168  Fw::TextLogString& text
1169  ) const
1170  {
1171  FW_ASSERT(
1172  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1173  static_cast<FwAssertArgType>(portNum)
1174  );
1175 
1176  FW_ASSERT(
1177  this->m_logTextOut_OutputPort[portNum].isConnected(),
1178  static_cast<FwAssertArgType>(portNum)
1179  );
1180  this->m_logTextOut_OutputPort[portNum].invoke(
1181  id,
1182  timeTag,
1183  severity,
1184  text
1185  );
1186  }
1187 
1188 #endif
1189 
1190  void SdlsSaRouterComponentBase ::
1191  timeCaller_out(
1192  FwIndexType portNum,
1193  Fw::Time& time
1194  ) const
1195  {
1196  FW_ASSERT(
1197  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1198  static_cast<FwAssertArgType>(portNum)
1199  );
1200 
1201  FW_ASSERT(
1202  this->m_timeCaller_OutputPort[portNum].isConnected(),
1203  static_cast<FwAssertArgType>(portNum)
1204  );
1205  this->m_timeCaller_OutputPort[portNum].invoke(
1206  time
1207  );
1208  }
1209 
1210 #endif
1211 
1212  }
1213 
1214 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
Svc::InputComDataWithContextPort * get_saBufferReturnIn_InputPort(FwIndexType portNum)
void set_saDataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to saDataReturnOut[portNum].
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
I32 FwEnumStoreType
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(U16 securityAssociationIndex, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
SdlsSaRouterComponentBase(const char *compName="")
Construct SdlsSaRouterComponentBase object.
void bufferReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port bufferReturnOut.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
bool isConnected_saDataOut_OutputPort(FwIndexType portNum) const
bool isConnected_saDataReturnOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputCcsdsSdlsEncryptionPort *callPort)
Register an input port.
No time base has been established (Required)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void invoke(const Svc::Ccsds::SdlsStatus &status, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
static constexpr FwIndexType getNum_saBufferReturnIn_InputPorts()
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
void init()
Object initializer.
Definition: ObjBase.cpp:24
Status of an SDLS (Space Data Link Security) encryption/decryption request.
SerializeStatus
forward declaration for string
virtual void lock()
Lock the guarded mutex.
void init()
Initialization function.
void saDataOut_out(FwIndexType portNum, U16 securityAssociationIndex, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port saDataOut.
FwIdType FwEventIdType
The type of an event identifier.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler 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
void init()
Initialization function.
Definition: TimePortAc.cpp:151
A returned buffer was not found in the tracking table; it was returned upstream.
void dataOut_out(FwIndexType portNum, const Svc::Ccsds::SdlsStatus &status, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::Ccsds::InputCcsdsSdlsDataPort *port)
Connect port to dataOut[portNum].
virtual void dataIn_handler(FwIndexType portNum, U16 securityAssociationIndex, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
virtual void unLock()
Unlock the guarded mutex.
void unLock()
unlock the mutex and assert success
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
void saDataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port saDataReturnOut.
A serious but recoverable event.
void init()
Initialization function.
void init()
Initialization function.
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
virtual void saBufferReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port saBufferReturnIn.
Enum representing event severity.
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
Svc::Ccsds::InputCcsdsSdlsEncryptionPort * get_dataIn_InputPort(FwIndexType portNum)
The outstanding-buffer tracking table is full; the data was dropped and its buffer returned...
bool isConnected_bufferReturnOut_OutputPort(FwIndexType portNum) const
void lock()
lock the mutex and assert success
void init()
Initialization function.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_dataIn_InputPorts()
static constexpr FwIndexType getNum_bufferReturnOut_OutputPorts()
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void dataIn_handlerBase(FwIndexType portNum, U16 securityAssociationIndex, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void addCallPort(InputCcsdsSdlsDataPort *callPort)
Register an input port.
virtual void saDataIn_handler(FwIndexType portNum, const Svc::Ccsds::SdlsStatus &status, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port saDataIn.
Type used to pass context info between components during framing/deframing.
void saDataIn_handlerBase(FwIndexType portNum, const Svc::Ccsds::SdlsStatus &status, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port saDataIn.
RateGroupDivider component implementation.
static constexpr FwIndexType getNum_saDataReturnOut_OutputPorts()
Auto-generated base for SdlsSaRouter component.
static constexpr FwIndexType getNum_dataOut_OutputPorts()
Implementation of malloc based allocator.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
void set_bufferReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to bufferReturnOut[portNum].
static constexpr FwIndexType getNum_saDataOut_OutputPorts()
Svc::Ccsds::InputCcsdsSdlsDataPort * get_saDataIn_InputPort(FwIndexType portNum)
void saBufferReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port saBufferReturnIn.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
virtual ~SdlsSaRouterComponentBase()
Destroy SdlsSaRouterComponentBase object.
static constexpr FwIndexType getNum_saDataIn_InputPorts()
void set_saDataOut_OutputPort(FwIndexType portNum, Svc::Ccsds::InputCcsdsSdlsEncryptionPort *port)
Connect port to saDataOut[portNum].
static constexpr FwIndexType getNum_logOut_OutputPorts()
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const