F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FrameAccumulatorComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FrameAccumulatorComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FrameAccumulator 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  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26 #if !FW_DIRECT_PORT_CALLS
27  // Connect input port dataIn
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_dataIn_InputPorts());
31  port++
32  ) {
33  this->m_dataIn_InputPort[port].init();
34  this->m_dataIn_InputPort[port].addCallComp(
35  this,
36  m_p_dataIn_in
37  );
38  this->m_dataIn_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_dataIn_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_dataIn_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51 
52 #if !FW_DIRECT_PORT_CALLS
53  // Connect input port dataReturnIn
54  for (
55  FwIndexType port = 0;
56  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
57  port++
58  ) {
59  this->m_dataReturnIn_InputPort[port].init();
60  this->m_dataReturnIn_InputPort[port].addCallComp(
61  this,
62  m_p_dataReturnIn_in
63  );
64  this->m_dataReturnIn_InputPort[port].setPortNum(port);
65 
66 #if FW_OBJECT_NAMES == 1
67  Fw::ObjectName portName;
68  portName.format(
69  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
70  this->m_objName.toChar(),
71  port
72  );
73  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
74 #endif
75  }
76 #endif
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect output port logOut
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
83  port++
84  ) {
85  this->m_logOut_OutputPort[port].init();
86 
87 #if FW_OBJECT_NAMES == 1
88  Fw::ObjectName portName;
89  portName.format(
90  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
91  this->m_objName.toChar(),
92  port
93  );
94  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
95 #endif
96  }
97 #endif
98 
99 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
100  // Connect output port logTextOut
101  for (
102  FwIndexType port = 0;
103  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
104  port++
105  ) {
106  this->m_logTextOut_OutputPort[port].init();
107 
108 #if FW_OBJECT_NAMES == 1
109  Fw::ObjectName portName;
110  portName.format(
111  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
112  this->m_objName.toChar(),
113  port
114  );
115  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
116 #endif
117  }
118 #endif
119 
120 #if !FW_DIRECT_PORT_CALLS
121  // Connect output port timeCaller
122  for (
123  FwIndexType port = 0;
124  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
125  port++
126  ) {
127  this->m_timeCaller_OutputPort[port].init();
128 
129 #if FW_OBJECT_NAMES == 1
130  Fw::ObjectName portName;
131  portName.format(
132  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
133  this->m_objName.toChar(),
134  port
135  );
136  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
137 #endif
138  }
139 #endif
140 
141 #if !FW_DIRECT_PORT_CALLS
142  // Connect output port bufferAllocate
143  for (
144  FwIndexType port = 0;
145  port < static_cast<FwIndexType>(this->getNum_bufferAllocate_OutputPorts());
146  port++
147  ) {
148  this->m_bufferAllocate_OutputPort[port].init();
149 
150 #if FW_OBJECT_NAMES == 1
151  Fw::ObjectName portName;
152  portName.format(
153  "%s_bufferAllocate_OutputPort[%" PRI_FwIndexType "]",
154  this->m_objName.toChar(),
155  port
156  );
157  this->m_bufferAllocate_OutputPort[port].setObjName(portName.toChar());
158 #endif
159  }
160 #endif
161 
162 #if !FW_DIRECT_PORT_CALLS
163  // Connect output port bufferDeallocate
164  for (
165  FwIndexType port = 0;
166  port < static_cast<FwIndexType>(this->getNum_bufferDeallocate_OutputPorts());
167  port++
168  ) {
169  this->m_bufferDeallocate_OutputPort[port].init();
170 
171 #if FW_OBJECT_NAMES == 1
172  Fw::ObjectName portName;
173  portName.format(
174  "%s_bufferDeallocate_OutputPort[%" PRI_FwIndexType "]",
175  this->m_objName.toChar(),
176  port
177  );
178  this->m_bufferDeallocate_OutputPort[port].setObjName(portName.toChar());
179 #endif
180  }
181 #endif
182 
183 #if !FW_DIRECT_PORT_CALLS
184  // Connect output port dataOut
185  for (
186  FwIndexType port = 0;
187  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
188  port++
189  ) {
190  this->m_dataOut_OutputPort[port].init();
191 
192 #if FW_OBJECT_NAMES == 1
193  Fw::ObjectName portName;
194  portName.format(
195  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
196  this->m_objName.toChar(),
197  port
198  );
199  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
200 #endif
201  }
202 #endif
203 
204 #if !FW_DIRECT_PORT_CALLS
205  // Connect output port dataReturnOut
206  for (
207  FwIndexType port = 0;
208  port < static_cast<FwIndexType>(this->getNum_dataReturnOut_OutputPorts());
209  port++
210  ) {
211  this->m_dataReturnOut_OutputPort[port].init();
212 
213 #if FW_OBJECT_NAMES == 1
214  Fw::ObjectName portName;
215  portName.format(
216  "%s_dataReturnOut_OutputPort[%" PRI_FwIndexType "]",
217  this->m_objName.toChar(),
218  port
219  );
220  this->m_dataReturnOut_OutputPort[port].setObjName(portName.toChar());
221 #endif
222  }
223 #endif
224  }
225 
226 #if !FW_DIRECT_PORT_CALLS
227 
228  // ----------------------------------------------------------------------
229  // Getters for typed input ports
230  // ----------------------------------------------------------------------
231 
234  {
235  FW_ASSERT(
236  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
237  static_cast<FwAssertArgType>(portNum)
238  );
239 
240  return &this->m_dataIn_InputPort[portNum];
241  }
242 
245  {
246  FW_ASSERT(
247  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
248  static_cast<FwAssertArgType>(portNum)
249  );
250 
251  return &this->m_dataReturnIn_InputPort[portNum];
252  }
253 
254 #endif
255 
256 #if !FW_DIRECT_PORT_CALLS
257 
258  // ----------------------------------------------------------------------
259  // Connect input ports to special output ports
260  // ----------------------------------------------------------------------
261 
264  FwIndexType portNum,
265  Fw::InputLogPort* port
266  )
267  {
268  FW_ASSERT(
269  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
270  static_cast<FwAssertArgType>(portNum)
271  );
272 
273  this->m_logOut_OutputPort[portNum].addCallPort(port);
274  }
275 
276 #if FW_ENABLE_TEXT_LOGGING == 1
277 
278  void FrameAccumulatorComponentBase ::
279  set_logTextOut_OutputPort(
280  FwIndexType portNum,
282  )
283  {
284  FW_ASSERT(
285  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
286  static_cast<FwAssertArgType>(portNum)
287  );
288 
289  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
290  }
291 
292 #endif
293 
296  FwIndexType portNum,
297  Fw::InputTimePort* port
298  )
299  {
300  FW_ASSERT(
301  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
302  static_cast<FwAssertArgType>(portNum)
303  );
304 
305  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
306  }
307 
308 #endif
309 
310 #if !FW_DIRECT_PORT_CALLS
311 
312  // ----------------------------------------------------------------------
313  // Connect typed input ports to typed output ports
314  // ----------------------------------------------------------------------
315 
318  FwIndexType portNum,
320  )
321  {
322  FW_ASSERT(
323  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
324  static_cast<FwAssertArgType>(portNum)
325  );
326 
327  this->m_bufferAllocate_OutputPort[portNum].addCallPort(port);
328  }
329 
332  FwIndexType portNum,
334  )
335  {
336  FW_ASSERT(
337  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
338  static_cast<FwAssertArgType>(portNum)
339  );
340 
341  this->m_bufferDeallocate_OutputPort[portNum].addCallPort(port);
342  }
343 
346  FwIndexType portNum,
348  )
349  {
350  FW_ASSERT(
351  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
352  static_cast<FwAssertArgType>(portNum)
353  );
354 
355  this->m_dataOut_OutputPort[portNum].addCallPort(port);
356  }
357 
360  FwIndexType portNum,
362  )
363  {
364  FW_ASSERT(
365  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
366  static_cast<FwAssertArgType>(portNum)
367  );
368 
369  this->m_dataReturnOut_OutputPort[portNum].addCallPort(port);
370  }
371 
372 #endif
373 
374 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
375 
376  // ----------------------------------------------------------------------
377  // Connect serial input ports to special output ports
378  // ----------------------------------------------------------------------
379 
382  FwIndexType portNum,
383  Fw::InputSerializePort* port
384  )
385  {
386  FW_ASSERT(
387  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
388  static_cast<FwAssertArgType>(portNum)
389  );
390 
391  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
392  }
393 
394 #if FW_ENABLE_TEXT_LOGGING == 1
395 
396  void FrameAccumulatorComponentBase ::
397  set_logTextOut_OutputPort(
398  FwIndexType portNum,
399  Fw::InputSerializePort* port
400  )
401  {
402  FW_ASSERT(
403  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
404  static_cast<FwAssertArgType>(portNum)
405  );
406 
407  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
408  }
409 
410 #endif
411 
414  FwIndexType portNum,
415  Fw::InputSerializePort* port
416  )
417  {
418  FW_ASSERT(
419  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
420  static_cast<FwAssertArgType>(portNum)
421  );
422 
423  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
424  }
425 
426 #endif
427 
428 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
429 
430  // ----------------------------------------------------------------------
431  // Connect serial input ports to typed output ports
432  // ----------------------------------------------------------------------
433 
436  FwIndexType portNum,
437  Fw::InputSerializePort* port
438  )
439  {
440  FW_ASSERT(
441  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
442  static_cast<FwAssertArgType>(portNum)
443  );
444 
445  this->m_bufferDeallocate_OutputPort[portNum].registerSerialPort(port);
446  }
447 
450  FwIndexType portNum,
451  Fw::InputSerializePort* port
452  )
453  {
454  FW_ASSERT(
455  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
456  static_cast<FwAssertArgType>(portNum)
457  );
458 
459  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
460  }
461 
464  FwIndexType portNum,
465  Fw::InputSerializePort* port
466  )
467  {
468  FW_ASSERT(
469  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
470  static_cast<FwAssertArgType>(portNum)
471  );
472 
473  this->m_dataReturnOut_OutputPort[portNum].registerSerialPort(port);
474  }
475 
476 #endif
477 
478  // ----------------------------------------------------------------------
479  // Component construction and destruction
480  // ----------------------------------------------------------------------
481 
483  FrameAccumulatorComponentBase(const char* compName) :
484  Fw::PassiveComponentBase(compName)
485  {
486 
487  }
488 
491  {
492 
493  }
494 
495 #if !FW_DIRECT_PORT_CALLS
496 
497  // ----------------------------------------------------------------------
498  // Connection status queries for special output ports
499  // ----------------------------------------------------------------------
500 
503  {
504  FW_ASSERT(
505  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
506  static_cast<FwAssertArgType>(portNum)
507  );
508 
509  return this->m_logOut_OutputPort[portNum].isConnected();
510  }
511 
512 #if FW_ENABLE_TEXT_LOGGING == 1
513 
514  bool FrameAccumulatorComponentBase ::
515  isConnected_logTextOut_OutputPort(FwIndexType portNum) const
516  {
517  FW_ASSERT(
518  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
519  static_cast<FwAssertArgType>(portNum)
520  );
521 
522  return this->m_logTextOut_OutputPort[portNum].isConnected();
523  }
524 
525 #endif
526 
529  {
530  FW_ASSERT(
531  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
532  static_cast<FwAssertArgType>(portNum)
533  );
534 
535  return this->m_timeCaller_OutputPort[portNum].isConnected();
536  }
537 
538 #endif
539 
540 #if !FW_DIRECT_PORT_CALLS
541 
542  // ----------------------------------------------------------------------
543  // Connection status queries for typed output ports
544  // ----------------------------------------------------------------------
545 
548  {
549  FW_ASSERT(
550  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
551  static_cast<FwAssertArgType>(portNum)
552  );
553 
554  return this->m_bufferAllocate_OutputPort[portNum].isConnected();
555  }
556 
559  {
560  FW_ASSERT(
561  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
562  static_cast<FwAssertArgType>(portNum)
563  );
564 
565  return this->m_bufferDeallocate_OutputPort[portNum].isConnected();
566  }
567 
570  {
571  FW_ASSERT(
572  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
573  static_cast<FwAssertArgType>(portNum)
574  );
575 
576  return this->m_dataOut_OutputPort[portNum].isConnected();
577  }
578 
581  {
582  FW_ASSERT(
583  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
584  static_cast<FwAssertArgType>(portNum)
585  );
586 
587  return this->m_dataReturnOut_OutputPort[portNum].isConnected();
588  }
589 
590 #endif
591 
592  // ----------------------------------------------------------------------
593  // Port handler base-class functions for typed input ports
594  //
595  // Call these functions directly to bypass the corresponding ports
596  // ----------------------------------------------------------------------
597 
600  FwIndexType portNum,
601  Fw::Buffer& data,
602  const ComCfg::FrameContext& context
603  )
604  {
605  // Make sure port number is valid
606  FW_ASSERT(
607  (0 <= portNum) && (portNum < this->getNum_dataIn_InputPorts()),
608  static_cast<FwAssertArgType>(portNum)
609  );
610 
611  // Lock guard mutex before calling
612  this->lock();
613 
614  // Call handler function
615  this->dataIn_handler(
616  portNum,
617  data,
618  context
619  );
620 
621  // Unlock guard mutex
622  this->unLock();
623  }
624 
627  FwIndexType portNum,
628  Fw::Buffer& data,
629  const ComCfg::FrameContext& context
630  )
631  {
632  // Make sure port number is valid
633  FW_ASSERT(
634  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
635  static_cast<FwAssertArgType>(portNum)
636  );
637 
638  // Call handler function
639  this->dataReturnIn_handler(
640  portNum,
641  data,
642  context
643  );
644  }
645 
646 #if !FW_DIRECT_PORT_CALLS
647 
648  // ----------------------------------------------------------------------
649  // Invocation functions for typed output ports
650  // ----------------------------------------------------------------------
651 
654  FwIndexType portNum,
655  FwSizeType size
656  ) const
657  {
658  FW_ASSERT(
659  (0 <= portNum) && (portNum < this->getNum_bufferAllocate_OutputPorts()),
660  static_cast<FwAssertArgType>(portNum)
661  );
662 
663  FW_ASSERT(
664  this->m_bufferAllocate_OutputPort[portNum].isConnected(),
665  static_cast<FwAssertArgType>(portNum)
666  );
667  return this->m_bufferAllocate_OutputPort[portNum].invoke(
668  size
669  );
670  }
671 
674  FwIndexType portNum,
675  Fw::Buffer& fwBuffer
676  ) const
677  {
678  FW_ASSERT(
679  (0 <= portNum) && (portNum < this->getNum_bufferDeallocate_OutputPorts()),
680  static_cast<FwAssertArgType>(portNum)
681  );
682 
683  FW_ASSERT(
684  this->m_bufferDeallocate_OutputPort[portNum].isConnected(),
685  static_cast<FwAssertArgType>(portNum)
686  );
687  this->m_bufferDeallocate_OutputPort[portNum].invoke(
688  fwBuffer
689  );
690  }
691 
694  FwIndexType portNum,
695  Fw::Buffer& data,
696  const ComCfg::FrameContext& context
697  ) const
698  {
699  FW_ASSERT(
700  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
701  static_cast<FwAssertArgType>(portNum)
702  );
703 
704  FW_ASSERT(
705  this->m_dataOut_OutputPort[portNum].isConnected(),
706  static_cast<FwAssertArgType>(portNum)
707  );
708  this->m_dataOut_OutputPort[portNum].invoke(
709  data,
710  context
711  );
712  }
713 
716  FwIndexType portNum,
717  Fw::Buffer& data,
718  const ComCfg::FrameContext& context
719  ) const
720  {
721  FW_ASSERT(
722  (0 <= portNum) && (portNum < this->getNum_dataReturnOut_OutputPorts()),
723  static_cast<FwAssertArgType>(portNum)
724  );
725 
726  FW_ASSERT(
727  this->m_dataReturnOut_OutputPort[portNum].isConnected(),
728  static_cast<FwAssertArgType>(portNum)
729  );
730  this->m_dataReturnOut_OutputPort[portNum].invoke(
731  data,
732  context
733  );
734  }
735 
736 #endif
737 
738  // ----------------------------------------------------------------------
739  // Event logging functions
740  // ----------------------------------------------------------------------
741 
744  {
745  // Get the time
746  Fw::Time _logTime;
747  if (this->isConnected_timeCaller_OutputPort(0)) {
748  this->timeCaller_out(0, _logTime);
749  }
750 
751  const FwEventIdType _id = this->getIdBase() + EVENTID_NOBUFFERAVAILABLE;
752 
753  // Emit the event on the log port
754  if (this->isConnected_logOut_OutputPort(0)) {
755  Fw::LogBuffer _logBuff;
756 
757 #if FW_AMPCS_COMPATIBLE
759  // Serialize the number of arguments
760  _status = _logBuff.serializeFrom(static_cast<U8>(0));
761  FW_ASSERT(
762  _status == Fw::FW_SERIALIZE_OK,
763  static_cast<FwAssertArgType>(_status)
764  );
765 #endif
766 
767  this->logOut_out(
768  0,
769  _id,
770  _logTime,
772  _logBuff
773  );
774  }
775 
776  // Emit the event on the text log port
777 #if FW_ENABLE_TEXT_LOGGING
778  if (this->isConnected_logTextOut_OutputPort(0)) {
779 #if FW_OBJECT_NAMES == 1
780  const char* _formatString =
781  "(%s) %s: Could not allocate a valid buffer to fit the detected frame";
782 #else
783  const char* _formatString =
784  "%s: Could not allocate a valid buffer to fit the detected frame";
785 #endif
786 
787  Fw::TextLogString _logString;
788  _logString.format(
789  _formatString,
790 #if FW_OBJECT_NAMES == 1
791  this->m_objName.toChar(),
792 #endif
793  "NoBufferAvailable "
794  );
795 
796  this->logTextOut_out(
797  0,
798  _id,
799  _logTime,
801  _logString
802  );
803  }
804 #endif
805  }
806 
809  {
810  // Get the time
811  Fw::Time _logTime;
812  if (this->isConnected_timeCaller_OutputPort(0)) {
813  this->timeCaller_out(0, _logTime);
814  }
815 
817 
818  // Emit the event on the log port
819  if (this->isConnected_logOut_OutputPort(0)) {
820  Fw::LogBuffer _logBuff;
822 
823 #if FW_AMPCS_COMPATIBLE
824  // Serialize the number of arguments
825  _status = _logBuff.serializeFrom(static_cast<U8>(1));
826  FW_ASSERT(
827  _status == Fw::FW_SERIALIZE_OK,
828  static_cast<FwAssertArgType>(_status)
829  );
830 #endif
831 
832 #if FW_AMPCS_COMPATIBLE
833  // Serialize the argument size
834  _status = _logBuff.serializeFrom(
835  static_cast<U8>(sizeof(FwSizeType))
836  );
837  FW_ASSERT(
838  _status == Fw::FW_SERIALIZE_OK,
839  static_cast<FwAssertArgType>(_status)
840  );
841 #endif
842  _status = _logBuff.serializeFrom(size_out);
843  FW_ASSERT(
844  _status == Fw::FW_SERIALIZE_OK,
845  static_cast<FwAssertArgType>(_status)
846  );
847 
848  this->logOut_out(
849  0,
850  _id,
851  _logTime,
853  _logBuff
854  );
855  }
856 
857  // Emit the event on the text log port
858 #if FW_ENABLE_TEXT_LOGGING
859  if (this->isConnected_logTextOut_OutputPort(0)) {
860 #if FW_OBJECT_NAMES == 1
861  const char* _formatString =
862  "(%s) %s: Reported size_out=%" PRIu64 " exceeds accumulation buffer capacity";
863 #else
864  const char* _formatString =
865  "%s: Reported size_out=%" PRIu64 " exceeds accumulation buffer capacity";
866 #endif
867 
868  Fw::TextLogString _logString;
869  _logString.format(
870  _formatString,
871 #if FW_OBJECT_NAMES == 1
872  this->m_objName.toChar(),
873 #endif
874  "FrameDetectionSizeError ",
875  size_out
876  );
877 
878  this->logTextOut_out(
879  0,
880  _id,
881  _logTime,
883  _logString
884  );
885  }
886 #endif
887  }
888 
891  {
892  // Get the time
893  Fw::Time _logTime;
894  if (this->isConnected_timeCaller_OutputPort(0)) {
895  this->timeCaller_out(0, _logTime);
896  }
897 
899 
900  // Emit the event on the log port
901  if (this->isConnected_logOut_OutputPort(0)) {
902  Fw::LogBuffer _logBuff;
903 
904 #if FW_AMPCS_COMPATIBLE
906  // Serialize the number of arguments
907  _status = _logBuff.serializeFrom(static_cast<U8>(0));
908  FW_ASSERT(
909  _status == Fw::FW_SERIALIZE_OK,
910  static_cast<FwAssertArgType>(_status)
911  );
912 #endif
913 
914  this->logOut_out(
915  0,
916  _id,
917  _logTime,
919  _logBuff
920  );
921  }
922 
923  // Emit the event on the text log port
924 #if FW_ENABLE_TEXT_LOGGING
925  if (this->isConnected_logTextOut_OutputPort(0)) {
926 #if FW_OBJECT_NAMES == 1
927  const char* _formatString =
928  "(%s) %s: A valid frame was detected but dropped";
929 #else
930  const char* _formatString =
931  "%s: A valid frame was detected but dropped";
932 #endif
933 
934  Fw::TextLogString _logString;
935  _logString.format(
936  _formatString,
937 #if FW_OBJECT_NAMES == 1
938  this->m_objName.toChar(),
939 #endif
940  "FrameDetectionValidFrameDropped "
941  );
942 
943  this->logTextOut_out(
944  0,
945  _id,
946  _logTime,
948  _logString
949  );
950  }
951 #endif
952  }
953 
954  // ----------------------------------------------------------------------
955  // Time
956  // ----------------------------------------------------------------------
957 
959  getTime() const
960  {
961  if (this->isConnected_timeCaller_OutputPort(0)) {
962  Fw::Time _time;
963  this->timeCaller_out(0, _time);
964  return _time;
965  }
966  else {
967  return Fw::Time(TimeBase::TB_NONE, 0, 0);
968  }
969  }
970 
971  // ----------------------------------------------------------------------
972  // Mutex operations for guarded ports
973  //
974  // You can override these operations to provide more sophisticated
975  // synchronization
976  // ----------------------------------------------------------------------
977 
980  {
981  this->m_guardedPortMutex.lock();
982  }
983 
986  {
987  this->m_guardedPortMutex.unLock();
988  }
989 
990  // ----------------------------------------------------------------------
991  // Calls for messages received on typed input ports
992  // ----------------------------------------------------------------------
993 
994  void FrameAccumulatorComponentBase ::
995  m_p_dataIn_in(
996  Fw::PassiveComponentBase* callComp,
997  FwIndexType portNum,
998  Fw::Buffer& data,
999  const ComCfg::FrameContext& context
1000  )
1001  {
1002  FW_ASSERT(callComp);
1003  FrameAccumulatorComponentBase* compPtr = static_cast<FrameAccumulatorComponentBase*>(callComp);
1004  compPtr->dataIn_handlerBase(
1005  portNum,
1006  data,
1007  context
1008  );
1009  }
1010 
1011  void FrameAccumulatorComponentBase ::
1012  m_p_dataReturnIn_in(
1013  Fw::PassiveComponentBase* callComp,
1014  FwIndexType portNum,
1015  Fw::Buffer& data,
1016  const ComCfg::FrameContext& context
1017  )
1018  {
1019  FW_ASSERT(callComp);
1020  FrameAccumulatorComponentBase* compPtr = static_cast<FrameAccumulatorComponentBase*>(callComp);
1021  compPtr->dataReturnIn_handlerBase(
1022  portNum,
1023  data,
1024  context
1025  );
1026  }
1027 
1028 #if !FW_DIRECT_PORT_CALLS
1029 
1030  // ----------------------------------------------------------------------
1031  // Invocation functions for special output ports
1032  // ----------------------------------------------------------------------
1033 
1034  void FrameAccumulatorComponentBase ::
1035  logOut_out(
1036  FwIndexType portNum,
1037  FwEventIdType id,
1038  Fw::Time& timeTag,
1039  const Fw::LogSeverity& severity,
1040  Fw::LogBuffer& args
1041  ) const
1042  {
1043  FW_ASSERT(
1044  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
1045  static_cast<FwAssertArgType>(portNum)
1046  );
1047 
1048  FW_ASSERT(
1049  this->m_logOut_OutputPort[portNum].isConnected(),
1050  static_cast<FwAssertArgType>(portNum)
1051  );
1052  this->m_logOut_OutputPort[portNum].invoke(
1053  id,
1054  timeTag,
1055  severity,
1056  args
1057  );
1058  }
1059 
1060 #if FW_ENABLE_TEXT_LOGGING
1061 
1062  void FrameAccumulatorComponentBase ::
1063  logTextOut_out(
1064  FwIndexType portNum,
1065  FwEventIdType id,
1066  Fw::Time& timeTag,
1067  const Fw::LogSeverity& severity,
1068  Fw::TextLogString& text
1069  ) const
1070  {
1071  FW_ASSERT(
1072  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
1073  static_cast<FwAssertArgType>(portNum)
1074  );
1075 
1076  FW_ASSERT(
1077  this->m_logTextOut_OutputPort[portNum].isConnected(),
1078  static_cast<FwAssertArgType>(portNum)
1079  );
1080  this->m_logTextOut_OutputPort[portNum].invoke(
1081  id,
1082  timeTag,
1083  severity,
1084  text
1085  );
1086  }
1087 
1088 #endif
1089 
1090  void FrameAccumulatorComponentBase ::
1091  timeCaller_out(
1092  FwIndexType portNum,
1093  Fw::Time& time
1094  ) const
1095  {
1096  FW_ASSERT(
1097  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
1098  static_cast<FwAssertArgType>(portNum)
1099  );
1100 
1101  FW_ASSERT(
1102  this->m_timeCaller_OutputPort[portNum].isConnected(),
1103  static_cast<FwAssertArgType>(portNum)
1104  );
1105  this->m_timeCaller_OutputPort[portNum].invoke(
1106  time
1107  );
1108  }
1109 
1110 #endif
1111 
1112 }
bool isConnected_bufferAllocate_OutputPort(FwIndexType portNum) const
Serialization/Deserialization operation was successful.
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
bool isConnected_logOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
virtual void unLock()
Unlock the guarded mutex.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
PlatformSizeType FwSizeType
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
I32 FwEnumStoreType
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void set_bufferAllocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferAllocate[portNum].
static constexpr FwIndexType getNum_dataIn_InputPorts()
No time base has been established (Required)
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
bool isConnected_bufferDeallocate_OutputPort(FwIndexType portNum) const
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
void init()
Object initializer.
Definition: ObjBase.cpp:24
static constexpr FwIndexType getNum_bufferDeallocate_OutputPorts()
SerializeStatus
forward declaration for string
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
FwIdType FwEventIdType
The type of an event identifier.
static constexpr FwIndexType getNum_bufferAllocate_OutputPorts()
#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 addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
static constexpr FwIndexType getNum_dataOut_OutputPorts()
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
A serious but recoverable event.
void init()
Initialization function.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
#define PRI_FwIndexType
void bufferDeallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferDeallocate.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
static constexpr FwIndexType getNum_logOut_OutputPorts()
void setPortNum(FwIndexType portNum)
virtual void lock()
Lock the guarded mutex.
Fw::Buffer invoke(FwSizeType size) const
void init()
Initialization function.
void init()
Initialization function.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
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_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void log_WARNING_HI_FrameDetectionSizeError(FwSizeType size_out) const
PlatformIndexType FwIndexType
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
Fw::Buffer bufferAllocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port bufferAllocate.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
Type used to pass context info between components during framing/deframing.
Auto-generated base for FrameAccumulator component.
void init()
Initialization function.
RateGroupDivider component implementation.
void set_bufferDeallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferDeallocate[portNum].
FrameAccumulatorComponentBase(const char *compName="")
Construct FrameAccumulatorComponentBase object.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
Implementation of malloc based allocator.
virtual ~FrameAccumulatorComponentBase()
Destroy FrameAccumulatorComponentBase object.
A frame was detected but dropped because there was no buffer to hold it.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34