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