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