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 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  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  portNum < this->getNum_bufferSendOutDrain_OutputPorts(),
1156  static_cast<FwAssertArgType>(portNum)
1157  );
1158  this->m_bufferSendOutDrain_OutputPort[portNum].invoke(
1159  fwBuffer
1160  );
1161  }
1162 
1165  FwIndexType portNum,
1166  Fw::Buffer& fwBuffer
1167  )
1168  {
1169  FW_ASSERT(
1170  portNum < this->getNum_bufferSendOutReturn_OutputPorts(),
1171  static_cast<FwAssertArgType>(portNum)
1172  );
1173  this->m_bufferSendOutReturn_OutputPort[portNum].invoke(
1174  fwBuffer
1175  );
1176  }
1177 
1180  FwIndexType portNum,
1181  U32 key
1182  )
1183  {
1184  FW_ASSERT(
1185  portNum < this->getNum_pingOut_OutputPorts(),
1186  static_cast<FwAssertArgType>(portNum)
1187  );
1188  this->m_pingOut_OutputPort[portNum].invoke(
1189  key
1190  );
1191  }
1192 
1193  // ----------------------------------------------------------------------
1194  // Command response
1195  // ----------------------------------------------------------------------
1196 
1199  FwOpcodeType opCode,
1200  U32 cmdSeq,
1201  Fw::CmdResponse response
1202  )
1203  {
1204  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1205  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1206  }
1207 
1208  // ----------------------------------------------------------------------
1209  // Command handler base-class functions
1210  //
1211  // Call these functions directly to bypass the command input port
1212  // ----------------------------------------------------------------------
1213 
1216  FwOpcodeType opCode,
1217  U32 cmdSeq,
1218  Fw::CmdArgBuffer& args
1219  )
1220  {
1221  // Call pre-message hook
1222  this->BA_SetMode_preMsgHook(opCode,cmdSeq);
1223 
1224  // Defer deserializing arguments to the message dispatcher
1225  // to avoid deserializing and reserializing just for IPC
1226  ComponentIpcSerializableBuffer msg;
1228 
1229  // Serialize for IPC
1230  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_BA_SETMODE));
1231  FW_ASSERT (
1232  _status == Fw::FW_SERIALIZE_OK,
1233  static_cast<FwAssertArgType>(_status)
1234  );
1235 
1236  // Fake port number to make message dequeue work
1237  FwIndexType port = 0;
1238 
1239  _status = msg.serialize(port);
1240  FW_ASSERT (
1241  _status == Fw::FW_SERIALIZE_OK,
1242  static_cast<FwAssertArgType>(_status)
1243  );
1244 
1245  _status = msg.serialize(opCode);
1246  FW_ASSERT (
1247  _status == Fw::FW_SERIALIZE_OK,
1248  static_cast<FwAssertArgType>(_status)
1249  );
1250 
1251  _status = msg.serialize(cmdSeq);
1252  FW_ASSERT (
1253  _status == Fw::FW_SERIALIZE_OK,
1254  static_cast<FwAssertArgType>(_status)
1255  );
1256 
1257  _status = msg.serialize(args);
1258  FW_ASSERT (
1259  _status == Fw::FW_SERIALIZE_OK,
1260  static_cast<FwAssertArgType>(_status)
1261  );
1262 
1263  // Send message
1265  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1266 
1267  FW_ASSERT(
1268  qStatus == Os::Queue::OP_OK,
1269  static_cast<FwAssertArgType>(qStatus)
1270  );
1271  }
1272 
1275  FwOpcodeType opCode,
1276  U32 cmdSeq,
1277  Fw::CmdArgBuffer& args
1278  )
1279  {
1280  // Call pre-message hook
1281  this->BA_DrainBuffers_preMsgHook(opCode,cmdSeq);
1282 
1283  // Defer deserializing arguments to the message dispatcher
1284  // to avoid deserializing and reserializing just for IPC
1285  ComponentIpcSerializableBuffer msg;
1287 
1288  // Serialize for IPC
1289  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_BA_DRAINBUFFERS));
1290  FW_ASSERT (
1291  _status == Fw::FW_SERIALIZE_OK,
1292  static_cast<FwAssertArgType>(_status)
1293  );
1294 
1295  // Fake port number to make message dequeue work
1296  FwIndexType port = 0;
1297 
1298  _status = msg.serialize(port);
1299  FW_ASSERT (
1300  _status == Fw::FW_SERIALIZE_OK,
1301  static_cast<FwAssertArgType>(_status)
1302  );
1303 
1304  _status = msg.serialize(opCode);
1305  FW_ASSERT (
1306  _status == Fw::FW_SERIALIZE_OK,
1307  static_cast<FwAssertArgType>(_status)
1308  );
1309 
1310  _status = msg.serialize(cmdSeq);
1311  FW_ASSERT (
1312  _status == Fw::FW_SERIALIZE_OK,
1313  static_cast<FwAssertArgType>(_status)
1314  );
1315 
1316  _status = msg.serialize(args);
1317  FW_ASSERT (
1318  _status == Fw::FW_SERIALIZE_OK,
1319  static_cast<FwAssertArgType>(_status)
1320  );
1321 
1322  // Send message
1324  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1325 
1326  FW_ASSERT(
1327  qStatus == Os::Queue::OP_OK,
1328  static_cast<FwAssertArgType>(qStatus)
1329  );
1330  }
1331 
1332  // ----------------------------------------------------------------------
1333  // Pre-message hooks for async commands
1334  //
1335  // Each of these functions is invoked just before processing the
1336  // corresponding command. By default they do nothing. You can
1337  // override them to provide specific pre-command behavior.
1338  // ----------------------------------------------------------------------
1339 
1342  FwOpcodeType opCode,
1343  U32 cmdSeq
1344  )
1345  {
1346  // Defaults to no-op; can be overridden
1347  (void) opCode;
1348  (void) cmdSeq;
1349  }
1350 
1353  FwOpcodeType opCode,
1354  U32 cmdSeq
1355  )
1356  {
1357  // Defaults to no-op; can be overridden
1358  (void) opCode;
1359  (void) cmdSeq;
1360  }
1361 
1362  // ----------------------------------------------------------------------
1363  // Event logging functions
1364  // ----------------------------------------------------------------------
1365 
1368  {
1369  // Get the time
1370  Fw::Time _logTime;
1371  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1372  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1373  }
1374 
1375  FwEventIdType _id = static_cast<FwEventIdType>(0);
1376 
1377  _id = this->getIdBase() + EVENTID_BA_BUFFERACCEPTED;
1378 
1379  // Emit the event on the log port
1380  if (this->m_eventOut_OutputPort[0].isConnected()) {
1381  Fw::LogBuffer _logBuff;
1382 
1383 #if FW_AMPCS_COMPATIBLE
1385  // Serialize the number of arguments
1386  _status = _logBuff.serialize(static_cast<U8>(0));
1387  FW_ASSERT(
1388  _status == Fw::FW_SERIALIZE_OK,
1389  static_cast<FwAssertArgType>(_status)
1390  );
1391 #endif
1392 
1393  this->m_eventOut_OutputPort[0].invoke(
1394  _id,
1395  _logTime,
1397  _logBuff
1398  );
1399  }
1400 
1401  // Emit the event on the text log port
1402 #if FW_ENABLE_TEXT_LOGGING
1403  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1404 #if FW_OBJECT_NAMES == 1
1405  const char* _formatString =
1406  "(%s) %s: Buffer accepted";
1407 #else
1408  const char* _formatString =
1409  "%s: Buffer accepted";
1410 #endif
1411 
1412  Fw::TextLogString _logString;
1413  _logString.format(
1414  _formatString,
1415 #if FW_OBJECT_NAMES == 1
1416  this->m_objName.toChar(),
1417 #endif
1418  "BA_BufferAccepted "
1419  );
1420 
1421  this->m_eventOutText_OutputPort[0].invoke(
1422  _id,
1423  _logTime,
1425  _logString
1426  );
1427  }
1428 #endif
1429  }
1430 
1433  {
1434  // Get the time
1435  Fw::Time _logTime;
1436  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1437  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1438  }
1439 
1440  FwEventIdType _id = static_cast<FwEventIdType>(0);
1441 
1442  _id = this->getIdBase() + EVENTID_BA_QUEUEFULL;
1443 
1444  // Emit the event on the log port
1445  if (this->m_eventOut_OutputPort[0].isConnected()) {
1446  Fw::LogBuffer _logBuff;
1447 
1448 #if FW_AMPCS_COMPATIBLE
1450  // Serialize the number of arguments
1451  _status = _logBuff.serialize(static_cast<U8>(0));
1452  FW_ASSERT(
1453  _status == Fw::FW_SERIALIZE_OK,
1454  static_cast<FwAssertArgType>(_status)
1455  );
1456 #endif
1457 
1458  this->m_eventOut_OutputPort[0].invoke(
1459  _id,
1460  _logTime,
1462  _logBuff
1463  );
1464  }
1465 
1466  // Emit the event on the text log port
1467 #if FW_ENABLE_TEXT_LOGGING
1468  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1469 #if FW_OBJECT_NAMES == 1
1470  const char* _formatString =
1471  "(%s) %s: Queue full";
1472 #else
1473  const char* _formatString =
1474  "%s: Queue full";
1475 #endif
1476 
1477  Fw::TextLogString _logString;
1478  _logString.format(
1479  _formatString,
1480 #if FW_OBJECT_NAMES == 1
1481  this->m_objName.toChar(),
1482 #endif
1483  "BA_QueueFull "
1484  );
1485 
1486  this->m_eventOutText_OutputPort[0].invoke(
1487  _id,
1488  _logTime,
1490  _logString
1491  );
1492  }
1493 #endif
1494  }
1495 
1498  U32 numDrained,
1499  U32 numToDrain
1500  ) const
1501  {
1502  // Get the time
1503  Fw::Time _logTime;
1504  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1505  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1506  }
1507 
1508  FwEventIdType _id = static_cast<FwEventIdType>(0);
1509 
1510  _id = this->getIdBase() + EVENTID_BA_STILLDRAINING;
1511 
1512  // Emit the event on the log port
1513  if (this->m_eventOut_OutputPort[0].isConnected()) {
1514  Fw::LogBuffer _logBuff;
1516 
1517 #if FW_AMPCS_COMPATIBLE
1518  // Serialize the number of arguments
1519  _status = _logBuff.serialize(static_cast<U8>(2));
1520  FW_ASSERT(
1521  _status == Fw::FW_SERIALIZE_OK,
1522  static_cast<FwAssertArgType>(_status)
1523  );
1524 #endif
1525 
1526 #if FW_AMPCS_COMPATIBLE
1527  // Serialize the argument size
1528  _status = _logBuff.serialize(
1529  static_cast<U8>(sizeof(U32))
1530  );
1531  FW_ASSERT(
1532  _status == Fw::FW_SERIALIZE_OK,
1533  static_cast<FwAssertArgType>(_status)
1534  );
1535 #endif
1536  _status = _logBuff.serialize(numDrained);
1537  FW_ASSERT(
1538  _status == Fw::FW_SERIALIZE_OK,
1539  static_cast<FwAssertArgType>(_status)
1540  );
1541 
1542 #if FW_AMPCS_COMPATIBLE
1543  // Serialize the argument size
1544  _status = _logBuff.serialize(
1545  static_cast<U8>(sizeof(U32))
1546  );
1547  FW_ASSERT(
1548  _status == Fw::FW_SERIALIZE_OK,
1549  static_cast<FwAssertArgType>(_status)
1550  );
1551 #endif
1552  _status = _logBuff.serialize(numToDrain);
1553  FW_ASSERT(
1554  _status == Fw::FW_SERIALIZE_OK,
1555  static_cast<FwAssertArgType>(_status)
1556  );
1557 
1558  this->m_eventOut_OutputPort[0].invoke(
1559  _id,
1560  _logTime,
1562  _logBuff
1563  );
1564  }
1565 
1566  // Emit the event on the text log port
1567 #if FW_ENABLE_TEXT_LOGGING
1568  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1569 #if FW_OBJECT_NAMES == 1
1570  const char* _formatString =
1571  "(%s) %s: Still draining %" PRIu32 " of %" PRIu32 "";
1572 #else
1573  const char* _formatString =
1574  "%s: Still draining %" PRIu32 " of %" PRIu32 "";
1575 #endif
1576 
1577  Fw::TextLogString _logString;
1578  _logString.format(
1579  _formatString,
1580 #if FW_OBJECT_NAMES == 1
1581  this->m_objName.toChar(),
1582 #endif
1583  "BA_StillDraining ",
1584  numDrained,
1585  numToDrain
1586  );
1587 
1588  this->m_eventOutText_OutputPort[0].invoke(
1589  _id,
1590  _logTime,
1592  _logString
1593  );
1594  }
1595 #endif
1596  }
1597 
1600  {
1601  // Get the time
1602  Fw::Time _logTime;
1603  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1604  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1605  }
1606 
1607  FwEventIdType _id = static_cast<FwEventIdType>(0);
1608 
1609  _id = this->getIdBase() + EVENTID_BA_ALREADYDRAINING;
1610 
1611  // Emit the event on the log port
1612  if (this->m_eventOut_OutputPort[0].isConnected()) {
1613  Fw::LogBuffer _logBuff;
1614 
1615 #if FW_AMPCS_COMPATIBLE
1617  // Serialize the number of arguments
1618  _status = _logBuff.serialize(static_cast<U8>(0));
1619  FW_ASSERT(
1620  _status == Fw::FW_SERIALIZE_OK,
1621  static_cast<FwAssertArgType>(_status)
1622  );
1623 #endif
1624 
1625  this->m_eventOut_OutputPort[0].invoke(
1626  _id,
1627  _logTime,
1629  _logBuff
1630  );
1631  }
1632 
1633  // Emit the event on the text log port
1634 #if FW_ENABLE_TEXT_LOGGING
1635  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1636 #if FW_OBJECT_NAMES == 1
1637  const char* _formatString =
1638  "(%s) %s: Already in DRAIN mode";
1639 #else
1640  const char* _formatString =
1641  "%s: Already in DRAIN mode";
1642 #endif
1643 
1644  Fw::TextLogString _logString;
1645  _logString.format(
1646  _formatString,
1647 #if FW_OBJECT_NAMES == 1
1648  this->m_objName.toChar(),
1649 #endif
1650  "BA_AlreadyDraining "
1651  );
1652 
1653  this->m_eventOutText_OutputPort[0].invoke(
1654  _id,
1655  _logTime,
1657  _logString
1658  );
1659  }
1660 #endif
1661  }
1662 
1665  U32 numDrained,
1666  U32 numToDrain
1667  ) const
1668  {
1669  // Get the time
1670  Fw::Time _logTime;
1671  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1672  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1673  }
1674 
1675  FwEventIdType _id = static_cast<FwEventIdType>(0);
1676 
1677  _id = this->getIdBase() + EVENTID_BA_DRAINSTALLED;
1678 
1679  // Emit the event on the log port
1680  if (this->m_eventOut_OutputPort[0].isConnected()) {
1681  Fw::LogBuffer _logBuff;
1683 
1684 #if FW_AMPCS_COMPATIBLE
1685  // Serialize the number of arguments
1686  _status = _logBuff.serialize(static_cast<U8>(2));
1687  FW_ASSERT(
1688  _status == Fw::FW_SERIALIZE_OK,
1689  static_cast<FwAssertArgType>(_status)
1690  );
1691 #endif
1692 
1693 #if FW_AMPCS_COMPATIBLE
1694  // Serialize the argument size
1695  _status = _logBuff.serialize(
1696  static_cast<U8>(sizeof(U32))
1697  );
1698  FW_ASSERT(
1699  _status == Fw::FW_SERIALIZE_OK,
1700  static_cast<FwAssertArgType>(_status)
1701  );
1702 #endif
1703  _status = _logBuff.serialize(numDrained);
1704  FW_ASSERT(
1705  _status == Fw::FW_SERIALIZE_OK,
1706  static_cast<FwAssertArgType>(_status)
1707  );
1708 
1709 #if FW_AMPCS_COMPATIBLE
1710  // Serialize the argument size
1711  _status = _logBuff.serialize(
1712  static_cast<U8>(sizeof(U32))
1713  );
1714  FW_ASSERT(
1715  _status == Fw::FW_SERIALIZE_OK,
1716  static_cast<FwAssertArgType>(_status)
1717  );
1718 #endif
1719  _status = _logBuff.serialize(numToDrain);
1720  FW_ASSERT(
1721  _status == Fw::FW_SERIALIZE_OK,
1722  static_cast<FwAssertArgType>(_status)
1723  );
1724 
1725  this->m_eventOut_OutputPort[0].invoke(
1726  _id,
1727  _logTime,
1729  _logBuff
1730  );
1731  }
1732 
1733  // Emit the event on the text log port
1734 #if FW_ENABLE_TEXT_LOGGING
1735  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1736 #if FW_OBJECT_NAMES == 1
1737  const char* _formatString =
1738  "(%s) %s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1739 #else
1740  const char* _formatString =
1741  "%s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1742 #endif
1743 
1744  Fw::TextLogString _logString;
1745  _logString.format(
1746  _formatString,
1747 #if FW_OBJECT_NAMES == 1
1748  this->m_objName.toChar(),
1749 #endif
1750  "BA_DrainStalled ",
1751  numDrained,
1752  numToDrain
1753  );
1754 
1755  this->m_eventOutText_OutputPort[0].invoke(
1756  _id,
1757  _logTime,
1759  _logString
1760  );
1761  }
1762 #endif
1763  }
1764 
1767  {
1768  // Get the time
1769  Fw::Time _logTime;
1770  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1771  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1772  }
1773 
1774  FwEventIdType _id = static_cast<FwEventIdType>(0);
1775 
1776  _id = this->getIdBase() + EVENTID_BA_PARTIALDRAINDONE;
1777 
1778  // Emit the event on the log port
1779  if (this->m_eventOut_OutputPort[0].isConnected()) {
1780  Fw::LogBuffer _logBuff;
1782 
1783 #if FW_AMPCS_COMPATIBLE
1784  // Serialize the number of arguments
1785  _status = _logBuff.serialize(static_cast<U8>(1));
1786  FW_ASSERT(
1787  _status == Fw::FW_SERIALIZE_OK,
1788  static_cast<FwAssertArgType>(_status)
1789  );
1790 #endif
1791 
1792 #if FW_AMPCS_COMPATIBLE
1793  // Serialize the argument size
1794  _status = _logBuff.serialize(
1795  static_cast<U8>(sizeof(U32))
1796  );
1797  FW_ASSERT(
1798  _status == Fw::FW_SERIALIZE_OK,
1799  static_cast<FwAssertArgType>(_status)
1800  );
1801 #endif
1802  _status = _logBuff.serialize(numDrained);
1803  FW_ASSERT(
1804  _status == Fw::FW_SERIALIZE_OK,
1805  static_cast<FwAssertArgType>(_status)
1806  );
1807 
1808  this->m_eventOut_OutputPort[0].invoke(
1809  _id,
1810  _logTime,
1812  _logBuff
1813  );
1814  }
1815 
1816  // Emit the event on the text log port
1817 #if FW_ENABLE_TEXT_LOGGING
1818  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1819 #if FW_OBJECT_NAMES == 1
1820  const char* _formatString =
1821  "(%s) %s: Partial drain of %" PRIu32 " finished";
1822 #else
1823  const char* _formatString =
1824  "%s: Partial drain of %" PRIu32 " finished";
1825 #endif
1826 
1827  Fw::TextLogString _logString;
1828  _logString.format(
1829  _formatString,
1830 #if FW_OBJECT_NAMES == 1
1831  this->m_objName.toChar(),
1832 #endif
1833  "BA_PartialDrainDone ",
1834  numDrained
1835  );
1836 
1837  this->m_eventOutText_OutputPort[0].invoke(
1838  _id,
1839  _logTime,
1841  _logString
1842  );
1843  }
1844 #endif
1845  }
1846 
1849  U32 numWillDrain,
1850  U32 numReqDrain
1851  ) const
1852  {
1853  // Get the time
1854  Fw::Time _logTime;
1855  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1856  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1857  }
1858 
1859  FwEventIdType _id = static_cast<FwEventIdType>(0);
1860 
1861  _id = this->getIdBase() + EVENTID_BA_NONBLOCKDRAIN;
1862 
1863  // Emit the event on the log port
1864  if (this->m_eventOut_OutputPort[0].isConnected()) {
1865  Fw::LogBuffer _logBuff;
1867 
1868 #if FW_AMPCS_COMPATIBLE
1869  // Serialize the number of arguments
1870  _status = _logBuff.serialize(static_cast<U8>(2));
1871  FW_ASSERT(
1872  _status == Fw::FW_SERIALIZE_OK,
1873  static_cast<FwAssertArgType>(_status)
1874  );
1875 #endif
1876 
1877 #if FW_AMPCS_COMPATIBLE
1878  // Serialize the argument size
1879  _status = _logBuff.serialize(
1880  static_cast<U8>(sizeof(U32))
1881  );
1882  FW_ASSERT(
1883  _status == Fw::FW_SERIALIZE_OK,
1884  static_cast<FwAssertArgType>(_status)
1885  );
1886 #endif
1887  _status = _logBuff.serialize(numWillDrain);
1888  FW_ASSERT(
1889  _status == Fw::FW_SERIALIZE_OK,
1890  static_cast<FwAssertArgType>(_status)
1891  );
1892 
1893 #if FW_AMPCS_COMPATIBLE
1894  // Serialize the argument size
1895  _status = _logBuff.serialize(
1896  static_cast<U8>(sizeof(U32))
1897  );
1898  FW_ASSERT(
1899  _status == Fw::FW_SERIALIZE_OK,
1900  static_cast<FwAssertArgType>(_status)
1901  );
1902 #endif
1903  _status = _logBuff.serialize(numReqDrain);
1904  FW_ASSERT(
1905  _status == Fw::FW_SERIALIZE_OK,
1906  static_cast<FwAssertArgType>(_status)
1907  );
1908 
1909  this->m_eventOut_OutputPort[0].invoke(
1910  _id,
1911  _logTime,
1913  _logBuff
1914  );
1915  }
1916 
1917  // Emit the event on the text log port
1918 #if FW_ENABLE_TEXT_LOGGING
1919  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1920 #if FW_OBJECT_NAMES == 1
1921  const char* _formatString =
1922  "(%s) %s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1923 #else
1924  const char* _formatString =
1925  "%s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1926 #endif
1927 
1928  Fw::TextLogString _logString;
1929  _logString.format(
1930  _formatString,
1931 #if FW_OBJECT_NAMES == 1
1932  this->m_objName.toChar(),
1933 #endif
1934  "BA_NonBlockDrain ",
1935  numWillDrain,
1936  numReqDrain
1937  );
1938 
1939  this->m_eventOutText_OutputPort[0].invoke(
1940  _id,
1941  _logTime,
1943  _logString
1944  );
1945  }
1946 #endif
1947  }
1948 
1949  // ----------------------------------------------------------------------
1950  // Telemetry write functions
1951  // ----------------------------------------------------------------------
1952 
1955  U32 arg,
1956  Fw::Time _tlmTime
1957  ) const
1958  {
1959  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1960  if (
1961  this->m_timeCaller_OutputPort[0].isConnected() &&
1962  (_tlmTime == Fw::ZERO_TIME)
1963  ) {
1964  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1965  }
1966 
1967  Fw::TlmBuffer _tlmBuff;
1968  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1969  FW_ASSERT(
1970  _stat == Fw::FW_SERIALIZE_OK,
1971  static_cast<FwAssertArgType>(_stat)
1972  );
1973 
1974  FwChanIdType _id;
1975 
1976  _id = this->getIdBase() + CHANNELID_BA_NUMQUEUEDBUFFERS;
1977 
1978  this->m_tlmOut_OutputPort[0].invoke(
1979  _id,
1980  _tlmTime,
1981  _tlmBuff
1982  );
1983  }
1984  }
1985 
1986  // ----------------------------------------------------------------------
1987  // Time
1988  // ----------------------------------------------------------------------
1989 
1992  {
1993  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1994  Fw::Time _time;
1995  this->m_timeCaller_OutputPort[0].invoke(_time);
1996  return _time;
1997  }
1998  else {
1999  return Fw::Time(TB_NONE, 0, 0);
2000  }
2001  }
2002 
2003  // ----------------------------------------------------------------------
2004  // Message dispatch functions
2005  // ----------------------------------------------------------------------
2006 
2007  Fw::QueuedComponentBase::MsgDispatchStatus BufferAccumulatorComponentBase ::
2008  doDispatch()
2009  {
2010  ComponentIpcSerializableBuffer msg;
2011  FwQueuePriorityType priority = 0;
2012 
2013  Os::Queue::Status msgStatus = this->m_queue.receive(
2014  msg,
2016  priority
2017  );
2018  FW_ASSERT(
2019  msgStatus == Os::Queue::OP_OK,
2020  static_cast<FwAssertArgType>(msgStatus)
2021  );
2022 
2023  // Reset to beginning of buffer
2024  msg.resetDeser();
2025 
2026  FwEnumStoreType desMsg = 0;
2027  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
2028  FW_ASSERT(
2029  deserStatus == Fw::FW_SERIALIZE_OK,
2030  static_cast<FwAssertArgType>(deserStatus)
2031  );
2032 
2033  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
2034 
2035  if (msgType == BUFFERACCUMULATOR_COMPONENT_EXIT) {
2036  return MSG_DISPATCH_EXIT;
2037  }
2038 
2039  FwIndexType portNum = 0;
2040  deserStatus = msg.deserialize(portNum);
2041  FW_ASSERT(
2042  deserStatus == Fw::FW_SERIALIZE_OK,
2043  static_cast<FwAssertArgType>(deserStatus)
2044  );
2045 
2046  switch (msgType) {
2047  // Handle async input port bufferSendInFill
2048  case BUFFERSENDINFILL_BUFFERSEND: {
2049  // Deserialize argument fwBuffer
2050  Fw::Buffer fwBuffer;
2051  deserStatus = msg.deserialize(fwBuffer);
2052  FW_ASSERT(
2053  deserStatus == Fw::FW_SERIALIZE_OK,
2054  static_cast<FwAssertArgType>(deserStatus)
2055  );
2056  // Call handler function
2058  portNum,
2059  fwBuffer
2060  );
2061 
2062  break;
2063  }
2064 
2065  // Handle async input port bufferSendInReturn
2066  case BUFFERSENDINRETURN_BUFFERSEND: {
2067  // Deserialize argument fwBuffer
2068  Fw::Buffer fwBuffer;
2069  deserStatus = msg.deserialize(fwBuffer);
2070  FW_ASSERT(
2071  deserStatus == Fw::FW_SERIALIZE_OK,
2072  static_cast<FwAssertArgType>(deserStatus)
2073  );
2074  // Call handler function
2076  portNum,
2077  fwBuffer
2078  );
2079 
2080  break;
2081  }
2082 
2083  // Handle async input port pingIn
2084  case PINGIN_PING: {
2085  // Deserialize argument key
2086  U32 key;
2087  deserStatus = msg.deserialize(key);
2088  FW_ASSERT(
2089  deserStatus == Fw::FW_SERIALIZE_OK,
2090  static_cast<FwAssertArgType>(deserStatus)
2091  );
2092  // Call handler function
2093  this->pingIn_handler(
2094  portNum,
2095  key
2096  );
2097 
2098  break;
2099  }
2100 
2101  // Handle command BA_SetMode
2102  case CMD_BA_SETMODE: {
2103  // Deserialize opcode
2104  FwOpcodeType opCode = 0;
2105  deserStatus = msg.deserialize(opCode);
2106  FW_ASSERT (
2107  deserStatus == Fw::FW_SERIALIZE_OK,
2108  static_cast<FwAssertArgType>(deserStatus)
2109  );
2110 
2111  // Deserialize command sequence
2112  U32 cmdSeq = 0;
2113  deserStatus = msg.deserialize(cmdSeq);
2114  FW_ASSERT (
2115  deserStatus == Fw::FW_SERIALIZE_OK,
2116  static_cast<FwAssertArgType>(deserStatus)
2117  );
2118 
2119  // Deserialize command argument buffer
2120  Fw::CmdArgBuffer args;
2121  deserStatus = msg.deserialize(args);
2122  FW_ASSERT (
2123  deserStatus == Fw::FW_SERIALIZE_OK,
2124  static_cast<FwAssertArgType>(deserStatus)
2125  );
2126 
2127  // Reset buffer
2128  args.resetDeser();
2129 
2130  // Deserialize argument mode
2132  deserStatus = args.deserialize(mode);
2133  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2134  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2135  this->cmdResponse_out(
2136  opCode,
2137  cmdSeq,
2139  );
2140  }
2141  // Don't crash the task if bad arguments were passed from the ground
2142  break;
2143  }
2144 
2145  // Make sure there was no data left over.
2146  // That means the argument buffer size was incorrect.
2147 #if FW_CMD_CHECK_RESIDUAL
2148  if (args.getBuffLeft() != 0) {
2149  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2150  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2151  }
2152  // Don't crash the task if bad arguments were passed from the ground
2153  break;
2154  }
2155 #endif
2156 
2157  // Call handler function
2158  this->BA_SetMode_cmdHandler(
2159  opCode, cmdSeq,
2160  mode
2161  );
2162 
2163  break;
2164  }
2165 
2166  // Handle command BA_DrainBuffers
2167  case CMD_BA_DRAINBUFFERS: {
2168  // Deserialize opcode
2169  FwOpcodeType opCode = 0;
2170  deserStatus = msg.deserialize(opCode);
2171  FW_ASSERT (
2172  deserStatus == Fw::FW_SERIALIZE_OK,
2173  static_cast<FwAssertArgType>(deserStatus)
2174  );
2175 
2176  // Deserialize command sequence
2177  U32 cmdSeq = 0;
2178  deserStatus = msg.deserialize(cmdSeq);
2179  FW_ASSERT (
2180  deserStatus == Fw::FW_SERIALIZE_OK,
2181  static_cast<FwAssertArgType>(deserStatus)
2182  );
2183 
2184  // Deserialize command argument buffer
2185  Fw::CmdArgBuffer args;
2186  deserStatus = msg.deserialize(args);
2187  FW_ASSERT (
2188  deserStatus == Fw::FW_SERIALIZE_OK,
2189  static_cast<FwAssertArgType>(deserStatus)
2190  );
2191 
2192  // Reset buffer
2193  args.resetDeser();
2194 
2195  // Deserialize argument numToDrain
2196  U32 numToDrain;
2197  deserStatus = args.deserialize(numToDrain);
2198  if (deserStatus != Fw::FW_SERIALIZE_OK) {
2199  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2200  this->cmdResponse_out(
2201  opCode,
2202  cmdSeq,
2204  );
2205  }
2206  // Don't crash the task if bad arguments were passed from the ground
2207  break;
2208  }
2209 
2210  // Deserialize argument blockMode
2212  deserStatus = args.deserialize(blockMode);
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  // Make sure there was no data left over.
2226  // That means the argument buffer size was incorrect.
2227 #if FW_CMD_CHECK_RESIDUAL
2228  if (args.getBuffLeft() != 0) {
2229  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2230  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2231  }
2232  // Don't crash the task if bad arguments were passed from the ground
2233  break;
2234  }
2235 #endif
2236 
2237  // Call handler function
2239  opCode, cmdSeq,
2240  numToDrain,
2241  blockMode
2242  );
2243 
2244  break;
2245  }
2246 
2247  default:
2248  return MSG_DISPATCH_ERROR;
2249  }
2250 
2251  return MSG_DISPATCH_OK;
2252  }
2253 
2254  // ----------------------------------------------------------------------
2255  // Calls for messages received on special input ports
2256  // ----------------------------------------------------------------------
2257 
2258  void BufferAccumulatorComponentBase ::
2259  m_p_cmdIn_in(
2260  Fw::PassiveComponentBase* callComp,
2261  FwIndexType portNum,
2262  FwOpcodeType opCode,
2263  U32 cmdSeq,
2264  Fw::CmdArgBuffer& args
2265  )
2266  {
2267  FW_ASSERT(callComp);
2268  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2269 
2270  const U32 idBase = callComp->getIdBase();
2271  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2272 
2273  // Select base class function based on opcode
2274  switch (opCode - idBase) {
2275  case OPCODE_BA_SETMODE: {
2276  compPtr->BA_SetMode_cmdHandlerBase(
2277  opCode,
2278  cmdSeq,
2279  args
2280  );
2281  break;
2282  }
2283 
2284  case OPCODE_BA_DRAINBUFFERS: {
2285  compPtr->BA_DrainBuffers_cmdHandlerBase(
2286  opCode,
2287  cmdSeq,
2288  args
2289  );
2290  break;
2291  }
2292  }
2293  }
2294 
2295  // ----------------------------------------------------------------------
2296  // Calls for messages received on typed input ports
2297  // ----------------------------------------------------------------------
2298 
2299  void BufferAccumulatorComponentBase ::
2300  m_p_bufferSendInFill_in(
2301  Fw::PassiveComponentBase* callComp,
2302  FwIndexType portNum,
2303  Fw::Buffer& fwBuffer
2304  )
2305  {
2306  FW_ASSERT(callComp);
2307  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2308  compPtr->bufferSendInFill_handlerBase(
2309  portNum,
2310  fwBuffer
2311  );
2312  }
2313 
2314  void BufferAccumulatorComponentBase ::
2315  m_p_bufferSendInReturn_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->bufferSendInReturn_handlerBase(
2324  portNum,
2325  fwBuffer
2326  );
2327  }
2328 
2329  void BufferAccumulatorComponentBase ::
2330  m_p_pingIn_in(
2331  Fw::PassiveComponentBase* callComp,
2332  FwIndexType portNum,
2333  U32 key
2334  )
2335  {
2336  FW_ASSERT(callComp);
2337  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2338  compPtr->pingIn_handlerBase(
2339  portNum,
2340  key
2341  );
2342  }
2343 
2344 }
Serialization/Deserialization operation was successful.
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.
NATIVE_UINT_TYPE SizeType
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)
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
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
The Buffer Accumulator instance accepted and enqueued a buffer. To avoid uncontrolled sending of even...
I32 FwEnumStoreType
Definition: FpConfig.h:64
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.
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
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
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
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:46
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.
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 setPortNum(NATIVE_INT_TYPE 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.
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
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)
U32 FwOpcodeType
Definition: FpConfig.h:91
The size of the serial representations of the port arguments.
Not enough buffers to complete requested drain, and NOBLOCK was set; will only drain what we have...
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
No time base has been established.
Definition: FpConfig.h:70
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
void resetDeser()
reset deserialization to beginning
Ran out of buffers while executing DrainBuffers command.
A serious but recoverable event.
void BA_SetMode_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
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
U32 FwEventIdType
Definition: FpConfig.h:103
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
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:30
BlockingType
message type
Definition: Queue.hpp:45
#define PRI_PlatformIntType
bool isConnected_bufferSendOutReturn_OutputPort(FwIndexType portNum)
Command failed to deserialize.
void set_bufferSendOutDrain_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutDrain[portNum].
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].
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
message to exit active component task
virtual void bufferSendInFill_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendInFill.
A message was sent requesting an exit of the loop.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Got DrainBuffers command while executing DrainBuffers command.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
The Buffer Accumulator instance received a buffer when its queue was full. To avoid uncontrolled send...
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
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:31
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
Message will return with status when space is unavailable.
Definition: Queue.hpp:47
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
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_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:148
#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.
U32 FwChanIdType
Definition: FpConfig.h:95
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.