F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DpManagerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title DpManagerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for DpManager 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  DPMANAGER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  PRODUCTREQUESTIN_DPREQUEST,
20  PRODUCTSENDIN_DPSEND,
21  SCHEDIN_SCHED,
22  CMD_CLEAR_EVENT_THROTTLE,
23  };
24 
25  // Get the max size by constructing a union of the async input, command, and
26  // internal port serialization sizes
27  union BuffUnion {
28  BYTE productRequestInPortSize[Fw::InputDpRequestPort::SERIALIZED_SIZE];
29  BYTE productSendInPortSize[Fw::InputDpSendPort::SERIALIZED_SIZE];
32  };
33 
34  // Define a message buffer class large enough to handle all the
35  // asynchronous inputs to the component
36  class ComponentIpcSerializableBuffer :
38  {
39 
40  public:
41 
42  enum {
43  // Offset into data in buffer: Size of message ID and port number
44  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
45  // Max data size
46  MAX_DATA_SIZE = sizeof(BuffUnion),
47  // Max message size: Size of message id + size of port + max data size
48  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
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 
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 productGetIn
108  for (
109  FwIndexType port = 0;
110  port < static_cast<FwIndexType>(this->getNum_productGetIn_InputPorts());
111  port++
112  ) {
113  this->m_productGetIn_InputPort[port].init();
114  this->m_productGetIn_InputPort[port].addCallComp(
115  this,
116  m_p_productGetIn_in
117  );
118  this->m_productGetIn_InputPort[port].setPortNum(port);
119 
120 #if FW_OBJECT_NAMES == 1
121  Fw::ObjectName portName;
122  portName.format(
123  "%s_productGetIn_InputPort[%" PRI_PlatformIntType "]",
124  this->m_objName.toChar(),
125  port
126  );
127  this->m_productGetIn_InputPort[port].setObjName(portName.toChar());
128 #endif
129  }
130 
131  // Connect input port productRequestIn
132  for (
133  FwIndexType port = 0;
134  port < static_cast<FwIndexType>(this->getNum_productRequestIn_InputPorts());
135  port++
136  ) {
137  this->m_productRequestIn_InputPort[port].init();
138  this->m_productRequestIn_InputPort[port].addCallComp(
139  this,
140  m_p_productRequestIn_in
141  );
142  this->m_productRequestIn_InputPort[port].setPortNum(port);
143 
144 #if FW_OBJECT_NAMES == 1
145  Fw::ObjectName portName;
146  portName.format(
147  "%s_productRequestIn_InputPort[%" PRI_PlatformIntType "]",
148  this->m_objName.toChar(),
149  port
150  );
151  this->m_productRequestIn_InputPort[port].setObjName(portName.toChar());
152 #endif
153  }
154 
155  // Connect input port productSendIn
156  for (
157  FwIndexType port = 0;
158  port < static_cast<FwIndexType>(this->getNum_productSendIn_InputPorts());
159  port++
160  ) {
161  this->m_productSendIn_InputPort[port].init();
162  this->m_productSendIn_InputPort[port].addCallComp(
163  this,
164  m_p_productSendIn_in
165  );
166  this->m_productSendIn_InputPort[port].setPortNum(port);
167 
168 #if FW_OBJECT_NAMES == 1
169  Fw::ObjectName portName;
170  portName.format(
171  "%s_productSendIn_InputPort[%" PRI_PlatformIntType "]",
172  this->m_objName.toChar(),
173  port
174  );
175  this->m_productSendIn_InputPort[port].setObjName(portName.toChar());
176 #endif
177  }
178 
179  // Connect input port schedIn
180  for (
181  FwIndexType port = 0;
182  port < static_cast<FwIndexType>(this->getNum_schedIn_InputPorts());
183  port++
184  ) {
185  this->m_schedIn_InputPort[port].init();
186  this->m_schedIn_InputPort[port].addCallComp(
187  this,
188  m_p_schedIn_in
189  );
190  this->m_schedIn_InputPort[port].setPortNum(port);
191 
192 #if FW_OBJECT_NAMES == 1
193  Fw::ObjectName portName;
194  portName.format(
195  "%s_schedIn_InputPort[%" PRI_PlatformIntType "]",
196  this->m_objName.toChar(),
197  port
198  );
199  this->m_schedIn_InputPort[port].setObjName(portName.toChar());
200 #endif
201  }
202 
203  // Connect output port cmdRegIn
204  for (
205  FwIndexType port = 0;
206  port < static_cast<FwIndexType>(this->getNum_cmdRegIn_OutputPorts());
207  port++
208  ) {
209  this->m_cmdRegIn_OutputPort[port].init();
210 
211 #if FW_OBJECT_NAMES == 1
212  Fw::ObjectName portName;
213  portName.format(
214  "%s_cmdRegIn_OutputPort[%" PRI_PlatformIntType "]",
215  this->m_objName.toChar(),
216  port
217  );
218  this->m_cmdRegIn_OutputPort[port].setObjName(portName.toChar());
219 #endif
220  }
221 
222  // Connect output port cmdResponseOut
223  for (
224  FwIndexType port = 0;
225  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
226  port++
227  ) {
228  this->m_cmdResponseOut_OutputPort[port].init();
229 
230 #if FW_OBJECT_NAMES == 1
231  Fw::ObjectName portName;
232  portName.format(
233  "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]",
234  this->m_objName.toChar(),
235  port
236  );
237  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
238 #endif
239  }
240 
241  // Connect output port eventOut
242  for (
243  FwIndexType port = 0;
244  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
245  port++
246  ) {
247  this->m_eventOut_OutputPort[port].init();
248 
249 #if FW_OBJECT_NAMES == 1
250  Fw::ObjectName portName;
251  portName.format(
252  "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]",
253  this->m_objName.toChar(),
254  port
255  );
256  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
257 #endif
258  }
259 
260 #if FW_ENABLE_TEXT_LOGGING == 1
261  // Connect output port textEventOut
262  for (
263  FwIndexType port = 0;
264  port < static_cast<FwIndexType>(this->getNum_textEventOut_OutputPorts());
265  port++
266  ) {
267  this->m_textEventOut_OutputPort[port].init();
268 
269 #if FW_OBJECT_NAMES == 1
270  Fw::ObjectName portName;
271  portName.format(
272  "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]",
273  this->m_objName.toChar(),
274  port
275  );
276  this->m_textEventOut_OutputPort[port].setObjName(portName.toChar());
277 #endif
278  }
279 #endif
280 
281  // Connect output port timeGetOut
282  for (
283  FwIndexType port = 0;
284  port < static_cast<FwIndexType>(this->getNum_timeGetOut_OutputPorts());
285  port++
286  ) {
287  this->m_timeGetOut_OutputPort[port].init();
288 
289 #if FW_OBJECT_NAMES == 1
290  Fw::ObjectName portName;
291  portName.format(
292  "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]",
293  this->m_objName.toChar(),
294  port
295  );
296  this->m_timeGetOut_OutputPort[port].setObjName(portName.toChar());
297 #endif
298  }
299 
300  // Connect output port tlmOut
301  for (
302  FwIndexType port = 0;
303  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
304  port++
305  ) {
306  this->m_tlmOut_OutputPort[port].init();
307 
308 #if FW_OBJECT_NAMES == 1
309  Fw::ObjectName portName;
310  portName.format(
311  "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
312  this->m_objName.toChar(),
313  port
314  );
315  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
316 #endif
317  }
318 
319  // Connect output port bufferGetOut
320  for (
321  FwIndexType port = 0;
322  port < static_cast<FwIndexType>(this->getNum_bufferGetOut_OutputPorts());
323  port++
324  ) {
325  this->m_bufferGetOut_OutputPort[port].init();
326 
327 #if FW_OBJECT_NAMES == 1
328  Fw::ObjectName portName;
329  portName.format(
330  "%s_bufferGetOut_OutputPort[%" PRI_PlatformIntType "]",
331  this->m_objName.toChar(),
332  port
333  );
334  this->m_bufferGetOut_OutputPort[port].setObjName(portName.toChar());
335 #endif
336  }
337 
338  // Connect output port productResponseOut
339  for (
340  FwIndexType port = 0;
341  port < static_cast<FwIndexType>(this->getNum_productResponseOut_OutputPorts());
342  port++
343  ) {
344  this->m_productResponseOut_OutputPort[port].init();
345 
346 #if FW_OBJECT_NAMES == 1
347  Fw::ObjectName portName;
348  portName.format(
349  "%s_productResponseOut_OutputPort[%" PRI_PlatformIntType "]",
350  this->m_objName.toChar(),
351  port
352  );
353  this->m_productResponseOut_OutputPort[port].setObjName(portName.toChar());
354 #endif
355  }
356 
357  // Connect output port productSendOut
358  for (
359  FwIndexType port = 0;
360  port < static_cast<FwIndexType>(this->getNum_productSendOut_OutputPorts());
361  port++
362  ) {
363  this->m_productSendOut_OutputPort[port].init();
364 
365 #if FW_OBJECT_NAMES == 1
366  Fw::ObjectName portName;
367  portName.format(
368  "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]",
369  this->m_objName.toChar(),
370  port
371  );
372  this->m_productSendOut_OutputPort[port].setObjName(portName.toChar());
373 #endif
374  }
375 
376  // Create the queue
377  Os::Queue::Status qStat = this->createQueue(
378  queueDepth,
379  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
380  );
381  FW_ASSERT(
382  Os::Queue::Status::OP_OK == qStat,
383  static_cast<FwAssertArgType>(qStat)
384  );
385  }
386 
387  // ----------------------------------------------------------------------
388  // Getters for special input ports
389  // ----------------------------------------------------------------------
390 
393  {
394  FW_ASSERT(
395  portNum < this->getNum_cmdIn_InputPorts(),
396  static_cast<FwAssertArgType>(portNum)
397  );
398 
399  return &this->m_cmdIn_InputPort[portNum];
400  }
401 
402  // ----------------------------------------------------------------------
403  // Getters for typed input ports
404  // ----------------------------------------------------------------------
405 
408  {
409  FW_ASSERT(
410  portNum < this->getNum_productGetIn_InputPorts(),
411  static_cast<FwAssertArgType>(portNum)
412  );
413 
414  return &this->m_productGetIn_InputPort[portNum];
415  }
416 
419  {
420  FW_ASSERT(
421  portNum < this->getNum_productRequestIn_InputPorts(),
422  static_cast<FwAssertArgType>(portNum)
423  );
424 
425  return &this->m_productRequestIn_InputPort[portNum];
426  }
427 
430  {
431  FW_ASSERT(
432  portNum < this->getNum_productSendIn_InputPorts(),
433  static_cast<FwAssertArgType>(portNum)
434  );
435 
436  return &this->m_productSendIn_InputPort[portNum];
437  }
438 
441  {
442  FW_ASSERT(
443  portNum < this->getNum_schedIn_InputPorts(),
444  static_cast<FwAssertArgType>(portNum)
445  );
446 
447  return &this->m_schedIn_InputPort[portNum];
448  }
449 
450  // ----------------------------------------------------------------------
451  // Connect input ports to special output ports
452  // ----------------------------------------------------------------------
453 
456  FwIndexType portNum,
457  Fw::InputCmdRegPort* port
458  )
459  {
460  FW_ASSERT(
461  portNum < this->getNum_cmdRegIn_OutputPorts(),
462  static_cast<FwAssertArgType>(portNum)
463  );
464 
465  this->m_cmdRegIn_OutputPort[portNum].addCallPort(port);
466  }
467 
470  FwIndexType portNum,
472  )
473  {
474  FW_ASSERT(
475  portNum < this->getNum_cmdResponseOut_OutputPorts(),
476  static_cast<FwAssertArgType>(portNum)
477  );
478 
479  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
480  }
481 
484  FwIndexType portNum,
485  Fw::InputLogPort* port
486  )
487  {
488  FW_ASSERT(
489  portNum < this->getNum_eventOut_OutputPorts(),
490  static_cast<FwAssertArgType>(portNum)
491  );
492 
493  this->m_eventOut_OutputPort[portNum].addCallPort(port);
494  }
495 
496 #if FW_ENABLE_TEXT_LOGGING == 1
497 
498  void DpManagerComponentBase ::
499  set_textEventOut_OutputPort(
500  FwIndexType portNum,
502  )
503  {
504  FW_ASSERT(
505  portNum < this->getNum_textEventOut_OutputPorts(),
506  static_cast<FwAssertArgType>(portNum)
507  );
508 
509  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
510  }
511 
512 #endif
513 
516  FwIndexType portNum,
517  Fw::InputTimePort* port
518  )
519  {
520  FW_ASSERT(
521  portNum < this->getNum_timeGetOut_OutputPorts(),
522  static_cast<FwAssertArgType>(portNum)
523  );
524 
525  this->m_timeGetOut_OutputPort[portNum].addCallPort(port);
526  }
527 
530  FwIndexType portNum,
531  Fw::InputTlmPort* port
532  )
533  {
534  FW_ASSERT(
535  portNum < this->getNum_tlmOut_OutputPorts(),
536  static_cast<FwAssertArgType>(portNum)
537  );
538 
539  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
540  }
541 
542  // ----------------------------------------------------------------------
543  // Connect typed input ports to typed output ports
544  // ----------------------------------------------------------------------
545 
548  FwIndexType portNum,
550  )
551  {
552  FW_ASSERT(
553  portNum < this->getNum_bufferGetOut_OutputPorts(),
554  static_cast<FwAssertArgType>(portNum)
555  );
556 
557  this->m_bufferGetOut_OutputPort[portNum].addCallPort(port);
558  }
559 
562  FwIndexType portNum,
564  )
565  {
566  FW_ASSERT(
567  portNum < this->getNum_productResponseOut_OutputPorts(),
568  static_cast<FwAssertArgType>(portNum)
569  );
570 
571  this->m_productResponseOut_OutputPort[portNum].addCallPort(port);
572  }
573 
576  FwIndexType portNum,
578  )
579  {
580  FW_ASSERT(
581  portNum < this->getNum_productSendOut_OutputPorts(),
582  static_cast<FwAssertArgType>(portNum)
583  );
584 
585  this->m_productSendOut_OutputPort[portNum].addCallPort(port);
586  }
587 
588 #if FW_PORT_SERIALIZATION
589 
590  // ----------------------------------------------------------------------
591  // Connect serial input ports to special output ports
592  // ----------------------------------------------------------------------
593 
596  FwIndexType portNum,
597  Fw::InputSerializePort* port
598  )
599  {
600  FW_ASSERT(
601  portNum < this->getNum_cmdRegIn_OutputPorts(),
602  static_cast<FwAssertArgType>(portNum)
603  );
604 
605  this->m_cmdRegIn_OutputPort[portNum].registerSerialPort(port);
606  }
607 
610  FwIndexType portNum,
611  Fw::InputSerializePort* port
612  )
613  {
614  FW_ASSERT(
615  portNum < this->getNum_cmdResponseOut_OutputPorts(),
616  static_cast<FwAssertArgType>(portNum)
617  );
618 
619  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
620  }
621 
624  FwIndexType portNum,
625  Fw::InputSerializePort* port
626  )
627  {
628  FW_ASSERT(
629  portNum < this->getNum_eventOut_OutputPorts(),
630  static_cast<FwAssertArgType>(portNum)
631  );
632 
633  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
634  }
635 
636 #if FW_ENABLE_TEXT_LOGGING == 1
637 
638  void DpManagerComponentBase ::
639  set_textEventOut_OutputPort(
640  FwIndexType portNum,
641  Fw::InputSerializePort* port
642  )
643  {
644  FW_ASSERT(
645  portNum < this->getNum_textEventOut_OutputPorts(),
646  static_cast<FwAssertArgType>(portNum)
647  );
648 
649  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
650  }
651 
652 #endif
653 
656  FwIndexType portNum,
657  Fw::InputSerializePort* port
658  )
659  {
660  FW_ASSERT(
661  portNum < this->getNum_timeGetOut_OutputPorts(),
662  static_cast<FwAssertArgType>(portNum)
663  );
664 
665  this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port);
666  }
667 
670  FwIndexType portNum,
671  Fw::InputSerializePort* port
672  )
673  {
674  FW_ASSERT(
675  portNum < this->getNum_tlmOut_OutputPorts(),
676  static_cast<FwAssertArgType>(portNum)
677  );
678 
679  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
680  }
681 
682 #endif
683 
684 #if FW_PORT_SERIALIZATION
685 
686  // ----------------------------------------------------------------------
687  // Connect serial input ports to typed output ports
688  // ----------------------------------------------------------------------
689 
692  FwIndexType portNum,
693  Fw::InputSerializePort* port
694  )
695  {
696  FW_ASSERT(
697  portNum < this->getNum_productResponseOut_OutputPorts(),
698  static_cast<FwAssertArgType>(portNum)
699  );
700 
701  this->m_productResponseOut_OutputPort[portNum].registerSerialPort(port);
702  }
703 
706  FwIndexType portNum,
707  Fw::InputSerializePort* port
708  )
709  {
710  FW_ASSERT(
711  portNum < this->getNum_productSendOut_OutputPorts(),
712  static_cast<FwAssertArgType>(portNum)
713  );
714 
715  this->m_productSendOut_OutputPort[portNum].registerSerialPort(port);
716  }
717 
718 #endif
719 
720  // ----------------------------------------------------------------------
721  // Command registration
722  // ----------------------------------------------------------------------
723 
726  {
727  FW_ASSERT(this->m_cmdRegIn_OutputPort[0].isConnected());
728 
729  this->m_cmdRegIn_OutputPort[0].invoke(
731  );
732  }
733 
734  // ----------------------------------------------------------------------
735  // Component construction and destruction
736  // ----------------------------------------------------------------------
737 
739  DpManagerComponentBase(const char* compName) :
740  Fw::ActiveComponentBase(compName)
741  {
742  // Write telemetry channel NumSuccessfulAllocations
743  this->m_first_update_NumSuccessfulAllocations = true;
744  this->m_last_NumSuccessfulAllocations = 0;
745 
746  // Write telemetry channel NumFailedAllocations
747  this->m_first_update_NumFailedAllocations = true;
748  this->m_last_NumFailedAllocations = 0;
749 
750  // Write telemetry channel NumDataProducts
751  this->m_first_update_NumDataProducts = true;
752  this->m_last_NumDataProducts = 0;
753 
754  // Write telemetry channel NumBytes
755  this->m_first_update_NumBytes = true;
756  this->m_last_NumBytes = 0;
757 
758  this->m_BufferAllocationFailedThrottle = 0;
759  }
760 
763  {
764 
765  }
766 
767  // ----------------------------------------------------------------------
768  // Getters for numbers of special input ports
769  // ----------------------------------------------------------------------
770 
773  {
774  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
775  }
776 
777  // ----------------------------------------------------------------------
778  // Getters for numbers of typed input ports
779  // ----------------------------------------------------------------------
780 
783  {
784  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productGetIn_InputPort));
785  }
786 
789  {
790  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestIn_InputPort));
791  }
792 
795  {
796  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productSendIn_InputPort));
797  }
798 
801  {
802  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_schedIn_InputPort));
803  }
804 
805  // ----------------------------------------------------------------------
806  // Getters for numbers of special output ports
807  // ----------------------------------------------------------------------
808 
811  {
812  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegIn_OutputPort));
813  }
814 
817  {
818  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
819  }
820 
823  {
824  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
825  }
826 
827 #if FW_ENABLE_TEXT_LOGGING == 1
828 
829  FwIndexType DpManagerComponentBase ::
830  getNum_textEventOut_OutputPorts() const
831  {
832  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort));
833  }
834 
835 #endif
836 
839  {
840  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort));
841  }
842 
845  {
846  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
847  }
848 
849  // ----------------------------------------------------------------------
850  // Getters for numbers of typed output ports
851  // ----------------------------------------------------------------------
852 
855  {
856  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferGetOut_OutputPort));
857  }
858 
861  {
862  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productResponseOut_OutputPort));
863  }
864 
867  {
868  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort));
869  }
870 
871  // ----------------------------------------------------------------------
872  // Connection status queries for special output ports
873  // ----------------------------------------------------------------------
874 
877  {
878  FW_ASSERT(
879  portNum < this->getNum_cmdRegIn_OutputPorts(),
880  static_cast<FwAssertArgType>(portNum)
881  );
882 
883  return this->m_cmdRegIn_OutputPort[portNum].isConnected();
884  }
885 
888  {
889  FW_ASSERT(
890  portNum < this->getNum_cmdResponseOut_OutputPorts(),
891  static_cast<FwAssertArgType>(portNum)
892  );
893 
894  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
895  }
896 
899  {
900  FW_ASSERT(
901  portNum < this->getNum_eventOut_OutputPorts(),
902  static_cast<FwAssertArgType>(portNum)
903  );
904 
905  return this->m_eventOut_OutputPort[portNum].isConnected();
906  }
907 
908 #if FW_ENABLE_TEXT_LOGGING == 1
909 
910  bool DpManagerComponentBase ::
911  isConnected_textEventOut_OutputPort(FwIndexType portNum)
912  {
913  FW_ASSERT(
914  portNum < this->getNum_textEventOut_OutputPorts(),
915  static_cast<FwAssertArgType>(portNum)
916  );
917 
918  return this->m_textEventOut_OutputPort[portNum].isConnected();
919  }
920 
921 #endif
922 
925  {
926  FW_ASSERT(
927  portNum < this->getNum_timeGetOut_OutputPorts(),
928  static_cast<FwAssertArgType>(portNum)
929  );
930 
931  return this->m_timeGetOut_OutputPort[portNum].isConnected();
932  }
933 
936  {
937  FW_ASSERT(
938  portNum < this->getNum_tlmOut_OutputPorts(),
939  static_cast<FwAssertArgType>(portNum)
940  );
941 
942  return this->m_tlmOut_OutputPort[portNum].isConnected();
943  }
944 
945  // ----------------------------------------------------------------------
946  // Connection status queries for typed output ports
947  // ----------------------------------------------------------------------
948 
951  {
952  FW_ASSERT(
953  portNum < this->getNum_bufferGetOut_OutputPorts(),
954  static_cast<FwAssertArgType>(portNum)
955  );
956 
957  return this->m_bufferGetOut_OutputPort[portNum].isConnected();
958  }
959 
962  {
963  FW_ASSERT(
964  portNum < this->getNum_productResponseOut_OutputPorts(),
965  static_cast<FwAssertArgType>(portNum)
966  );
967 
968  return this->m_productResponseOut_OutputPort[portNum].isConnected();
969  }
970 
973  {
974  FW_ASSERT(
975  portNum < this->getNum_productSendOut_OutputPorts(),
976  static_cast<FwAssertArgType>(portNum)
977  );
978 
979  return this->m_productSendOut_OutputPort[portNum].isConnected();
980  }
981 
982  // ----------------------------------------------------------------------
983  // Port handler base-class functions for typed input ports
984  //
985  // Call these functions directly to bypass the corresponding ports
986  // ----------------------------------------------------------------------
987 
990  FwIndexType portNum,
991  FwDpIdType id,
992  FwSizeType dataSize,
993  Fw::Buffer& buffer
994  )
995  {
996  // Make sure port number is valid
997  FW_ASSERT(
998  portNum < this->getNum_productGetIn_InputPorts(),
999  static_cast<FwAssertArgType>(portNum)
1000  );
1001 
1002  Fw::Success retVal;
1003 
1004  // Call handler function
1005  retVal = this->productGetIn_handler(
1006  portNum,
1007  id,
1008  dataSize,
1009  buffer
1010  );
1011 
1012  return retVal;
1013  }
1014 
1017  FwIndexType portNum,
1018  FwDpIdType id,
1019  FwSizeType dataSize
1020  )
1021  {
1022  // Make sure port number is valid
1023  FW_ASSERT(
1024  portNum < this->getNum_productRequestIn_InputPorts(),
1025  static_cast<FwAssertArgType>(portNum)
1026  );
1027 
1028  // Call pre-message hook
1030  portNum,
1031  id,
1032  dataSize
1033  );
1034  ComponentIpcSerializableBuffer msg;
1036 
1037  // Serialize message ID
1038  _status = msg.serialize(
1039  static_cast<FwEnumStoreType>(PRODUCTREQUESTIN_DPREQUEST)
1040  );
1041  FW_ASSERT(
1042  _status == Fw::FW_SERIALIZE_OK,
1043  static_cast<FwAssertArgType>(_status)
1044  );
1045 
1046  // Serialize port number
1047  _status = msg.serialize(portNum);
1048  FW_ASSERT(
1049  _status == Fw::FW_SERIALIZE_OK,
1050  static_cast<FwAssertArgType>(_status)
1051  );
1052 
1053  // Serialize argument id
1054  _status = msg.serialize(id);
1055  FW_ASSERT(
1056  _status == Fw::FW_SERIALIZE_OK,
1057  static_cast<FwAssertArgType>(_status)
1058  );
1059 
1060  // Serialize argument dataSize
1061  _status = msg.serialize(dataSize);
1062  FW_ASSERT(
1063  _status == Fw::FW_SERIALIZE_OK,
1064  static_cast<FwAssertArgType>(_status)
1065  );
1066 
1067  // Send message
1069  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1070 
1071  FW_ASSERT(
1072  qStatus == Os::Queue::OP_OK,
1073  static_cast<FwAssertArgType>(qStatus)
1074  );
1075  }
1076 
1079  FwIndexType portNum,
1080  FwDpIdType id,
1081  const Fw::Buffer& buffer
1082  )
1083  {
1084  // Make sure port number is valid
1085  FW_ASSERT(
1086  portNum < this->getNum_productSendIn_InputPorts(),
1087  static_cast<FwAssertArgType>(portNum)
1088  );
1089 
1090  // Call pre-message hook
1092  portNum,
1093  id,
1094  buffer
1095  );
1096  ComponentIpcSerializableBuffer msg;
1098 
1099  // Serialize message ID
1100  _status = msg.serialize(
1101  static_cast<FwEnumStoreType>(PRODUCTSENDIN_DPSEND)
1102  );
1103  FW_ASSERT(
1104  _status == Fw::FW_SERIALIZE_OK,
1105  static_cast<FwAssertArgType>(_status)
1106  );
1107 
1108  // Serialize port number
1109  _status = msg.serialize(portNum);
1110  FW_ASSERT(
1111  _status == Fw::FW_SERIALIZE_OK,
1112  static_cast<FwAssertArgType>(_status)
1113  );
1114 
1115  // Serialize argument id
1116  _status = msg.serialize(id);
1117  FW_ASSERT(
1118  _status == Fw::FW_SERIALIZE_OK,
1119  static_cast<FwAssertArgType>(_status)
1120  );
1121 
1122  // Serialize argument buffer
1123  _status = msg.serialize(buffer);
1124  FW_ASSERT(
1125  _status == Fw::FW_SERIALIZE_OK,
1126  static_cast<FwAssertArgType>(_status)
1127  );
1128 
1129  // Send message
1131  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1132 
1133  FW_ASSERT(
1134  qStatus == Os::Queue::OP_OK,
1135  static_cast<FwAssertArgType>(qStatus)
1136  );
1137  }
1138 
1141  FwIndexType portNum,
1142  U32 context
1143  )
1144  {
1145  // Make sure port number is valid
1146  FW_ASSERT(
1147  portNum < this->getNum_schedIn_InputPorts(),
1148  static_cast<FwAssertArgType>(portNum)
1149  );
1150 
1151  // Call pre-message hook
1153  portNum,
1154  context
1155  );
1156  ComponentIpcSerializableBuffer msg;
1158 
1159  // Serialize message ID
1160  _status = msg.serialize(
1161  static_cast<FwEnumStoreType>(SCHEDIN_SCHED)
1162  );
1163  FW_ASSERT(
1164  _status == Fw::FW_SERIALIZE_OK,
1165  static_cast<FwAssertArgType>(_status)
1166  );
1167 
1168  // Serialize port number
1169  _status = msg.serialize(portNum);
1170  FW_ASSERT(
1171  _status == Fw::FW_SERIALIZE_OK,
1172  static_cast<FwAssertArgType>(_status)
1173  );
1174 
1175  // Serialize argument context
1176  _status = msg.serialize(context);
1177  FW_ASSERT(
1178  _status == Fw::FW_SERIALIZE_OK,
1179  static_cast<FwAssertArgType>(_status)
1180  );
1181 
1182  // Send message
1184  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1185 
1186  FW_ASSERT(
1187  qStatus == Os::Queue::OP_OK,
1188  static_cast<FwAssertArgType>(qStatus)
1189  );
1190  }
1191 
1192  // ----------------------------------------------------------------------
1193  // Pre-message hooks for typed async input ports
1194  //
1195  // Each of these functions is invoked just before processing a message
1196  // on the corresponding port. By default, they do nothing. You can
1197  // override them to provide specific pre-message behavior.
1198  // ----------------------------------------------------------------------
1199 
1202  FwIndexType portNum,
1203  FwDpIdType id,
1204  FwSizeType dataSize
1205  )
1206  {
1207  // Default: no-op
1208  }
1209 
1212  FwIndexType portNum,
1213  FwDpIdType id,
1214  const Fw::Buffer& buffer
1215  )
1216  {
1217  // Default: no-op
1218  }
1219 
1222  FwIndexType portNum,
1223  U32 context
1224  )
1225  {
1226  // Default: no-op
1227  }
1228 
1229  // ----------------------------------------------------------------------
1230  // Invocation functions for typed output ports
1231  // ----------------------------------------------------------------------
1232 
1235  FwIndexType portNum,
1236  U32 size
1237  )
1238  {
1239  FW_ASSERT(
1240  portNum < this->getNum_bufferGetOut_OutputPorts(),
1241  static_cast<FwAssertArgType>(portNum)
1242  );
1243 
1244  FW_ASSERT(
1245  this->m_bufferGetOut_OutputPort[portNum].isConnected(),
1246  static_cast<FwAssertArgType>(portNum)
1247  );
1248  return this->m_bufferGetOut_OutputPort[portNum].invoke(
1249  size
1250  );
1251  }
1252 
1255  FwIndexType portNum,
1256  FwDpIdType id,
1257  const Fw::Buffer& buffer,
1258  const Fw::Success& status
1259  )
1260  {
1261  FW_ASSERT(
1262  portNum < this->getNum_productResponseOut_OutputPorts(),
1263  static_cast<FwAssertArgType>(portNum)
1264  );
1265 
1266  FW_ASSERT(
1267  this->m_productResponseOut_OutputPort[portNum].isConnected(),
1268  static_cast<FwAssertArgType>(portNum)
1269  );
1270  this->m_productResponseOut_OutputPort[portNum].invoke(
1271  id,
1272  buffer,
1273  status
1274  );
1275  }
1276 
1279  FwIndexType portNum,
1280  Fw::Buffer& fwBuffer
1281  )
1282  {
1283  FW_ASSERT(
1284  portNum < this->getNum_productSendOut_OutputPorts(),
1285  static_cast<FwAssertArgType>(portNum)
1286  );
1287 
1288  FW_ASSERT(
1289  this->m_productSendOut_OutputPort[portNum].isConnected(),
1290  static_cast<FwAssertArgType>(portNum)
1291  );
1292  this->m_productSendOut_OutputPort[portNum].invoke(
1293  fwBuffer
1294  );
1295  }
1296 
1297  // ----------------------------------------------------------------------
1298  // Command response
1299  // ----------------------------------------------------------------------
1300 
1303  FwOpcodeType opCode,
1304  U32 cmdSeq,
1305  Fw::CmdResponse response
1306  )
1307  {
1308  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1309  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1310  }
1311 
1312  // ----------------------------------------------------------------------
1313  // Command handler base-class functions
1314  //
1315  // Call these functions directly to bypass the command input port
1316  // ----------------------------------------------------------------------
1317 
1320  FwOpcodeType opCode,
1321  U32 cmdSeq,
1322  Fw::CmdArgBuffer& args
1323  )
1324  {
1325  // Call pre-message hook
1326  this->CLEAR_EVENT_THROTTLE_preMsgHook(opCode,cmdSeq);
1327 
1328  // Defer deserializing arguments to the message dispatcher
1329  // to avoid deserializing and reserializing just for IPC
1330  ComponentIpcSerializableBuffer msg;
1332 
1333  // Serialize for IPC
1334  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CLEAR_EVENT_THROTTLE));
1335  FW_ASSERT (
1336  _status == Fw::FW_SERIALIZE_OK,
1337  static_cast<FwAssertArgType>(_status)
1338  );
1339 
1340  // Fake port number to make message dequeue work
1341  FwIndexType port = 0;
1342 
1343  _status = msg.serialize(port);
1344  FW_ASSERT (
1345  _status == Fw::FW_SERIALIZE_OK,
1346  static_cast<FwAssertArgType>(_status)
1347  );
1348 
1349  _status = msg.serialize(opCode);
1350  FW_ASSERT (
1351  _status == Fw::FW_SERIALIZE_OK,
1352  static_cast<FwAssertArgType>(_status)
1353  );
1354 
1355  _status = msg.serialize(cmdSeq);
1356  FW_ASSERT (
1357  _status == Fw::FW_SERIALIZE_OK,
1358  static_cast<FwAssertArgType>(_status)
1359  );
1360 
1361  _status = msg.serialize(args);
1362  FW_ASSERT (
1363  _status == Fw::FW_SERIALIZE_OK,
1364  static_cast<FwAssertArgType>(_status)
1365  );
1366 
1367  // Send message
1369  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1370 
1371  FW_ASSERT(
1372  qStatus == Os::Queue::OP_OK,
1373  static_cast<FwAssertArgType>(qStatus)
1374  );
1375  }
1376 
1377  // ----------------------------------------------------------------------
1378  // Pre-message hooks for async commands
1379  //
1380  // Each of these functions is invoked just before processing the
1381  // corresponding command. By default they do nothing. You can
1382  // override them to provide specific pre-command behavior.
1383  // ----------------------------------------------------------------------
1384 
1387  FwOpcodeType opCode,
1388  U32 cmdSeq
1389  )
1390  {
1391  // Defaults to no-op; can be overridden
1392  (void) opCode;
1393  (void) cmdSeq;
1394  }
1395 
1396  // ----------------------------------------------------------------------
1397  // Event logging functions
1398  // ----------------------------------------------------------------------
1399 
1402  {
1403  // Check throttle value
1404  if (this->m_BufferAllocationFailedThrottle >= EVENTID_BUFFERALLOCATIONFAILED_THROTTLE) {
1405  return;
1406  }
1407  else {
1408  this->m_BufferAllocationFailedThrottle++;
1409  }
1410 
1411  // Get the time
1412  Fw::Time _logTime;
1413  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1414  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1415  }
1416 
1417  FwEventIdType _id = static_cast<FwEventIdType>(0);
1418 
1419  _id = this->getIdBase() + EVENTID_BUFFERALLOCATIONFAILED;
1420 
1421  // Emit the event on the log port
1422  if (this->m_eventOut_OutputPort[0].isConnected()) {
1423  Fw::LogBuffer _logBuff;
1425 
1426 #if FW_AMPCS_COMPATIBLE
1427  // Serialize the number of arguments
1428  _status = _logBuff.serialize(static_cast<U8>(1));
1429  FW_ASSERT(
1430  _status == Fw::FW_SERIALIZE_OK,
1431  static_cast<FwAssertArgType>(_status)
1432  );
1433 #endif
1434 
1435 #if FW_AMPCS_COMPATIBLE
1436  // Serialize the argument size
1437  _status = _logBuff.serialize(
1438  static_cast<U8>(sizeof(U32))
1439  );
1440  FW_ASSERT(
1441  _status == Fw::FW_SERIALIZE_OK,
1442  static_cast<FwAssertArgType>(_status)
1443  );
1444 #endif
1445  _status = _logBuff.serialize(id);
1446  FW_ASSERT(
1447  _status == Fw::FW_SERIALIZE_OK,
1448  static_cast<FwAssertArgType>(_status)
1449  );
1450 
1451  this->m_eventOut_OutputPort[0].invoke(
1452  _id,
1453  _logTime,
1455  _logBuff
1456  );
1457  }
1458 
1459  // Emit the event on the text log port
1460 #if FW_ENABLE_TEXT_LOGGING
1461  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1462 #if FW_OBJECT_NAMES == 1
1463  const char* _formatString =
1464  "(%s) %s: Buffer allocation failed for container id %" PRIu32 "";
1465 #else
1466  const char* _formatString =
1467  "%s: Buffer allocation failed for container id %" PRIu32 "";
1468 #endif
1469 
1470  Fw::TextLogString _logString;
1471  _logString.format(
1472  _formatString,
1473 #if FW_OBJECT_NAMES == 1
1474  this->m_objName.toChar(),
1475 #endif
1476  "BufferAllocationFailed ",
1477  id
1478  );
1479 
1480  this->m_textEventOut_OutputPort[0].invoke(
1481  _id,
1482  _logTime,
1484  _logString
1485  );
1486  }
1487 #endif
1488  }
1489 
1490  // ----------------------------------------------------------------------
1491  // Event throttle reset functions
1492  // ----------------------------------------------------------------------
1493 
1496  {
1497  // Reset throttle counter
1498  this->m_BufferAllocationFailedThrottle = 0;
1499  }
1500 
1501  // ----------------------------------------------------------------------
1502  // Telemetry write functions
1503  // ----------------------------------------------------------------------
1504 
1507  U32 arg,
1508  Fw::Time _tlmTime
1509  )
1510  {
1511  // Check to see if it is the first time
1512  if (not this->m_first_update_NumSuccessfulAllocations) {
1513  // Check to see if value has changed. If not, don't write it.
1514  if (arg == this->m_last_NumSuccessfulAllocations) {
1515  return;
1516  }
1517  else {
1518  this->m_last_NumSuccessfulAllocations = arg;
1519  }
1520  }
1521  else {
1522  this->m_first_update_NumSuccessfulAllocations = false;
1523  this->m_last_NumSuccessfulAllocations = arg;
1524  }
1525 
1526  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1527  if (
1528  this->m_timeGetOut_OutputPort[0].isConnected() &&
1529  (_tlmTime == Fw::ZERO_TIME)
1530  ) {
1531  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1532  }
1533 
1534  Fw::TlmBuffer _tlmBuff;
1535  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1536  FW_ASSERT(
1537  _stat == Fw::FW_SERIALIZE_OK,
1538  static_cast<FwAssertArgType>(_stat)
1539  );
1540 
1541  FwChanIdType _id;
1542 
1544 
1545  this->m_tlmOut_OutputPort[0].invoke(
1546  _id,
1547  _tlmTime,
1548  _tlmBuff
1549  );
1550  }
1551  }
1552 
1555  U32 arg,
1556  Fw::Time _tlmTime
1557  )
1558  {
1559  // Check to see if it is the first time
1560  if (not this->m_first_update_NumFailedAllocations) {
1561  // Check to see if value has changed. If not, don't write it.
1562  if (arg == this->m_last_NumFailedAllocations) {
1563  return;
1564  }
1565  else {
1566  this->m_last_NumFailedAllocations = arg;
1567  }
1568  }
1569  else {
1570  this->m_first_update_NumFailedAllocations = false;
1571  this->m_last_NumFailedAllocations = arg;
1572  }
1573 
1574  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1575  if (
1576  this->m_timeGetOut_OutputPort[0].isConnected() &&
1577  (_tlmTime == Fw::ZERO_TIME)
1578  ) {
1579  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1580  }
1581 
1582  Fw::TlmBuffer _tlmBuff;
1583  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1584  FW_ASSERT(
1585  _stat == Fw::FW_SERIALIZE_OK,
1586  static_cast<FwAssertArgType>(_stat)
1587  );
1588 
1589  FwChanIdType _id;
1590 
1591  _id = this->getIdBase() + CHANNELID_NUMFAILEDALLOCATIONS;
1592 
1593  this->m_tlmOut_OutputPort[0].invoke(
1594  _id,
1595  _tlmTime,
1596  _tlmBuff
1597  );
1598  }
1599  }
1600 
1603  U32 arg,
1604  Fw::Time _tlmTime
1605  )
1606  {
1607  // Check to see if it is the first time
1608  if (not this->m_first_update_NumDataProducts) {
1609  // Check to see if value has changed. If not, don't write it.
1610  if (arg == this->m_last_NumDataProducts) {
1611  return;
1612  }
1613  else {
1614  this->m_last_NumDataProducts = arg;
1615  }
1616  }
1617  else {
1618  this->m_first_update_NumDataProducts = false;
1619  this->m_last_NumDataProducts = arg;
1620  }
1621 
1622  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1623  if (
1624  this->m_timeGetOut_OutputPort[0].isConnected() &&
1625  (_tlmTime == Fw::ZERO_TIME)
1626  ) {
1627  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1628  }
1629 
1630  Fw::TlmBuffer _tlmBuff;
1631  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1632  FW_ASSERT(
1633  _stat == Fw::FW_SERIALIZE_OK,
1634  static_cast<FwAssertArgType>(_stat)
1635  );
1636 
1637  FwChanIdType _id;
1638 
1639  _id = this->getIdBase() + CHANNELID_NUMDATAPRODUCTS;
1640 
1641  this->m_tlmOut_OutputPort[0].invoke(
1642  _id,
1643  _tlmTime,
1644  _tlmBuff
1645  );
1646  }
1647  }
1648 
1651  U64 arg,
1652  Fw::Time _tlmTime
1653  )
1654  {
1655  // Check to see if it is the first time
1656  if (not this->m_first_update_NumBytes) {
1657  // Check to see if value has changed. If not, don't write it.
1658  if (arg == this->m_last_NumBytes) {
1659  return;
1660  }
1661  else {
1662  this->m_last_NumBytes = arg;
1663  }
1664  }
1665  else {
1666  this->m_first_update_NumBytes = false;
1667  this->m_last_NumBytes = arg;
1668  }
1669 
1670  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1671  if (
1672  this->m_timeGetOut_OutputPort[0].isConnected() &&
1673  (_tlmTime == Fw::ZERO_TIME)
1674  ) {
1675  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1676  }
1677 
1678  Fw::TlmBuffer _tlmBuff;
1679  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1680  FW_ASSERT(
1681  _stat == Fw::FW_SERIALIZE_OK,
1682  static_cast<FwAssertArgType>(_stat)
1683  );
1684 
1685  FwChanIdType _id;
1686 
1687  _id = this->getIdBase() + CHANNELID_NUMBYTES;
1688 
1689  this->m_tlmOut_OutputPort[0].invoke(
1690  _id,
1691  _tlmTime,
1692  _tlmBuff
1693  );
1694  }
1695  }
1696 
1697  // ----------------------------------------------------------------------
1698  // Time
1699  // ----------------------------------------------------------------------
1700 
1703  {
1704  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1705  Fw::Time _time;
1706  this->m_timeGetOut_OutputPort[0].invoke(_time);
1707  return _time;
1708  }
1709  else {
1710  return Fw::Time(TB_NONE, 0, 0);
1711  }
1712  }
1713 
1714  // ----------------------------------------------------------------------
1715  // Message dispatch functions
1716  // ----------------------------------------------------------------------
1717 
1718  Fw::QueuedComponentBase::MsgDispatchStatus DpManagerComponentBase ::
1719  doDispatch()
1720  {
1721  ComponentIpcSerializableBuffer _msg;
1722  FwQueuePriorityType _priority = 0;
1723 
1724  Os::Queue::Status _msgStatus = this->m_queue.receive(
1725  _msg,
1727  _priority
1728  );
1729  FW_ASSERT(
1730  _msgStatus == Os::Queue::OP_OK,
1731  static_cast<FwAssertArgType>(_msgStatus)
1732  );
1733 
1734  // Reset to beginning of buffer
1735  _msg.resetDeser();
1736 
1737  FwEnumStoreType _desMsg = 0;
1738  Fw::SerializeStatus _deserStatus = _msg.deserialize(_desMsg);
1739  FW_ASSERT(
1740  _deserStatus == Fw::FW_SERIALIZE_OK,
1741  static_cast<FwAssertArgType>(_deserStatus)
1742  );
1743 
1744  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1745 
1746  if (_msgType == DPMANAGER_COMPONENT_EXIT) {
1747  return MSG_DISPATCH_EXIT;
1748  }
1749 
1750  FwIndexType portNum = 0;
1751  _deserStatus = _msg.deserialize(portNum);
1752  FW_ASSERT(
1753  _deserStatus == Fw::FW_SERIALIZE_OK,
1754  static_cast<FwAssertArgType>(_deserStatus)
1755  );
1756 
1757  switch (_msgType) {
1758  // Handle async input port productRequestIn
1759  case PRODUCTREQUESTIN_DPREQUEST: {
1760  // Deserialize argument id
1761  FwDpIdType id;
1762  _deserStatus = _msg.deserialize(id);
1763  FW_ASSERT(
1764  _deserStatus == Fw::FW_SERIALIZE_OK,
1765  static_cast<FwAssertArgType>(_deserStatus)
1766  );
1767 
1768  // Deserialize argument dataSize
1769  FwSizeType dataSize;
1770  _deserStatus = _msg.deserialize(dataSize);
1771  FW_ASSERT(
1772  _deserStatus == Fw::FW_SERIALIZE_OK,
1773  static_cast<FwAssertArgType>(_deserStatus)
1774  );
1775  // Call handler function
1777  portNum,
1778  id,
1779  dataSize
1780  );
1781 
1782  break;
1783  }
1784 
1785  // Handle async input port productSendIn
1786  case PRODUCTSENDIN_DPSEND: {
1787  // Deserialize argument id
1788  FwDpIdType id;
1789  _deserStatus = _msg.deserialize(id);
1790  FW_ASSERT(
1791  _deserStatus == Fw::FW_SERIALIZE_OK,
1792  static_cast<FwAssertArgType>(_deserStatus)
1793  );
1794 
1795  // Deserialize argument buffer
1796  Fw::Buffer buffer;
1797  _deserStatus = _msg.deserialize(buffer);
1798  FW_ASSERT(
1799  _deserStatus == Fw::FW_SERIALIZE_OK,
1800  static_cast<FwAssertArgType>(_deserStatus)
1801  );
1802  // Call handler function
1803  this->productSendIn_handler(
1804  portNum,
1805  id,
1806  buffer
1807  );
1808 
1809  break;
1810  }
1811 
1812  // Handle async input port schedIn
1813  case SCHEDIN_SCHED: {
1814  // Deserialize argument context
1815  U32 context;
1816  _deserStatus = _msg.deserialize(context);
1817  FW_ASSERT(
1818  _deserStatus == Fw::FW_SERIALIZE_OK,
1819  static_cast<FwAssertArgType>(_deserStatus)
1820  );
1821  // Call handler function
1822  this->schedIn_handler(
1823  portNum,
1824  context
1825  );
1826 
1827  break;
1828  }
1829 
1830  // Handle command CLEAR_EVENT_THROTTLE
1831  case CMD_CLEAR_EVENT_THROTTLE: {
1832  // Deserialize opcode
1833  FwOpcodeType _opCode = 0;
1834  _deserStatus = _msg.deserialize(_opCode);
1835  FW_ASSERT (
1836  _deserStatus == Fw::FW_SERIALIZE_OK,
1837  static_cast<FwAssertArgType>(_deserStatus)
1838  );
1839 
1840  // Deserialize command sequence
1841  U32 _cmdSeq = 0;
1842  _deserStatus = _msg.deserialize(_cmdSeq);
1843  FW_ASSERT (
1844  _deserStatus == Fw::FW_SERIALIZE_OK,
1845  static_cast<FwAssertArgType>(_deserStatus)
1846  );
1847 
1848  // Deserialize command argument buffer
1849  Fw::CmdArgBuffer args;
1850  _deserStatus = _msg.deserialize(args);
1851  FW_ASSERT (
1852  _deserStatus == Fw::FW_SERIALIZE_OK,
1853  static_cast<FwAssertArgType>(_deserStatus)
1854  );
1855 
1856  // Reset buffer
1857  args.resetDeser();
1858 
1859  // Make sure there was no data left over.
1860  // That means the argument buffer size was incorrect.
1861 #if FW_CMD_CHECK_RESIDUAL
1862  if (args.getBuffLeft() != 0) {
1863  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1864  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1865  }
1866  // Don't crash the task if bad arguments were passed from the ground
1867  break;
1868  }
1869 #endif
1870 
1871  // Call handler function
1872  this->CLEAR_EVENT_THROTTLE_cmdHandler(_opCode, _cmdSeq);
1873 
1874  break;
1875  }
1876 
1877  default:
1878  return MSG_DISPATCH_ERROR;
1879  }
1880 
1881  return MSG_DISPATCH_OK;
1882  }
1883 
1884  // ----------------------------------------------------------------------
1885  // Calls for messages received on special input ports
1886  // ----------------------------------------------------------------------
1887 
1888  void DpManagerComponentBase ::
1889  m_p_cmdIn_in(
1890  Fw::PassiveComponentBase* callComp,
1891  FwIndexType portNum,
1892  FwOpcodeType opCode,
1893  U32 cmdSeq,
1894  Fw::CmdArgBuffer& args
1895  )
1896  {
1897  FW_ASSERT(callComp);
1898  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1899 
1900  const U32 idBase = callComp->getIdBase();
1901  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1902 
1903  // Select base class function based on opcode
1904  switch (opCode - idBase) {
1906  compPtr->CLEAR_EVENT_THROTTLE_cmdHandlerBase(
1907  opCode,
1908  cmdSeq,
1909  args
1910  );
1911  break;
1912  }
1913  }
1914  }
1915 
1916  // ----------------------------------------------------------------------
1917  // Calls for messages received on typed input ports
1918  // ----------------------------------------------------------------------
1919 
1920  Fw::Success DpManagerComponentBase ::
1921  m_p_productGetIn_in(
1922  Fw::PassiveComponentBase* callComp,
1923  FwIndexType portNum,
1924  FwDpIdType id,
1925  FwSizeType dataSize,
1926  Fw::Buffer& buffer
1927  )
1928  {
1929  FW_ASSERT(callComp);
1930  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1931  return compPtr->productGetIn_handlerBase(
1932  portNum,
1933  id,
1934  dataSize,
1935  buffer
1936  );
1937  }
1938 
1939  void DpManagerComponentBase ::
1940  m_p_productRequestIn_in(
1941  Fw::PassiveComponentBase* callComp,
1942  FwIndexType portNum,
1943  FwDpIdType id,
1944  FwSizeType dataSize
1945  )
1946  {
1947  FW_ASSERT(callComp);
1948  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1949  compPtr->productRequestIn_handlerBase(
1950  portNum,
1951  id,
1952  dataSize
1953  );
1954  }
1955 
1956  void DpManagerComponentBase ::
1957  m_p_productSendIn_in(
1958  Fw::PassiveComponentBase* callComp,
1959  FwIndexType portNum,
1960  FwDpIdType id,
1961  const Fw::Buffer& buffer
1962  )
1963  {
1964  FW_ASSERT(callComp);
1965  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1966  compPtr->productSendIn_handlerBase(
1967  portNum,
1968  id,
1969  buffer
1970  );
1971  }
1972 
1973  void DpManagerComponentBase ::
1974  m_p_schedIn_in(
1975  Fw::PassiveComponentBase* callComp,
1976  FwIndexType portNum,
1977  U32 context
1978  )
1979  {
1980  FW_ASSERT(callComp);
1981  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1982  compPtr->schedIn_handlerBase(
1983  portNum,
1984  context
1985  );
1986  }
1987 
1988 }
Serialization/Deserialization operation was successful.
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
FwIndexType getNum_productGetIn_InputPorts() const
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Definition: Time.hpp:9
void set_productSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to productSendOut[portNum].
Operation succeeded.
Definition: Os.hpp:26
void log_WARNING_HI_BufferAllocationFailed_ThrottleClear()
Reset throttle value for BufferAllocationFailed.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegIn_OutputPort(FwIndexType portNum)
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: DpGetPortAc.cpp:32
Status
status returned from the queue send function
Definition: Queue.hpp:30
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void init()
Initialization function.
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
void set_timeGetOut_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeGetOut[portNum].
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
Fw::Buffer invoke(U32 size) const
Invoke a port interface.
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
The size of the serial representations of the port arguments.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
U32 FwDpIdType
Definition: FpConfig.h:115
FwIndexType getNum_eventOut_OutputPorts() const
const Time ZERO_TIME
Definition: Time.cpp:5
virtual ~DpManagerComponentBase()
Destroy DpManagerComponentBase object.
I32 FwEnumStoreType
Definition: FpConfig.h:64
void addCallPort(InputDpResponsePort *callPort)
Register an input port.
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
FwIndexType getNum_timeGetOut_OutputPorts() const
void productRequestIn_handlerBase(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)
Handler base-class function for input port productRequestIn.
FwIndexType getNum_schedIn_InputPorts() const
Enum representing a command response.
FwIndexType getNum_productRequestIn_InputPorts() const
void tlmWrite_NumSuccessfulAllocations(U32 arg, Fw::Time _tlmTime=Fw::Time())
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
Fw::Buffer bufferGetOut_out(FwIndexType portNum, U32 size)
Invoke output port bufferGetOut.
void tlmWrite_NumFailedAllocations(U32 arg, Fw::Time _tlmTime=Fw::Time())
Os::Queue m_queue
queue object for active component
void productSendIn_handlerBase(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer)
Handler base-class function for input port productSendIn.
void invoke(FwDpIdType id, const Fw::Buffer &buffer, const Fw::Success &status) const
Invoke a port interface.
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Object initializer.
Definition: ObjBase.cpp:26
Fw::InputDpGetPort * get_productGetIn_InputPort(FwIndexType portNum)
SerializeStatus
forward declaration for string
virtual void productSendIn_handler(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer)=0
Handler for input port productSendIn.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
Message will block until space is available.
Definition: Queue.hpp:46
FwIndexType getNum_cmdRegIn_OutputPorts() const
virtual Fw::Success productGetIn_handler(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize, Fw::Buffer &buffer)=0
Handler for input port productGetIn.
void init()
Initialization function.
FwIndexType getNum_bufferGetOut_OutputPorts() const
virtual void productSendIn_preMsgHook(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer)
Pre-message hook for async input port productSendIn.
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
Fw::InputDpSendPort * get_productSendIn_InputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TimePortAc.cpp:128
FwIndexType getNum_productSendIn_InputPorts() const
message to exit active component task
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port interface.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void productResponseOut_out(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer, const Fw::Success &status)
Invoke output port productResponseOut.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void tlmWrite_NumDataProducts(U32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_productResponseOut_OutputPort(FwIndexType portNum)
U32 FwOpcodeType
Definition: FpConfig.h:91
bool isConnected_bufferGetOut_OutputPort(FwIndexType portNum)
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
No time base has been established.
Definition: FpConfig.h:70
virtual void schedIn_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port schedIn.
FwSizeType SizeType
FwIndexType getNum_productResponseOut_OutputPorts() const
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
virtual void CLEAR_EVENT_THROTTLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum)
void resetDeser()
reset deserialization to beginning
void CLEAR_EVENT_THROTTLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
A serious but recoverable event.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:42
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
U32 FwEventIdType
Definition: FpConfig.h:103
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:32
BlockingType
message type
Definition: Queue.hpp:45
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
void init()
Initialization function.
void productSendOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port productSendOut.
FwIndexType getNum_cmdIn_InputPorts() const
virtual void productRequestIn_handler(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)=0
Handler for input port productRequestIn.
Command failed to deserialize.
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
void set_productResponseOut_OutputPort(FwIndexType portNum, Fw::InputDpResponsePort *port)
Connect port to productResponseOut[portNum].
A message was sent requesting an exit of the loop.
The size of the serial representations of the port arguments.
virtual void productRequestIn_preMsgHook(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)
Pre-message hook for async input port productRequestIn.
DpManagerComponentBase(const char *compName="")
Construct DpManagerComponentBase object.
Fw::InputDpRequestPort * get_productRequestIn_InputPort(FwIndexType portNum)
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:85
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
bool isConnected_productSendOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
void regCommands()
Register commands with the Command Dispatcher.
FwIndexType getNum_cmdResponseOut_OutputPorts() const
void init()
Initialization function.
void set_bufferGetOut_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferGetOut[portNum].
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:35
FwIndexType getNum_productSendOut_OutputPorts() const
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
FwIndexType getNum_tlmOut_OutputPorts() const
Fw::Success productGetIn_handlerBase(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize, Fw::Buffer &buffer)
Handler base-class function for input port productGetIn.
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
virtual void CLEAR_EVENT_THROTTLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CLEAR_EVENT_THROTTLE.
Message will return with status when space is unavailable.
Definition: Queue.hpp:47
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
void init()
Initialization function.
void set_cmdRegIn_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegIn[portNum].
void tlmWrite_NumBytes(U64 arg, Fw::Time _tlmTime=Fw::Time())
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:148
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Success/Failure.
void init()
Initialization function.
Definition: DpGetPortAc.cpp:26
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
U32 FwChanIdType
Definition: FpConfig.h:95
#define U64(C)
Definition: sha.h:180