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::InputBufferSendPort::SERIALIZED_SIZE];
30  BYTE bufferSendInReturnPortSize[Fw::InputBufferSendPort::SERIALIZED_SIZE];
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 getBuffCapacity() 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  // Connect input port cmdIn
85  for (
86  FwIndexType port = 0;
87  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
88  port++
89  ) {
90  this->m_cmdIn_InputPort[port].init();
91  this->m_cmdIn_InputPort[port].addCallComp(
92  this,
93  m_p_cmdIn_in
94  );
95  this->m_cmdIn_InputPort[port].setPortNum(port);
96 
97 #if FW_OBJECT_NAMES == 1
98  Fw::ObjectName portName;
99  portName.format(
100  "%s_cmdIn_InputPort[%" PRI_FwIndexType "]",
101  this->m_objName.toChar(),
102  port
103  );
104  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
105 #endif
106  }
107 
108  // Connect input port bufferSendInFill
109  for (
110  FwIndexType port = 0;
111  port < static_cast<FwIndexType>(this->getNum_bufferSendInFill_InputPorts());
112  port++
113  ) {
114  this->m_bufferSendInFill_InputPort[port].init();
115  this->m_bufferSendInFill_InputPort[port].addCallComp(
116  this,
117  m_p_bufferSendInFill_in
118  );
119  this->m_bufferSendInFill_InputPort[port].setPortNum(port);
120 
121 #if FW_OBJECT_NAMES == 1
122  Fw::ObjectName portName;
123  portName.format(
124  "%s_bufferSendInFill_InputPort[%" PRI_FwIndexType "]",
125  this->m_objName.toChar(),
126  port
127  );
128  this->m_bufferSendInFill_InputPort[port].setObjName(portName.toChar());
129 #endif
130  }
131 
132  // Connect input port bufferSendInReturn
133  for (
134  FwIndexType port = 0;
135  port < static_cast<FwIndexType>(this->getNum_bufferSendInReturn_InputPorts());
136  port++
137  ) {
138  this->m_bufferSendInReturn_InputPort[port].init();
139  this->m_bufferSendInReturn_InputPort[port].addCallComp(
140  this,
141  m_p_bufferSendInReturn_in
142  );
143  this->m_bufferSendInReturn_InputPort[port].setPortNum(port);
144 
145 #if FW_OBJECT_NAMES == 1
146  Fw::ObjectName portName;
147  portName.format(
148  "%s_bufferSendInReturn_InputPort[%" PRI_FwIndexType "]",
149  this->m_objName.toChar(),
150  port
151  );
152  this->m_bufferSendInReturn_InputPort[port].setObjName(portName.toChar());
153 #endif
154  }
155 
156  // Connect input port pingIn
157  for (
158  FwIndexType port = 0;
159  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
160  port++
161  ) {
162  this->m_pingIn_InputPort[port].init();
163  this->m_pingIn_InputPort[port].addCallComp(
164  this,
165  m_p_pingIn_in
166  );
167  this->m_pingIn_InputPort[port].setPortNum(port);
168 
169 #if FW_OBJECT_NAMES == 1
170  Fw::ObjectName portName;
171  portName.format(
172  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
173  this->m_objName.toChar(),
174  port
175  );
176  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
177 #endif
178  }
179 
180  // Connect output port cmdRegOut
181  for (
182  FwIndexType port = 0;
183  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
184  port++
185  ) {
186  this->m_cmdRegOut_OutputPort[port].init();
187 
188 #if FW_OBJECT_NAMES == 1
189  Fw::ObjectName portName;
190  portName.format(
191  "%s_cmdRegOut_OutputPort[%" PRI_FwIndexType "]",
192  this->m_objName.toChar(),
193  port
194  );
195  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
196 #endif
197  }
198 
199  // Connect output port cmdResponseOut
200  for (
201  FwIndexType port = 0;
202  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
203  port++
204  ) {
205  this->m_cmdResponseOut_OutputPort[port].init();
206 
207 #if FW_OBJECT_NAMES == 1
208  Fw::ObjectName portName;
209  portName.format(
210  "%s_cmdResponseOut_OutputPort[%" PRI_FwIndexType "]",
211  this->m_objName.toChar(),
212  port
213  );
214  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
215 #endif
216  }
217 
218  // Connect output port eventOut
219  for (
220  FwIndexType port = 0;
221  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
222  port++
223  ) {
224  this->m_eventOut_OutputPort[port].init();
225 
226 #if FW_OBJECT_NAMES == 1
227  Fw::ObjectName portName;
228  portName.format(
229  "%s_eventOut_OutputPort[%" PRI_FwIndexType "]",
230  this->m_objName.toChar(),
231  port
232  );
233  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
234 #endif
235  }
236 
237 #if FW_ENABLE_TEXT_LOGGING == 1
238  // Connect output port eventOutText
239  for (
240  FwIndexType port = 0;
241  port < static_cast<FwIndexType>(this->getNum_eventOutText_OutputPorts());
242  port++
243  ) {
244  this->m_eventOutText_OutputPort[port].init();
245 
246 #if FW_OBJECT_NAMES == 1
247  Fw::ObjectName portName;
248  portName.format(
249  "%s_eventOutText_OutputPort[%" PRI_FwIndexType "]",
250  this->m_objName.toChar(),
251  port
252  );
253  this->m_eventOutText_OutputPort[port].setObjName(portName.toChar());
254 #endif
255  }
256 #endif
257 
258  // Connect output port timeCaller
259  for (
260  FwIndexType port = 0;
261  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
262  port++
263  ) {
264  this->m_timeCaller_OutputPort[port].init();
265 
266 #if FW_OBJECT_NAMES == 1
267  Fw::ObjectName portName;
268  portName.format(
269  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
270  this->m_objName.toChar(),
271  port
272  );
273  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
274 #endif
275  }
276 
277  // Connect output port tlmOut
278  for (
279  FwIndexType port = 0;
280  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
281  port++
282  ) {
283  this->m_tlmOut_OutputPort[port].init();
284 
285 #if FW_OBJECT_NAMES == 1
286  Fw::ObjectName portName;
287  portName.format(
288  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
289  this->m_objName.toChar(),
290  port
291  );
292  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
293 #endif
294  }
295 
296  // Connect output port bufferSendOutDrain
297  for (
298  FwIndexType port = 0;
299  port < static_cast<FwIndexType>(this->getNum_bufferSendOutDrain_OutputPorts());
300  port++
301  ) {
302  this->m_bufferSendOutDrain_OutputPort[port].init();
303 
304 #if FW_OBJECT_NAMES == 1
305  Fw::ObjectName portName;
306  portName.format(
307  "%s_bufferSendOutDrain_OutputPort[%" PRI_FwIndexType "]",
308  this->m_objName.toChar(),
309  port
310  );
311  this->m_bufferSendOutDrain_OutputPort[port].setObjName(portName.toChar());
312 #endif
313  }
314 
315  // Connect output port bufferSendOutReturn
316  for (
317  FwIndexType port = 0;
318  port < static_cast<FwIndexType>(this->getNum_bufferSendOutReturn_OutputPorts());
319  port++
320  ) {
321  this->m_bufferSendOutReturn_OutputPort[port].init();
322 
323 #if FW_OBJECT_NAMES == 1
324  Fw::ObjectName portName;
325  portName.format(
326  "%s_bufferSendOutReturn_OutputPort[%" PRI_FwIndexType "]",
327  this->m_objName.toChar(),
328  port
329  );
330  this->m_bufferSendOutReturn_OutputPort[port].setObjName(portName.toChar());
331 #endif
332  }
333 
334  // Connect output port pingOut
335  for (
336  FwIndexType port = 0;
337  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
338  port++
339  ) {
340  this->m_pingOut_OutputPort[port].init();
341 
342 #if FW_OBJECT_NAMES == 1
343  Fw::ObjectName portName;
344  portName.format(
345  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
346  this->m_objName.toChar(),
347  port
348  );
349  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
350 #endif
351  }
352 
353  // Create the queue
354  Os::Queue::Status qStat = this->createQueue(
355  queueDepth,
356  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
357  );
358  FW_ASSERT(
359  Os::Queue::Status::OP_OK == qStat,
360  static_cast<FwAssertArgType>(qStat)
361  );
362  }
363 
364  // ----------------------------------------------------------------------
365  // Getters for special input ports
366  // ----------------------------------------------------------------------
367 
370  {
371  FW_ASSERT(
372  (0 <= portNum) && (portNum < this->getNum_cmdIn_InputPorts()),
373  static_cast<FwAssertArgType>(portNum)
374  );
375 
376  return &this->m_cmdIn_InputPort[portNum];
377  }
378 
379  // ----------------------------------------------------------------------
380  // Getters for typed input ports
381  // ----------------------------------------------------------------------
382 
385  {
386  FW_ASSERT(
387  (0 <= portNum) && (portNum < this->getNum_bufferSendInFill_InputPorts()),
388  static_cast<FwAssertArgType>(portNum)
389  );
390 
391  return &this->m_bufferSendInFill_InputPort[portNum];
392  }
393 
396  {
397  FW_ASSERT(
398  (0 <= portNum) && (portNum < this->getNum_bufferSendInReturn_InputPorts()),
399  static_cast<FwAssertArgType>(portNum)
400  );
401 
402  return &this->m_bufferSendInReturn_InputPort[portNum];
403  }
404 
407  {
408  FW_ASSERT(
409  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
410  static_cast<FwAssertArgType>(portNum)
411  );
412 
413  return &this->m_pingIn_InputPort[portNum];
414  }
415 
416  // ----------------------------------------------------------------------
417  // Connect input ports to special output ports
418  // ----------------------------------------------------------------------
419 
422  FwIndexType portNum,
423  Fw::InputCmdRegPort* port
424  )
425  {
426  FW_ASSERT(
427  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
428  static_cast<FwAssertArgType>(portNum)
429  );
430 
431  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
432  }
433 
436  FwIndexType portNum,
438  )
439  {
440  FW_ASSERT(
441  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
442  static_cast<FwAssertArgType>(portNum)
443  );
444 
445  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
446  }
447 
450  FwIndexType portNum,
451  Fw::InputLogPort* port
452  )
453  {
454  FW_ASSERT(
455  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
456  static_cast<FwAssertArgType>(portNum)
457  );
458 
459  this->m_eventOut_OutputPort[portNum].addCallPort(port);
460  }
461 
462 #if FW_ENABLE_TEXT_LOGGING == 1
463 
464  void BufferAccumulatorComponentBase ::
465  set_eventOutText_OutputPort(
466  FwIndexType portNum,
468  )
469  {
470  FW_ASSERT(
471  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
472  static_cast<FwAssertArgType>(portNum)
473  );
474 
475  this->m_eventOutText_OutputPort[portNum].addCallPort(port);
476  }
477 
478 #endif
479 
482  FwIndexType portNum,
483  Fw::InputTimePort* port
484  )
485  {
486  FW_ASSERT(
487  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
488  static_cast<FwAssertArgType>(portNum)
489  );
490 
491  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
492  }
493 
496  FwIndexType portNum,
497  Fw::InputTlmPort* port
498  )
499  {
500  FW_ASSERT(
501  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
502  static_cast<FwAssertArgType>(portNum)
503  );
504 
505  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
506  }
507 
508  // ----------------------------------------------------------------------
509  // Connect typed input ports to typed output ports
510  // ----------------------------------------------------------------------
511 
514  FwIndexType portNum,
516  )
517  {
518  FW_ASSERT(
519  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
520  static_cast<FwAssertArgType>(portNum)
521  );
522 
523  this->m_bufferSendOutDrain_OutputPort[portNum].addCallPort(port);
524  }
525 
528  FwIndexType portNum,
530  )
531  {
532  FW_ASSERT(
533  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
534  static_cast<FwAssertArgType>(portNum)
535  );
536 
537  this->m_bufferSendOutReturn_OutputPort[portNum].addCallPort(port);
538  }
539 
542  FwIndexType portNum,
543  Svc::InputPingPort* port
544  )
545  {
546  FW_ASSERT(
547  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
548  static_cast<FwAssertArgType>(portNum)
549  );
550 
551  this->m_pingOut_OutputPort[portNum].addCallPort(port);
552  }
553 
554 #if FW_PORT_SERIALIZATION
555 
556  // ----------------------------------------------------------------------
557  // Connect serial input ports to special output ports
558  // ----------------------------------------------------------------------
559 
562  FwIndexType portNum,
563  Fw::InputSerializePort* port
564  )
565  {
566  FW_ASSERT(
567  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
568  static_cast<FwAssertArgType>(portNum)
569  );
570 
571  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
572  }
573 
576  FwIndexType portNum,
577  Fw::InputSerializePort* port
578  )
579  {
580  FW_ASSERT(
581  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
582  static_cast<FwAssertArgType>(portNum)
583  );
584 
585  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
586  }
587 
590  FwIndexType portNum,
591  Fw::InputSerializePort* port
592  )
593  {
594  FW_ASSERT(
595  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
596  static_cast<FwAssertArgType>(portNum)
597  );
598 
599  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
600  }
601 
602 #if FW_ENABLE_TEXT_LOGGING == 1
603 
604  void BufferAccumulatorComponentBase ::
605  set_eventOutText_OutputPort(
606  FwIndexType portNum,
607  Fw::InputSerializePort* port
608  )
609  {
610  FW_ASSERT(
611  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
612  static_cast<FwAssertArgType>(portNum)
613  );
614 
615  this->m_eventOutText_OutputPort[portNum].registerSerialPort(port);
616  }
617 
618 #endif
619 
622  FwIndexType portNum,
623  Fw::InputSerializePort* port
624  )
625  {
626  FW_ASSERT(
627  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
628  static_cast<FwAssertArgType>(portNum)
629  );
630 
631  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
632  }
633 
636  FwIndexType portNum,
637  Fw::InputSerializePort* port
638  )
639  {
640  FW_ASSERT(
641  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
642  static_cast<FwAssertArgType>(portNum)
643  );
644 
645  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
646  }
647 
648 #endif
649 
650 #if FW_PORT_SERIALIZATION
651 
652  // ----------------------------------------------------------------------
653  // Connect serial input ports to typed output ports
654  // ----------------------------------------------------------------------
655 
658  FwIndexType portNum,
659  Fw::InputSerializePort* port
660  )
661  {
662  FW_ASSERT(
663  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
664  static_cast<FwAssertArgType>(portNum)
665  );
666 
667  this->m_bufferSendOutDrain_OutputPort[portNum].registerSerialPort(port);
668  }
669 
672  FwIndexType portNum,
673  Fw::InputSerializePort* port
674  )
675  {
676  FW_ASSERT(
677  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
678  static_cast<FwAssertArgType>(portNum)
679  );
680 
681  this->m_bufferSendOutReturn_OutputPort[portNum].registerSerialPort(port);
682  }
683 
686  FwIndexType portNum,
687  Fw::InputSerializePort* port
688  )
689  {
690  FW_ASSERT(
691  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
692  static_cast<FwAssertArgType>(portNum)
693  );
694 
695  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
696  }
697 
698 #endif
699 
700  // ----------------------------------------------------------------------
701  // Command registration
702  // ----------------------------------------------------------------------
703 
706  {
707  FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
708 
709  this->m_cmdRegOut_OutputPort[0].invoke(
710  this->getIdBase() + OPCODE_BA_SETMODE
711  );
712 
713  this->m_cmdRegOut_OutputPort[0].invoke(
715  );
716  }
717 
718  // ----------------------------------------------------------------------
719  // Component construction and destruction
720  // ----------------------------------------------------------------------
721 
723  BufferAccumulatorComponentBase(const char* compName) :
724  Fw::ActiveComponentBase(compName)
725  {
726 
727  }
728 
731  {
732 
733  }
734 
735  // ----------------------------------------------------------------------
736  // Getters for numbers of special input ports
737  // ----------------------------------------------------------------------
738 
741  {
742  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
743  }
744 
745  // ----------------------------------------------------------------------
746  // Getters for numbers of typed input ports
747  // ----------------------------------------------------------------------
748 
751  {
752  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendInFill_InputPort));
753  }
754 
757  {
758  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendInReturn_InputPort));
759  }
760 
763  {
764  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
765  }
766 
767  // ----------------------------------------------------------------------
768  // Getters for numbers of special output ports
769  // ----------------------------------------------------------------------
770 
773  {
774  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort));
775  }
776 
779  {
780  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
781  }
782 
785  {
786  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
787  }
788 
789 #if FW_ENABLE_TEXT_LOGGING == 1
790 
791  FwIndexType BufferAccumulatorComponentBase ::
792  getNum_eventOutText_OutputPorts() const
793  {
794  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOutText_OutputPort));
795  }
796 
797 #endif
798 
801  {
802  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
803  }
804 
807  {
808  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
809  }
810 
811  // ----------------------------------------------------------------------
812  // Getters for numbers of typed output ports
813  // ----------------------------------------------------------------------
814 
817  {
818  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendOutDrain_OutputPort));
819  }
820 
823  {
824  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendOutReturn_OutputPort));
825  }
826 
829  {
830  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
831  }
832 
833  // ----------------------------------------------------------------------
834  // Connection status queries for special output ports
835  // ----------------------------------------------------------------------
836 
839  {
840  FW_ASSERT(
841  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
842  static_cast<FwAssertArgType>(portNum)
843  );
844 
845  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
846  }
847 
850  {
851  FW_ASSERT(
852  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
853  static_cast<FwAssertArgType>(portNum)
854  );
855 
856  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
857  }
858 
861  {
862  FW_ASSERT(
863  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
864  static_cast<FwAssertArgType>(portNum)
865  );
866 
867  return this->m_eventOut_OutputPort[portNum].isConnected();
868  }
869 
870 #if FW_ENABLE_TEXT_LOGGING == 1
871 
872  bool BufferAccumulatorComponentBase ::
873  isConnected_eventOutText_OutputPort(FwIndexType portNum)
874  {
875  FW_ASSERT(
876  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
877  static_cast<FwAssertArgType>(portNum)
878  );
879 
880  return this->m_eventOutText_OutputPort[portNum].isConnected();
881  }
882 
883 #endif
884 
887  {
888  FW_ASSERT(
889  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
890  static_cast<FwAssertArgType>(portNum)
891  );
892 
893  return this->m_timeCaller_OutputPort[portNum].isConnected();
894  }
895 
898  {
899  FW_ASSERT(
900  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
901  static_cast<FwAssertArgType>(portNum)
902  );
903 
904  return this->m_tlmOut_OutputPort[portNum].isConnected();
905  }
906 
907  // ----------------------------------------------------------------------
908  // Connection status queries for typed output ports
909  // ----------------------------------------------------------------------
910 
913  {
914  FW_ASSERT(
915  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
916  static_cast<FwAssertArgType>(portNum)
917  );
918 
919  return this->m_bufferSendOutDrain_OutputPort[portNum].isConnected();
920  }
921 
924  {
925  FW_ASSERT(
926  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
927  static_cast<FwAssertArgType>(portNum)
928  );
929 
930  return this->m_bufferSendOutReturn_OutputPort[portNum].isConnected();
931  }
932 
935  {
936  FW_ASSERT(
937  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
938  static_cast<FwAssertArgType>(portNum)
939  );
940 
941  return this->m_pingOut_OutputPort[portNum].isConnected();
942  }
943 
944  // ----------------------------------------------------------------------
945  // Port handler base-class functions for typed input ports
946  //
947  // Call these functions directly to bypass the corresponding ports
948  // ----------------------------------------------------------------------
949 
952  FwIndexType portNum,
953  Fw::Buffer& fwBuffer
954  )
955  {
956  // Make sure port number is valid
957  FW_ASSERT(
958  (0 <= portNum) && (portNum < this->getNum_bufferSendInFill_InputPorts()),
959  static_cast<FwAssertArgType>(portNum)
960  );
961 
962  // Call pre-message hook
964  portNum,
965  fwBuffer
966  );
967  ComponentIpcSerializableBuffer msg;
969 
970  // Serialize message ID
971  _status = msg.serialize(
972  static_cast<FwEnumStoreType>(BUFFERSENDINFILL_BUFFERSEND)
973  );
974  FW_ASSERT(
975  _status == Fw::FW_SERIALIZE_OK,
976  static_cast<FwAssertArgType>(_status)
977  );
978 
979  // Serialize port number
980  _status = msg.serialize(portNum);
981  FW_ASSERT(
982  _status == Fw::FW_SERIALIZE_OK,
983  static_cast<FwAssertArgType>(_status)
984  );
985 
986  // Serialize argument fwBuffer
987  _status = msg.serialize(fwBuffer);
988  FW_ASSERT(
989  _status == Fw::FW_SERIALIZE_OK,
990  static_cast<FwAssertArgType>(_status)
991  );
992 
993  // Send message
995  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
996 
997  FW_ASSERT(
998  qStatus == Os::Queue::OP_OK,
999  static_cast<FwAssertArgType>(qStatus)
1000  );
1001  }
1002 
1005  FwIndexType portNum,
1006  Fw::Buffer& fwBuffer
1007  )
1008  {
1009  // Make sure port number is valid
1010  FW_ASSERT(
1011  (0 <= portNum) && (portNum < this->getNum_bufferSendInReturn_InputPorts()),
1012  static_cast<FwAssertArgType>(portNum)
1013  );
1014 
1015  // Call pre-message hook
1017  portNum,
1018  fwBuffer
1019  );
1020  ComponentIpcSerializableBuffer msg;
1022 
1023  // Serialize message ID
1024  _status = msg.serialize(
1025  static_cast<FwEnumStoreType>(BUFFERSENDINRETURN_BUFFERSEND)
1026  );
1027  FW_ASSERT(
1028  _status == Fw::FW_SERIALIZE_OK,
1029  static_cast<FwAssertArgType>(_status)
1030  );
1031 
1032  // Serialize port number
1033  _status = msg.serialize(portNum);
1034  FW_ASSERT(
1035  _status == Fw::FW_SERIALIZE_OK,
1036  static_cast<FwAssertArgType>(_status)
1037  );
1038 
1039  // Serialize argument fwBuffer
1040  _status = msg.serialize(fwBuffer);
1041  FW_ASSERT(
1042  _status == Fw::FW_SERIALIZE_OK,
1043  static_cast<FwAssertArgType>(_status)
1044  );
1045 
1046  // Send message
1048  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1049 
1050  FW_ASSERT(
1051  qStatus == Os::Queue::OP_OK,
1052  static_cast<FwAssertArgType>(qStatus)
1053  );
1054  }
1055 
1058  FwIndexType portNum,
1059  U32 key
1060  )
1061  {
1062  // Make sure port number is valid
1063  FW_ASSERT(
1064  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
1065  static_cast<FwAssertArgType>(portNum)
1066  );
1067 
1068  // Call pre-message hook
1070  portNum,
1071  key
1072  );
1073  ComponentIpcSerializableBuffer msg;
1075 
1076  // Serialize message ID
1077  _status = msg.serialize(
1078  static_cast<FwEnumStoreType>(PINGIN_PING)
1079  );
1080  FW_ASSERT(
1081  _status == Fw::FW_SERIALIZE_OK,
1082  static_cast<FwAssertArgType>(_status)
1083  );
1084 
1085  // Serialize port number
1086  _status = msg.serialize(portNum);
1087  FW_ASSERT(
1088  _status == Fw::FW_SERIALIZE_OK,
1089  static_cast<FwAssertArgType>(_status)
1090  );
1091 
1092  // Serialize argument key
1093  _status = msg.serialize(key);
1094  FW_ASSERT(
1095  _status == Fw::FW_SERIALIZE_OK,
1096  static_cast<FwAssertArgType>(_status)
1097  );
1098 
1099  // Send message
1101  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1102 
1103  FW_ASSERT(
1104  qStatus == Os::Queue::OP_OK,
1105  static_cast<FwAssertArgType>(qStatus)
1106  );
1107  }
1108 
1109  // ----------------------------------------------------------------------
1110  // Pre-message hooks for typed async input ports
1111  //
1112  // Each of these functions is invoked just before processing a message
1113  // on the corresponding port. By default, they do nothing. You can
1114  // override them to provide specific pre-message behavior.
1115  // ----------------------------------------------------------------------
1116 
1119  FwIndexType portNum,
1120  Fw::Buffer& fwBuffer
1121  )
1122  {
1123  // Default: no-op
1124  }
1125 
1128  FwIndexType portNum,
1129  Fw::Buffer& fwBuffer
1130  )
1131  {
1132  // Default: no-op
1133  }
1134 
1137  FwIndexType portNum,
1138  U32 key
1139  )
1140  {
1141  // Default: no-op
1142  }
1143 
1144  // ----------------------------------------------------------------------
1145  // Invocation functions for typed output ports
1146  // ----------------------------------------------------------------------
1147 
1150  FwIndexType portNum,
1151  Fw::Buffer& fwBuffer
1152  )
1153  {
1154  FW_ASSERT(
1155  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
1156  static_cast<FwAssertArgType>(portNum)
1157  );
1158 
1159  FW_ASSERT(
1160  this->m_bufferSendOutDrain_OutputPort[portNum].isConnected(),
1161  static_cast<FwAssertArgType>(portNum)
1162  );
1163  this->m_bufferSendOutDrain_OutputPort[portNum].invoke(
1164  fwBuffer
1165  );
1166  }
1167 
1170  FwIndexType portNum,
1171  Fw::Buffer& fwBuffer
1172  )
1173  {
1174  FW_ASSERT(
1175  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
1176  static_cast<FwAssertArgType>(portNum)
1177  );
1178 
1179  FW_ASSERT(
1180  this->m_bufferSendOutReturn_OutputPort[portNum].isConnected(),
1181  static_cast<FwAssertArgType>(portNum)
1182  );
1183  this->m_bufferSendOutReturn_OutputPort[portNum].invoke(
1184  fwBuffer
1185  );
1186  }
1187 
1190  FwIndexType portNum,
1191  U32 key
1192  )
1193  {
1194  FW_ASSERT(
1195  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1196  static_cast<FwAssertArgType>(portNum)
1197  );
1198 
1199  FW_ASSERT(
1200  this->m_pingOut_OutputPort[portNum].isConnected(),
1201  static_cast<FwAssertArgType>(portNum)
1202  );
1203  this->m_pingOut_OutputPort[portNum].invoke(
1204  key
1205  );
1206  }
1207 
1208  // ----------------------------------------------------------------------
1209  // Command response
1210  // ----------------------------------------------------------------------
1211 
1214  FwOpcodeType opCode,
1215  U32 cmdSeq,
1216  Fw::CmdResponse response
1217  )
1218  {
1219  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1220  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1221  }
1222 
1223  // ----------------------------------------------------------------------
1224  // Command handler base-class functions
1225  //
1226  // Call these functions directly to bypass the command input port
1227  // ----------------------------------------------------------------------
1228 
1231  FwOpcodeType opCode,
1232  U32 cmdSeq,
1233  Fw::CmdArgBuffer& args
1234  )
1235  {
1236  // Call pre-message hook
1237  this->BA_SetMode_preMsgHook(opCode,cmdSeq);
1238 
1239  // Defer deserializing arguments to the message dispatcher
1240  // to avoid deserializing and reserializing just for IPC
1241  ComponentIpcSerializableBuffer msg;
1243 
1244  // Serialize for IPC
1245  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_BA_SETMODE));
1246  FW_ASSERT (
1247  _status == Fw::FW_SERIALIZE_OK,
1248  static_cast<FwAssertArgType>(_status)
1249  );
1250 
1251  // Fake port number to make message dequeue work
1252  FwIndexType port = 0;
1253 
1254  _status = msg.serialize(port);
1255  FW_ASSERT (
1256  _status == Fw::FW_SERIALIZE_OK,
1257  static_cast<FwAssertArgType>(_status)
1258  );
1259 
1260  _status = msg.serialize(opCode);
1261  FW_ASSERT (
1262  _status == Fw::FW_SERIALIZE_OK,
1263  static_cast<FwAssertArgType>(_status)
1264  );
1265 
1266  _status = msg.serialize(cmdSeq);
1267  FW_ASSERT (
1268  _status == Fw::FW_SERIALIZE_OK,
1269  static_cast<FwAssertArgType>(_status)
1270  );
1271 
1272  _status = msg.serialize(args);
1273  FW_ASSERT (
1274  _status == Fw::FW_SERIALIZE_OK,
1275  static_cast<FwAssertArgType>(_status)
1276  );
1277 
1278  // Send message
1280  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1281 
1282  FW_ASSERT(
1283  qStatus == Os::Queue::OP_OK,
1284  static_cast<FwAssertArgType>(qStatus)
1285  );
1286  }
1287 
1290  FwOpcodeType opCode,
1291  U32 cmdSeq,
1292  Fw::CmdArgBuffer& args
1293  )
1294  {
1295  // Call pre-message hook
1296  this->BA_DrainBuffers_preMsgHook(opCode,cmdSeq);
1297 
1298  // Defer deserializing arguments to the message dispatcher
1299  // to avoid deserializing and reserializing just for IPC
1300  ComponentIpcSerializableBuffer msg;
1302 
1303  // Serialize for IPC
1304  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_BA_DRAINBUFFERS));
1305  FW_ASSERT (
1306  _status == Fw::FW_SERIALIZE_OK,
1307  static_cast<FwAssertArgType>(_status)
1308  );
1309 
1310  // Fake port number to make message dequeue work
1311  FwIndexType port = 0;
1312 
1313  _status = msg.serialize(port);
1314  FW_ASSERT (
1315  _status == Fw::FW_SERIALIZE_OK,
1316  static_cast<FwAssertArgType>(_status)
1317  );
1318 
1319  _status = msg.serialize(opCode);
1320  FW_ASSERT (
1321  _status == Fw::FW_SERIALIZE_OK,
1322  static_cast<FwAssertArgType>(_status)
1323  );
1324 
1325  _status = msg.serialize(cmdSeq);
1326  FW_ASSERT (
1327  _status == Fw::FW_SERIALIZE_OK,
1328  static_cast<FwAssertArgType>(_status)
1329  );
1330 
1331  _status = msg.serialize(args);
1332  FW_ASSERT (
1333  _status == Fw::FW_SERIALIZE_OK,
1334  static_cast<FwAssertArgType>(_status)
1335  );
1336 
1337  // Send message
1339  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1340 
1341  FW_ASSERT(
1342  qStatus == Os::Queue::OP_OK,
1343  static_cast<FwAssertArgType>(qStatus)
1344  );
1345  }
1346 
1347  // ----------------------------------------------------------------------
1348  // Pre-message hooks for async commands
1349  //
1350  // Each of these functions is invoked just before processing the
1351  // corresponding command. By default they do nothing. You can
1352  // override them to provide specific pre-command behavior.
1353  // ----------------------------------------------------------------------
1354 
1357  FwOpcodeType opCode,
1358  U32 cmdSeq
1359  )
1360  {
1361  // Defaults to no-op; can be overridden
1362  (void) opCode;
1363  (void) cmdSeq;
1364  }
1365 
1368  FwOpcodeType opCode,
1369  U32 cmdSeq
1370  )
1371  {
1372  // Defaults to no-op; can be overridden
1373  (void) opCode;
1374  (void) cmdSeq;
1375  }
1376 
1377  // ----------------------------------------------------------------------
1378  // Event logging functions
1379  // ----------------------------------------------------------------------
1380 
1383  {
1384  // Get the time
1385  Fw::Time _logTime;
1386  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1387  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1388  }
1389 
1390  FwEventIdType _id = static_cast<FwEventIdType>(0);
1391 
1392  _id = this->getIdBase() + EVENTID_BA_BUFFERACCEPTED;
1393 
1394  // Emit the event on the log port
1395  if (this->m_eventOut_OutputPort[0].isConnected()) {
1396  Fw::LogBuffer _logBuff;
1397 
1398 #if FW_AMPCS_COMPATIBLE
1400  // Serialize the number of arguments
1401  _status = _logBuff.serialize(static_cast<U8>(0));
1402  FW_ASSERT(
1403  _status == Fw::FW_SERIALIZE_OK,
1404  static_cast<FwAssertArgType>(_status)
1405  );
1406 #endif
1407 
1408  this->m_eventOut_OutputPort[0].invoke(
1409  _id,
1410  _logTime,
1412  _logBuff
1413  );
1414  }
1415 
1416  // Emit the event on the text log port
1417 #if FW_ENABLE_TEXT_LOGGING
1418  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1419 #if FW_OBJECT_NAMES == 1
1420  const char* _formatString =
1421  "(%s) %s: Buffer accepted";
1422 #else
1423  const char* _formatString =
1424  "%s: Buffer accepted";
1425 #endif
1426 
1427  Fw::TextLogString _logString;
1428  _logString.format(
1429  _formatString,
1430 #if FW_OBJECT_NAMES == 1
1431  this->m_objName.toChar(),
1432 #endif
1433  "BA_BufferAccepted "
1434  );
1435 
1436  this->m_eventOutText_OutputPort[0].invoke(
1437  _id,
1438  _logTime,
1440  _logString
1441  );
1442  }
1443 #endif
1444  }
1445 
1448  {
1449  // Get the time
1450  Fw::Time _logTime;
1451  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1452  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1453  }
1454 
1455  FwEventIdType _id = static_cast<FwEventIdType>(0);
1456 
1457  _id = this->getIdBase() + EVENTID_BA_QUEUEFULL;
1458 
1459  // Emit the event on the log port
1460  if (this->m_eventOut_OutputPort[0].isConnected()) {
1461  Fw::LogBuffer _logBuff;
1462 
1463 #if FW_AMPCS_COMPATIBLE
1465  // Serialize the number of arguments
1466  _status = _logBuff.serialize(static_cast<U8>(0));
1467  FW_ASSERT(
1468  _status == Fw::FW_SERIALIZE_OK,
1469  static_cast<FwAssertArgType>(_status)
1470  );
1471 #endif
1472 
1473  this->m_eventOut_OutputPort[0].invoke(
1474  _id,
1475  _logTime,
1477  _logBuff
1478  );
1479  }
1480 
1481  // Emit the event on the text log port
1482 #if FW_ENABLE_TEXT_LOGGING
1483  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1484 #if FW_OBJECT_NAMES == 1
1485  const char* _formatString =
1486  "(%s) %s: Queue full";
1487 #else
1488  const char* _formatString =
1489  "%s: Queue full";
1490 #endif
1491 
1492  Fw::TextLogString _logString;
1493  _logString.format(
1494  _formatString,
1495 #if FW_OBJECT_NAMES == 1
1496  this->m_objName.toChar(),
1497 #endif
1498  "BA_QueueFull "
1499  );
1500 
1501  this->m_eventOutText_OutputPort[0].invoke(
1502  _id,
1503  _logTime,
1505  _logString
1506  );
1507  }
1508 #endif
1509  }
1510 
1513  U32 numDrained,
1514  U32 numToDrain
1515  ) const
1516  {
1517  // Get the time
1518  Fw::Time _logTime;
1519  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1520  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1521  }
1522 
1523  FwEventIdType _id = static_cast<FwEventIdType>(0);
1524 
1525  _id = this->getIdBase() + EVENTID_BA_STILLDRAINING;
1526 
1527  // Emit the event on the log port
1528  if (this->m_eventOut_OutputPort[0].isConnected()) {
1529  Fw::LogBuffer _logBuff;
1531 
1532 #if FW_AMPCS_COMPATIBLE
1533  // Serialize the number of arguments
1534  _status = _logBuff.serialize(static_cast<U8>(2));
1535  FW_ASSERT(
1536  _status == Fw::FW_SERIALIZE_OK,
1537  static_cast<FwAssertArgType>(_status)
1538  );
1539 #endif
1540 
1541 #if FW_AMPCS_COMPATIBLE
1542  // Serialize the argument size
1543  _status = _logBuff.serialize(
1544  static_cast<U8>(sizeof(U32))
1545  );
1546  FW_ASSERT(
1547  _status == Fw::FW_SERIALIZE_OK,
1548  static_cast<FwAssertArgType>(_status)
1549  );
1550 #endif
1551  _status = _logBuff.serialize(numDrained);
1552  FW_ASSERT(
1553  _status == Fw::FW_SERIALIZE_OK,
1554  static_cast<FwAssertArgType>(_status)
1555  );
1556 
1557 #if FW_AMPCS_COMPATIBLE
1558  // Serialize the argument size
1559  _status = _logBuff.serialize(
1560  static_cast<U8>(sizeof(U32))
1561  );
1562  FW_ASSERT(
1563  _status == Fw::FW_SERIALIZE_OK,
1564  static_cast<FwAssertArgType>(_status)
1565  );
1566 #endif
1567  _status = _logBuff.serialize(numToDrain);
1568  FW_ASSERT(
1569  _status == Fw::FW_SERIALIZE_OK,
1570  static_cast<FwAssertArgType>(_status)
1571  );
1572 
1573  this->m_eventOut_OutputPort[0].invoke(
1574  _id,
1575  _logTime,
1577  _logBuff
1578  );
1579  }
1580 
1581  // Emit the event on the text log port
1582 #if FW_ENABLE_TEXT_LOGGING
1583  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1584 #if FW_OBJECT_NAMES == 1
1585  const char* _formatString =
1586  "(%s) %s: Still draining %" PRIu32 " of %" PRIu32 "";
1587 #else
1588  const char* _formatString =
1589  "%s: Still draining %" PRIu32 " of %" PRIu32 "";
1590 #endif
1591 
1592  Fw::TextLogString _logString;
1593  _logString.format(
1594  _formatString,
1595 #if FW_OBJECT_NAMES == 1
1596  this->m_objName.toChar(),
1597 #endif
1598  "BA_StillDraining ",
1599  numDrained,
1600  numToDrain
1601  );
1602 
1603  this->m_eventOutText_OutputPort[0].invoke(
1604  _id,
1605  _logTime,
1607  _logString
1608  );
1609  }
1610 #endif
1611  }
1612 
1615  {
1616  // Get the time
1617  Fw::Time _logTime;
1618  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1619  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1620  }
1621 
1622  FwEventIdType _id = static_cast<FwEventIdType>(0);
1623 
1624  _id = this->getIdBase() + EVENTID_BA_ALREADYDRAINING;
1625 
1626  // Emit the event on the log port
1627  if (this->m_eventOut_OutputPort[0].isConnected()) {
1628  Fw::LogBuffer _logBuff;
1629 
1630 #if FW_AMPCS_COMPATIBLE
1632  // Serialize the number of arguments
1633  _status = _logBuff.serialize(static_cast<U8>(0));
1634  FW_ASSERT(
1635  _status == Fw::FW_SERIALIZE_OK,
1636  static_cast<FwAssertArgType>(_status)
1637  );
1638 #endif
1639 
1640  this->m_eventOut_OutputPort[0].invoke(
1641  _id,
1642  _logTime,
1644  _logBuff
1645  );
1646  }
1647 
1648  // Emit the event on the text log port
1649 #if FW_ENABLE_TEXT_LOGGING
1650  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1651 #if FW_OBJECT_NAMES == 1
1652  const char* _formatString =
1653  "(%s) %s: Already in DRAIN mode";
1654 #else
1655  const char* _formatString =
1656  "%s: Already in DRAIN mode";
1657 #endif
1658 
1659  Fw::TextLogString _logString;
1660  _logString.format(
1661  _formatString,
1662 #if FW_OBJECT_NAMES == 1
1663  this->m_objName.toChar(),
1664 #endif
1665  "BA_AlreadyDraining "
1666  );
1667 
1668  this->m_eventOutText_OutputPort[0].invoke(
1669  _id,
1670  _logTime,
1672  _logString
1673  );
1674  }
1675 #endif
1676  }
1677 
1680  U32 numDrained,
1681  U32 numToDrain
1682  ) const
1683  {
1684  // Get the time
1685  Fw::Time _logTime;
1686  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1687  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1688  }
1689 
1690  FwEventIdType _id = static_cast<FwEventIdType>(0);
1691 
1692  _id = this->getIdBase() + EVENTID_BA_DRAINSTALLED;
1693 
1694  // Emit the event on the log port
1695  if (this->m_eventOut_OutputPort[0].isConnected()) {
1696  Fw::LogBuffer _logBuff;
1698 
1699 #if FW_AMPCS_COMPATIBLE
1700  // Serialize the number of arguments
1701  _status = _logBuff.serialize(static_cast<U8>(2));
1702  FW_ASSERT(
1703  _status == Fw::FW_SERIALIZE_OK,
1704  static_cast<FwAssertArgType>(_status)
1705  );
1706 #endif
1707 
1708 #if FW_AMPCS_COMPATIBLE
1709  // Serialize the argument size
1710  _status = _logBuff.serialize(
1711  static_cast<U8>(sizeof(U32))
1712  );
1713  FW_ASSERT(
1714  _status == Fw::FW_SERIALIZE_OK,
1715  static_cast<FwAssertArgType>(_status)
1716  );
1717 #endif
1718  _status = _logBuff.serialize(numDrained);
1719  FW_ASSERT(
1720  _status == Fw::FW_SERIALIZE_OK,
1721  static_cast<FwAssertArgType>(_status)
1722  );
1723 
1724 #if FW_AMPCS_COMPATIBLE
1725  // Serialize the argument size
1726  _status = _logBuff.serialize(
1727  static_cast<U8>(sizeof(U32))
1728  );
1729  FW_ASSERT(
1730  _status == Fw::FW_SERIALIZE_OK,
1731  static_cast<FwAssertArgType>(_status)
1732  );
1733 #endif
1734  _status = _logBuff.serialize(numToDrain);
1735  FW_ASSERT(
1736  _status == Fw::FW_SERIALIZE_OK,
1737  static_cast<FwAssertArgType>(_status)
1738  );
1739 
1740  this->m_eventOut_OutputPort[0].invoke(
1741  _id,
1742  _logTime,
1744  _logBuff
1745  );
1746  }
1747 
1748  // Emit the event on the text log port
1749 #if FW_ENABLE_TEXT_LOGGING
1750  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1751 #if FW_OBJECT_NAMES == 1
1752  const char* _formatString =
1753  "(%s) %s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1754 #else
1755  const char* _formatString =
1756  "%s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1757 #endif
1758 
1759  Fw::TextLogString _logString;
1760  _logString.format(
1761  _formatString,
1762 #if FW_OBJECT_NAMES == 1
1763  this->m_objName.toChar(),
1764 #endif
1765  "BA_DrainStalled ",
1766  numDrained,
1767  numToDrain
1768  );
1769 
1770  this->m_eventOutText_OutputPort[0].invoke(
1771  _id,
1772  _logTime,
1774  _logString
1775  );
1776  }
1777 #endif
1778  }
1779 
1782  {
1783  // Get the time
1784  Fw::Time _logTime;
1785  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1786  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1787  }
1788 
1789  FwEventIdType _id = static_cast<FwEventIdType>(0);
1790 
1791  _id = this->getIdBase() + EVENTID_BA_PARTIALDRAINDONE;
1792 
1793  // Emit the event on the log port
1794  if (this->m_eventOut_OutputPort[0].isConnected()) {
1795  Fw::LogBuffer _logBuff;
1797 
1798 #if FW_AMPCS_COMPATIBLE
1799  // Serialize the number of arguments
1800  _status = _logBuff.serialize(static_cast<U8>(1));
1801  FW_ASSERT(
1802  _status == Fw::FW_SERIALIZE_OK,
1803  static_cast<FwAssertArgType>(_status)
1804  );
1805 #endif
1806 
1807 #if FW_AMPCS_COMPATIBLE
1808  // Serialize the argument size
1809  _status = _logBuff.serialize(
1810  static_cast<U8>(sizeof(U32))
1811  );
1812  FW_ASSERT(
1813  _status == Fw::FW_SERIALIZE_OK,
1814  static_cast<FwAssertArgType>(_status)
1815  );
1816 #endif
1817  _status = _logBuff.serialize(numDrained);
1818  FW_ASSERT(
1819  _status == Fw::FW_SERIALIZE_OK,
1820  static_cast<FwAssertArgType>(_status)
1821  );
1822 
1823  this->m_eventOut_OutputPort[0].invoke(
1824  _id,
1825  _logTime,
1827  _logBuff
1828  );
1829  }
1830 
1831  // Emit the event on the text log port
1832 #if FW_ENABLE_TEXT_LOGGING
1833  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1834 #if FW_OBJECT_NAMES == 1
1835  const char* _formatString =
1836  "(%s) %s: Partial drain of %" PRIu32 " finished";
1837 #else
1838  const char* _formatString =
1839  "%s: Partial drain of %" PRIu32 " finished";
1840 #endif
1841 
1842  Fw::TextLogString _logString;
1843  _logString.format(
1844  _formatString,
1845 #if FW_OBJECT_NAMES == 1
1846  this->m_objName.toChar(),
1847 #endif
1848  "BA_PartialDrainDone ",
1849  numDrained
1850  );
1851 
1852  this->m_eventOutText_OutputPort[0].invoke(
1853  _id,
1854  _logTime,
1856  _logString
1857  );
1858  }
1859 #endif
1860  }
1861 
1864  U32 numWillDrain,
1865  U32 numReqDrain
1866  ) const
1867  {
1868  // Get the time
1869  Fw::Time _logTime;
1870  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1871  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1872  }
1873 
1874  FwEventIdType _id = static_cast<FwEventIdType>(0);
1875 
1876  _id = this->getIdBase() + EVENTID_BA_NONBLOCKDRAIN;
1877 
1878  // Emit the event on the log port
1879  if (this->m_eventOut_OutputPort[0].isConnected()) {
1880  Fw::LogBuffer _logBuff;
1882 
1883 #if FW_AMPCS_COMPATIBLE
1884  // Serialize the number of arguments
1885  _status = _logBuff.serialize(static_cast<U8>(2));
1886  FW_ASSERT(
1887  _status == Fw::FW_SERIALIZE_OK,
1888  static_cast<FwAssertArgType>(_status)
1889  );
1890 #endif
1891 
1892 #if FW_AMPCS_COMPATIBLE
1893  // Serialize the argument size
1894  _status = _logBuff.serialize(
1895  static_cast<U8>(sizeof(U32))
1896  );
1897  FW_ASSERT(
1898  _status == Fw::FW_SERIALIZE_OK,
1899  static_cast<FwAssertArgType>(_status)
1900  );
1901 #endif
1902  _status = _logBuff.serialize(numWillDrain);
1903  FW_ASSERT(
1904  _status == Fw::FW_SERIALIZE_OK,
1905  static_cast<FwAssertArgType>(_status)
1906  );
1907 
1908 #if FW_AMPCS_COMPATIBLE
1909  // Serialize the argument size
1910  _status = _logBuff.serialize(
1911  static_cast<U8>(sizeof(U32))
1912  );
1913  FW_ASSERT(
1914  _status == Fw::FW_SERIALIZE_OK,
1915  static_cast<FwAssertArgType>(_status)
1916  );
1917 #endif
1918  _status = _logBuff.serialize(numReqDrain);
1919  FW_ASSERT(
1920  _status == Fw::FW_SERIALIZE_OK,
1921  static_cast<FwAssertArgType>(_status)
1922  );
1923 
1924  this->m_eventOut_OutputPort[0].invoke(
1925  _id,
1926  _logTime,
1928  _logBuff
1929  );
1930  }
1931 
1932  // Emit the event on the text log port
1933 #if FW_ENABLE_TEXT_LOGGING
1934  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1935 #if FW_OBJECT_NAMES == 1
1936  const char* _formatString =
1937  "(%s) %s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1938 #else
1939  const char* _formatString =
1940  "%s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1941 #endif
1942 
1943  Fw::TextLogString _logString;
1944  _logString.format(
1945  _formatString,
1946 #if FW_OBJECT_NAMES == 1
1947  this->m_objName.toChar(),
1948 #endif
1949  "BA_NonBlockDrain ",
1950  numWillDrain,
1951  numReqDrain
1952  );
1953 
1954  this->m_eventOutText_OutputPort[0].invoke(
1955  _id,
1956  _logTime,
1958  _logString
1959  );
1960  }
1961 #endif
1962  }
1963 
1964  // ----------------------------------------------------------------------
1965  // Telemetry write functions
1966  // ----------------------------------------------------------------------
1967 
1970  U32 arg,
1971  Fw::Time _tlmTime
1972  ) const
1973  {
1974  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1975  if (
1976  this->m_timeCaller_OutputPort[0].isConnected() &&
1977  (_tlmTime == Fw::ZERO_TIME)
1978  ) {
1979  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1980  }
1981 
1982  Fw::TlmBuffer _tlmBuff;
1983  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1984  FW_ASSERT(
1985  _stat == Fw::FW_SERIALIZE_OK,
1986  static_cast<FwAssertArgType>(_stat)
1987  );
1988 
1989  FwChanIdType _id;
1990 
1991  _id = this->getIdBase() + CHANNELID_BA_NUMQUEUEDBUFFERS;
1992 
1993  this->m_tlmOut_OutputPort[0].invoke(
1994  _id,
1995  _tlmTime,
1996  _tlmBuff
1997  );
1998  }
1999  }
2000 
2001  // ----------------------------------------------------------------------
2002  // Time
2003  // ----------------------------------------------------------------------
2004 
2006  getTime() const
2007  {
2008  if (this->m_timeCaller_OutputPort[0].isConnected()) {
2009  Fw::Time _time;
2010  this->m_timeCaller_OutputPort[0].invoke(_time);
2011  return _time;
2012  }
2013  else {
2014  return Fw::Time(TB_NONE, 0, 0);
2015  }
2016  }
2017 
2018  // ----------------------------------------------------------------------
2019  // Message dispatch functions
2020  // ----------------------------------------------------------------------
2021 
2022  Fw::QueuedComponentBase::MsgDispatchStatus BufferAccumulatorComponentBase ::
2023  doDispatch()
2024  {
2025  ComponentIpcSerializableBuffer _msg;
2026  FwQueuePriorityType _priority = 0;
2027 
2028  Os::Queue::Status _msgStatus = this->m_queue.receive(
2029  _msg,
2031  _priority
2032  );
2033  FW_ASSERT(
2034  _msgStatus == Os::Queue::OP_OK,
2035  static_cast<FwAssertArgType>(_msgStatus)
2036  );
2037 
2038  // Reset to beginning of buffer
2039  _msg.resetDeser();
2040 
2041  FwEnumStoreType _desMsg = 0;
2042  Fw::SerializeStatus _deserStatus = _msg.deserialize(_desMsg);
2043  FW_ASSERT(
2044  _deserStatus == Fw::FW_SERIALIZE_OK,
2045  static_cast<FwAssertArgType>(_deserStatus)
2046  );
2047 
2048  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2049 
2050  if (_msgType == BUFFERACCUMULATOR_COMPONENT_EXIT) {
2051  return MSG_DISPATCH_EXIT;
2052  }
2053 
2054  FwIndexType portNum = 0;
2055  _deserStatus = _msg.deserialize(portNum);
2056  FW_ASSERT(
2057  _deserStatus == Fw::FW_SERIALIZE_OK,
2058  static_cast<FwAssertArgType>(_deserStatus)
2059  );
2060 
2061  switch (_msgType) {
2062  // Handle async input port bufferSendInFill
2063  case BUFFERSENDINFILL_BUFFERSEND: {
2064  // Deserialize argument fwBuffer
2065  Fw::Buffer fwBuffer;
2066  _deserStatus = _msg.deserialize(fwBuffer);
2067  FW_ASSERT(
2068  _deserStatus == Fw::FW_SERIALIZE_OK,
2069  static_cast<FwAssertArgType>(_deserStatus)
2070  );
2071  // Call handler function
2073  portNum,
2074  fwBuffer
2075  );
2076 
2077  break;
2078  }
2079 
2080  // Handle async input port bufferSendInReturn
2081  case BUFFERSENDINRETURN_BUFFERSEND: {
2082  // Deserialize argument fwBuffer
2083  Fw::Buffer fwBuffer;
2084  _deserStatus = _msg.deserialize(fwBuffer);
2085  FW_ASSERT(
2086  _deserStatus == Fw::FW_SERIALIZE_OK,
2087  static_cast<FwAssertArgType>(_deserStatus)
2088  );
2089  // Call handler function
2091  portNum,
2092  fwBuffer
2093  );
2094 
2095  break;
2096  }
2097 
2098  // Handle async input port pingIn
2099  case PINGIN_PING: {
2100  // Deserialize argument key
2101  U32 key;
2102  _deserStatus = _msg.deserialize(key);
2103  FW_ASSERT(
2104  _deserStatus == Fw::FW_SERIALIZE_OK,
2105  static_cast<FwAssertArgType>(_deserStatus)
2106  );
2107  // Call handler function
2108  this->pingIn_handler(
2109  portNum,
2110  key
2111  );
2112 
2113  break;
2114  }
2115 
2116  // Handle command BA_SetMode
2117  case CMD_BA_SETMODE: {
2118  // Deserialize opcode
2119  FwOpcodeType _opCode = 0;
2120  _deserStatus = _msg.deserialize(_opCode);
2121  FW_ASSERT (
2122  _deserStatus == Fw::FW_SERIALIZE_OK,
2123  static_cast<FwAssertArgType>(_deserStatus)
2124  );
2125 
2126  // Deserialize command sequence
2127  U32 _cmdSeq = 0;
2128  _deserStatus = _msg.deserialize(_cmdSeq);
2129  FW_ASSERT (
2130  _deserStatus == Fw::FW_SERIALIZE_OK,
2131  static_cast<FwAssertArgType>(_deserStatus)
2132  );
2133 
2134  // Deserialize command argument buffer
2135  Fw::CmdArgBuffer args;
2136  _deserStatus = _msg.deserialize(args);
2137  FW_ASSERT (
2138  _deserStatus == Fw::FW_SERIALIZE_OK,
2139  static_cast<FwAssertArgType>(_deserStatus)
2140  );
2141 
2142  // Reset buffer
2143  args.resetDeser();
2144 
2145  // Deserialize argument mode
2147  _deserStatus = args.deserialize(mode);
2148  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2149  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2150  this->cmdResponse_out(
2151  _opCode,
2152  _cmdSeq,
2154  );
2155  }
2156  // Don't crash the task if bad arguments were passed from the ground
2157  break;
2158  }
2159 
2160  // Make sure there was no data left over.
2161  // That means the argument buffer size was incorrect.
2162 #if FW_CMD_CHECK_RESIDUAL
2163  if (args.getBuffLeft() != 0) {
2164  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2165  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2166  }
2167  // Don't crash the task if bad arguments were passed from the ground
2168  break;
2169  }
2170 #endif
2171 
2172  // Call handler function
2173  this->BA_SetMode_cmdHandler(
2174  _opCode, _cmdSeq,
2175  mode
2176  );
2177 
2178  break;
2179  }
2180 
2181  // Handle command BA_DrainBuffers
2182  case CMD_BA_DRAINBUFFERS: {
2183  // Deserialize opcode
2184  FwOpcodeType _opCode = 0;
2185  _deserStatus = _msg.deserialize(_opCode);
2186  FW_ASSERT (
2187  _deserStatus == Fw::FW_SERIALIZE_OK,
2188  static_cast<FwAssertArgType>(_deserStatus)
2189  );
2190 
2191  // Deserialize command sequence
2192  U32 _cmdSeq = 0;
2193  _deserStatus = _msg.deserialize(_cmdSeq);
2194  FW_ASSERT (
2195  _deserStatus == Fw::FW_SERIALIZE_OK,
2196  static_cast<FwAssertArgType>(_deserStatus)
2197  );
2198 
2199  // Deserialize command argument buffer
2200  Fw::CmdArgBuffer args;
2201  _deserStatus = _msg.deserialize(args);
2202  FW_ASSERT (
2203  _deserStatus == Fw::FW_SERIALIZE_OK,
2204  static_cast<FwAssertArgType>(_deserStatus)
2205  );
2206 
2207  // Reset buffer
2208  args.resetDeser();
2209 
2210  // Deserialize argument numToDrain
2211  U32 numToDrain;
2212  _deserStatus = args.deserialize(numToDrain);
2213  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2214  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2215  this->cmdResponse_out(
2216  _opCode,
2217  _cmdSeq,
2219  );
2220  }
2221  // Don't crash the task if bad arguments were passed from the ground
2222  break;
2223  }
2224 
2225  // Deserialize argument blockMode
2227  _deserStatus = args.deserialize(blockMode);
2228  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2229  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2230  this->cmdResponse_out(
2231  _opCode,
2232  _cmdSeq,
2234  );
2235  }
2236  // Don't crash the task if bad arguments were passed from the ground
2237  break;
2238  }
2239 
2240  // Make sure there was no data left over.
2241  // That means the argument buffer size was incorrect.
2242 #if FW_CMD_CHECK_RESIDUAL
2243  if (args.getBuffLeft() != 0) {
2244  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2245  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2246  }
2247  // Don't crash the task if bad arguments were passed from the ground
2248  break;
2249  }
2250 #endif
2251 
2252  // Call handler function
2254  _opCode, _cmdSeq,
2255  numToDrain,
2256  blockMode
2257  );
2258 
2259  break;
2260  }
2261 
2262  default:
2263  return MSG_DISPATCH_ERROR;
2264  }
2265 
2266  return MSG_DISPATCH_OK;
2267  }
2268 
2269  // ----------------------------------------------------------------------
2270  // Calls for messages received on special input ports
2271  // ----------------------------------------------------------------------
2272 
2273  void BufferAccumulatorComponentBase ::
2274  m_p_cmdIn_in(
2275  Fw::PassiveComponentBase* callComp,
2276  FwIndexType portNum,
2277  FwOpcodeType opCode,
2278  U32 cmdSeq,
2279  Fw::CmdArgBuffer& args
2280  )
2281  {
2282  FW_ASSERT(callComp);
2283  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2284 
2285  const U32 idBase = callComp->getIdBase();
2286  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2287 
2288  // Select base class function based on opcode
2289  switch (opCode - idBase) {
2290  case OPCODE_BA_SETMODE: {
2291  compPtr->BA_SetMode_cmdHandlerBase(
2292  opCode,
2293  cmdSeq,
2294  args
2295  );
2296  break;
2297  }
2298 
2299  case OPCODE_BA_DRAINBUFFERS: {
2300  compPtr->BA_DrainBuffers_cmdHandlerBase(
2301  opCode,
2302  cmdSeq,
2303  args
2304  );
2305  break;
2306  }
2307  }
2308  }
2309 
2310  // ----------------------------------------------------------------------
2311  // Calls for messages received on typed input ports
2312  // ----------------------------------------------------------------------
2313 
2314  void BufferAccumulatorComponentBase ::
2315  m_p_bufferSendInFill_in(
2316  Fw::PassiveComponentBase* callComp,
2317  FwIndexType portNum,
2318  Fw::Buffer& fwBuffer
2319  )
2320  {
2321  FW_ASSERT(callComp);
2322  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2323  compPtr->bufferSendInFill_handlerBase(
2324  portNum,
2325  fwBuffer
2326  );
2327  }
2328 
2329  void BufferAccumulatorComponentBase ::
2330  m_p_bufferSendInReturn_in(
2331  Fw::PassiveComponentBase* callComp,
2332  FwIndexType portNum,
2333  Fw::Buffer& fwBuffer
2334  )
2335  {
2336  FW_ASSERT(callComp);
2337  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2338  compPtr->bufferSendInReturn_handlerBase(
2339  portNum,
2340  fwBuffer
2341  );
2342  }
2343 
2344  void BufferAccumulatorComponentBase ::
2345  m_p_pingIn_in(
2346  Fw::PassiveComponentBase* callComp,
2347  FwIndexType portNum,
2348  U32 key
2349  )
2350  {
2351  FW_ASSERT(callComp);
2352  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2353  compPtr->pingIn_handlerBase(
2354  portNum,
2355  key
2356  );
2357  }
2358 
2359 }
Serialization/Deserialization operation was successful.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
Definition: Time.hpp:9
void bufferSendOutReturn_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOutReturn.
virtual void BA_SetMode_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::BufferAccumulator_OpState mode)=0
bool isConnected_bufferSendOutDrain_OutputPort(FwIndexType portNum)
Operation succeeded.
Definition: Os.hpp:26
virtual void bufferSendInReturn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendInReturn.
PlatformSizeType FwSizeType
The size of the serial representations of the port arguments.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:59
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
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].
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
U32 FwChanIdType
The type of a telemetry channel identifier.
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
const Time ZERO_TIME
Definition: Time.cpp:5
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void log_ACTIVITY_HI_BA_PartialDrainDone(U32 numDrained) const
Enum representing a command response.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
BufferAccumulatorComponentBase(const char *compName="")
Construct BufferAccumulatorComponentBase object.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
Not enough buffers to complete requested drain, and NOBLOCK was set; will only drain what we have...
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Object initializer.
Definition: ObjBase.cpp:26
U32 FwEventIdType
The type of an event identifier.
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:62
Message will block until space is available.
Definition: Queue.hpp:47
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
void set_bufferSendOutReturn_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutReturn[portNum].
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
U32 FwOpcodeType
The type of a command opcode.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:53
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
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
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
A less serious but recoverable event.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port interface.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
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 interface.
Definition: TimePortAc.cpp:147
void BA_DrainBuffers_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
FwSizeType SizeType
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
void regCommands()
Register commands with the Command Dispatcher.
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:42
void resetDeser()
reset deserialization to beginning
message to exit active component task
A serious but recoverable event.
void BA_SetMode_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:42
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
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:56
BlockingType
message type
Definition: Queue.hpp:46
bool isConnected_bufferSendOutReturn_OutputPort(FwIndexType portNum)
Command failed to deserialize.
void set_bufferSendOutDrain_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutDrain[portNum].
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Important informational events.
void init()
Initialization function.
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 interface.
Definition: LogPortAc.cpp:170
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].
No time base has been established.
Definition: FpConfig.h:30
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
PlatformIndexType FwIndexType
The Buffer Accumulator instance accepted and enqueued a buffer. To avoid uncontrolled sending of even...
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:93
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
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:56
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:59
Got DrainBuffers command while executing DrainBuffers command.
void bufferSendOutDrain_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferSendOutDrain.
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:62
The Buffer Accumulator instance received a buffer when its queue was full. To avoid uncontrolled send...
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
Ran out of buffers while executing DrainBuffers command.
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
virtual void BA_DrainBuffers_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 numToDrain, Svc::BufferAccumulator_BlockMode blockMode)=0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void BA_SetMode_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command BA_SetMode.