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