F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
BufferAccumulatorComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title BufferAccumulatorComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for BufferAccumulator 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 {
17  enum MsgTypeEnum {
18  BUFFERACCUMULATOR_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  BUFFERSENDINFILL_BUFFERSEND,
20  BUFFERSENDINRETURN_BUFFERSEND,
21  PINGIN_PING,
22  CMD_BA_SETMODE,
23  CMD_BA_DRAINBUFFERS,
24  };
25 
26  // Get the max size by constructing a union of the async input, command, and
27  // internal port serialization sizes
28  union BuffUnion {
29  BYTE bufferSendInFillPortSize[Fw::BufferSendPortBuffer::CAPACITY];
30  BYTE bufferSendInReturnPortSize[Fw::BufferSendPortBuffer::CAPACITY];
33  };
34 
35  // Define a message buffer class large enough to handle all the
36  // asynchronous inputs to the component
37  class ComponentIpcSerializableBuffer :
39  {
40 
41  public:
42 
43  enum {
44  // Offset into data in buffer: Size of message ID and port number
45  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
46  // Max data size
47  MAX_DATA_SIZE = sizeof(BuffUnion),
48  // Max message size: Size of message id + size of port + max data size
49  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
50  };
51 
52  ComponentIpcSerializableBuffer() : Fw::LinearBufferBase(m_buff, sizeof(m_buff)) {
53 
54  }
55 
56  private:
57  // Should be the max of all the input ports serialized sizes...
58  U8 m_buff[SERIALIZATION_SIZE];
59 
60  };
61  }
62 
63  // ----------------------------------------------------------------------
64  // Component initialization
65  // ----------------------------------------------------------------------
66 
69  FwSizeType queueDepth,
70  FwEnumStoreType instance
71  )
72  {
73  // Initialize base class
75 
76 #if !FW_DIRECT_PORT_CALLS
77  // Connect input port cmdIn
78  for (
79  FwIndexType port = 0;
80  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
81  port++
82  ) {
83  this->m_cmdIn_InputPort[port].init();
84  this->m_cmdIn_InputPort[port].addCallComp(
85  this,
86  m_p_cmdIn_in
87  );
88  this->m_cmdIn_InputPort[port].setPortNum(port);
89 
90 #if FW_OBJECT_NAMES == 1
91  Fw::ObjectName portName;
92  portName.format(
93  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
94  this->m_objName.toChar(),
95  port
96  );
97  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
98 #endif
99  }
100 #endif
101 
102 #if !FW_DIRECT_PORT_CALLS
103  // Connect input port bufferSendInFill
104  for (
105  FwIndexType port = 0;
106  port < static_cast<FwIndexType>(this->getNum_bufferSendInFill_InputPorts());
107  port++
108  ) {
109  this->m_bufferSendInFill_InputPort[port].init();
110  this->m_bufferSendInFill_InputPort[port].addCallComp(
111  this,
112  m_p_bufferSendInFill_in
113  );
114  this->m_bufferSendInFill_InputPort[port].setPortNum(port);
115 
116 #if FW_OBJECT_NAMES == 1
117  Fw::ObjectName portName;
118  portName.format(
119  "%s_bufferSendInFill_InputPort[%" PRI_FwIndexType "]",
120  this->m_objName.toChar(),
121  port
122  );
123  this->m_bufferSendInFill_InputPort[port].setObjName(portName.toChar());
124 #endif
125  }
126 #endif
127 
128 #if !FW_DIRECT_PORT_CALLS
129  // Connect input port bufferSendInReturn
130  for (
131  FwIndexType port = 0;
132  port < static_cast<FwIndexType>(this->getNum_bufferSendInReturn_InputPorts());
133  port++
134  ) {
135  this->m_bufferSendInReturn_InputPort[port].init();
136  this->m_bufferSendInReturn_InputPort[port].addCallComp(
137  this,
138  m_p_bufferSendInReturn_in
139  );
140  this->m_bufferSendInReturn_InputPort[port].setPortNum(port);
141 
142 #if FW_OBJECT_NAMES == 1
143  Fw::ObjectName portName;
144  portName.format(
145  "%s_bufferSendInReturn_InputPort[%" PRI_FwIndexType "]",
146  this->m_objName.toChar(),
147  port
148  );
149  this->m_bufferSendInReturn_InputPort[port].setObjName(portName.toChar());
150 #endif
151  }
152 #endif
153 
154 #if !FW_DIRECT_PORT_CALLS
155  // Connect input port pingIn
156  for (
157  FwIndexType port = 0;
158  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
159  port++
160  ) {
161  this->m_pingIn_InputPort[port].init();
162  this->m_pingIn_InputPort[port].addCallComp(
163  this,
164  m_p_pingIn_in
165  );
166  this->m_pingIn_InputPort[port].setPortNum(port);
167 
168 #if FW_OBJECT_NAMES == 1
169  Fw::ObjectName portName;
170  portName.format(
171  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
172  this->m_objName.toChar(),
173  port
174  );
175  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
176 #endif
177  }
178 #endif
179 
180 #if !FW_DIRECT_PORT_CALLS
181  // Connect output port cmdRegOut
182  for (
183  FwIndexType port = 0;
184  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
185  port++
186  ) {
187  this->m_cmdRegOut_OutputPort[port].init();
188 
189 #if FW_OBJECT_NAMES == 1
190  Fw::ObjectName portName;
191  portName.format(
192  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
193  this->m_objName.toChar(),
194  port
195  );
196  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
197 #endif
198  }
199 #endif
200 
201 #if !FW_DIRECT_PORT_CALLS
202  // Connect output port cmdResponseOut
203  for (
204  FwIndexType port = 0;
205  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
206  port++
207  ) {
208  this->m_cmdResponseOut_OutputPort[port].init();
209 
210 #if FW_OBJECT_NAMES == 1
211  Fw::ObjectName portName;
212  portName.format(
213  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
214  this->m_objName.toChar(),
215  port
216  );
217  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
218 #endif
219  }
220 #endif
221 
222 #if !FW_DIRECT_PORT_CALLS
223  // Connect output port eventOut
224  for (
225  FwIndexType port = 0;
226  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
227  port++
228  ) {
229  this->m_eventOut_OutputPort[port].init();
230 
231 #if FW_OBJECT_NAMES == 1
232  Fw::ObjectName portName;
233  portName.format(
234  "%s_eventOut_OutputPort[%" PRI_FwIndexType "]",
235  this->m_objName.toChar(),
236  port
237  );
238  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
239 #endif
240  }
241 #endif
242 
243 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
244  // Connect output port eventOutText
245  for (
246  FwIndexType port = 0;
247  port < static_cast<FwIndexType>(this->getNum_eventOutText_OutputPorts());
248  port++
249  ) {
250  this->m_eventOutText_OutputPort[port].init();
251 
252 #if FW_OBJECT_NAMES == 1
253  Fw::ObjectName portName;
254  portName.format(
255  "%s_eventOutText_OutputPort[%" PRI_FwIndexType "]",
256  this->m_objName.toChar(),
257  port
258  );
259  this->m_eventOutText_OutputPort[port].setObjName(portName.toChar());
260 #endif
261  }
262 #endif
263 
264 #if !FW_DIRECT_PORT_CALLS
265  // Connect output port timeCaller
266  for (
267  FwIndexType port = 0;
268  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
269  port++
270  ) {
271  this->m_timeCaller_OutputPort[port].init();
272 
273 #if FW_OBJECT_NAMES == 1
274  Fw::ObjectName portName;
275  portName.format(
276  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
277  this->m_objName.toChar(),
278  port
279  );
280  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
281 #endif
282  }
283 #endif
284 
285 #if !FW_DIRECT_PORT_CALLS
286  // Connect output port tlmOut
287  for (
288  FwIndexType port = 0;
289  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
290  port++
291  ) {
292  this->m_tlmOut_OutputPort[port].init();
293 
294 #if FW_OBJECT_NAMES == 1
295  Fw::ObjectName portName;
296  portName.format(
297  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
298  this->m_objName.toChar(),
299  port
300  );
301  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
302 #endif
303  }
304 #endif
305 
306 #if !FW_DIRECT_PORT_CALLS
307  // Connect output port bufferSendOutDrain
308  for (
309  FwIndexType port = 0;
310  port < static_cast<FwIndexType>(this->getNum_bufferSendOutDrain_OutputPorts());
311  port++
312  ) {
313  this->m_bufferSendOutDrain_OutputPort[port].init();
314 
315 #if FW_OBJECT_NAMES == 1
316  Fw::ObjectName portName;
317  portName.format(
318  "%s_bufferSendOutDrain_OutputPort[%" PRI_FwIndexType "]",
319  this->m_objName.toChar(),
320  port
321  );
322  this->m_bufferSendOutDrain_OutputPort[port].setObjName(portName.toChar());
323 #endif
324  }
325 #endif
326 
327 #if !FW_DIRECT_PORT_CALLS
328  // Connect output port bufferSendOutReturn
329  for (
330  FwIndexType port = 0;
331  port < static_cast<FwIndexType>(this->getNum_bufferSendOutReturn_OutputPorts());
332  port++
333  ) {
334  this->m_bufferSendOutReturn_OutputPort[port].init();
335 
336 #if FW_OBJECT_NAMES == 1
337  Fw::ObjectName portName;
338  portName.format(
339  "%s_bufferSendOutReturn_OutputPort[%" PRI_FwIndexType "]",
340  this->m_objName.toChar(),
341  port
342  );
343  this->m_bufferSendOutReturn_OutputPort[port].setObjName(portName.toChar());
344 #endif
345  }
346 #endif
347 
348 #if !FW_DIRECT_PORT_CALLS
349  // Connect output port pingOut
350  for (
351  FwIndexType port = 0;
352  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
353  port++
354  ) {
355  this->m_pingOut_OutputPort[port].init();
356 
357 #if FW_OBJECT_NAMES == 1
358  Fw::ObjectName portName;
359  portName.format(
360  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
361  this->m_objName.toChar(),
362  port
363  );
364  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
365 #endif
366  }
367 #endif
368 
369  // Create the queue
370  Os::Queue::Status qStat = this->createQueue(
371  queueDepth,
372  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
373  );
374  FW_ASSERT(
375  Os::Queue::Status::OP_OK == qStat,
376  static_cast<FwAssertArgType>(qStat)
377  );
378  }
379 
380 #if !FW_DIRECT_PORT_CALLS
381 
382  // ----------------------------------------------------------------------
383  // Getters for special input ports
384  // ----------------------------------------------------------------------
385 
388  {
389  FW_ASSERT(
390  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
391  static_cast<FwAssertArgType>(portNum)
392  );
393 
394  return &this->m_cmdIn_InputPort[portNum];
395  }
396 
397 #endif
398 
399 #if !FW_DIRECT_PORT_CALLS
400 
401  // ----------------------------------------------------------------------
402  // Getters for typed input ports
403  // ----------------------------------------------------------------------
404 
407  {
408  FW_ASSERT(
409  (0 <= portNum) && (portNum < this->getNum_bufferSendInFill_InputPorts()),
410  static_cast<FwAssertArgType>(portNum)
411  );
412 
413  return &this->m_bufferSendInFill_InputPort[portNum];
414  }
415 
418  {
419  FW_ASSERT(
420  (0 <= portNum) && (portNum < this->getNum_bufferSendInReturn_InputPorts()),
421  static_cast<FwAssertArgType>(portNum)
422  );
423 
424  return &this->m_bufferSendInReturn_InputPort[portNum];
425  }
426 
429  {
430  FW_ASSERT(
431  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
432  static_cast<FwAssertArgType>(portNum)
433  );
434 
435  return &this->m_pingIn_InputPort[portNum];
436  }
437 
438 #endif
439 
440 #if !FW_DIRECT_PORT_CALLS
441 
442  // ----------------------------------------------------------------------
443  // Connect input ports to special output ports
444  // ----------------------------------------------------------------------
445 
448  FwIndexType portNum,
449  Fw::InputCmdRegPort* port
450  )
451  {
452  FW_ASSERT(
453  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
454  static_cast<FwAssertArgType>(portNum)
455  );
456 
457  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
458  }
459 
462  FwIndexType portNum,
464  )
465  {
466  FW_ASSERT(
467  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
468  static_cast<FwAssertArgType>(portNum)
469  );
470 
471  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
472  }
473 
476  FwIndexType portNum,
477  Fw::InputLogPort* port
478  )
479  {
480  FW_ASSERT(
481  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
482  static_cast<FwAssertArgType>(portNum)
483  );
484 
485  this->m_eventOut_OutputPort[portNum].addCallPort(port);
486  }
487 
488 #if FW_ENABLE_TEXT_LOGGING == 1
489 
490  void BufferAccumulatorComponentBase ::
491  set_eventOutText_OutputPort(
492  FwIndexType portNum,
494  )
495  {
496  FW_ASSERT(
497  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
498  static_cast<FwAssertArgType>(portNum)
499  );
500 
501  this->m_eventOutText_OutputPort[portNum].addCallPort(port);
502  }
503 
504 #endif
505 
508  FwIndexType portNum,
509  Fw::InputTimePort* port
510  )
511  {
512  FW_ASSERT(
513  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
514  static_cast<FwAssertArgType>(portNum)
515  );
516 
517  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
518  }
519 
522  FwIndexType portNum,
523  Fw::InputTlmPort* port
524  )
525  {
526  FW_ASSERT(
527  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
528  static_cast<FwAssertArgType>(portNum)
529  );
530 
531  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
532  }
533 
534 #endif
535 
536 #if !FW_DIRECT_PORT_CALLS
537 
538  // ----------------------------------------------------------------------
539  // Connect typed input ports to typed output ports
540  // ----------------------------------------------------------------------
541 
544  FwIndexType portNum,
546  )
547  {
548  FW_ASSERT(
549  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
550  static_cast<FwAssertArgType>(portNum)
551  );
552 
553  this->m_bufferSendOutDrain_OutputPort[portNum].addCallPort(port);
554  }
555 
558  FwIndexType portNum,
560  )
561  {
562  FW_ASSERT(
563  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
564  static_cast<FwAssertArgType>(portNum)
565  );
566 
567  this->m_bufferSendOutReturn_OutputPort[portNum].addCallPort(port);
568  }
569 
572  FwIndexType portNum,
573  Svc::InputPingPort* port
574  )
575  {
576  FW_ASSERT(
577  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
578  static_cast<FwAssertArgType>(portNum)
579  );
580 
581  this->m_pingOut_OutputPort[portNum].addCallPort(port);
582  }
583 
584 #endif
585 
586 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
587 
588  // ----------------------------------------------------------------------
589  // Connect serial input ports to special output ports
590  // ----------------------------------------------------------------------
591 
594  FwIndexType portNum,
595  Fw::InputSerializePort* port
596  )
597  {
598  FW_ASSERT(
599  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
600  static_cast<FwAssertArgType>(portNum)
601  );
602 
603  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
604  }
605 
608  FwIndexType portNum,
609  Fw::InputSerializePort* port
610  )
611  {
612  FW_ASSERT(
613  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
614  static_cast<FwAssertArgType>(portNum)
615  );
616 
617  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
618  }
619 
622  FwIndexType portNum,
623  Fw::InputSerializePort* port
624  )
625  {
626  FW_ASSERT(
627  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
628  static_cast<FwAssertArgType>(portNum)
629  );
630 
631  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
632  }
633 
634 #if FW_ENABLE_TEXT_LOGGING == 1
635 
636  void BufferAccumulatorComponentBase ::
637  set_eventOutText_OutputPort(
638  FwIndexType portNum,
639  Fw::InputSerializePort* port
640  )
641  {
642  FW_ASSERT(
643  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
644  static_cast<FwAssertArgType>(portNum)
645  );
646 
647  this->m_eventOutText_OutputPort[portNum].registerSerialPort(port);
648  }
649 
650 #endif
651 
654  FwIndexType portNum,
655  Fw::InputSerializePort* port
656  )
657  {
658  FW_ASSERT(
659  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
660  static_cast<FwAssertArgType>(portNum)
661  );
662 
663  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
664  }
665 
668  FwIndexType portNum,
669  Fw::InputSerializePort* port
670  )
671  {
672  FW_ASSERT(
673  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
674  static_cast<FwAssertArgType>(portNum)
675  );
676 
677  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
678  }
679 
680 #endif
681 
682 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
683 
684  // ----------------------------------------------------------------------
685  // Connect serial input ports to typed output ports
686  // ----------------------------------------------------------------------
687 
690  FwIndexType portNum,
691  Fw::InputSerializePort* port
692  )
693  {
694  FW_ASSERT(
695  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
696  static_cast<FwAssertArgType>(portNum)
697  );
698 
699  this->m_bufferSendOutDrain_OutputPort[portNum].registerSerialPort(port);
700  }
701 
704  FwIndexType portNum,
705  Fw::InputSerializePort* port
706  )
707  {
708  FW_ASSERT(
709  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
710  static_cast<FwAssertArgType>(portNum)
711  );
712 
713  this->m_bufferSendOutReturn_OutputPort[portNum].registerSerialPort(port);
714  }
715 
718  FwIndexType portNum,
719  Fw::InputSerializePort* port
720  )
721  {
722  FW_ASSERT(
723  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
724  static_cast<FwAssertArgType>(portNum)
725  );
726 
727  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
728  }
729 
730 #endif
731 
732  // ----------------------------------------------------------------------
733  // Command registration
734  // ----------------------------------------------------------------------
735 
738  {
740 
741  this->cmdRegOut_out(
742  0,
743  this->getIdBase() + OPCODE_BA_SETMODE
744  );
745 
746  this->cmdRegOut_out(
747  0,
749  );
750  }
751 
752  // ----------------------------------------------------------------------
753  // Component construction and destruction
754  // ----------------------------------------------------------------------
755 
757  BufferAccumulatorComponentBase(const char* compName) :
758  Fw::ActiveComponentBase(compName)
759  {
760 
761  }
762 
765  {
766 
767  }
768 
769 #if !FW_DIRECT_PORT_CALLS
770 
771  // ----------------------------------------------------------------------
772  // Connection status queries for special output ports
773  // ----------------------------------------------------------------------
774 
777  {
778  FW_ASSERT(
779  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
780  static_cast<FwAssertArgType>(portNum)
781  );
782 
783  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
784  }
785 
788  {
789  FW_ASSERT(
790  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
791  static_cast<FwAssertArgType>(portNum)
792  );
793 
794  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
795  }
796 
799  {
800  FW_ASSERT(
801  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
802  static_cast<FwAssertArgType>(portNum)
803  );
804 
805  return this->m_eventOut_OutputPort[portNum].isConnected();
806  }
807 
808 #if FW_ENABLE_TEXT_LOGGING == 1
809 
810  bool BufferAccumulatorComponentBase ::
811  isConnected_eventOutText_OutputPort(FwIndexType portNum) const
812  {
813  FW_ASSERT(
814  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
815  static_cast<FwAssertArgType>(portNum)
816  );
817 
818  return this->m_eventOutText_OutputPort[portNum].isConnected();
819  }
820 
821 #endif
822 
825  {
826  FW_ASSERT(
827  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
828  static_cast<FwAssertArgType>(portNum)
829  );
830 
831  return this->m_timeCaller_OutputPort[portNum].isConnected();
832  }
833 
836  {
837  FW_ASSERT(
838  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
839  static_cast<FwAssertArgType>(portNum)
840  );
841 
842  return this->m_tlmOut_OutputPort[portNum].isConnected();
843  }
844 
845 #endif
846 
847 #if !FW_DIRECT_PORT_CALLS
848 
849  // ----------------------------------------------------------------------
850  // Connection status queries for typed output ports
851  // ----------------------------------------------------------------------
852 
855  {
856  FW_ASSERT(
857  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
858  static_cast<FwAssertArgType>(portNum)
859  );
860 
861  return this->m_bufferSendOutDrain_OutputPort[portNum].isConnected();
862  }
863 
866  {
867  FW_ASSERT(
868  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
869  static_cast<FwAssertArgType>(portNum)
870  );
871 
872  return this->m_bufferSendOutReturn_OutputPort[portNum].isConnected();
873  }
874 
877  {
878  FW_ASSERT(
879  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
880  static_cast<FwAssertArgType>(portNum)
881  );
882 
883  return this->m_pingOut_OutputPort[portNum].isConnected();
884  }
885 
886 #endif
887 
888  // ----------------------------------------------------------------------
889  // Port handler base-class functions for special input ports
890  //
891  // Call these functions directly to bypass the corresponding ports
892  // ----------------------------------------------------------------------
893 
896  FwIndexType portNum,
897  FwOpcodeType opCode,
898  U32 cmdSeq,
899  Fw::CmdArgBuffer& args
900  )
901  {
902 
903  const U32 idBase = this->getIdBase();
904  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
905 
906  // Select base class function based on opcode
907  switch (opCode - idBase) {
908  case OPCODE_BA_SETMODE: {
910  opCode,
911  cmdSeq,
912  args
913  );
914  break;
915  }
916 
917  case OPCODE_BA_DRAINBUFFERS: {
919  opCode,
920  cmdSeq,
921  args
922  );
923  break;
924  }
925  default:
926  // Unknown opcode: ignore it
927  break;
928  }
929  }
930 
931  // ----------------------------------------------------------------------
932  // Port handler base-class functions for typed input ports
933  //
934  // Call these functions directly to bypass the corresponding ports
935  // ----------------------------------------------------------------------
936 
939  FwIndexType portNum,
940  Fw::Buffer& fwBuffer
941  )
942  {
943  // Make sure port number is valid
944  FW_ASSERT(
945  (0 <= portNum) && (portNum < this->getNum_bufferSendInFill_InputPorts()),
946  static_cast<FwAssertArgType>(portNum)
947  );
948 
949  // Call pre-message hook
951  portNum,
952  fwBuffer
953  );
954  ComponentIpcSerializableBuffer msg;
956 
957  // Serialize message ID
958  _status = msg.serializeFrom(
959  static_cast<FwEnumStoreType>(BUFFERSENDINFILL_BUFFERSEND)
960  );
961  FW_ASSERT(
962  _status == Fw::FW_SERIALIZE_OK,
963  static_cast<FwAssertArgType>(_status)
964  );
965 
966  // Serialize port number
967  _status = msg.serializeFrom(portNum);
968  FW_ASSERT(
969  _status == Fw::FW_SERIALIZE_OK,
970  static_cast<FwAssertArgType>(_status)
971  );
972 
973  // Serialize argument fwBuffer
974  _status = msg.serializeFrom(fwBuffer);
975  FW_ASSERT(
976  _status == Fw::FW_SERIALIZE_OK,
977  static_cast<FwAssertArgType>(_status)
978  );
979 
980  // Send message
982  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
983 
984  FW_ASSERT(
985  qStatus == Os::Queue::OP_OK,
986  static_cast<FwAssertArgType>(qStatus)
987  );
988  }
989 
992  FwIndexType portNum,
993  Fw::Buffer& fwBuffer
994  )
995  {
996  // Make sure port number is valid
997  FW_ASSERT(
998  (0 <= portNum) && (portNum < this->getNum_bufferSendInReturn_InputPorts()),
999  static_cast<FwAssertArgType>(portNum)
1000  );
1001 
1002  // Call pre-message hook
1004  portNum,
1005  fwBuffer
1006  );
1007  ComponentIpcSerializableBuffer msg;
1009 
1010  // Serialize message ID
1011  _status = msg.serializeFrom(
1012  static_cast<FwEnumStoreType>(BUFFERSENDINRETURN_BUFFERSEND)
1013  );
1014  FW_ASSERT(
1015  _status == Fw::FW_SERIALIZE_OK,
1016  static_cast<FwAssertArgType>(_status)
1017  );
1018 
1019  // Serialize port number
1020  _status = msg.serializeFrom(portNum);
1021  FW_ASSERT(
1022  _status == Fw::FW_SERIALIZE_OK,
1023  static_cast<FwAssertArgType>(_status)
1024  );
1025 
1026  // Serialize argument fwBuffer
1027  _status = msg.serializeFrom(fwBuffer);
1028  FW_ASSERT(
1029  _status == Fw::FW_SERIALIZE_OK,
1030  static_cast<FwAssertArgType>(_status)
1031  );
1032 
1033  // Send message
1035  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1036 
1037  FW_ASSERT(
1038  qStatus == Os::Queue::OP_OK,
1039  static_cast<FwAssertArgType>(qStatus)
1040  );
1041  }
1042 
1045  FwIndexType portNum,
1046  U32 key
1047  )
1048  {
1049  // Make sure port number is valid
1050  FW_ASSERT(
1051  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
1052  static_cast<FwAssertArgType>(portNum)
1053  );
1054 
1055  // Call pre-message hook
1057  portNum,
1058  key
1059  );
1060  ComponentIpcSerializableBuffer msg;
1062 
1063  // Serialize message ID
1064  _status = msg.serializeFrom(
1065  static_cast<FwEnumStoreType>(PINGIN_PING)
1066  );
1067  FW_ASSERT(
1068  _status == Fw::FW_SERIALIZE_OK,
1069  static_cast<FwAssertArgType>(_status)
1070  );
1071 
1072  // Serialize port number
1073  _status = msg.serializeFrom(portNum);
1074  FW_ASSERT(
1075  _status == Fw::FW_SERIALIZE_OK,
1076  static_cast<FwAssertArgType>(_status)
1077  );
1078 
1079  // Serialize argument key
1080  _status = msg.serializeFrom(key);
1081  FW_ASSERT(
1082  _status == Fw::FW_SERIALIZE_OK,
1083  static_cast<FwAssertArgType>(_status)
1084  );
1085 
1086  // Send message
1088  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1089 
1090  if (qStatus == Os::Queue::Status::FULL) {
1091  this->incNumMsgDropped();
1092  return;
1093  }
1094 
1095  FW_ASSERT(
1096  qStatus == Os::Queue::OP_OK,
1097  static_cast<FwAssertArgType>(qStatus)
1098  );
1099  }
1100 
1101  // ----------------------------------------------------------------------
1102  // Pre-message hooks for typed async input ports
1103  //
1104  // Each of these functions is invoked just before processing a message
1105  // on the corresponding port. By default, they do nothing. You can
1106  // override them to provide specific pre-message behavior.
1107  // ----------------------------------------------------------------------
1108 
1111  FwIndexType portNum,
1112  Fw::Buffer& fwBuffer
1113  )
1114  {
1115  // Default: no-op
1116  }
1117 
1120  FwIndexType portNum,
1121  Fw::Buffer& fwBuffer
1122  )
1123  {
1124  // Default: no-op
1125  }
1126 
1129  FwIndexType portNum,
1130  U32 key
1131  )
1132  {
1133  // Default: no-op
1134  }
1135 
1136 #if !FW_DIRECT_PORT_CALLS
1137 
1138  // ----------------------------------------------------------------------
1139  // Invocation functions for typed output ports
1140  // ----------------------------------------------------------------------
1141 
1144  FwIndexType portNum,
1145  Fw::Buffer& fwBuffer
1146  ) const
1147  {
1148  FW_ASSERT(
1149  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
1150  static_cast<FwAssertArgType>(portNum)
1151  );
1152 
1153  FW_ASSERT(
1154  this->m_bufferSendOutDrain_OutputPort[portNum].isConnected(),
1155  static_cast<FwAssertArgType>(portNum)
1156  );
1157  this->m_bufferSendOutDrain_OutputPort[portNum].invoke(
1158  fwBuffer
1159  );
1160  }
1161 
1164  FwIndexType portNum,
1165  Fw::Buffer& fwBuffer
1166  ) const
1167  {
1168  FW_ASSERT(
1169  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
1170  static_cast<FwAssertArgType>(portNum)
1171  );
1172 
1173  FW_ASSERT(
1174  this->m_bufferSendOutReturn_OutputPort[portNum].isConnected(),
1175  static_cast<FwAssertArgType>(portNum)
1176  );
1177  this->m_bufferSendOutReturn_OutputPort[portNum].invoke(
1178  fwBuffer
1179  );
1180  }
1181 
1184  FwIndexType portNum,
1185  U32 key
1186  ) const
1187  {
1188  FW_ASSERT(
1189  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1190  static_cast<FwAssertArgType>(portNum)
1191  );
1192 
1193  FW_ASSERT(
1194  this->m_pingOut_OutputPort[portNum].isConnected(),
1195  static_cast<FwAssertArgType>(portNum)
1196  );
1197  this->m_pingOut_OutputPort[portNum].invoke(
1198  key
1199  );
1200  }
1201 
1202 #endif
1203 
1204  // ----------------------------------------------------------------------
1205  // Command response
1206  // ----------------------------------------------------------------------
1207 
1210  FwOpcodeType opCode,
1211  U32 cmdSeq,
1212  Fw::CmdResponse response
1213  )
1214  {
1216  this->cmdResponseOut_out(0, opCode, cmdSeq, response);
1217  }
1218 
1219  // ----------------------------------------------------------------------
1220  // Command handler base-class functions
1221  //
1222  // Call these functions directly to bypass the command input port
1223  // ----------------------------------------------------------------------
1224 
1227  FwOpcodeType opCode,
1228  U32 cmdSeq,
1229  Fw::CmdArgBuffer& args
1230  )
1231  {
1232  // Call pre-message hook
1233  this->BA_SetMode_preMsgHook(opCode,cmdSeq);
1234 
1235  // Defer deserializing arguments to the message dispatcher
1236  // to avoid deserializing and reserializing just for IPC
1237  ComponentIpcSerializableBuffer msg;
1239 
1240  // Serialize for IPC
1241  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_BA_SETMODE));
1242  FW_ASSERT (
1243  _status == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_status)
1245  );
1246 
1247  // Fake port number to make message dequeue work
1248  FwIndexType port = 0;
1249 
1250  _status = msg.serializeFrom(port);
1251  FW_ASSERT (
1252  _status == Fw::FW_SERIALIZE_OK,
1253  static_cast<FwAssertArgType>(_status)
1254  );
1255 
1256  _status = msg.serializeFrom(opCode);
1257  FW_ASSERT (
1258  _status == Fw::FW_SERIALIZE_OK,
1259  static_cast<FwAssertArgType>(_status)
1260  );
1261 
1262  _status = msg.serializeFrom(cmdSeq);
1263  FW_ASSERT (
1264  _status == Fw::FW_SERIALIZE_OK,
1265  static_cast<FwAssertArgType>(_status)
1266  );
1267 
1268  _status = msg.serializeFrom(args);
1269  FW_ASSERT (
1270  _status == Fw::FW_SERIALIZE_OK,
1271  static_cast<FwAssertArgType>(_status)
1272  );
1273 
1274  // Send message
1276  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1277 
1278  FW_ASSERT(
1279  qStatus == Os::Queue::OP_OK,
1280  static_cast<FwAssertArgType>(qStatus)
1281  );
1282  }
1283 
1286  FwOpcodeType opCode,
1287  U32 cmdSeq,
1288  Fw::CmdArgBuffer& args
1289  )
1290  {
1291  // Call pre-message hook
1292  this->BA_DrainBuffers_preMsgHook(opCode,cmdSeq);
1293 
1294  // Defer deserializing arguments to the message dispatcher
1295  // to avoid deserializing and reserializing just for IPC
1296  ComponentIpcSerializableBuffer msg;
1298 
1299  // Serialize for IPC
1300  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_BA_DRAINBUFFERS));
1301  FW_ASSERT (
1302  _status == Fw::FW_SERIALIZE_OK,
1303  static_cast<FwAssertArgType>(_status)
1304  );
1305 
1306  // Fake port number to make message dequeue work
1307  FwIndexType port = 0;
1308 
1309  _status = msg.serializeFrom(port);
1310  FW_ASSERT (
1311  _status == Fw::FW_SERIALIZE_OK,
1312  static_cast<FwAssertArgType>(_status)
1313  );
1314 
1315  _status = msg.serializeFrom(opCode);
1316  FW_ASSERT (
1317  _status == Fw::FW_SERIALIZE_OK,
1318  static_cast<FwAssertArgType>(_status)
1319  );
1320 
1321  _status = msg.serializeFrom(cmdSeq);
1322  FW_ASSERT (
1323  _status == Fw::FW_SERIALIZE_OK,
1324  static_cast<FwAssertArgType>(_status)
1325  );
1326 
1327  _status = msg.serializeFrom(args);
1328  FW_ASSERT (
1329  _status == Fw::FW_SERIALIZE_OK,
1330  static_cast<FwAssertArgType>(_status)
1331  );
1332 
1333  // Send message
1335  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1336 
1337  FW_ASSERT(
1338  qStatus == Os::Queue::OP_OK,
1339  static_cast<FwAssertArgType>(qStatus)
1340  );
1341  }
1342 
1343  // ----------------------------------------------------------------------
1344  // Pre-message hooks for async commands
1345  //
1346  // Each of these functions is invoked just before processing the
1347  // corresponding command. By default they do nothing. You can
1348  // override them to provide specific pre-command behavior.
1349  // ----------------------------------------------------------------------
1350 
1353  FwOpcodeType opCode,
1354  U32 cmdSeq
1355  )
1356  {
1357  // Defaults to no-op; can be overridden
1358  (void) opCode;
1359  (void) cmdSeq;
1360  }
1361 
1364  FwOpcodeType opCode,
1365  U32 cmdSeq
1366  )
1367  {
1368  // Defaults to no-op; can be overridden
1369  (void) opCode;
1370  (void) cmdSeq;
1371  }
1372 
1373  // ----------------------------------------------------------------------
1374  // Event logging functions
1375  // ----------------------------------------------------------------------
1376 
1379  {
1380  // Get the time
1381  Fw::Time _logTime;
1382  if (this->isConnected_timeCaller_OutputPort(0)) {
1383  this->timeCaller_out(0, _logTime);
1384  }
1385 
1386  const FwEventIdType _id = this->getIdBase() + EVENTID_BA_BUFFERACCEPTED;
1387 
1388  // Emit the event on the log port
1389  if (this->isConnected_eventOut_OutputPort(0)) {
1390  Fw::LogBuffer _logBuff;
1391 
1392 #if FW_AMPCS_COMPATIBLE
1394  // Serialize the number of arguments
1395  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1396  FW_ASSERT(
1397  _status == Fw::FW_SERIALIZE_OK,
1398  static_cast<FwAssertArgType>(_status)
1399  );
1400 #endif
1401 
1402  this->eventOut_out(
1403  0,
1404  _id,
1405  _logTime,
1407  _logBuff
1408  );
1409  }
1410 
1411  // Emit the event on the text log port
1412 #if FW_ENABLE_TEXT_LOGGING
1413  if (this->isConnected_eventOutText_OutputPort(0)) {
1414 #if FW_OBJECT_NAMES == 1
1415  const char* _formatString =
1416  "(%s) %s: Buffer accepted";
1417 #else
1418  const char* _formatString =
1419  "%s: Buffer accepted";
1420 #endif
1421 
1422  Fw::TextLogString _logString;
1423  (void) _logString.format(
1424  _formatString,
1425 #if FW_OBJECT_NAMES == 1
1426  this->m_objName.toChar(),
1427 #endif
1428  "BA_BufferAccepted "
1429  );
1430 
1431  this->eventOutText_out(
1432  0,
1433  _id,
1434  _logTime,
1436  _logString
1437  );
1438  }
1439 #endif
1440  }
1441 
1444  {
1445  // Get the time
1446  Fw::Time _logTime;
1447  if (this->isConnected_timeCaller_OutputPort(0)) {
1448  this->timeCaller_out(0, _logTime);
1449  }
1450 
1451  const FwEventIdType _id = this->getIdBase() + EVENTID_BA_QUEUEFULL;
1452 
1453  // Emit the event on the log port
1454  if (this->isConnected_eventOut_OutputPort(0)) {
1455  Fw::LogBuffer _logBuff;
1456 
1457 #if FW_AMPCS_COMPATIBLE
1459  // Serialize the number of arguments
1460  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1461  FW_ASSERT(
1462  _status == Fw::FW_SERIALIZE_OK,
1463  static_cast<FwAssertArgType>(_status)
1464  );
1465 #endif
1466 
1467  this->eventOut_out(
1468  0,
1469  _id,
1470  _logTime,
1472  _logBuff
1473  );
1474  }
1475 
1476  // Emit the event on the text log port
1477 #if FW_ENABLE_TEXT_LOGGING
1478  if (this->isConnected_eventOutText_OutputPort(0)) {
1479 #if FW_OBJECT_NAMES == 1
1480  const char* _formatString =
1481  "(%s) %s: Queue full";
1482 #else
1483  const char* _formatString =
1484  "%s: Queue full";
1485 #endif
1486 
1487  Fw::TextLogString _logString;
1488  (void) _logString.format(
1489  _formatString,
1490 #if FW_OBJECT_NAMES == 1
1491  this->m_objName.toChar(),
1492 #endif
1493  "BA_QueueFull "
1494  );
1495 
1496  this->eventOutText_out(
1497  0,
1498  _id,
1499  _logTime,
1501  _logString
1502  );
1503  }
1504 #endif
1505  }
1506 
1509  U32 numDrained,
1510  U32 numToDrain
1511  ) const
1512  {
1513  // Get the time
1514  Fw::Time _logTime;
1515  if (this->isConnected_timeCaller_OutputPort(0)) {
1516  this->timeCaller_out(0, _logTime);
1517  }
1518 
1519  const FwEventIdType _id = this->getIdBase() + EVENTID_BA_STILLDRAINING;
1520 
1521  // Emit the event on the log port
1522  if (this->isConnected_eventOut_OutputPort(0)) {
1523  Fw::LogBuffer _logBuff;
1525 
1526 #if FW_AMPCS_COMPATIBLE
1527  // Serialize the number of arguments
1528  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1529  FW_ASSERT(
1530  _status == Fw::FW_SERIALIZE_OK,
1531  static_cast<FwAssertArgType>(_status)
1532  );
1533 #endif
1534 
1535 #if FW_AMPCS_COMPATIBLE
1536  // Serialize the argument size
1537  _status = _logBuff.serializeFrom(
1538  static_cast<U8>(sizeof(U32))
1539  );
1540  FW_ASSERT(
1541  _status == Fw::FW_SERIALIZE_OK,
1542  static_cast<FwAssertArgType>(_status)
1543  );
1544 #endif
1545  _status = _logBuff.serializeFrom(numDrained);
1546  FW_ASSERT(
1547  _status == Fw::FW_SERIALIZE_OK,
1548  static_cast<FwAssertArgType>(_status)
1549  );
1550 
1551 #if FW_AMPCS_COMPATIBLE
1552  // Serialize the argument size
1553  _status = _logBuff.serializeFrom(
1554  static_cast<U8>(sizeof(U32))
1555  );
1556  FW_ASSERT(
1557  _status == Fw::FW_SERIALIZE_OK,
1558  static_cast<FwAssertArgType>(_status)
1559  );
1560 #endif
1561  _status = _logBuff.serializeFrom(numToDrain);
1562  FW_ASSERT(
1563  _status == Fw::FW_SERIALIZE_OK,
1564  static_cast<FwAssertArgType>(_status)
1565  );
1566 
1567  this->eventOut_out(
1568  0,
1569  _id,
1570  _logTime,
1572  _logBuff
1573  );
1574  }
1575 
1576  // Emit the event on the text log port
1577 #if FW_ENABLE_TEXT_LOGGING
1578  if (this->isConnected_eventOutText_OutputPort(0)) {
1579 #if FW_OBJECT_NAMES == 1
1580  const char* _formatString =
1581  "(%s) %s: Still draining %" PRIu32 " of %" PRIu32 "";
1582 #else
1583  const char* _formatString =
1584  "%s: Still draining %" PRIu32 " of %" PRIu32 "";
1585 #endif
1586 
1587  Fw::TextLogString _logString;
1588  (void) _logString.format(
1589  _formatString,
1590 #if FW_OBJECT_NAMES == 1
1591  this->m_objName.toChar(),
1592 #endif
1593  "BA_StillDraining ",
1594  numDrained,
1595  numToDrain
1596  );
1597 
1598  this->eventOutText_out(
1599  0,
1600  _id,
1601  _logTime,
1603  _logString
1604  );
1605  }
1606 #endif
1607  }
1608 
1611  {
1612  // Get the time
1613  Fw::Time _logTime;
1614  if (this->isConnected_timeCaller_OutputPort(0)) {
1615  this->timeCaller_out(0, _logTime);
1616  }
1617 
1618  const FwEventIdType _id = this->getIdBase() + EVENTID_BA_ALREADYDRAINING;
1619 
1620  // Emit the event on the log port
1621  if (this->isConnected_eventOut_OutputPort(0)) {
1622  Fw::LogBuffer _logBuff;
1623 
1624 #if FW_AMPCS_COMPATIBLE
1626  // Serialize the number of arguments
1627  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1628  FW_ASSERT(
1629  _status == Fw::FW_SERIALIZE_OK,
1630  static_cast<FwAssertArgType>(_status)
1631  );
1632 #endif
1633 
1634  this->eventOut_out(
1635  0,
1636  _id,
1637  _logTime,
1639  _logBuff
1640  );
1641  }
1642 
1643  // Emit the event on the text log port
1644 #if FW_ENABLE_TEXT_LOGGING
1645  if (this->isConnected_eventOutText_OutputPort(0)) {
1646 #if FW_OBJECT_NAMES == 1
1647  const char* _formatString =
1648  "(%s) %s: Already in DRAIN mode";
1649 #else
1650  const char* _formatString =
1651  "%s: Already in DRAIN mode";
1652 #endif
1653 
1654  Fw::TextLogString _logString;
1655  (void) _logString.format(
1656  _formatString,
1657 #if FW_OBJECT_NAMES == 1
1658  this->m_objName.toChar(),
1659 #endif
1660  "BA_AlreadyDraining "
1661  );
1662 
1663  this->eventOutText_out(
1664  0,
1665  _id,
1666  _logTime,
1668  _logString
1669  );
1670  }
1671 #endif
1672  }
1673 
1676  U32 numDrained,
1677  U32 numToDrain
1678  ) const
1679  {
1680  // Get the time
1681  Fw::Time _logTime;
1682  if (this->isConnected_timeCaller_OutputPort(0)) {
1683  this->timeCaller_out(0, _logTime);
1684  }
1685 
1686  const FwEventIdType _id = this->getIdBase() + EVENTID_BA_DRAINSTALLED;
1687 
1688  // Emit the event on the log port
1689  if (this->isConnected_eventOut_OutputPort(0)) {
1690  Fw::LogBuffer _logBuff;
1692 
1693 #if FW_AMPCS_COMPATIBLE
1694  // Serialize the number of arguments
1695  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1696  FW_ASSERT(
1697  _status == Fw::FW_SERIALIZE_OK,
1698  static_cast<FwAssertArgType>(_status)
1699  );
1700 #endif
1701 
1702 #if FW_AMPCS_COMPATIBLE
1703  // Serialize the argument size
1704  _status = _logBuff.serializeFrom(
1705  static_cast<U8>(sizeof(U32))
1706  );
1707  FW_ASSERT(
1708  _status == Fw::FW_SERIALIZE_OK,
1709  static_cast<FwAssertArgType>(_status)
1710  );
1711 #endif
1712  _status = _logBuff.serializeFrom(numDrained);
1713  FW_ASSERT(
1714  _status == Fw::FW_SERIALIZE_OK,
1715  static_cast<FwAssertArgType>(_status)
1716  );
1717 
1718 #if FW_AMPCS_COMPATIBLE
1719  // Serialize the argument size
1720  _status = _logBuff.serializeFrom(
1721  static_cast<U8>(sizeof(U32))
1722  );
1723  FW_ASSERT(
1724  _status == Fw::FW_SERIALIZE_OK,
1725  static_cast<FwAssertArgType>(_status)
1726  );
1727 #endif
1728  _status = _logBuff.serializeFrom(numToDrain);
1729  FW_ASSERT(
1730  _status == Fw::FW_SERIALIZE_OK,
1731  static_cast<FwAssertArgType>(_status)
1732  );
1733 
1734  this->eventOut_out(
1735  0,
1736  _id,
1737  _logTime,
1739  _logBuff
1740  );
1741  }
1742 
1743  // Emit the event on the text log port
1744 #if FW_ENABLE_TEXT_LOGGING
1745  if (this->isConnected_eventOutText_OutputPort(0)) {
1746 #if FW_OBJECT_NAMES == 1
1747  const char* _formatString =
1748  "(%s) %s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1749 #else
1750  const char* _formatString =
1751  "%s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1752 #endif
1753 
1754  Fw::TextLogString _logString;
1755  (void) _logString.format(
1756  _formatString,
1757 #if FW_OBJECT_NAMES == 1
1758  this->m_objName.toChar(),
1759 #endif
1760  "BA_DrainStalled ",
1761  numDrained,
1762  numToDrain
1763  );
1764 
1765  this->eventOutText_out(
1766  0,
1767  _id,
1768  _logTime,
1770  _logString
1771  );
1772  }
1773 #endif
1774  }
1775 
1778  {
1779  // Get the time
1780  Fw::Time _logTime;
1781  if (this->isConnected_timeCaller_OutputPort(0)) {
1782  this->timeCaller_out(0, _logTime);
1783  }
1784 
1785  const FwEventIdType _id = this->getIdBase() + EVENTID_BA_PARTIALDRAINDONE;
1786 
1787  // Emit the event on the log port
1788  if (this->isConnected_eventOut_OutputPort(0)) {
1789  Fw::LogBuffer _logBuff;
1791 
1792 #if FW_AMPCS_COMPATIBLE
1793  // Serialize the number of arguments
1794  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1795  FW_ASSERT(
1796  _status == Fw::FW_SERIALIZE_OK,
1797  static_cast<FwAssertArgType>(_status)
1798  );
1799 #endif
1800 
1801 #if FW_AMPCS_COMPATIBLE
1802  // Serialize the argument size
1803  _status = _logBuff.serializeFrom(
1804  static_cast<U8>(sizeof(U32))
1805  );
1806  FW_ASSERT(
1807  _status == Fw::FW_SERIALIZE_OK,
1808  static_cast<FwAssertArgType>(_status)
1809  );
1810 #endif
1811  _status = _logBuff.serializeFrom(numDrained);
1812  FW_ASSERT(
1813  _status == Fw::FW_SERIALIZE_OK,
1814  static_cast<FwAssertArgType>(_status)
1815  );
1816 
1817  this->eventOut_out(
1818  0,
1819  _id,
1820  _logTime,
1822  _logBuff
1823  );
1824  }
1825 
1826  // Emit the event on the text log port
1827 #if FW_ENABLE_TEXT_LOGGING
1828  if (this->isConnected_eventOutText_OutputPort(0)) {
1829 #if FW_OBJECT_NAMES == 1
1830  const char* _formatString =
1831  "(%s) %s: Partial drain of %" PRIu32 " finished";
1832 #else
1833  const char* _formatString =
1834  "%s: Partial drain of %" PRIu32 " finished";
1835 #endif
1836 
1837  Fw::TextLogString _logString;
1838  (void) _logString.format(
1839  _formatString,
1840 #if FW_OBJECT_NAMES == 1
1841  this->m_objName.toChar(),
1842 #endif
1843  "BA_PartialDrainDone ",
1844  numDrained
1845  );
1846 
1847  this->eventOutText_out(
1848  0,
1849  _id,
1850  _logTime,
1852  _logString
1853  );
1854  }
1855 #endif
1856  }
1857 
1860  U32 numWillDrain,
1861  U32 numReqDrain
1862  ) const
1863  {
1864  // Get the time
1865  Fw::Time _logTime;
1866  if (this->isConnected_timeCaller_OutputPort(0)) {
1867  this->timeCaller_out(0, _logTime);
1868  }
1869 
1870  const FwEventIdType _id = this->getIdBase() + EVENTID_BA_NONBLOCKDRAIN;
1871 
1872  // Emit the event on the log port
1873  if (this->isConnected_eventOut_OutputPort(0)) {
1874  Fw::LogBuffer _logBuff;
1876 
1877 #if FW_AMPCS_COMPATIBLE
1878  // Serialize the number of arguments
1879  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1880  FW_ASSERT(
1881  _status == Fw::FW_SERIALIZE_OK,
1882  static_cast<FwAssertArgType>(_status)
1883  );
1884 #endif
1885 
1886 #if FW_AMPCS_COMPATIBLE
1887  // Serialize the argument size
1888  _status = _logBuff.serializeFrom(
1889  static_cast<U8>(sizeof(U32))
1890  );
1891  FW_ASSERT(
1892  _status == Fw::FW_SERIALIZE_OK,
1893  static_cast<FwAssertArgType>(_status)
1894  );
1895 #endif
1896  _status = _logBuff.serializeFrom(numWillDrain);
1897  FW_ASSERT(
1898  _status == Fw::FW_SERIALIZE_OK,
1899  static_cast<FwAssertArgType>(_status)
1900  );
1901 
1902 #if FW_AMPCS_COMPATIBLE
1903  // Serialize the argument size
1904  _status = _logBuff.serializeFrom(
1905  static_cast<U8>(sizeof(U32))
1906  );
1907  FW_ASSERT(
1908  _status == Fw::FW_SERIALIZE_OK,
1909  static_cast<FwAssertArgType>(_status)
1910  );
1911 #endif
1912  _status = _logBuff.serializeFrom(numReqDrain);
1913  FW_ASSERT(
1914  _status == Fw::FW_SERIALIZE_OK,
1915  static_cast<FwAssertArgType>(_status)
1916  );
1917 
1918  this->eventOut_out(
1919  0,
1920  _id,
1921  _logTime,
1923  _logBuff
1924  );
1925  }
1926 
1927  // Emit the event on the text log port
1928 #if FW_ENABLE_TEXT_LOGGING
1929  if (this->isConnected_eventOutText_OutputPort(0)) {
1930 #if FW_OBJECT_NAMES == 1
1931  const char* _formatString =
1932  "(%s) %s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1933 #else
1934  const char* _formatString =
1935  "%s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1936 #endif
1937 
1938  Fw::TextLogString _logString;
1939  (void) _logString.format(
1940  _formatString,
1941 #if FW_OBJECT_NAMES == 1
1942  this->m_objName.toChar(),
1943 #endif
1944  "BA_NonBlockDrain ",
1945  numWillDrain,
1946  numReqDrain
1947  );
1948 
1949  this->eventOutText_out(
1950  0,
1951  _id,
1952  _logTime,
1954  _logString
1955  );
1956  }
1957 #endif
1958  }
1959 
1960  // ----------------------------------------------------------------------
1961  // Telemetry serialized write
1962  // ----------------------------------------------------------------------
1963 
1966  FwChanIdType id,
1967  Fw::TlmBuffer& _tlmBuff,
1968  Fw::Time _tlmTime
1969  ) const
1970  {
1971  if (this->isConnected_tlmOut_OutputPort(0)) {
1972  if (
1974  (_tlmTime == Fw::ZERO_TIME)
1975  ) {
1976  this->timeCaller_out(0, _tlmTime);
1977  }
1978 
1979  FwChanIdType _id;
1980  _id = this->getIdBase() + id;
1981 
1982  this->tlmOut_out(
1983  0,
1984  _id,
1985  _tlmTime,
1986  _tlmBuff
1987  );
1988  }
1989  }
1990 
1991  // ----------------------------------------------------------------------
1992  // Telemetry write functions
1993  // ----------------------------------------------------------------------
1994 
1997  U32 arg,
1998  Fw::Time _tlmTime
1999  ) const
2000  {
2001  if (this->isConnected_tlmOut_OutputPort(0)) {
2002  Fw::TlmBuffer _tlmBuff;
2003  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2004  FW_ASSERT(
2005  _stat == Fw::FW_SERIALIZE_OK,
2006  static_cast<FwAssertArgType>(_stat)
2007  );
2008 
2009  this->tlmWrite(
2011  _tlmBuff,
2012  _tlmTime
2013  );
2014  }
2015  }
2016 
2017  // ----------------------------------------------------------------------
2018  // Time
2019  // ----------------------------------------------------------------------
2020 
2022  getTime() const
2023  {
2024  if (this->isConnected_timeCaller_OutputPort(0)) {
2025  Fw::Time _time;
2026  this->timeCaller_out(0, _time);
2027  return _time;
2028  }
2029  else {
2030  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2031  }
2032  }
2033 
2034  // ----------------------------------------------------------------------
2035  // Message dispatch functions
2036  // ----------------------------------------------------------------------
2037 
2038  Fw::QueuedComponentBase::MsgDispatchStatus BufferAccumulatorComponentBase ::
2039  doDispatch()
2040  {
2041  ComponentIpcSerializableBuffer _msg;
2042  FwQueuePriorityType _priority = 0;
2043 
2044  Os::Queue::Status _msgStatus = this->m_queue.receive(
2045  _msg,
2047  _priority
2048  );
2049  FW_ASSERT(
2050  _msgStatus == Os::Queue::OP_OK,
2051  static_cast<FwAssertArgType>(_msgStatus)
2052  );
2053 
2054  // Reset to beginning of buffer
2055  _msg.resetDeser();
2056 
2057  FwEnumStoreType _desMsg = 0;
2058  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2059  FW_ASSERT(
2060  _deserStatus == Fw::FW_SERIALIZE_OK,
2061  static_cast<FwAssertArgType>(_deserStatus)
2062  );
2063 
2064  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2065 
2066  if (_msgType == BUFFERACCUMULATOR_COMPONENT_EXIT) {
2067  return MSG_DISPATCH_EXIT;
2068  }
2069 
2070  FwIndexType portNum = 0;
2071  _deserStatus = _msg.deserializeTo(portNum);
2072  FW_ASSERT(
2073  _deserStatus == Fw::FW_SERIALIZE_OK,
2074  static_cast<FwAssertArgType>(_deserStatus)
2075  );
2076 
2077  switch (_msgType) {
2078  // Handle async input port bufferSendInFill
2079  case BUFFERSENDINFILL_BUFFERSEND: {
2080  // Deserialize argument fwBuffer
2081  Fw::Buffer fwBuffer;
2082  _deserStatus = _msg.deserializeTo(fwBuffer);
2083  FW_ASSERT(
2084  _deserStatus == Fw::FW_SERIALIZE_OK,
2085  static_cast<FwAssertArgType>(_deserStatus)
2086  );
2087  // Call handler function
2089  portNum,
2090  fwBuffer
2091  );
2092 
2093  break;
2094  }
2095 
2096  // Handle async input port bufferSendInReturn
2097  case BUFFERSENDINRETURN_BUFFERSEND: {
2098  // Deserialize argument fwBuffer
2099  Fw::Buffer fwBuffer;
2100  _deserStatus = _msg.deserializeTo(fwBuffer);
2101  FW_ASSERT(
2102  _deserStatus == Fw::FW_SERIALIZE_OK,
2103  static_cast<FwAssertArgType>(_deserStatus)
2104  );
2105  // Call handler function
2107  portNum,
2108  fwBuffer
2109  );
2110 
2111  break;
2112  }
2113 
2114  // Handle async input port pingIn
2115  case PINGIN_PING: {
2116  // Deserialize argument key
2117  U32 key;
2118  _deserStatus = _msg.deserializeTo(key);
2119  FW_ASSERT(
2120  _deserStatus == Fw::FW_SERIALIZE_OK,
2121  static_cast<FwAssertArgType>(_deserStatus)
2122  );
2123  // Call handler function
2124  this->pingIn_handler(
2125  portNum,
2126  key
2127  );
2128 
2129  break;
2130  }
2131 
2132  // Handle command BA_SetMode
2133  case CMD_BA_SETMODE: {
2134  // Deserialize opcode
2135  FwOpcodeType _opCode = 0;
2136  _deserStatus = _msg.deserializeTo(_opCode);
2137  FW_ASSERT (
2138  _deserStatus == Fw::FW_SERIALIZE_OK,
2139  static_cast<FwAssertArgType>(_deserStatus)
2140  );
2141 
2142  // Deserialize command sequence
2143  U32 _cmdSeq = 0;
2144  _deserStatus = _msg.deserializeTo(_cmdSeq);
2145  FW_ASSERT (
2146  _deserStatus == Fw::FW_SERIALIZE_OK,
2147  static_cast<FwAssertArgType>(_deserStatus)
2148  );
2149 
2150  // Deserialize command argument buffer
2151  Fw::CmdArgBuffer args;
2152  _deserStatus = _msg.deserializeTo(args);
2153  FW_ASSERT (
2154  _deserStatus == Fw::FW_SERIALIZE_OK,
2155  static_cast<FwAssertArgType>(_deserStatus)
2156  );
2157 
2158  // Reset buffer
2159  args.resetDeser();
2160 
2161  // Deserialize argument mode
2163  _deserStatus = args.deserializeTo(mode);
2164  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2166  this->cmdResponse_out(
2167  _opCode,
2168  _cmdSeq,
2170  );
2171  }
2172  // Don't crash the task if bad arguments were passed from the ground
2173  break;
2174  }
2175 
2176  // Make sure there was no data left over.
2177  // That means the argument buffer size was incorrect.
2178 #if FW_CMD_CHECK_RESIDUAL
2179  if (args.getDeserializeSizeLeft() != 0) {
2181  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2182  }
2183  // Don't crash the task if bad arguments were passed from the ground
2184  break;
2185  }
2186 #endif
2187 
2188  // Call handler function
2189  this->BA_SetMode_cmdHandler(
2190  _opCode, _cmdSeq,
2191  mode
2192  );
2193 
2194  break;
2195  }
2196 
2197  // Handle command BA_DrainBuffers
2198  case CMD_BA_DRAINBUFFERS: {
2199  // Deserialize opcode
2200  FwOpcodeType _opCode = 0;
2201  _deserStatus = _msg.deserializeTo(_opCode);
2202  FW_ASSERT (
2203  _deserStatus == Fw::FW_SERIALIZE_OK,
2204  static_cast<FwAssertArgType>(_deserStatus)
2205  );
2206 
2207  // Deserialize command sequence
2208  U32 _cmdSeq = 0;
2209  _deserStatus = _msg.deserializeTo(_cmdSeq);
2210  FW_ASSERT (
2211  _deserStatus == Fw::FW_SERIALIZE_OK,
2212  static_cast<FwAssertArgType>(_deserStatus)
2213  );
2214 
2215  // Deserialize command argument buffer
2216  Fw::CmdArgBuffer args;
2217  _deserStatus = _msg.deserializeTo(args);
2218  FW_ASSERT (
2219  _deserStatus == Fw::FW_SERIALIZE_OK,
2220  static_cast<FwAssertArgType>(_deserStatus)
2221  );
2222 
2223  // Reset buffer
2224  args.resetDeser();
2225 
2226  // Deserialize argument numToDrain
2227  U32 numToDrain;
2228  _deserStatus = args.deserializeTo(numToDrain);
2229  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2231  this->cmdResponse_out(
2232  _opCode,
2233  _cmdSeq,
2235  );
2236  }
2237  // Don't crash the task if bad arguments were passed from the ground
2238  break;
2239  }
2240 
2241  // Deserialize argument blockMode
2243  _deserStatus = args.deserializeTo(blockMode);
2244  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2246  this->cmdResponse_out(
2247  _opCode,
2248  _cmdSeq,
2250  );
2251  }
2252  // Don't crash the task if bad arguments were passed from the ground
2253  break;
2254  }
2255 
2256  // Make sure there was no data left over.
2257  // That means the argument buffer size was incorrect.
2258 #if FW_CMD_CHECK_RESIDUAL
2259  if (args.getDeserializeSizeLeft() != 0) {
2261  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2262  }
2263  // Don't crash the task if bad arguments were passed from the ground
2264  break;
2265  }
2266 #endif
2267 
2268  // Call handler function
2270  _opCode, _cmdSeq,
2271  numToDrain,
2272  blockMode
2273  );
2274 
2275  break;
2276  }
2277 
2278  default:
2279  return MSG_DISPATCH_ERROR;
2280  }
2281 
2282  return MSG_DISPATCH_OK;
2283  }
2284 
2285  // ----------------------------------------------------------------------
2286  // Calls for messages received on special input ports
2287  // ----------------------------------------------------------------------
2288 
2289  void BufferAccumulatorComponentBase ::
2290  m_p_cmdIn_in(
2291  Fw::PassiveComponentBase* callComp,
2292  FwIndexType portNum,
2293  FwOpcodeType opCode,
2294  U32 cmdSeq,
2295  Fw::CmdArgBuffer& args
2296  )
2297  {
2298  FW_ASSERT(callComp != nullptr);
2299  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2300  compPtr->cmdIn_handlerBase(
2301  portNum,
2302  opCode,
2303  cmdSeq,
2304  args
2305  );
2306  }
2307 
2308  // ----------------------------------------------------------------------
2309  // Calls for messages received on typed input ports
2310  // ----------------------------------------------------------------------
2311 
2312  void BufferAccumulatorComponentBase ::
2313  m_p_bufferSendInFill_in(
2314  Fw::PassiveComponentBase* callComp,
2315  FwIndexType portNum,
2316  Fw::Buffer& fwBuffer
2317  )
2318  {
2319  FW_ASSERT(callComp != nullptr);
2320  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2321  compPtr->bufferSendInFill_handlerBase(
2322  portNum,
2323  fwBuffer
2324  );
2325  }
2326 
2327  void BufferAccumulatorComponentBase ::
2328  m_p_bufferSendInReturn_in(
2329  Fw::PassiveComponentBase* callComp,
2330  FwIndexType portNum,
2331  Fw::Buffer& fwBuffer
2332  )
2333  {
2334  FW_ASSERT(callComp != nullptr);
2335  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2336  compPtr->bufferSendInReturn_handlerBase(
2337  portNum,
2338  fwBuffer
2339  );
2340  }
2341 
2342  void BufferAccumulatorComponentBase ::
2343  m_p_pingIn_in(
2344  Fw::PassiveComponentBase* callComp,
2345  FwIndexType portNum,
2346  U32 key
2347  )
2348  {
2349  FW_ASSERT(callComp != nullptr);
2350  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2351  compPtr->pingIn_handlerBase(
2352  portNum,
2353  key
2354  );
2355  }
2356 
2357 #if !FW_DIRECT_PORT_CALLS
2358 
2359  // ----------------------------------------------------------------------
2360  // Invocation functions for special output ports
2361  // ----------------------------------------------------------------------
2362 
2363  void BufferAccumulatorComponentBase ::
2364  cmdRegOut_out(
2365  FwIndexType portNum,
2366  FwOpcodeType opCode
2367  ) const
2368  {
2369  FW_ASSERT(
2370  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
2371  static_cast<FwAssertArgType>(portNum)
2372  );
2373 
2374  FW_ASSERT(
2375  this->m_cmdRegOut_OutputPort[portNum].isConnected(),
2376  static_cast<FwAssertArgType>(portNum)
2377  );
2378  this->m_cmdRegOut_OutputPort[portNum].invoke(
2379  opCode
2380  );
2381  }
2382 
2383  void BufferAccumulatorComponentBase ::
2384  cmdResponseOut_out(
2385  FwIndexType portNum,
2386  FwOpcodeType opCode,
2387  U32 cmdSeq,
2388  const Fw::CmdResponse& response
2389  ) const
2390  {
2391  FW_ASSERT(
2392  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
2393  static_cast<FwAssertArgType>(portNum)
2394  );
2395 
2396  FW_ASSERT(
2397  this->m_cmdResponseOut_OutputPort[portNum].isConnected(),
2398  static_cast<FwAssertArgType>(portNum)
2399  );
2400  this->m_cmdResponseOut_OutputPort[portNum].invoke(
2401  opCode,
2402  cmdSeq,
2403  response
2404  );
2405  }
2406 
2407  void BufferAccumulatorComponentBase ::
2408  eventOut_out(
2409  FwIndexType portNum,
2410  FwEventIdType id,
2411  Fw::Time& timeTag,
2412  const Fw::LogSeverity& severity,
2413  Fw::LogBuffer& args
2414  ) const
2415  {
2416  FW_ASSERT(
2417  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
2418  static_cast<FwAssertArgType>(portNum)
2419  );
2420 
2421  FW_ASSERT(
2422  this->m_eventOut_OutputPort[portNum].isConnected(),
2423  static_cast<FwAssertArgType>(portNum)
2424  );
2425  this->m_eventOut_OutputPort[portNum].invoke(
2426  id,
2427  timeTag,
2428  severity,
2429  args
2430  );
2431  }
2432 
2433 #if FW_ENABLE_TEXT_LOGGING
2434 
2435  void BufferAccumulatorComponentBase ::
2436  eventOutText_out(
2437  FwIndexType portNum,
2438  FwEventIdType id,
2439  Fw::Time& timeTag,
2440  const Fw::LogSeverity& severity,
2441  Fw::TextLogString& text
2442  ) const
2443  {
2444  FW_ASSERT(
2445  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
2446  static_cast<FwAssertArgType>(portNum)
2447  );
2448 
2449  FW_ASSERT(
2450  this->m_eventOutText_OutputPort[portNum].isConnected(),
2451  static_cast<FwAssertArgType>(portNum)
2452  );
2453  this->m_eventOutText_OutputPort[portNum].invoke(
2454  id,
2455  timeTag,
2456  severity,
2457  text
2458  );
2459  }
2460 
2461 #endif
2462 
2463  void BufferAccumulatorComponentBase ::
2464  timeCaller_out(
2465  FwIndexType portNum,
2466  Fw::Time& time
2467  ) const
2468  {
2469  FW_ASSERT(
2470  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
2471  static_cast<FwAssertArgType>(portNum)
2472  );
2473 
2474  FW_ASSERT(
2475  this->m_timeCaller_OutputPort[portNum].isConnected(),
2476  static_cast<FwAssertArgType>(portNum)
2477  );
2478  this->m_timeCaller_OutputPort[portNum].invoke(
2479  time
2480  );
2481  }
2482 
2483  void BufferAccumulatorComponentBase ::
2484  tlmOut_out(
2485  FwIndexType portNum,
2486  FwChanIdType id,
2487  Fw::Time& timeTag,
2488  Fw::TlmBuffer& val
2489  ) const
2490  {
2491  FW_ASSERT(
2492  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
2493  static_cast<FwAssertArgType>(portNum)
2494  );
2495 
2496  FW_ASSERT(
2497  this->m_tlmOut_OutputPort[portNum].isConnected(),
2498  static_cast<FwAssertArgType>(portNum)
2499  );
2500  this->m_tlmOut_OutputPort[portNum].invoke(
2501  id,
2502  timeTag,
2503  val
2504  );
2505  }
2506 
2507 #endif
2508 
2509 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
bool isConnected_tlmOut_OutputPort(FwIndexType portNum) const
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
static constexpr FwIndexType getNum_pingIn_InputPorts()
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:27
virtual void bufferSendInReturn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendInReturn.
static constexpr FwIndexType getNum_eventOut_OutputPorts()
PlatformSizeType FwSizeType
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
I32 FwEnumStoreType
void bufferSendOutReturn_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferSendOutReturn.
Status
status returned from the queue send function
Definition: Queue.hpp:30
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
virtual ~BufferAccumulatorComponentBase()
Destroy BufferAccumulatorComponentBase object.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY]
static constexpr FwIndexType getNum_bufferSendInReturn_InputPorts()
Got DrainBuffers command while executing DrainBuffers command.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
static constexpr FwSizeType CAPACITY
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
static constexpr FwIndexType getNum_pingOut_OutputPorts()
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
const Time ZERO_TIME
Definition: Time.cpp:5
static constexpr FwIndexType getNum_bufferSendInFill_InputPorts()
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
void log_ACTIVITY_HI_BA_PartialDrainDone(U32 numDrained) const
Enum representing a command response.
No time base has been established (Required)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
BufferAccumulatorComponentBase(const char *compName="")
Construct BufferAccumulatorComponentBase object.
Os::Queue m_queue
queue object for active component
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
void log_WARNING_LO_BA_NonBlockDrain(U32 numWillDrain, U32 numReqDrain) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
Message will block until space is available.
Definition: Queue.hpp:47
static constexpr FwIndexType getNum_bufferSendOutDrain_OutputPorts()
FwIdType FwEventIdType
The type of an event identifier.
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
void set_bufferSendOutReturn_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutReturn[portNum].
static constexpr FwSizeType CAPACITY
Definition: PingPortAc.hpp:34
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
#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 set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
virtual void BA_SetMode_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Svc::BufferAccumulator_OpState &mode)=0
void log_WARNING_HI_BA_StillDraining(U32 numDrained, U32 numToDrain) const
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
void tlmWrite_BA_NumQueuedBuffers(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
virtual void BA_DrainBuffers_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 numToDrain, const Svc::BufferAccumulator_BlockMode &blockMode)=0
A less serious but recoverable event.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
void init()
Initialization function.
Definition: PingPortAc.cpp:151
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
virtual void bufferSendInFill_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendInFill.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
void pingOut_out(FwIndexType portNum, U32 key) const
Invoke output port pingOut.
void BA_DrainBuffers_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
void regCommands()
Register commands with the Command Dispatcher.
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
A serious but recoverable event.
void BA_SetMode_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
static constexpr FwIndexType getNum_cmdIn_InputPorts()
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_timeCaller_OutputPort(FwIndexType portNum) const
#define PRI_FwIndexType
The Buffer Accumulator instance received a buffer when its queue was full. To avoid uncontrolled send...
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)
virtual void BA_DrainBuffers_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BA_DrainBuffers.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
BlockingType
message type
Definition: Queue.hpp:46
Command failed to deserialize.
void set_bufferSendOutDrain_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutDrain[portNum].
bool isConnected_eventOut_OutputPort(FwIndexType portNum) const
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Important informational events.
Ran out of buffers while executing DrainBuffers command.
void init()
Initialization function.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
Fw::InputBufferSendPort * get_bufferSendInReturn_InputPort(FwIndexType 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_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
message to exit active component task
virtual void bufferSendInFill_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendInFill.
A message was sent requesting an exit of the loop.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
void bufferSendOutDrain_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferSendOutDrain.
static constexpr FwIndexType getNum_bufferSendOutReturn_OutputPorts()
The Buffer Accumulator instance accepted and enqueued a buffer. To avoid uncontrolled sending of even...
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
bool isConnected_bufferSendOutReturn_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
Fw::InputBufferSendPort * get_bufferSendInFill_InputPort(FwIndexType portNum)
void init()
Initialization function.
void incNumMsgDropped()
increment the number of messages dropped
void log_WARNING_HI_BA_DrainStalled(U32 numDrained, U32 numToDrain) const
void init()
Initialization function.
Definition: PingPortAc.cpp:73
RateGroupDivider component implementation.
Not enough buffers to complete requested drain, and NOBLOCK was set; will only drain what we have...
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:57
virtual void bufferSendInReturn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferSendInReturn.
void bufferSendInFill_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendInFill.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum) const
Implementation of malloc based allocator.
bool isConnected_bufferSendOutDrain_OutputPort(FwIndexType portNum) const
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
void init()
Initialization function.
void bufferSendInReturn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferSendInReturn.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
bool isConnected_pingOut_OutputPort(FwIndexType portNum) const
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void cmdIn_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port cmdIn.
virtual void BA_SetMode_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BA_SetMode.
BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY]