F´ Flight Software - C/C++ Documentation  devel
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  // Max. message size = size of data + message id + port
44  SERIALIZATION_SIZE =
45  sizeof(BuffUnion) +
46  sizeof(FwEnumStoreType) +
47  sizeof(FwIndexType)
48  };
49 
50  Fw::Serializable::SizeType getBuffCapacity() const {
51  return sizeof(m_buff);
52  }
53 
54  U8* getBuffAddr() {
55  return m_buff;
56  }
57 
58  const U8* getBuffAddr() const {
59  return m_buff;
60  }
61 
62  private:
63  // Should be the max of all the input ports serialized sizes...
64  U8 m_buff[SERIALIZATION_SIZE];
65 
66  };
67  }
68 
69  // ----------------------------------------------------------------------
70  // Component initialization
71  // ----------------------------------------------------------------------
72 
74  init(
75  FwSizeType queueDepth,
76  FwEnumStoreType instance
77  )
78  {
79  // Initialize base class
81 
82  // Connect input port cmdIn
83  for (
84  FwIndexType port = 0;
85  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
86  port++
87  ) {
88  this->m_cmdIn_InputPort[port].init();
89  this->m_cmdIn_InputPort[port].addCallComp(
90  this,
91  m_p_cmdIn_in
92  );
93  this->m_cmdIn_InputPort[port].setPortNum(port);
94 
95 #if FW_OBJECT_NAMES == 1
96  Fw::ObjectName portName;
97  portName.format(
98  "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]",
99  this->m_objName.toChar(),
100  port
101  );
102  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
103 #endif
104  }
105 
106  // Connect input port productGetIn
107  for (
108  FwIndexType port = 0;
109  port < static_cast<FwIndexType>(this->getNum_productGetIn_InputPorts());
110  port++
111  ) {
112  this->m_productGetIn_InputPort[port].init();
113  this->m_productGetIn_InputPort[port].addCallComp(
114  this,
115  m_p_productGetIn_in
116  );
117  this->m_productGetIn_InputPort[port].setPortNum(port);
118 
119 #if FW_OBJECT_NAMES == 1
120  Fw::ObjectName portName;
121  portName.format(
122  "%s_productGetIn_InputPort[%" PRI_PlatformIntType "]",
123  this->m_objName.toChar(),
124  port
125  );
126  this->m_productGetIn_InputPort[port].setObjName(portName.toChar());
127 #endif
128  }
129 
130  // Connect input port productRequestIn
131  for (
132  FwIndexType port = 0;
133  port < static_cast<FwIndexType>(this->getNum_productRequestIn_InputPorts());
134  port++
135  ) {
136  this->m_productRequestIn_InputPort[port].init();
137  this->m_productRequestIn_InputPort[port].addCallComp(
138  this,
139  m_p_productRequestIn_in
140  );
141  this->m_productRequestIn_InputPort[port].setPortNum(port);
142 
143 #if FW_OBJECT_NAMES == 1
144  Fw::ObjectName portName;
145  portName.format(
146  "%s_productRequestIn_InputPort[%" PRI_PlatformIntType "]",
147  this->m_objName.toChar(),
148  port
149  );
150  this->m_productRequestIn_InputPort[port].setObjName(portName.toChar());
151 #endif
152  }
153 
154  // Connect input port productSendIn
155  for (
156  FwIndexType port = 0;
157  port < static_cast<FwIndexType>(this->getNum_productSendIn_InputPorts());
158  port++
159  ) {
160  this->m_productSendIn_InputPort[port].init();
161  this->m_productSendIn_InputPort[port].addCallComp(
162  this,
163  m_p_productSendIn_in
164  );
165  this->m_productSendIn_InputPort[port].setPortNum(port);
166 
167 #if FW_OBJECT_NAMES == 1
168  Fw::ObjectName portName;
169  portName.format(
170  "%s_productSendIn_InputPort[%" PRI_PlatformIntType "]",
171  this->m_objName.toChar(),
172  port
173  );
174  this->m_productSendIn_InputPort[port].setObjName(portName.toChar());
175 #endif
176  }
177 
178  // Connect input port schedIn
179  for (
180  FwIndexType port = 0;
181  port < static_cast<FwIndexType>(this->getNum_schedIn_InputPorts());
182  port++
183  ) {
184  this->m_schedIn_InputPort[port].init();
185  this->m_schedIn_InputPort[port].addCallComp(
186  this,
187  m_p_schedIn_in
188  );
189  this->m_schedIn_InputPort[port].setPortNum(port);
190 
191 #if FW_OBJECT_NAMES == 1
192  Fw::ObjectName portName;
193  portName.format(
194  "%s_schedIn_InputPort[%" PRI_PlatformIntType "]",
195  this->m_objName.toChar(),
196  port
197  );
198  this->m_schedIn_InputPort[port].setObjName(portName.toChar());
199 #endif
200  }
201 
202  // Connect output port cmdRegIn
203  for (
204  FwIndexType port = 0;
205  port < static_cast<FwIndexType>(this->getNum_cmdRegIn_OutputPorts());
206  port++
207  ) {
208  this->m_cmdRegIn_OutputPort[port].init();
209 
210 #if FW_OBJECT_NAMES == 1
211  Fw::ObjectName portName;
212  portName.format(
213  "%s_cmdRegIn_OutputPort[%" PRI_PlatformIntType "]",
214  this->m_objName.toChar(),
215  port
216  );
217  this->m_cmdRegIn_OutputPort[port].setObjName(portName.toChar());
218 #endif
219  }
220 
221  // Connect output port cmdResponseOut
222  for (
223  FwIndexType port = 0;
224  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
225  port++
226  ) {
227  this->m_cmdResponseOut_OutputPort[port].init();
228 
229 #if FW_OBJECT_NAMES == 1
230  Fw::ObjectName portName;
231  portName.format(
232  "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]",
233  this->m_objName.toChar(),
234  port
235  );
236  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
237 #endif
238  }
239 
240  // Connect output port eventOut
241  for (
242  FwIndexType port = 0;
243  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
244  port++
245  ) {
246  this->m_eventOut_OutputPort[port].init();
247 
248 #if FW_OBJECT_NAMES == 1
249  Fw::ObjectName portName;
250  portName.format(
251  "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]",
252  this->m_objName.toChar(),
253  port
254  );
255  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
256 #endif
257  }
258 
259 #if FW_ENABLE_TEXT_LOGGING == 1
260  // Connect output port textEventOut
261  for (
262  FwIndexType port = 0;
263  port < static_cast<FwIndexType>(this->getNum_textEventOut_OutputPorts());
264  port++
265  ) {
266  this->m_textEventOut_OutputPort[port].init();
267 
268 #if FW_OBJECT_NAMES == 1
269  Fw::ObjectName portName;
270  portName.format(
271  "%s_textEventOut_OutputPort[%" PRI_PlatformIntType "]",
272  this->m_objName.toChar(),
273  port
274  );
275  this->m_textEventOut_OutputPort[port].setObjName(portName.toChar());
276 #endif
277  }
278 #endif
279 
280  // Connect output port timeGetOut
281  for (
282  FwIndexType port = 0;
283  port < static_cast<FwIndexType>(this->getNum_timeGetOut_OutputPorts());
284  port++
285  ) {
286  this->m_timeGetOut_OutputPort[port].init();
287 
288 #if FW_OBJECT_NAMES == 1
289  Fw::ObjectName portName;
290  portName.format(
291  "%s_timeGetOut_OutputPort[%" PRI_PlatformIntType "]",
292  this->m_objName.toChar(),
293  port
294  );
295  this->m_timeGetOut_OutputPort[port].setObjName(portName.toChar());
296 #endif
297  }
298 
299  // Connect output port tlmOut
300  for (
301  FwIndexType port = 0;
302  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
303  port++
304  ) {
305  this->m_tlmOut_OutputPort[port].init();
306 
307 #if FW_OBJECT_NAMES == 1
308  Fw::ObjectName portName;
309  portName.format(
310  "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
311  this->m_objName.toChar(),
312  port
313  );
314  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
315 #endif
316  }
317 
318  // Connect output port bufferGetOut
319  for (
320  FwIndexType port = 0;
321  port < static_cast<FwIndexType>(this->getNum_bufferGetOut_OutputPorts());
322  port++
323  ) {
324  this->m_bufferGetOut_OutputPort[port].init();
325 
326 #if FW_OBJECT_NAMES == 1
327  Fw::ObjectName portName;
328  portName.format(
329  "%s_bufferGetOut_OutputPort[%" PRI_PlatformIntType "]",
330  this->m_objName.toChar(),
331  port
332  );
333  this->m_bufferGetOut_OutputPort[port].setObjName(portName.toChar());
334 #endif
335  }
336 
337  // Connect output port productResponseOut
338  for (
339  FwIndexType port = 0;
340  port < static_cast<FwIndexType>(this->getNum_productResponseOut_OutputPorts());
341  port++
342  ) {
343  this->m_productResponseOut_OutputPort[port].init();
344 
345 #if FW_OBJECT_NAMES == 1
346  Fw::ObjectName portName;
347  portName.format(
348  "%s_productResponseOut_OutputPort[%" PRI_PlatformIntType "]",
349  this->m_objName.toChar(),
350  port
351  );
352  this->m_productResponseOut_OutputPort[port].setObjName(portName.toChar());
353 #endif
354  }
355 
356  // Connect output port productSendOut
357  for (
358  FwIndexType port = 0;
359  port < static_cast<FwIndexType>(this->getNum_productSendOut_OutputPorts());
360  port++
361  ) {
362  this->m_productSendOut_OutputPort[port].init();
363 
364 #if FW_OBJECT_NAMES == 1
365  Fw::ObjectName portName;
366  portName.format(
367  "%s_productSendOut_OutputPort[%" PRI_PlatformIntType "]",
368  this->m_objName.toChar(),
369  port
370  );
371  this->m_productSendOut_OutputPort[port].setObjName(portName.toChar());
372 #endif
373  }
374 
375  Os::Queue::Status qStat = this->createQueue(
376  queueDepth,
377  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
378  );
379  FW_ASSERT(
380  Os::Queue::Status::OP_OK == qStat,
381  static_cast<FwAssertArgType>(qStat)
382  );
383  }
384 
385  // ----------------------------------------------------------------------
386  // Getters for special input ports
387  // ----------------------------------------------------------------------
388 
391  {
392  FW_ASSERT(
393  portNum < this->getNum_cmdIn_InputPorts(),
394  static_cast<FwAssertArgType>(portNum)
395  );
396 
397  return &this->m_cmdIn_InputPort[portNum];
398  }
399 
400  // ----------------------------------------------------------------------
401  // Getters for typed input ports
402  // ----------------------------------------------------------------------
403 
406  {
407  FW_ASSERT(
408  portNum < this->getNum_productGetIn_InputPorts(),
409  static_cast<FwAssertArgType>(portNum)
410  );
411 
412  return &this->m_productGetIn_InputPort[portNum];
413  }
414 
417  {
418  FW_ASSERT(
419  portNum < this->getNum_productRequestIn_InputPorts(),
420  static_cast<FwAssertArgType>(portNum)
421  );
422 
423  return &this->m_productRequestIn_InputPort[portNum];
424  }
425 
428  {
429  FW_ASSERT(
430  portNum < this->getNum_productSendIn_InputPorts(),
431  static_cast<FwAssertArgType>(portNum)
432  );
433 
434  return &this->m_productSendIn_InputPort[portNum];
435  }
436 
439  {
440  FW_ASSERT(
441  portNum < this->getNum_schedIn_InputPorts(),
442  static_cast<FwAssertArgType>(portNum)
443  );
444 
445  return &this->m_schedIn_InputPort[portNum];
446  }
447 
448  // ----------------------------------------------------------------------
449  // Connect input ports to special output ports
450  // ----------------------------------------------------------------------
451 
454  FwIndexType portNum,
455  Fw::InputCmdRegPort* port
456  )
457  {
458  FW_ASSERT(
459  portNum < this->getNum_cmdRegIn_OutputPorts(),
460  static_cast<FwAssertArgType>(portNum)
461  );
462 
463  this->m_cmdRegIn_OutputPort[portNum].addCallPort(port);
464  }
465 
468  FwIndexType portNum,
470  )
471  {
472  FW_ASSERT(
473  portNum < this->getNum_cmdResponseOut_OutputPorts(),
474  static_cast<FwAssertArgType>(portNum)
475  );
476 
477  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
478  }
479 
482  FwIndexType portNum,
483  Fw::InputLogPort* port
484  )
485  {
486  FW_ASSERT(
487  portNum < this->getNum_eventOut_OutputPorts(),
488  static_cast<FwAssertArgType>(portNum)
489  );
490 
491  this->m_eventOut_OutputPort[portNum].addCallPort(port);
492  }
493 
494 #if FW_ENABLE_TEXT_LOGGING == 1
495 
496  void DpManagerComponentBase ::
497  set_textEventOut_OutputPort(
498  FwIndexType portNum,
500  )
501  {
502  FW_ASSERT(
503  portNum < this->getNum_textEventOut_OutputPorts(),
504  static_cast<FwAssertArgType>(portNum)
505  );
506 
507  this->m_textEventOut_OutputPort[portNum].addCallPort(port);
508  }
509 
510 #endif
511 
514  FwIndexType portNum,
515  Fw::InputTimePort* port
516  )
517  {
518  FW_ASSERT(
519  portNum < this->getNum_timeGetOut_OutputPorts(),
520  static_cast<FwAssertArgType>(portNum)
521  );
522 
523  this->m_timeGetOut_OutputPort[portNum].addCallPort(port);
524  }
525 
528  FwIndexType portNum,
529  Fw::InputTlmPort* port
530  )
531  {
532  FW_ASSERT(
533  portNum < this->getNum_tlmOut_OutputPorts(),
534  static_cast<FwAssertArgType>(portNum)
535  );
536 
537  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
538  }
539 
540  // ----------------------------------------------------------------------
541  // Connect typed input ports to typed output ports
542  // ----------------------------------------------------------------------
543 
546  FwIndexType portNum,
548  )
549  {
550  FW_ASSERT(
551  portNum < this->getNum_bufferGetOut_OutputPorts(),
552  static_cast<FwAssertArgType>(portNum)
553  );
554 
555  this->m_bufferGetOut_OutputPort[portNum].addCallPort(port);
556  }
557 
560  FwIndexType portNum,
562  )
563  {
564  FW_ASSERT(
565  portNum < this->getNum_productResponseOut_OutputPorts(),
566  static_cast<FwAssertArgType>(portNum)
567  );
568 
569  this->m_productResponseOut_OutputPort[portNum].addCallPort(port);
570  }
571 
574  FwIndexType portNum,
576  )
577  {
578  FW_ASSERT(
579  portNum < this->getNum_productSendOut_OutputPorts(),
580  static_cast<FwAssertArgType>(portNum)
581  );
582 
583  this->m_productSendOut_OutputPort[portNum].addCallPort(port);
584  }
585 
586 #if FW_PORT_SERIALIZATION
587 
588  // ----------------------------------------------------------------------
589  // Connect serial input ports to special output ports
590  // ----------------------------------------------------------------------
591 
594  FwIndexType portNum,
595  Fw::InputSerializePort* port
596  )
597  {
598  FW_ASSERT(
599  portNum < this->getNum_cmdRegIn_OutputPorts(),
600  static_cast<FwAssertArgType>(portNum)
601  );
602 
603  this->m_cmdRegIn_OutputPort[portNum].registerSerialPort(port);
604  }
605 
608  FwIndexType portNum,
609  Fw::InputSerializePort* port
610  )
611  {
612  FW_ASSERT(
613  portNum < this->getNum_cmdResponseOut_OutputPorts(),
614  static_cast<FwAssertArgType>(portNum)
615  );
616 
617  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
618  }
619 
622  FwIndexType portNum,
623  Fw::InputSerializePort* port
624  )
625  {
626  FW_ASSERT(
627  portNum < this->getNum_eventOut_OutputPorts(),
628  static_cast<FwAssertArgType>(portNum)
629  );
630 
631  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
632  }
633 
634 #if FW_ENABLE_TEXT_LOGGING == 1
635 
636  void DpManagerComponentBase ::
637  set_textEventOut_OutputPort(
638  FwIndexType portNum,
639  Fw::InputSerializePort* port
640  )
641  {
642  FW_ASSERT(
643  portNum < this->getNum_textEventOut_OutputPorts(),
644  static_cast<FwAssertArgType>(portNum)
645  );
646 
647  this->m_textEventOut_OutputPort[portNum].registerSerialPort(port);
648  }
649 
650 #endif
651 
654  FwIndexType portNum,
655  Fw::InputSerializePort* port
656  )
657  {
658  FW_ASSERT(
659  portNum < this->getNum_timeGetOut_OutputPorts(),
660  static_cast<FwAssertArgType>(portNum)
661  );
662 
663  this->m_timeGetOut_OutputPort[portNum].registerSerialPort(port);
664  }
665 
668  FwIndexType portNum,
669  Fw::InputSerializePort* port
670  )
671  {
672  FW_ASSERT(
673  portNum < this->getNum_tlmOut_OutputPorts(),
674  static_cast<FwAssertArgType>(portNum)
675  );
676 
677  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
678  }
679 
680 #endif
681 
682 #if FW_PORT_SERIALIZATION
683 
684  // ----------------------------------------------------------------------
685  // Connect serial input ports to typed output ports
686  // ----------------------------------------------------------------------
687 
690  FwIndexType portNum,
691  Fw::InputSerializePort* port
692  )
693  {
694  FW_ASSERT(
695  portNum < this->getNum_productResponseOut_OutputPorts(),
696  static_cast<FwAssertArgType>(portNum)
697  );
698 
699  this->m_productResponseOut_OutputPort[portNum].registerSerialPort(port);
700  }
701 
704  FwIndexType portNum,
705  Fw::InputSerializePort* port
706  )
707  {
708  FW_ASSERT(
709  portNum < this->getNum_productSendOut_OutputPorts(),
710  static_cast<FwAssertArgType>(portNum)
711  );
712 
713  this->m_productSendOut_OutputPort[portNum].registerSerialPort(port);
714  }
715 
716 #endif
717 
718  // ----------------------------------------------------------------------
719  // Command registration
720  // ----------------------------------------------------------------------
721 
723  regCommands()
724  {
725  FW_ASSERT(this->m_cmdRegIn_OutputPort[0].isConnected());
726 
727  this->m_cmdRegIn_OutputPort[0].invoke(
729  );
730  }
731 
732  // ----------------------------------------------------------------------
733  // Component construction and destruction
734  // ----------------------------------------------------------------------
735 
737  DpManagerComponentBase(const char* compName) :
738  Fw::ActiveComponentBase(compName)
739  {
740  // Write telemetry channel NumSuccessfulAllocations
741  this->m_first_update_NumSuccessfulAllocations = true;
742  this->m_last_NumSuccessfulAllocations = 0;
743 
744  // Write telemetry channel NumFailedAllocations
745  this->m_first_update_NumFailedAllocations = true;
746  this->m_last_NumFailedAllocations = 0;
747 
748  // Write telemetry channel NumDataProducts
749  this->m_first_update_NumDataProducts = true;
750  this->m_last_NumDataProducts = 0;
751 
752  // Write telemetry channel NumBytes
753  this->m_first_update_NumBytes = true;
754  this->m_last_NumBytes = 0;
755 
756  this->m_BufferAllocationFailedThrottle = 0;
757  }
758 
761  {
762 
763  }
764 
765  // ----------------------------------------------------------------------
766  // Getters for numbers of special input ports
767  // ----------------------------------------------------------------------
768 
771  {
772  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
773  }
774 
775  // ----------------------------------------------------------------------
776  // Getters for numbers of typed input ports
777  // ----------------------------------------------------------------------
778 
781  {
782  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productGetIn_InputPort));
783  }
784 
787  {
788  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productRequestIn_InputPort));
789  }
790 
793  {
794  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productSendIn_InputPort));
795  }
796 
799  {
800  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_schedIn_InputPort));
801  }
802 
803  // ----------------------------------------------------------------------
804  // Getters for numbers of special output ports
805  // ----------------------------------------------------------------------
806 
809  {
810  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegIn_OutputPort));
811  }
812 
815  {
816  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
817  }
818 
821  {
822  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
823  }
824 
825 #if FW_ENABLE_TEXT_LOGGING == 1
826 
827  FwIndexType DpManagerComponentBase ::
828  getNum_textEventOut_OutputPorts() const
829  {
830  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_textEventOut_OutputPort));
831  }
832 
833 #endif
834 
837  {
838  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetOut_OutputPort));
839  }
840 
843  {
844  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
845  }
846 
847  // ----------------------------------------------------------------------
848  // Getters for numbers of typed output ports
849  // ----------------------------------------------------------------------
850 
853  {
854  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferGetOut_OutputPort));
855  }
856 
859  {
860  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productResponseOut_OutputPort));
861  }
862 
865  {
866  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_productSendOut_OutputPort));
867  }
868 
869  // ----------------------------------------------------------------------
870  // Connection status queries for special output ports
871  // ----------------------------------------------------------------------
872 
875  {
876  FW_ASSERT(
877  portNum < this->getNum_cmdRegIn_OutputPorts(),
878  static_cast<FwAssertArgType>(portNum)
879  );
880 
881  return this->m_cmdRegIn_OutputPort[portNum].isConnected();
882  }
883 
886  {
887  FW_ASSERT(
888  portNum < this->getNum_cmdResponseOut_OutputPorts(),
889  static_cast<FwAssertArgType>(portNum)
890  );
891 
892  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
893  }
894 
897  {
898  FW_ASSERT(
899  portNum < this->getNum_eventOut_OutputPorts(),
900  static_cast<FwAssertArgType>(portNum)
901  );
902 
903  return this->m_eventOut_OutputPort[portNum].isConnected();
904  }
905 
906 #if FW_ENABLE_TEXT_LOGGING == 1
907 
908  bool DpManagerComponentBase ::
909  isConnected_textEventOut_OutputPort(FwIndexType portNum)
910  {
911  FW_ASSERT(
912  portNum < this->getNum_textEventOut_OutputPorts(),
913  static_cast<FwAssertArgType>(portNum)
914  );
915 
916  return this->m_textEventOut_OutputPort[portNum].isConnected();
917  }
918 
919 #endif
920 
923  {
924  FW_ASSERT(
925  portNum < this->getNum_timeGetOut_OutputPorts(),
926  static_cast<FwAssertArgType>(portNum)
927  );
928 
929  return this->m_timeGetOut_OutputPort[portNum].isConnected();
930  }
931 
934  {
935  FW_ASSERT(
936  portNum < this->getNum_tlmOut_OutputPorts(),
937  static_cast<FwAssertArgType>(portNum)
938  );
939 
940  return this->m_tlmOut_OutputPort[portNum].isConnected();
941  }
942 
943  // ----------------------------------------------------------------------
944  // Connection status queries for typed output ports
945  // ----------------------------------------------------------------------
946 
949  {
950  FW_ASSERT(
951  portNum < this->getNum_bufferGetOut_OutputPorts(),
952  static_cast<FwAssertArgType>(portNum)
953  );
954 
955  return this->m_bufferGetOut_OutputPort[portNum].isConnected();
956  }
957 
960  {
961  FW_ASSERT(
962  portNum < this->getNum_productResponseOut_OutputPorts(),
963  static_cast<FwAssertArgType>(portNum)
964  );
965 
966  return this->m_productResponseOut_OutputPort[portNum].isConnected();
967  }
968 
971  {
972  FW_ASSERT(
973  portNum < this->getNum_productSendOut_OutputPorts(),
974  static_cast<FwAssertArgType>(portNum)
975  );
976 
977  return this->m_productSendOut_OutputPort[portNum].isConnected();
978  }
979 
980  // ----------------------------------------------------------------------
981  // Port handler base-class functions for typed input ports
982  //
983  // Call these functions directly to bypass the corresponding ports
984  // ----------------------------------------------------------------------
985 
988  FwIndexType portNum,
989  FwDpIdType id,
990  FwSizeType dataSize,
991  Fw::Buffer& buffer
992  )
993  {
994  // Make sure port number is valid
995  FW_ASSERT(
996  portNum < this->getNum_productGetIn_InputPorts(),
997  static_cast<FwAssertArgType>(portNum)
998  );
999 
1000  Fw::Success retVal;
1001 
1002  // Call handler function
1003  retVal = this->productGetIn_handler(
1004  portNum,
1005  id,
1006  dataSize,
1007  buffer
1008  );
1009 
1010  return retVal;
1011  }
1012 
1015  FwIndexType portNum,
1016  FwDpIdType id,
1017  FwSizeType dataSize
1018  )
1019  {
1020  // Make sure port number is valid
1021  FW_ASSERT(
1022  portNum < this->getNum_productRequestIn_InputPorts(),
1023  static_cast<FwAssertArgType>(portNum)
1024  );
1025 
1026  // Call pre-message hook
1028  portNum,
1029  id,
1030  dataSize
1031  );
1032  ComponentIpcSerializableBuffer msg;
1034 
1035  // Serialize message ID
1036  _status = msg.serialize(
1037  static_cast<FwEnumStoreType>(PRODUCTREQUESTIN_DPREQUEST)
1038  );
1039  FW_ASSERT(
1040  _status == Fw::FW_SERIALIZE_OK,
1041  static_cast<FwAssertArgType>(_status)
1042  );
1043 
1044  // Serialize port number
1045  _status = msg.serialize(portNum);
1046  FW_ASSERT(
1047  _status == Fw::FW_SERIALIZE_OK,
1048  static_cast<FwAssertArgType>(_status)
1049  );
1050 
1051  // Serialize argument id
1052  _status = msg.serialize(id);
1053  FW_ASSERT(
1054  _status == Fw::FW_SERIALIZE_OK,
1055  static_cast<FwAssertArgType>(_status)
1056  );
1057 
1058  // Serialize argument dataSize
1059  _status = msg.serialize(dataSize);
1060  FW_ASSERT(
1061  _status == Fw::FW_SERIALIZE_OK,
1062  static_cast<FwAssertArgType>(_status)
1063  );
1064 
1065  // Send message
1067  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1068 
1069  FW_ASSERT(
1070  qStatus == Os::Queue::OP_OK,
1071  static_cast<FwAssertArgType>(qStatus)
1072  );
1073  }
1074 
1077  FwIndexType portNum,
1078  FwDpIdType id,
1079  const Fw::Buffer& buffer
1080  )
1081  {
1082  // Make sure port number is valid
1083  FW_ASSERT(
1084  portNum < this->getNum_productSendIn_InputPorts(),
1085  static_cast<FwAssertArgType>(portNum)
1086  );
1087 
1088  // Call pre-message hook
1090  portNum,
1091  id,
1092  buffer
1093  );
1094  ComponentIpcSerializableBuffer msg;
1096 
1097  // Serialize message ID
1098  _status = msg.serialize(
1099  static_cast<FwEnumStoreType>(PRODUCTSENDIN_DPSEND)
1100  );
1101  FW_ASSERT(
1102  _status == Fw::FW_SERIALIZE_OK,
1103  static_cast<FwAssertArgType>(_status)
1104  );
1105 
1106  // Serialize port number
1107  _status = msg.serialize(portNum);
1108  FW_ASSERT(
1109  _status == Fw::FW_SERIALIZE_OK,
1110  static_cast<FwAssertArgType>(_status)
1111  );
1112 
1113  // Serialize argument id
1114  _status = msg.serialize(id);
1115  FW_ASSERT(
1116  _status == Fw::FW_SERIALIZE_OK,
1117  static_cast<FwAssertArgType>(_status)
1118  );
1119 
1120  // Serialize argument buffer
1121  _status = msg.serialize(buffer);
1122  FW_ASSERT(
1123  _status == Fw::FW_SERIALIZE_OK,
1124  static_cast<FwAssertArgType>(_status)
1125  );
1126 
1127  // Send message
1129  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1130 
1131  FW_ASSERT(
1132  qStatus == Os::Queue::OP_OK,
1133  static_cast<FwAssertArgType>(qStatus)
1134  );
1135  }
1136 
1139  FwIndexType portNum,
1140  U32 context
1141  )
1142  {
1143  // Make sure port number is valid
1144  FW_ASSERT(
1145  portNum < this->getNum_schedIn_InputPorts(),
1146  static_cast<FwAssertArgType>(portNum)
1147  );
1148 
1149  // Call pre-message hook
1151  portNum,
1152  context
1153  );
1154  ComponentIpcSerializableBuffer msg;
1156 
1157  // Serialize message ID
1158  _status = msg.serialize(
1159  static_cast<FwEnumStoreType>(SCHEDIN_SCHED)
1160  );
1161  FW_ASSERT(
1162  _status == Fw::FW_SERIALIZE_OK,
1163  static_cast<FwAssertArgType>(_status)
1164  );
1165 
1166  // Serialize port number
1167  _status = msg.serialize(portNum);
1168  FW_ASSERT(
1169  _status == Fw::FW_SERIALIZE_OK,
1170  static_cast<FwAssertArgType>(_status)
1171  );
1172 
1173  // Serialize argument context
1174  _status = msg.serialize(context);
1175  FW_ASSERT(
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 
1180  // Send message
1182  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1183 
1184  FW_ASSERT(
1185  qStatus == Os::Queue::OP_OK,
1186  static_cast<FwAssertArgType>(qStatus)
1187  );
1188  }
1189 
1190  // ----------------------------------------------------------------------
1191  // Pre-message hooks for typed async input ports
1192  //
1193  // Each of these functions is invoked just before processing a message
1194  // on the corresponding port. By default, they do nothing. You can
1195  // override them to provide specific pre-message behavior.
1196  // ----------------------------------------------------------------------
1197 
1200  FwIndexType portNum,
1201  FwDpIdType id,
1202  FwSizeType dataSize
1203  )
1204  {
1205  // Default: no-op
1206  }
1207 
1210  FwIndexType portNum,
1211  FwDpIdType id,
1212  const Fw::Buffer& buffer
1213  )
1214  {
1215  // Default: no-op
1216  }
1217 
1220  FwIndexType portNum,
1221  U32 context
1222  )
1223  {
1224  // Default: no-op
1225  }
1226 
1227  // ----------------------------------------------------------------------
1228  // Invocation functions for typed output ports
1229  // ----------------------------------------------------------------------
1230 
1233  FwIndexType portNum,
1234  U32 size
1235  )
1236  {
1237  FW_ASSERT(
1238  portNum < this->getNum_bufferGetOut_OutputPorts(),
1239  static_cast<FwAssertArgType>(portNum)
1240  );
1241  return this->m_bufferGetOut_OutputPort[portNum].invoke(
1242  size
1243  );
1244  }
1245 
1248  FwIndexType portNum,
1249  FwDpIdType id,
1250  const Fw::Buffer& buffer,
1251  const Fw::Success& status
1252  )
1253  {
1254  FW_ASSERT(
1255  portNum < this->getNum_productResponseOut_OutputPorts(),
1256  static_cast<FwAssertArgType>(portNum)
1257  );
1258  this->m_productResponseOut_OutputPort[portNum].invoke(
1259  id,
1260  buffer,
1261  status
1262  );
1263  }
1264 
1267  FwIndexType portNum,
1268  Fw::Buffer& fwBuffer
1269  )
1270  {
1271  FW_ASSERT(
1272  portNum < this->getNum_productSendOut_OutputPorts(),
1273  static_cast<FwAssertArgType>(portNum)
1274  );
1275  this->m_productSendOut_OutputPort[portNum].invoke(
1276  fwBuffer
1277  );
1278  }
1279 
1280  // ----------------------------------------------------------------------
1281  // Command response
1282  // ----------------------------------------------------------------------
1283 
1286  FwOpcodeType opCode,
1287  U32 cmdSeq,
1288  Fw::CmdResponse response
1289  )
1290  {
1291  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1292  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1293  }
1294 
1295  // ----------------------------------------------------------------------
1296  // Command handler base-class functions
1297  //
1298  // Call these functions directly to bypass the command input port
1299  // ----------------------------------------------------------------------
1300 
1303  FwOpcodeType opCode,
1304  U32 cmdSeq,
1305  Fw::CmdArgBuffer& args
1306  )
1307  {
1308  // Call pre-message hook
1309  this->CLEAR_EVENT_THROTTLE_preMsgHook(opCode,cmdSeq);
1310 
1311  // Defer deserializing arguments to the message dispatcher
1312  // to avoid deserializing and reserializing just for IPC
1313  ComponentIpcSerializableBuffer msg;
1315 
1316  // Serialize for IPC
1317  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CLEAR_EVENT_THROTTLE));
1318  FW_ASSERT (
1319  _status == Fw::FW_SERIALIZE_OK,
1320  static_cast<FwAssertArgType>(_status)
1321  );
1322 
1323  // Fake port number to make message dequeue work
1324  FwIndexType port = 0;
1325 
1326  _status = msg.serialize(port);
1327  FW_ASSERT (
1328  _status == Fw::FW_SERIALIZE_OK,
1329  static_cast<FwAssertArgType>(_status)
1330  );
1331 
1332  _status = msg.serialize(opCode);
1333  FW_ASSERT (
1334  _status == Fw::FW_SERIALIZE_OK,
1335  static_cast<FwAssertArgType>(_status)
1336  );
1337 
1338  _status = msg.serialize(cmdSeq);
1339  FW_ASSERT (
1340  _status == Fw::FW_SERIALIZE_OK,
1341  static_cast<FwAssertArgType>(_status)
1342  );
1343 
1344  _status = msg.serialize(args);
1345  FW_ASSERT (
1346  _status == Fw::FW_SERIALIZE_OK,
1347  static_cast<FwAssertArgType>(_status)
1348  );
1349 
1350  // Send message
1352  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1353 
1354  FW_ASSERT(
1355  qStatus == Os::Queue::OP_OK,
1356  static_cast<FwAssertArgType>(qStatus)
1357  );
1358  }
1359 
1360  // ----------------------------------------------------------------------
1361  // Pre-message hooks for async commands
1362  //
1363  // Each of these functions is invoked just before processing the
1364  // corresponding command. By default they do nothing. You can
1365  // override them to provide specific pre-command behavior.
1366  // ----------------------------------------------------------------------
1367 
1370  FwOpcodeType opCode,
1371  U32 cmdSeq
1372  )
1373  {
1374  // Defaults to no-op; can be overridden
1375  (void) opCode;
1376  (void) cmdSeq;
1377  }
1378 
1379  // ----------------------------------------------------------------------
1380  // Event logging functions
1381  // ----------------------------------------------------------------------
1382 
1385  {
1386  // Check throttle value
1387  if (this->m_BufferAllocationFailedThrottle >= EVENTID_BUFFERALLOCATIONFAILED_THROTTLE) {
1388  return;
1389  }
1390  else {
1391  this->m_BufferAllocationFailedThrottle++;
1392  }
1393 
1394  // Get the time
1395  Fw::Time _logTime;
1396  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1397  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1398  }
1399 
1400  FwEventIdType _id = static_cast<FwEventIdType>(0);
1401 
1402  _id = this->getIdBase() + EVENTID_BUFFERALLOCATIONFAILED;
1403 
1404  // Emit the event on the log port
1405  if (this->m_eventOut_OutputPort[0].isConnected()) {
1406  Fw::LogBuffer _logBuff;
1408 
1409 #if FW_AMPCS_COMPATIBLE
1410  // Serialize the number of arguments
1411  _status = _logBuff.serialize(static_cast<U8>(1));
1412  FW_ASSERT(
1413  _status == Fw::FW_SERIALIZE_OK,
1414  static_cast<FwAssertArgType>(_status)
1415  );
1416 #endif
1417 
1418 #if FW_AMPCS_COMPATIBLE
1419  // Serialize the argument size
1420  _status = _logBuff.serialize(
1421  static_cast<U8>(sizeof(U32))
1422  );
1423  FW_ASSERT(
1424  _status == Fw::FW_SERIALIZE_OK,
1425  static_cast<FwAssertArgType>(_status)
1426  );
1427 #endif
1428  _status = _logBuff.serialize(id);
1429  FW_ASSERT(
1430  _status == Fw::FW_SERIALIZE_OK,
1431  static_cast<FwAssertArgType>(_status)
1432  );
1433 
1434  this->m_eventOut_OutputPort[0].invoke(
1435  _id,
1436  _logTime,
1438  _logBuff
1439  );
1440  }
1441 
1442  // Emit the event on the text log port
1443 #if FW_ENABLE_TEXT_LOGGING
1444  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1445 #if FW_OBJECT_NAMES == 1
1446  const char* _formatString =
1447  "(%s) %s: Buffer allocation failed for container id %" PRIu32 "";
1448 #else
1449  const char* _formatString =
1450  "%s: Buffer allocation failed for container id %" PRIu32 "";
1451 #endif
1452 
1453  Fw::TextLogString _logString;
1454  _logString.format(
1455  _formatString,
1456 #if FW_OBJECT_NAMES == 1
1457  this->m_objName.toChar(),
1458 #endif
1459  "BufferAllocationFailed ",
1460  id
1461  );
1462 
1463  this->m_textEventOut_OutputPort[0].invoke(
1464  _id,
1465  _logTime,
1467  _logString
1468  );
1469  }
1470 #endif
1471  }
1472 
1473  // ----------------------------------------------------------------------
1474  // Event throttle reset functions
1475  // ----------------------------------------------------------------------
1476 
1479  {
1480  // Reset throttle counter
1481  this->m_BufferAllocationFailedThrottle = 0;
1482  }
1483 
1484  // ----------------------------------------------------------------------
1485  // Telemetry write functions
1486  // ----------------------------------------------------------------------
1487 
1490  U32 arg,
1491  Fw::Time _tlmTime
1492  )
1493  {
1494  // Check to see if it is the first time
1495  if (not this->m_first_update_NumSuccessfulAllocations) {
1496  // Check to see if value has changed. If not, don't write it.
1497  if (arg == this->m_last_NumSuccessfulAllocations) {
1498  return;
1499  }
1500  else {
1501  this->m_last_NumSuccessfulAllocations = arg;
1502  }
1503  }
1504  else {
1505  this->m_first_update_NumSuccessfulAllocations = false;
1506  this->m_last_NumSuccessfulAllocations = arg;
1507  }
1508 
1509  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1510  if (
1511  this->m_timeGetOut_OutputPort[0].isConnected() &&
1512  (_tlmTime == Fw::ZERO_TIME)
1513  ) {
1514  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1515  }
1516 
1517  Fw::TlmBuffer _tlmBuff;
1518  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1519  FW_ASSERT(
1520  _stat == Fw::FW_SERIALIZE_OK,
1521  static_cast<FwAssertArgType>(_stat)
1522  );
1523 
1524  FwChanIdType _id;
1525 
1527 
1528  this->m_tlmOut_OutputPort[0].invoke(
1529  _id,
1530  _tlmTime,
1531  _tlmBuff
1532  );
1533  }
1534  }
1535 
1538  U32 arg,
1539  Fw::Time _tlmTime
1540  )
1541  {
1542  // Check to see if it is the first time
1543  if (not this->m_first_update_NumFailedAllocations) {
1544  // Check to see if value has changed. If not, don't write it.
1545  if (arg == this->m_last_NumFailedAllocations) {
1546  return;
1547  }
1548  else {
1549  this->m_last_NumFailedAllocations = arg;
1550  }
1551  }
1552  else {
1553  this->m_first_update_NumFailedAllocations = false;
1554  this->m_last_NumFailedAllocations = arg;
1555  }
1556 
1557  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1558  if (
1559  this->m_timeGetOut_OutputPort[0].isConnected() &&
1560  (_tlmTime == Fw::ZERO_TIME)
1561  ) {
1562  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1563  }
1564 
1565  Fw::TlmBuffer _tlmBuff;
1566  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1567  FW_ASSERT(
1568  _stat == Fw::FW_SERIALIZE_OK,
1569  static_cast<FwAssertArgType>(_stat)
1570  );
1571 
1572  FwChanIdType _id;
1573 
1574  _id = this->getIdBase() + CHANNELID_NUMFAILEDALLOCATIONS;
1575 
1576  this->m_tlmOut_OutputPort[0].invoke(
1577  _id,
1578  _tlmTime,
1579  _tlmBuff
1580  );
1581  }
1582  }
1583 
1586  U32 arg,
1587  Fw::Time _tlmTime
1588  )
1589  {
1590  // Check to see if it is the first time
1591  if (not this->m_first_update_NumDataProducts) {
1592  // Check to see if value has changed. If not, don't write it.
1593  if (arg == this->m_last_NumDataProducts) {
1594  return;
1595  }
1596  else {
1597  this->m_last_NumDataProducts = arg;
1598  }
1599  }
1600  else {
1601  this->m_first_update_NumDataProducts = false;
1602  this->m_last_NumDataProducts = arg;
1603  }
1604 
1605  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1606  if (
1607  this->m_timeGetOut_OutputPort[0].isConnected() &&
1608  (_tlmTime == Fw::ZERO_TIME)
1609  ) {
1610  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1611  }
1612 
1613  Fw::TlmBuffer _tlmBuff;
1614  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1615  FW_ASSERT(
1616  _stat == Fw::FW_SERIALIZE_OK,
1617  static_cast<FwAssertArgType>(_stat)
1618  );
1619 
1620  FwChanIdType _id;
1621 
1622  _id = this->getIdBase() + CHANNELID_NUMDATAPRODUCTS;
1623 
1624  this->m_tlmOut_OutputPort[0].invoke(
1625  _id,
1626  _tlmTime,
1627  _tlmBuff
1628  );
1629  }
1630  }
1631 
1634  U64 arg,
1635  Fw::Time _tlmTime
1636  )
1637  {
1638  // Check to see if it is the first time
1639  if (not this->m_first_update_NumBytes) {
1640  // Check to see if value has changed. If not, don't write it.
1641  if (arg == this->m_last_NumBytes) {
1642  return;
1643  }
1644  else {
1645  this->m_last_NumBytes = arg;
1646  }
1647  }
1648  else {
1649  this->m_first_update_NumBytes = false;
1650  this->m_last_NumBytes = arg;
1651  }
1652 
1653  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1654  if (
1655  this->m_timeGetOut_OutputPort[0].isConnected() &&
1656  (_tlmTime == Fw::ZERO_TIME)
1657  ) {
1658  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1659  }
1660 
1661  Fw::TlmBuffer _tlmBuff;
1662  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1663  FW_ASSERT(
1664  _stat == Fw::FW_SERIALIZE_OK,
1665  static_cast<FwAssertArgType>(_stat)
1666  );
1667 
1668  FwChanIdType _id;
1669 
1670  _id = this->getIdBase() + CHANNELID_NUMBYTES;
1671 
1672  this->m_tlmOut_OutputPort[0].invoke(
1673  _id,
1674  _tlmTime,
1675  _tlmBuff
1676  );
1677  }
1678  }
1679 
1680  // ----------------------------------------------------------------------
1681  // Time
1682  // ----------------------------------------------------------------------
1683 
1685  getTime()
1686  {
1687  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1688  Fw::Time _time;
1689  this->m_timeGetOut_OutputPort[0].invoke(_time);
1690  return _time;
1691  }
1692  else {
1693  return Fw::Time(TB_NONE, 0, 0);
1694  }
1695  }
1696 
1697  // ----------------------------------------------------------------------
1698  // Message dispatch functions
1699  // ----------------------------------------------------------------------
1700 
1701  Fw::QueuedComponentBase::MsgDispatchStatus DpManagerComponentBase ::
1702  doDispatch()
1703  {
1704  ComponentIpcSerializableBuffer msg;
1705  FwQueuePriorityType priority = 0;
1706 
1707  Os::Queue::Status msgStatus = this->m_queue.receive(
1708  msg,
1710  priority
1711  );
1712  FW_ASSERT(
1713  msgStatus == Os::Queue::OP_OK,
1714  static_cast<FwAssertArgType>(msgStatus)
1715  );
1716 
1717  // Reset to beginning of buffer
1718  msg.resetDeser();
1719 
1720  FwEnumStoreType desMsg = 0;
1721  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1722  FW_ASSERT(
1723  deserStatus == Fw::FW_SERIALIZE_OK,
1724  static_cast<FwAssertArgType>(deserStatus)
1725  );
1726 
1727  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1728 
1729  if (msgType == DPMANAGER_COMPONENT_EXIT) {
1730  return MSG_DISPATCH_EXIT;
1731  }
1732 
1733  FwIndexType portNum = 0;
1734  deserStatus = msg.deserialize(portNum);
1735  FW_ASSERT(
1736  deserStatus == Fw::FW_SERIALIZE_OK,
1737  static_cast<FwAssertArgType>(deserStatus)
1738  );
1739 
1740  switch (msgType) {
1741  // Handle async input port productRequestIn
1742  case PRODUCTREQUESTIN_DPREQUEST: {
1743  // Deserialize argument id
1744  FwDpIdType id;
1745  deserStatus = msg.deserialize(id);
1746  FW_ASSERT(
1747  deserStatus == Fw::FW_SERIALIZE_OK,
1748  static_cast<FwAssertArgType>(deserStatus)
1749  );
1750 
1751  // Deserialize argument dataSize
1752  FwSizeType dataSize;
1753  deserStatus = msg.deserialize(dataSize);
1754  FW_ASSERT(
1755  deserStatus == Fw::FW_SERIALIZE_OK,
1756  static_cast<FwAssertArgType>(deserStatus)
1757  );
1758  // Call handler function
1760  portNum,
1761  id,
1762  dataSize
1763  );
1764 
1765  break;
1766  }
1767 
1768  // Handle async input port productSendIn
1769  case PRODUCTSENDIN_DPSEND: {
1770  // Deserialize argument id
1771  FwDpIdType id;
1772  deserStatus = msg.deserialize(id);
1773  FW_ASSERT(
1774  deserStatus == Fw::FW_SERIALIZE_OK,
1775  static_cast<FwAssertArgType>(deserStatus)
1776  );
1777 
1778  // Deserialize argument buffer
1779  Fw::Buffer buffer;
1780  deserStatus = msg.deserialize(buffer);
1781  FW_ASSERT(
1782  deserStatus == Fw::FW_SERIALIZE_OK,
1783  static_cast<FwAssertArgType>(deserStatus)
1784  );
1785  // Call handler function
1786  this->productSendIn_handler(
1787  portNum,
1788  id,
1789  buffer
1790  );
1791 
1792  break;
1793  }
1794 
1795  // Handle async input port schedIn
1796  case SCHEDIN_SCHED: {
1797  // Deserialize argument context
1798  U32 context;
1799  deserStatus = msg.deserialize(context);
1800  FW_ASSERT(
1801  deserStatus == Fw::FW_SERIALIZE_OK,
1802  static_cast<FwAssertArgType>(deserStatus)
1803  );
1804  // Call handler function
1805  this->schedIn_handler(
1806  portNum,
1807  context
1808  );
1809 
1810  break;
1811  }
1812 
1813  // Handle command CLEAR_EVENT_THROTTLE
1814  case CMD_CLEAR_EVENT_THROTTLE: {
1815  // Deserialize opcode
1816  FwOpcodeType opCode = 0;
1817  deserStatus = msg.deserialize(opCode);
1818  FW_ASSERT (
1819  deserStatus == Fw::FW_SERIALIZE_OK,
1820  static_cast<FwAssertArgType>(deserStatus)
1821  );
1822 
1823  // Deserialize command sequence
1824  U32 cmdSeq = 0;
1825  deserStatus = msg.deserialize(cmdSeq);
1826  FW_ASSERT (
1827  deserStatus == Fw::FW_SERIALIZE_OK,
1828  static_cast<FwAssertArgType>(deserStatus)
1829  );
1830 
1831  // Deserialize command argument buffer
1832  Fw::CmdArgBuffer args;
1833  deserStatus = msg.deserialize(args);
1834  FW_ASSERT (
1835  deserStatus == Fw::FW_SERIALIZE_OK,
1836  static_cast<FwAssertArgType>(deserStatus)
1837  );
1838 
1839  // Reset buffer
1840  args.resetDeser();
1841 
1842  // Make sure there was no data left over.
1843  // That means the argument buffer size was incorrect.
1844 #if FW_CMD_CHECK_RESIDUAL
1845  if (args.getBuffLeft() != 0) {
1846  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1847  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1848  }
1849  // Don't crash the task if bad arguments were passed from the ground
1850  break;
1851  }
1852 #endif
1853 
1854  // Call handler function
1855  this->CLEAR_EVENT_THROTTLE_cmdHandler(opCode, cmdSeq);
1856 
1857  break;
1858  }
1859 
1860  default:
1861  return MSG_DISPATCH_ERROR;
1862  }
1863 
1864  return MSG_DISPATCH_OK;
1865  }
1866 
1867  // ----------------------------------------------------------------------
1868  // Calls for messages received on special input ports
1869  // ----------------------------------------------------------------------
1870 
1871  void DpManagerComponentBase ::
1872  m_p_cmdIn_in(
1873  Fw::PassiveComponentBase* callComp,
1874  FwIndexType portNum,
1875  FwOpcodeType opCode,
1876  U32 cmdSeq,
1877  Fw::CmdArgBuffer& args
1878  )
1879  {
1880  FW_ASSERT(callComp);
1881  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1882 
1883  const U32 idBase = callComp->getIdBase();
1884  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1885 
1886  // Select base class function based on opcode
1887  switch (opCode - idBase) {
1889  compPtr->CLEAR_EVENT_THROTTLE_cmdHandlerBase(
1890  opCode,
1891  cmdSeq,
1892  args
1893  );
1894  break;
1895  }
1896  }
1897  }
1898 
1899  // ----------------------------------------------------------------------
1900  // Calls for messages received on typed input ports
1901  // ----------------------------------------------------------------------
1902 
1903  Fw::Success DpManagerComponentBase ::
1904  m_p_productGetIn_in(
1905  Fw::PassiveComponentBase* callComp,
1906  FwIndexType portNum,
1907  FwDpIdType id,
1908  FwSizeType dataSize,
1909  Fw::Buffer& buffer
1910  )
1911  {
1912  FW_ASSERT(callComp);
1913  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1914  return compPtr->productGetIn_handlerBase(
1915  portNum,
1916  id,
1917  dataSize,
1918  buffer
1919  );
1920  }
1921 
1922  void DpManagerComponentBase ::
1923  m_p_productRequestIn_in(
1924  Fw::PassiveComponentBase* callComp,
1925  FwIndexType portNum,
1926  FwDpIdType id,
1927  FwSizeType dataSize
1928  )
1929  {
1930  FW_ASSERT(callComp);
1931  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1932  compPtr->productRequestIn_handlerBase(
1933  portNum,
1934  id,
1935  dataSize
1936  );
1937  }
1938 
1939  void DpManagerComponentBase ::
1940  m_p_productSendIn_in(
1941  Fw::PassiveComponentBase* callComp,
1942  FwIndexType portNum,
1943  FwDpIdType id,
1944  const Fw::Buffer& buffer
1945  )
1946  {
1947  FW_ASSERT(callComp);
1948  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1949  compPtr->productSendIn_handlerBase(
1950  portNum,
1951  id,
1952  buffer
1953  );
1954  }
1955 
1956  void DpManagerComponentBase ::
1957  m_p_schedIn_in(
1958  Fw::PassiveComponentBase* callComp,
1959  FwIndexType portNum,
1960  U32 context
1961  )
1962  {
1963  FW_ASSERT(callComp);
1964  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1965  compPtr->schedIn_handlerBase(
1966  portNum,
1967  context
1968  );
1969  }
1970 
1971 }
#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 FwDpIdType
Definition: FpConfig.h:115
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.
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 init()
Initialization function.
Definition: DpGetPortAc.cpp:26
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: DpGetPortAc.cpp:32
void init()
Initialization function.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void setPortNum(NATIVE_INT_TYPE portNum)
@ WARNING_HI
A serious but recoverable event.
void init()
Object initializer.
Definition: ObjBase.cpp:27
const char * toChar() const
Definition: ObjectName.hpp:50
void init()
Initialization function.
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
Fw::Buffer invoke(U32 size)
Invoke a port interface.
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 invoke(FwDpIdType id, const Fw::Buffer &buffer, const Fw::Success &status)
Invoke a port interface.
void init()
Initialization function.
void addCallPort(InputDpResponsePort *callPort)
Register an input port.
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
Success/Failure.
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
FwIndexType getNum_cmdRegIn_OutputPorts() const
bool isConnected_productResponseOut_OutputPort(FwIndexType portNum)
@ OPCODE_CLEAR_EVENT_THROTTLE
Clear event throttling.
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum)
virtual void CLEAR_EVENT_THROTTLE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CLEAR_EVENT_THROTTLE.
void regCommands()
Register commands with the Command Dispatcher.
virtual void schedIn_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port schedIn.
FwIndexType getNum_timeGetOut_OutputPorts() const
void set_productSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to productSendOut[portNum].
void set_eventOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to eventOut[portNum].
void tlmWrite_NumDataProducts(U32 arg, Fw::Time _tlmTime=Fw::Time())
@ EVENTID_BUFFERALLOCATIONFAILED
Buffer allocation failed.
void set_timeGetOut_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeGetOut[portNum].
FwIndexType getNum_tlmOut_OutputPorts() const
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
void log_WARNING_HI_BufferAllocationFailed_ThrottleClear()
Reset throttle value for BufferAllocationFailed.
FwIndexType getNum_productSendIn_InputPorts() const
DpManagerComponentBase(const char *compName="")
Construct DpManagerComponentBase object.
FwIndexType getNum_cmdIn_InputPorts() const
virtual Fw::Success productGetIn_handler(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize, Fw::Buffer &buffer)=0
Handler for input port productGetIn.
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
FwIndexType getNum_productSendOut_OutputPorts() const
bool isConnected_bufferGetOut_OutputPort(FwIndexType portNum)
void tlmWrite_NumSuccessfulAllocations(U32 arg, Fw::Time _tlmTime=Fw::Time())
virtual void productRequestIn_preMsgHook(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)
Pre-message hook for async input port productRequestIn.
virtual void schedIn_handler(FwIndexType portNum, U32 context)=0
Handler for input port schedIn.
bool isConnected_productSendOut_OutputPort(FwIndexType portNum)
FwIndexType getNum_productResponseOut_OutputPorts() const
virtual ~DpManagerComponentBase()
Destroy DpManagerComponentBase object.
@ CHANNELID_NUMSUCCESSFULALLOCATIONS
Channel ID for NumSuccessfulAllocations.
@ CHANNELID_NUMBYTES
Channel ID for NumBytes.
@ CHANNELID_NUMFAILEDALLOCATIONS
Channel ID for NumFailedAllocations.
@ CHANNELID_NUMDATAPRODUCTS
Channel ID for NumDataProducts.
FwIndexType getNum_productGetIn_InputPorts() const
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Fw::InputDpSendPort * get_productSendIn_InputPort(FwIndexType portNum)
void CLEAR_EVENT_THROTTLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
FwIndexType getNum_cmdResponseOut_OutputPorts() const
void tlmWrite_NumBytes(U64 arg, Fw::Time _tlmTime=Fw::Time())
void set_cmdRegIn_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegIn[portNum].
bool isConnected_eventOut_OutputPort(FwIndexType portNum)
void productRequestIn_handlerBase(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)
Handler base-class function for input port productRequestIn.
Fw::Success productGetIn_handlerBase(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize, Fw::Buffer &buffer)
Handler base-class function for input port productGetIn.
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
FwIndexType getNum_eventOut_OutputPorts() const
Fw::Buffer bufferGetOut_out(FwIndexType portNum, U32 size)
Invoke output port bufferGetOut.
virtual void productRequestIn_handler(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)=0
Handler for input port productRequestIn.
void set_productResponseOut_OutputPort(FwIndexType portNum, Fw::InputDpResponsePort *port)
Connect port to productResponseOut[portNum].
bool isConnected_cmdRegIn_OutputPort(FwIndexType portNum)
virtual void CLEAR_EVENT_THROTTLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
@ EVENTID_BUFFERALLOCATIONFAILED_THROTTLE
Throttle reset count for BufferAllocationFailed.
Fw::InputDpGetPort * get_productGetIn_InputPort(FwIndexType portNum)
virtual void productSendIn_handler(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer)=0
Handler for input port productSendIn.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void set_bufferGetOut_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to bufferGetOut[portNum].
virtual void productSendIn_preMsgHook(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer)
Pre-message hook for async input port productSendIn.
void tlmWrite_NumFailedAllocations(U32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void productSendOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port productSendOut.
void productResponseOut_out(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer, const Fw::Success &status)
Invoke output port productResponseOut.
FwIndexType getNum_schedIn_InputPorts() const
void productSendIn_handlerBase(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer)
Handler base-class function for input port productSendIn.
FwIndexType getNum_productRequestIn_InputPorts() const
Fw::InputDpRequestPort * get_productRequestIn_InputPort(FwIndexType portNum)
FwIndexType getNum_bufferGetOut_OutputPorts() const
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
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
#define U64(C)
Definition: sha.h:176