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 getCapacity() const {
53  return sizeof(m_buff);
54  }
55 
56  U8* getBuffAddr() {
57  return m_buff;
58  }
59 
60  const U8* getBuffAddr() const {
61  return m_buff;
62  }
63 
64  private:
65  // Should be the max of all the input ports serialized sizes...
66  U8 m_buff[SERIALIZATION_SIZE];
67 
68  };
69  }
70 
71  // ----------------------------------------------------------------------
72  // Component initialization
73  // ----------------------------------------------------------------------
74 
77  FwSizeType queueDepth,
78  FwEnumStoreType instance
79  )
80  {
81  // Initialize base class
83 
84  // 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  // Connection status queries for special output ports
737  // ----------------------------------------------------------------------
738 
741  {
742  FW_ASSERT(
743  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
744  static_cast<FwAssertArgType>(portNum)
745  );
746 
747  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
748  }
749 
752  {
753  FW_ASSERT(
754  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
755  static_cast<FwAssertArgType>(portNum)
756  );
757 
758  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
759  }
760 
763  {
764  FW_ASSERT(
765  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
766  static_cast<FwAssertArgType>(portNum)
767  );
768 
769  return this->m_eventOut_OutputPort[portNum].isConnected();
770  }
771 
772 #if FW_ENABLE_TEXT_LOGGING == 1
773 
774  bool BufferAccumulatorComponentBase ::
775  isConnected_eventOutText_OutputPort(FwIndexType portNum)
776  {
777  FW_ASSERT(
778  (0 <= portNum) && (portNum < this->getNum_eventOutText_OutputPorts()),
779  static_cast<FwAssertArgType>(portNum)
780  );
781 
782  return this->m_eventOutText_OutputPort[portNum].isConnected();
783  }
784 
785 #endif
786 
789  {
790  FW_ASSERT(
791  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
792  static_cast<FwAssertArgType>(portNum)
793  );
794 
795  return this->m_timeCaller_OutputPort[portNum].isConnected();
796  }
797 
800  {
801  FW_ASSERT(
802  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
803  static_cast<FwAssertArgType>(portNum)
804  );
805 
806  return this->m_tlmOut_OutputPort[portNum].isConnected();
807  }
808 
809  // ----------------------------------------------------------------------
810  // Connection status queries for typed output ports
811  // ----------------------------------------------------------------------
812 
815  {
816  FW_ASSERT(
817  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
818  static_cast<FwAssertArgType>(portNum)
819  );
820 
821  return this->m_bufferSendOutDrain_OutputPort[portNum].isConnected();
822  }
823 
826  {
827  FW_ASSERT(
828  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
829  static_cast<FwAssertArgType>(portNum)
830  );
831 
832  return this->m_bufferSendOutReturn_OutputPort[portNum].isConnected();
833  }
834 
837  {
838  FW_ASSERT(
839  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
840  static_cast<FwAssertArgType>(portNum)
841  );
842 
843  return this->m_pingOut_OutputPort[portNum].isConnected();
844  }
845 
846  // ----------------------------------------------------------------------
847  // Port handler base-class functions for typed input ports
848  //
849  // Call these functions directly to bypass the corresponding ports
850  // ----------------------------------------------------------------------
851 
854  FwIndexType portNum,
855  Fw::Buffer& fwBuffer
856  )
857  {
858  // Make sure port number is valid
859  FW_ASSERT(
860  (0 <= portNum) && (portNum < this->getNum_bufferSendInFill_InputPorts()),
861  static_cast<FwAssertArgType>(portNum)
862  );
863 
864  // Call pre-message hook
866  portNum,
867  fwBuffer
868  );
869  ComponentIpcSerializableBuffer msg;
871 
872  // Serialize message ID
873  _status = msg.serializeFrom(
874  static_cast<FwEnumStoreType>(BUFFERSENDINFILL_BUFFERSEND)
875  );
876  FW_ASSERT(
877  _status == Fw::FW_SERIALIZE_OK,
878  static_cast<FwAssertArgType>(_status)
879  );
880 
881  // Serialize port number
882  _status = msg.serializeFrom(portNum);
883  FW_ASSERT(
884  _status == Fw::FW_SERIALIZE_OK,
885  static_cast<FwAssertArgType>(_status)
886  );
887 
888  // Serialize argument fwBuffer
889  _status = msg.serializeFrom(fwBuffer);
890  FW_ASSERT(
891  _status == Fw::FW_SERIALIZE_OK,
892  static_cast<FwAssertArgType>(_status)
893  );
894 
895  // Send message
897  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
898 
899  FW_ASSERT(
900  qStatus == Os::Queue::OP_OK,
901  static_cast<FwAssertArgType>(qStatus)
902  );
903  }
904 
907  FwIndexType portNum,
908  Fw::Buffer& fwBuffer
909  )
910  {
911  // Make sure port number is valid
912  FW_ASSERT(
913  (0 <= portNum) && (portNum < this->getNum_bufferSendInReturn_InputPorts()),
914  static_cast<FwAssertArgType>(portNum)
915  );
916 
917  // Call pre-message hook
919  portNum,
920  fwBuffer
921  );
922  ComponentIpcSerializableBuffer msg;
924 
925  // Serialize message ID
926  _status = msg.serializeFrom(
927  static_cast<FwEnumStoreType>(BUFFERSENDINRETURN_BUFFERSEND)
928  );
929  FW_ASSERT(
930  _status == Fw::FW_SERIALIZE_OK,
931  static_cast<FwAssertArgType>(_status)
932  );
933 
934  // Serialize port number
935  _status = msg.serializeFrom(portNum);
936  FW_ASSERT(
937  _status == Fw::FW_SERIALIZE_OK,
938  static_cast<FwAssertArgType>(_status)
939  );
940 
941  // Serialize argument fwBuffer
942  _status = msg.serializeFrom(fwBuffer);
943  FW_ASSERT(
944  _status == Fw::FW_SERIALIZE_OK,
945  static_cast<FwAssertArgType>(_status)
946  );
947 
948  // Send message
950  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
951 
952  FW_ASSERT(
953  qStatus == Os::Queue::OP_OK,
954  static_cast<FwAssertArgType>(qStatus)
955  );
956  }
957 
960  FwIndexType portNum,
961  U32 key
962  )
963  {
964  // Make sure port number is valid
965  FW_ASSERT(
966  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
967  static_cast<FwAssertArgType>(portNum)
968  );
969 
970  // Call pre-message hook
972  portNum,
973  key
974  );
975  ComponentIpcSerializableBuffer msg;
977 
978  // Serialize message ID
979  _status = msg.serializeFrom(
980  static_cast<FwEnumStoreType>(PINGIN_PING)
981  );
982  FW_ASSERT(
983  _status == Fw::FW_SERIALIZE_OK,
984  static_cast<FwAssertArgType>(_status)
985  );
986 
987  // Serialize port number
988  _status = msg.serializeFrom(portNum);
989  FW_ASSERT(
990  _status == Fw::FW_SERIALIZE_OK,
991  static_cast<FwAssertArgType>(_status)
992  );
993 
994  // Serialize argument key
995  _status = msg.serializeFrom(key);
996  FW_ASSERT(
997  _status == Fw::FW_SERIALIZE_OK,
998  static_cast<FwAssertArgType>(_status)
999  );
1000 
1001  // Send message
1003  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1004 
1005  FW_ASSERT(
1006  qStatus == Os::Queue::OP_OK,
1007  static_cast<FwAssertArgType>(qStatus)
1008  );
1009  }
1010 
1011  // ----------------------------------------------------------------------
1012  // Pre-message hooks for typed async input ports
1013  //
1014  // Each of these functions is invoked just before processing a message
1015  // on the corresponding port. By default, they do nothing. You can
1016  // override them to provide specific pre-message behavior.
1017  // ----------------------------------------------------------------------
1018 
1021  FwIndexType portNum,
1022  Fw::Buffer& fwBuffer
1023  )
1024  {
1025  // Default: no-op
1026  }
1027 
1030  FwIndexType portNum,
1031  Fw::Buffer& fwBuffer
1032  )
1033  {
1034  // Default: no-op
1035  }
1036 
1039  FwIndexType portNum,
1040  U32 key
1041  )
1042  {
1043  // Default: no-op
1044  }
1045 
1046  // ----------------------------------------------------------------------
1047  // Invocation functions for typed output ports
1048  // ----------------------------------------------------------------------
1049 
1052  FwIndexType portNum,
1053  Fw::Buffer& fwBuffer
1054  )
1055  {
1056  FW_ASSERT(
1057  (0 <= portNum) && (portNum < this->getNum_bufferSendOutDrain_OutputPorts()),
1058  static_cast<FwAssertArgType>(portNum)
1059  );
1060 
1061  FW_ASSERT(
1062  this->m_bufferSendOutDrain_OutputPort[portNum].isConnected(),
1063  static_cast<FwAssertArgType>(portNum)
1064  );
1065  this->m_bufferSendOutDrain_OutputPort[portNum].invoke(
1066  fwBuffer
1067  );
1068  }
1069 
1072  FwIndexType portNum,
1073  Fw::Buffer& fwBuffer
1074  )
1075  {
1076  FW_ASSERT(
1077  (0 <= portNum) && (portNum < this->getNum_bufferSendOutReturn_OutputPorts()),
1078  static_cast<FwAssertArgType>(portNum)
1079  );
1080 
1081  FW_ASSERT(
1082  this->m_bufferSendOutReturn_OutputPort[portNum].isConnected(),
1083  static_cast<FwAssertArgType>(portNum)
1084  );
1085  this->m_bufferSendOutReturn_OutputPort[portNum].invoke(
1086  fwBuffer
1087  );
1088  }
1089 
1092  FwIndexType portNum,
1093  U32 key
1094  )
1095  {
1096  FW_ASSERT(
1097  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
1098  static_cast<FwAssertArgType>(portNum)
1099  );
1100 
1101  FW_ASSERT(
1102  this->m_pingOut_OutputPort[portNum].isConnected(),
1103  static_cast<FwAssertArgType>(portNum)
1104  );
1105  this->m_pingOut_OutputPort[portNum].invoke(
1106  key
1107  );
1108  }
1109 
1110  // ----------------------------------------------------------------------
1111  // Command response
1112  // ----------------------------------------------------------------------
1113 
1116  FwOpcodeType opCode,
1117  U32 cmdSeq,
1118  Fw::CmdResponse response
1119  )
1120  {
1121  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1122  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1123  }
1124 
1125  // ----------------------------------------------------------------------
1126  // Command handler base-class functions
1127  //
1128  // Call these functions directly to bypass the command input port
1129  // ----------------------------------------------------------------------
1130 
1133  FwOpcodeType opCode,
1134  U32 cmdSeq,
1135  Fw::CmdArgBuffer& args
1136  )
1137  {
1138  // Call pre-message hook
1139  this->BA_SetMode_preMsgHook(opCode,cmdSeq);
1140 
1141  // Defer deserializing arguments to the message dispatcher
1142  // to avoid deserializing and reserializing just for IPC
1143  ComponentIpcSerializableBuffer msg;
1145 
1146  // Serialize for IPC
1147  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_BA_SETMODE));
1148  FW_ASSERT (
1149  _status == Fw::FW_SERIALIZE_OK,
1150  static_cast<FwAssertArgType>(_status)
1151  );
1152 
1153  // Fake port number to make message dequeue work
1154  FwIndexType port = 0;
1155 
1156  _status = msg.serializeFrom(port);
1157  FW_ASSERT (
1158  _status == Fw::FW_SERIALIZE_OK,
1159  static_cast<FwAssertArgType>(_status)
1160  );
1161 
1162  _status = msg.serializeFrom(opCode);
1163  FW_ASSERT (
1164  _status == Fw::FW_SERIALIZE_OK,
1165  static_cast<FwAssertArgType>(_status)
1166  );
1167 
1168  _status = msg.serializeFrom(cmdSeq);
1169  FW_ASSERT (
1170  _status == Fw::FW_SERIALIZE_OK,
1171  static_cast<FwAssertArgType>(_status)
1172  );
1173 
1174  _status = msg.serializeFrom(args);
1175  FW_ASSERT (
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 
1180  // Send message
1182  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1183 
1184  FW_ASSERT(
1185  qStatus == Os::Queue::OP_OK,
1186  static_cast<FwAssertArgType>(qStatus)
1187  );
1188  }
1189 
1192  FwOpcodeType opCode,
1193  U32 cmdSeq,
1194  Fw::CmdArgBuffer& args
1195  )
1196  {
1197  // Call pre-message hook
1198  this->BA_DrainBuffers_preMsgHook(opCode,cmdSeq);
1199 
1200  // Defer deserializing arguments to the message dispatcher
1201  // to avoid deserializing and reserializing just for IPC
1202  ComponentIpcSerializableBuffer msg;
1204 
1205  // Serialize for IPC
1206  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_BA_DRAINBUFFERS));
1207  FW_ASSERT (
1208  _status == Fw::FW_SERIALIZE_OK,
1209  static_cast<FwAssertArgType>(_status)
1210  );
1211 
1212  // Fake port number to make message dequeue work
1213  FwIndexType port = 0;
1214 
1215  _status = msg.serializeFrom(port);
1216  FW_ASSERT (
1217  _status == Fw::FW_SERIALIZE_OK,
1218  static_cast<FwAssertArgType>(_status)
1219  );
1220 
1221  _status = msg.serializeFrom(opCode);
1222  FW_ASSERT (
1223  _status == Fw::FW_SERIALIZE_OK,
1224  static_cast<FwAssertArgType>(_status)
1225  );
1226 
1227  _status = msg.serializeFrom(cmdSeq);
1228  FW_ASSERT (
1229  _status == Fw::FW_SERIALIZE_OK,
1230  static_cast<FwAssertArgType>(_status)
1231  );
1232 
1233  _status = msg.serializeFrom(args);
1234  FW_ASSERT (
1235  _status == Fw::FW_SERIALIZE_OK,
1236  static_cast<FwAssertArgType>(_status)
1237  );
1238 
1239  // Send message
1241  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1242 
1243  FW_ASSERT(
1244  qStatus == Os::Queue::OP_OK,
1245  static_cast<FwAssertArgType>(qStatus)
1246  );
1247  }
1248 
1249  // ----------------------------------------------------------------------
1250  // Pre-message hooks for async commands
1251  //
1252  // Each of these functions is invoked just before processing the
1253  // corresponding command. By default they do nothing. You can
1254  // override them to provide specific pre-command behavior.
1255  // ----------------------------------------------------------------------
1256 
1259  FwOpcodeType opCode,
1260  U32 cmdSeq
1261  )
1262  {
1263  // Defaults to no-op; can be overridden
1264  (void) opCode;
1265  (void) cmdSeq;
1266  }
1267 
1270  FwOpcodeType opCode,
1271  U32 cmdSeq
1272  )
1273  {
1274  // Defaults to no-op; can be overridden
1275  (void) opCode;
1276  (void) cmdSeq;
1277  }
1278 
1279  // ----------------------------------------------------------------------
1280  // Event logging functions
1281  // ----------------------------------------------------------------------
1282 
1285  {
1286  // Get the time
1287  Fw::Time _logTime;
1288  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1289  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1290  }
1291 
1292  FwEventIdType _id = static_cast<FwEventIdType>(0);
1293 
1294  _id = this->getIdBase() + EVENTID_BA_BUFFERACCEPTED;
1295 
1296  // Emit the event on the log port
1297  if (this->m_eventOut_OutputPort[0].isConnected()) {
1298  Fw::LogBuffer _logBuff;
1299 
1300 #if FW_AMPCS_COMPATIBLE
1302  // Serialize the number of arguments
1303  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1304  FW_ASSERT(
1305  _status == Fw::FW_SERIALIZE_OK,
1306  static_cast<FwAssertArgType>(_status)
1307  );
1308 #endif
1309 
1310  this->m_eventOut_OutputPort[0].invoke(
1311  _id,
1312  _logTime,
1314  _logBuff
1315  );
1316  }
1317 
1318  // Emit the event on the text log port
1319 #if FW_ENABLE_TEXT_LOGGING
1320  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1321 #if FW_OBJECT_NAMES == 1
1322  const char* _formatString =
1323  "(%s) %s: Buffer accepted";
1324 #else
1325  const char* _formatString =
1326  "%s: Buffer accepted";
1327 #endif
1328 
1329  Fw::TextLogString _logString;
1330  _logString.format(
1331  _formatString,
1332 #if FW_OBJECT_NAMES == 1
1333  this->m_objName.toChar(),
1334 #endif
1335  "BA_BufferAccepted "
1336  );
1337 
1338  this->m_eventOutText_OutputPort[0].invoke(
1339  _id,
1340  _logTime,
1342  _logString
1343  );
1344  }
1345 #endif
1346  }
1347 
1350  {
1351  // Get the time
1352  Fw::Time _logTime;
1353  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1354  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1355  }
1356 
1357  FwEventIdType _id = static_cast<FwEventIdType>(0);
1358 
1359  _id = this->getIdBase() + EVENTID_BA_QUEUEFULL;
1360 
1361  // Emit the event on the log port
1362  if (this->m_eventOut_OutputPort[0].isConnected()) {
1363  Fw::LogBuffer _logBuff;
1364 
1365 #if FW_AMPCS_COMPATIBLE
1367  // Serialize the number of arguments
1368  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1369  FW_ASSERT(
1370  _status == Fw::FW_SERIALIZE_OK,
1371  static_cast<FwAssertArgType>(_status)
1372  );
1373 #endif
1374 
1375  this->m_eventOut_OutputPort[0].invoke(
1376  _id,
1377  _logTime,
1379  _logBuff
1380  );
1381  }
1382 
1383  // Emit the event on the text log port
1384 #if FW_ENABLE_TEXT_LOGGING
1385  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1386 #if FW_OBJECT_NAMES == 1
1387  const char* _formatString =
1388  "(%s) %s: Queue full";
1389 #else
1390  const char* _formatString =
1391  "%s: Queue full";
1392 #endif
1393 
1394  Fw::TextLogString _logString;
1395  _logString.format(
1396  _formatString,
1397 #if FW_OBJECT_NAMES == 1
1398  this->m_objName.toChar(),
1399 #endif
1400  "BA_QueueFull "
1401  );
1402 
1403  this->m_eventOutText_OutputPort[0].invoke(
1404  _id,
1405  _logTime,
1407  _logString
1408  );
1409  }
1410 #endif
1411  }
1412 
1415  U32 numDrained,
1416  U32 numToDrain
1417  ) const
1418  {
1419  // Get the time
1420  Fw::Time _logTime;
1421  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1422  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1423  }
1424 
1425  FwEventIdType _id = static_cast<FwEventIdType>(0);
1426 
1427  _id = this->getIdBase() + EVENTID_BA_STILLDRAINING;
1428 
1429  // Emit the event on the log port
1430  if (this->m_eventOut_OutputPort[0].isConnected()) {
1431  Fw::LogBuffer _logBuff;
1433 
1434 #if FW_AMPCS_COMPATIBLE
1435  // Serialize the number of arguments
1436  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1437  FW_ASSERT(
1438  _status == Fw::FW_SERIALIZE_OK,
1439  static_cast<FwAssertArgType>(_status)
1440  );
1441 #endif
1442 
1443 #if FW_AMPCS_COMPATIBLE
1444  // Serialize the argument size
1445  _status = _logBuff.serializeFrom(
1446  static_cast<U8>(sizeof(U32))
1447  );
1448  FW_ASSERT(
1449  _status == Fw::FW_SERIALIZE_OK,
1450  static_cast<FwAssertArgType>(_status)
1451  );
1452 #endif
1453  _status = _logBuff.serializeFrom(numDrained);
1454  FW_ASSERT(
1455  _status == Fw::FW_SERIALIZE_OK,
1456  static_cast<FwAssertArgType>(_status)
1457  );
1458 
1459 #if FW_AMPCS_COMPATIBLE
1460  // Serialize the argument size
1461  _status = _logBuff.serializeFrom(
1462  static_cast<U8>(sizeof(U32))
1463  );
1464  FW_ASSERT(
1465  _status == Fw::FW_SERIALIZE_OK,
1466  static_cast<FwAssertArgType>(_status)
1467  );
1468 #endif
1469  _status = _logBuff.serializeFrom(numToDrain);
1470  FW_ASSERT(
1471  _status == Fw::FW_SERIALIZE_OK,
1472  static_cast<FwAssertArgType>(_status)
1473  );
1474 
1475  this->m_eventOut_OutputPort[0].invoke(
1476  _id,
1477  _logTime,
1479  _logBuff
1480  );
1481  }
1482 
1483  // Emit the event on the text log port
1484 #if FW_ENABLE_TEXT_LOGGING
1485  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1486 #if FW_OBJECT_NAMES == 1
1487  const char* _formatString =
1488  "(%s) %s: Still draining %" PRIu32 " of %" PRIu32 "";
1489 #else
1490  const char* _formatString =
1491  "%s: Still draining %" PRIu32 " of %" PRIu32 "";
1492 #endif
1493 
1494  Fw::TextLogString _logString;
1495  _logString.format(
1496  _formatString,
1497 #if FW_OBJECT_NAMES == 1
1498  this->m_objName.toChar(),
1499 #endif
1500  "BA_StillDraining ",
1501  numDrained,
1502  numToDrain
1503  );
1504 
1505  this->m_eventOutText_OutputPort[0].invoke(
1506  _id,
1507  _logTime,
1509  _logString
1510  );
1511  }
1512 #endif
1513  }
1514 
1517  {
1518  // Get the time
1519  Fw::Time _logTime;
1520  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1521  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1522  }
1523 
1524  FwEventIdType _id = static_cast<FwEventIdType>(0);
1525 
1526  _id = this->getIdBase() + EVENTID_BA_ALREADYDRAINING;
1527 
1528  // Emit the event on the log port
1529  if (this->m_eventOut_OutputPort[0].isConnected()) {
1530  Fw::LogBuffer _logBuff;
1531 
1532 #if FW_AMPCS_COMPATIBLE
1534  // Serialize the number of arguments
1535  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1536  FW_ASSERT(
1537  _status == Fw::FW_SERIALIZE_OK,
1538  static_cast<FwAssertArgType>(_status)
1539  );
1540 #endif
1541 
1542  this->m_eventOut_OutputPort[0].invoke(
1543  _id,
1544  _logTime,
1546  _logBuff
1547  );
1548  }
1549 
1550  // Emit the event on the text log port
1551 #if FW_ENABLE_TEXT_LOGGING
1552  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1553 #if FW_OBJECT_NAMES == 1
1554  const char* _formatString =
1555  "(%s) %s: Already in DRAIN mode";
1556 #else
1557  const char* _formatString =
1558  "%s: Already in DRAIN mode";
1559 #endif
1560 
1561  Fw::TextLogString _logString;
1562  _logString.format(
1563  _formatString,
1564 #if FW_OBJECT_NAMES == 1
1565  this->m_objName.toChar(),
1566 #endif
1567  "BA_AlreadyDraining "
1568  );
1569 
1570  this->m_eventOutText_OutputPort[0].invoke(
1571  _id,
1572  _logTime,
1574  _logString
1575  );
1576  }
1577 #endif
1578  }
1579 
1582  U32 numDrained,
1583  U32 numToDrain
1584  ) const
1585  {
1586  // Get the time
1587  Fw::Time _logTime;
1588  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1589  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1590  }
1591 
1592  FwEventIdType _id = static_cast<FwEventIdType>(0);
1593 
1594  _id = this->getIdBase() + EVENTID_BA_DRAINSTALLED;
1595 
1596  // Emit the event on the log port
1597  if (this->m_eventOut_OutputPort[0].isConnected()) {
1598  Fw::LogBuffer _logBuff;
1600 
1601 #if FW_AMPCS_COMPATIBLE
1602  // Serialize the number of arguments
1603  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1604  FW_ASSERT(
1605  _status == Fw::FW_SERIALIZE_OK,
1606  static_cast<FwAssertArgType>(_status)
1607  );
1608 #endif
1609 
1610 #if FW_AMPCS_COMPATIBLE
1611  // Serialize the argument size
1612  _status = _logBuff.serializeFrom(
1613  static_cast<U8>(sizeof(U32))
1614  );
1615  FW_ASSERT(
1616  _status == Fw::FW_SERIALIZE_OK,
1617  static_cast<FwAssertArgType>(_status)
1618  );
1619 #endif
1620  _status = _logBuff.serializeFrom(numDrained);
1621  FW_ASSERT(
1622  _status == Fw::FW_SERIALIZE_OK,
1623  static_cast<FwAssertArgType>(_status)
1624  );
1625 
1626 #if FW_AMPCS_COMPATIBLE
1627  // Serialize the argument size
1628  _status = _logBuff.serializeFrom(
1629  static_cast<U8>(sizeof(U32))
1630  );
1631  FW_ASSERT(
1632  _status == Fw::FW_SERIALIZE_OK,
1633  static_cast<FwAssertArgType>(_status)
1634  );
1635 #endif
1636  _status = _logBuff.serializeFrom(numToDrain);
1637  FW_ASSERT(
1638  _status == Fw::FW_SERIALIZE_OK,
1639  static_cast<FwAssertArgType>(_status)
1640  );
1641 
1642  this->m_eventOut_OutputPort[0].invoke(
1643  _id,
1644  _logTime,
1646  _logBuff
1647  );
1648  }
1649 
1650  // Emit the event on the text log port
1651 #if FW_ENABLE_TEXT_LOGGING
1652  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1653 #if FW_OBJECT_NAMES == 1
1654  const char* _formatString =
1655  "(%s) %s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1656 #else
1657  const char* _formatString =
1658  "%s: Drain stalling - only drained %" PRIu32 " of %" PRIu32 "";
1659 #endif
1660 
1661  Fw::TextLogString _logString;
1662  _logString.format(
1663  _formatString,
1664 #if FW_OBJECT_NAMES == 1
1665  this->m_objName.toChar(),
1666 #endif
1667  "BA_DrainStalled ",
1668  numDrained,
1669  numToDrain
1670  );
1671 
1672  this->m_eventOutText_OutputPort[0].invoke(
1673  _id,
1674  _logTime,
1676  _logString
1677  );
1678  }
1679 #endif
1680  }
1681 
1684  {
1685  // Get the time
1686  Fw::Time _logTime;
1687  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1688  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1689  }
1690 
1691  FwEventIdType _id = static_cast<FwEventIdType>(0);
1692 
1693  _id = this->getIdBase() + EVENTID_BA_PARTIALDRAINDONE;
1694 
1695  // Emit the event on the log port
1696  if (this->m_eventOut_OutputPort[0].isConnected()) {
1697  Fw::LogBuffer _logBuff;
1699 
1700 #if FW_AMPCS_COMPATIBLE
1701  // Serialize the number of arguments
1702  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1703  FW_ASSERT(
1704  _status == Fw::FW_SERIALIZE_OK,
1705  static_cast<FwAssertArgType>(_status)
1706  );
1707 #endif
1708 
1709 #if FW_AMPCS_COMPATIBLE
1710  // Serialize the argument size
1711  _status = _logBuff.serializeFrom(
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.serializeFrom(numDrained);
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: Partial drain of %" PRIu32 " finished";
1739 #else
1740  const char* _formatString =
1741  "%s: Partial drain of %" PRIu32 " finished";
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_PartialDrainDone ",
1751  numDrained
1752  );
1753 
1754  this->m_eventOutText_OutputPort[0].invoke(
1755  _id,
1756  _logTime,
1758  _logString
1759  );
1760  }
1761 #endif
1762  }
1763 
1766  U32 numWillDrain,
1767  U32 numReqDrain
1768  ) const
1769  {
1770  // Get the time
1771  Fw::Time _logTime;
1772  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1773  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1774  }
1775 
1776  FwEventIdType _id = static_cast<FwEventIdType>(0);
1777 
1778  _id = this->getIdBase() + EVENTID_BA_NONBLOCKDRAIN;
1779 
1780  // Emit the event on the log port
1781  if (this->m_eventOut_OutputPort[0].isConnected()) {
1782  Fw::LogBuffer _logBuff;
1784 
1785 #if FW_AMPCS_COMPATIBLE
1786  // Serialize the number of arguments
1787  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1788  FW_ASSERT(
1789  _status == Fw::FW_SERIALIZE_OK,
1790  static_cast<FwAssertArgType>(_status)
1791  );
1792 #endif
1793 
1794 #if FW_AMPCS_COMPATIBLE
1795  // Serialize the argument size
1796  _status = _logBuff.serializeFrom(
1797  static_cast<U8>(sizeof(U32))
1798  );
1799  FW_ASSERT(
1800  _status == Fw::FW_SERIALIZE_OK,
1801  static_cast<FwAssertArgType>(_status)
1802  );
1803 #endif
1804  _status = _logBuff.serializeFrom(numWillDrain);
1805  FW_ASSERT(
1806  _status == Fw::FW_SERIALIZE_OK,
1807  static_cast<FwAssertArgType>(_status)
1808  );
1809 
1810 #if FW_AMPCS_COMPATIBLE
1811  // Serialize the argument size
1812  _status = _logBuff.serializeFrom(
1813  static_cast<U8>(sizeof(U32))
1814  );
1815  FW_ASSERT(
1816  _status == Fw::FW_SERIALIZE_OK,
1817  static_cast<FwAssertArgType>(_status)
1818  );
1819 #endif
1820  _status = _logBuff.serializeFrom(numReqDrain);
1821  FW_ASSERT(
1822  _status == Fw::FW_SERIALIZE_OK,
1823  static_cast<FwAssertArgType>(_status)
1824  );
1825 
1826  this->m_eventOut_OutputPort[0].invoke(
1827  _id,
1828  _logTime,
1830  _logBuff
1831  );
1832  }
1833 
1834  // Emit the event on the text log port
1835 #if FW_ENABLE_TEXT_LOGGING
1836  if (this->m_eventOutText_OutputPort[0].isConnected()) {
1837 #if FW_OBJECT_NAMES == 1
1838  const char* _formatString =
1839  "(%s) %s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1840 #else
1841  const char* _formatString =
1842  "%s: Only have %" PRIu32 "; requested drain of %" PRIu32 "";
1843 #endif
1844 
1845  Fw::TextLogString _logString;
1846  _logString.format(
1847  _formatString,
1848 #if FW_OBJECT_NAMES == 1
1849  this->m_objName.toChar(),
1850 #endif
1851  "BA_NonBlockDrain ",
1852  numWillDrain,
1853  numReqDrain
1854  );
1855 
1856  this->m_eventOutText_OutputPort[0].invoke(
1857  _id,
1858  _logTime,
1860  _logString
1861  );
1862  }
1863 #endif
1864  }
1865 
1866  // ----------------------------------------------------------------------
1867  // Telemetry write functions
1868  // ----------------------------------------------------------------------
1869 
1872  U32 arg,
1873  Fw::Time _tlmTime
1874  ) const
1875  {
1876  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1877  if (
1878  this->m_timeCaller_OutputPort[0].isConnected() &&
1879  (_tlmTime == Fw::ZERO_TIME)
1880  ) {
1881  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1882  }
1883 
1884  Fw::TlmBuffer _tlmBuff;
1885  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1886  FW_ASSERT(
1887  _stat == Fw::FW_SERIALIZE_OK,
1888  static_cast<FwAssertArgType>(_stat)
1889  );
1890 
1891  FwChanIdType _id;
1892 
1893  _id = this->getIdBase() + CHANNELID_BA_NUMQUEUEDBUFFERS;
1894 
1895  this->m_tlmOut_OutputPort[0].invoke(
1896  _id,
1897  _tlmTime,
1898  _tlmBuff
1899  );
1900  }
1901  }
1902 
1903  // ----------------------------------------------------------------------
1904  // Time
1905  // ----------------------------------------------------------------------
1906 
1908  getTime() const
1909  {
1910  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1911  Fw::Time _time;
1912  this->m_timeCaller_OutputPort[0].invoke(_time);
1913  return _time;
1914  }
1915  else {
1916  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1917  }
1918  }
1919 
1920  // ----------------------------------------------------------------------
1921  // Message dispatch functions
1922  // ----------------------------------------------------------------------
1923 
1924  Fw::QueuedComponentBase::MsgDispatchStatus BufferAccumulatorComponentBase ::
1925  doDispatch()
1926  {
1927  ComponentIpcSerializableBuffer _msg;
1928  FwQueuePriorityType _priority = 0;
1929 
1930  Os::Queue::Status _msgStatus = this->m_queue.receive(
1931  _msg,
1933  _priority
1934  );
1935  FW_ASSERT(
1936  _msgStatus == Os::Queue::OP_OK,
1937  static_cast<FwAssertArgType>(_msgStatus)
1938  );
1939 
1940  // Reset to beginning of buffer
1941  _msg.resetDeser();
1942 
1943  FwEnumStoreType _desMsg = 0;
1944  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1945  FW_ASSERT(
1946  _deserStatus == Fw::FW_SERIALIZE_OK,
1947  static_cast<FwAssertArgType>(_deserStatus)
1948  );
1949 
1950  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1951 
1952  if (_msgType == BUFFERACCUMULATOR_COMPONENT_EXIT) {
1953  return MSG_DISPATCH_EXIT;
1954  }
1955 
1956  FwIndexType portNum = 0;
1957  _deserStatus = _msg.deserializeTo(portNum);
1958  FW_ASSERT(
1959  _deserStatus == Fw::FW_SERIALIZE_OK,
1960  static_cast<FwAssertArgType>(_deserStatus)
1961  );
1962 
1963  switch (_msgType) {
1964  // Handle async input port bufferSendInFill
1965  case BUFFERSENDINFILL_BUFFERSEND: {
1966  // Deserialize argument fwBuffer
1967  Fw::Buffer fwBuffer;
1968  _deserStatus = _msg.deserializeTo(fwBuffer);
1969  FW_ASSERT(
1970  _deserStatus == Fw::FW_SERIALIZE_OK,
1971  static_cast<FwAssertArgType>(_deserStatus)
1972  );
1973  // Call handler function
1975  portNum,
1976  fwBuffer
1977  );
1978 
1979  break;
1980  }
1981 
1982  // Handle async input port bufferSendInReturn
1983  case BUFFERSENDINRETURN_BUFFERSEND: {
1984  // Deserialize argument fwBuffer
1985  Fw::Buffer fwBuffer;
1986  _deserStatus = _msg.deserializeTo(fwBuffer);
1987  FW_ASSERT(
1988  _deserStatus == Fw::FW_SERIALIZE_OK,
1989  static_cast<FwAssertArgType>(_deserStatus)
1990  );
1991  // Call handler function
1993  portNum,
1994  fwBuffer
1995  );
1996 
1997  break;
1998  }
1999 
2000  // Handle async input port pingIn
2001  case PINGIN_PING: {
2002  // Deserialize argument key
2003  U32 key;
2004  _deserStatus = _msg.deserializeTo(key);
2005  FW_ASSERT(
2006  _deserStatus == Fw::FW_SERIALIZE_OK,
2007  static_cast<FwAssertArgType>(_deserStatus)
2008  );
2009  // Call handler function
2010  this->pingIn_handler(
2011  portNum,
2012  key
2013  );
2014 
2015  break;
2016  }
2017 
2018  // Handle command BA_SetMode
2019  case CMD_BA_SETMODE: {
2020  // Deserialize opcode
2021  FwOpcodeType _opCode = 0;
2022  _deserStatus = _msg.deserializeTo(_opCode);
2023  FW_ASSERT (
2024  _deserStatus == Fw::FW_SERIALIZE_OK,
2025  static_cast<FwAssertArgType>(_deserStatus)
2026  );
2027 
2028  // Deserialize command sequence
2029  U32 _cmdSeq = 0;
2030  _deserStatus = _msg.deserializeTo(_cmdSeq);
2031  FW_ASSERT (
2032  _deserStatus == Fw::FW_SERIALIZE_OK,
2033  static_cast<FwAssertArgType>(_deserStatus)
2034  );
2035 
2036  // Deserialize command argument buffer
2037  Fw::CmdArgBuffer args;
2038  _deserStatus = _msg.deserializeTo(args);
2039  FW_ASSERT (
2040  _deserStatus == Fw::FW_SERIALIZE_OK,
2041  static_cast<FwAssertArgType>(_deserStatus)
2042  );
2043 
2044  // Reset buffer
2045  args.resetDeser();
2046 
2047  // Deserialize argument mode
2049  _deserStatus = args.deserializeTo(mode);
2050  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2051  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2052  this->cmdResponse_out(
2053  _opCode,
2054  _cmdSeq,
2056  );
2057  }
2058  // Don't crash the task if bad arguments were passed from the ground
2059  break;
2060  }
2061 
2062  // Make sure there was no data left over.
2063  // That means the argument buffer size was incorrect.
2064 #if FW_CMD_CHECK_RESIDUAL
2065  if (args.getDeserializeSizeLeft() != 0) {
2066  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2067  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2068  }
2069  // Don't crash the task if bad arguments were passed from the ground
2070  break;
2071  }
2072 #endif
2073 
2074  // Call handler function
2075  this->BA_SetMode_cmdHandler(
2076  _opCode, _cmdSeq,
2077  mode
2078  );
2079 
2080  break;
2081  }
2082 
2083  // Handle command BA_DrainBuffers
2084  case CMD_BA_DRAINBUFFERS: {
2085  // Deserialize opcode
2086  FwOpcodeType _opCode = 0;
2087  _deserStatus = _msg.deserializeTo(_opCode);
2088  FW_ASSERT (
2089  _deserStatus == Fw::FW_SERIALIZE_OK,
2090  static_cast<FwAssertArgType>(_deserStatus)
2091  );
2092 
2093  // Deserialize command sequence
2094  U32 _cmdSeq = 0;
2095  _deserStatus = _msg.deserializeTo(_cmdSeq);
2096  FW_ASSERT (
2097  _deserStatus == Fw::FW_SERIALIZE_OK,
2098  static_cast<FwAssertArgType>(_deserStatus)
2099  );
2100 
2101  // Deserialize command argument buffer
2102  Fw::CmdArgBuffer args;
2103  _deserStatus = _msg.deserializeTo(args);
2104  FW_ASSERT (
2105  _deserStatus == Fw::FW_SERIALIZE_OK,
2106  static_cast<FwAssertArgType>(_deserStatus)
2107  );
2108 
2109  // Reset buffer
2110  args.resetDeser();
2111 
2112  // Deserialize argument numToDrain
2113  U32 numToDrain;
2114  _deserStatus = args.deserializeTo(numToDrain);
2115  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2116  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2117  this->cmdResponse_out(
2118  _opCode,
2119  _cmdSeq,
2121  );
2122  }
2123  // Don't crash the task if bad arguments were passed from the ground
2124  break;
2125  }
2126 
2127  // Deserialize argument blockMode
2129  _deserStatus = args.deserializeTo(blockMode);
2130  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2131  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2132  this->cmdResponse_out(
2133  _opCode,
2134  _cmdSeq,
2136  );
2137  }
2138  // Don't crash the task if bad arguments were passed from the ground
2139  break;
2140  }
2141 
2142  // Make sure there was no data left over.
2143  // That means the argument buffer size was incorrect.
2144 #if FW_CMD_CHECK_RESIDUAL
2145  if (args.getDeserializeSizeLeft() != 0) {
2146  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
2147  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2148  }
2149  // Don't crash the task if bad arguments were passed from the ground
2150  break;
2151  }
2152 #endif
2153 
2154  // Call handler function
2156  _opCode, _cmdSeq,
2157  numToDrain,
2158  blockMode
2159  );
2160 
2161  break;
2162  }
2163 
2164  default:
2165  return MSG_DISPATCH_ERROR;
2166  }
2167 
2168  return MSG_DISPATCH_OK;
2169  }
2170 
2171  // ----------------------------------------------------------------------
2172  // Calls for messages received on special input ports
2173  // ----------------------------------------------------------------------
2174 
2175  void BufferAccumulatorComponentBase ::
2176  m_p_cmdIn_in(
2177  Fw::PassiveComponentBase* callComp,
2178  FwIndexType portNum,
2179  FwOpcodeType opCode,
2180  U32 cmdSeq,
2181  Fw::CmdArgBuffer& args
2182  )
2183  {
2184  FW_ASSERT(callComp);
2185  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2186 
2187  const U32 idBase = callComp->getIdBase();
2188  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2189 
2190  // Select base class function based on opcode
2191  switch (opCode - idBase) {
2192  case OPCODE_BA_SETMODE: {
2193  compPtr->BA_SetMode_cmdHandlerBase(
2194  opCode,
2195  cmdSeq,
2196  args
2197  );
2198  break;
2199  }
2200 
2201  case OPCODE_BA_DRAINBUFFERS: {
2202  compPtr->BA_DrainBuffers_cmdHandlerBase(
2203  opCode,
2204  cmdSeq,
2205  args
2206  );
2207  break;
2208  }
2209  }
2210  }
2211 
2212  // ----------------------------------------------------------------------
2213  // Calls for messages received on typed input ports
2214  // ----------------------------------------------------------------------
2215 
2216  void BufferAccumulatorComponentBase ::
2217  m_p_bufferSendInFill_in(
2218  Fw::PassiveComponentBase* callComp,
2219  FwIndexType portNum,
2220  Fw::Buffer& fwBuffer
2221  )
2222  {
2223  FW_ASSERT(callComp);
2224  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2225  compPtr->bufferSendInFill_handlerBase(
2226  portNum,
2227  fwBuffer
2228  );
2229  }
2230 
2231  void BufferAccumulatorComponentBase ::
2232  m_p_bufferSendInReturn_in(
2233  Fw::PassiveComponentBase* callComp,
2234  FwIndexType portNum,
2235  Fw::Buffer& fwBuffer
2236  )
2237  {
2238  FW_ASSERT(callComp);
2239  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2240  compPtr->bufferSendInReturn_handlerBase(
2241  portNum,
2242  fwBuffer
2243  );
2244  }
2245 
2246  void BufferAccumulatorComponentBase ::
2247  m_p_pingIn_in(
2248  Fw::PassiveComponentBase* callComp,
2249  FwIndexType portNum,
2250  U32 key
2251  )
2252  {
2253  FW_ASSERT(callComp);
2254  BufferAccumulatorComponentBase* compPtr = static_cast<BufferAccumulatorComponentBase*>(callComp);
2255  compPtr->pingIn_handlerBase(
2256  portNum,
2257  key
2258  );
2259  }
2260 
2261 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
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
static constexpr FwIndexType getNum_pingIn_InputPorts()
bool isConnected_bufferSendOutDrain_OutputPort(FwIndexType portNum)
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:26
virtual void bufferSendInReturn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferSendInReturn.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
static constexpr FwIndexType getNum_eventOut_OutputPorts()
PlatformSizeType FwSizeType
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
virtual ~BufferAccumulatorComponentBase()
Destroy BufferAccumulatorComponentBase object.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_bufferSendInReturn_InputPorts()
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
Got DrainBuffers command while executing DrainBuffers command.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
static constexpr FwIndexType getNum_pingOut_OutputPorts()
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
const Time ZERO_TIME
Definition: Time.cpp:5
static constexpr FwIndexType getNum_bufferSendInFill_InputPorts()
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void log_ACTIVITY_HI_BA_PartialDrainDone(U32 numDrained) const
Enum representing a command response.
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
BufferAccumulatorComponentBase(const char *compName="")
Construct BufferAccumulatorComponentBase object.
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:24
SerializeStatus
forward declaration for string
void log_WARNING_LO_BA_NonBlockDrain(U32 numWillDrain, U32 numReqDrain) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
Message will block until space is available.
Definition: Queue.hpp:47
static constexpr FwIndexType getNum_bufferSendOutDrain_OutputPorts()
FwIdType FwEventIdType
The type of an event identifier.
void invoke(FwOpcodeType opCode) const
Invoke a port 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.
Ran out of buffers while executing DrainBuffers command.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
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.
The Buffer Accumulator instance received a buffer when its queue was full. To avoid uncontrolled send...
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)
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
message to exit active component task
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
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:54
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
A serious but recoverable event.
void BA_SetMode_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
static constexpr FwIndexType getNum_cmdIn_InputPorts()
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:38
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
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:53
BlockingType
message type
Definition: Queue.hpp:46
bool isConnected_bufferSendOutReturn_OutputPort(FwIndexType portNum)
Command failed to deserialize.
Not enough buffers to complete requested drain, and NOBLOCK was set; will only drain what we have...
void set_bufferSendOutDrain_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferSendOutDrain[portNum].
The Buffer Accumulator instance accepted and enqueued a buffer. To avoid uncontrolled sending of even...
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Important informational events.
void init()
Initialization function.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
Fw::InputBufferSendPort * get_bufferSendInReturn_InputPort(FwIndexType portNum)
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
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.
The size of the serial representations of the port arguments.
A message was sent requesting an exit of the loop.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_bufferSendOutReturn_OutputPorts()
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
Fw::InputBufferSendPort * get_bufferSendInFill_InputPort(FwIndexType portNum)
void init()
Initialization function.
void log_WARNING_HI_BA_DrainStalled(U32 numDrained, U32 numToDrain) const
void init()
Initialization function.
Definition: PingPortAc.cpp:56
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
U8 BYTE
byte type
Definition: BasicTypes.h:56
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:48
Implementation of malloc based allocator.
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.