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 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  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 getCapacity() 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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  this->m_BufferAllocationFailedThrottle = 0;
743  }
744 
747  {
748 
749  }
750 
751  // ----------------------------------------------------------------------
752  // Connection status queries for special output ports
753  // ----------------------------------------------------------------------
754 
757  {
758  FW_ASSERT(
759  (0 <= portNum) && (portNum < this->getNum_cmdRegIn_OutputPorts()),
760  static_cast<FwAssertArgType>(portNum)
761  );
762 
763  return this->m_cmdRegIn_OutputPort[portNum].isConnected();
764  }
765 
768  {
769  FW_ASSERT(
770  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
771  static_cast<FwAssertArgType>(portNum)
772  );
773 
774  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
775  }
776 
779  {
780  FW_ASSERT(
781  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
782  static_cast<FwAssertArgType>(portNum)
783  );
784 
785  return this->m_eventOut_OutputPort[portNum].isConnected();
786  }
787 
788 #if FW_ENABLE_TEXT_LOGGING == 1
789 
790  bool DpManagerComponentBase ::
791  isConnected_textEventOut_OutputPort(FwIndexType portNum)
792  {
793  FW_ASSERT(
794  (0 <= portNum) && (portNum < this->getNum_textEventOut_OutputPorts()),
795  static_cast<FwAssertArgType>(portNum)
796  );
797 
798  return this->m_textEventOut_OutputPort[portNum].isConnected();
799  }
800 
801 #endif
802 
805  {
806  FW_ASSERT(
807  (0 <= portNum) && (portNum < this->getNum_timeGetOut_OutputPorts()),
808  static_cast<FwAssertArgType>(portNum)
809  );
810 
811  return this->m_timeGetOut_OutputPort[portNum].isConnected();
812  }
813 
816  {
817  FW_ASSERT(
818  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
819  static_cast<FwAssertArgType>(portNum)
820  );
821 
822  return this->m_tlmOut_OutputPort[portNum].isConnected();
823  }
824 
825  // ----------------------------------------------------------------------
826  // Connection status queries for typed output ports
827  // ----------------------------------------------------------------------
828 
831  {
832  FW_ASSERT(
833  (0 <= portNum) && (portNum < this->getNum_bufferGetOut_OutputPorts()),
834  static_cast<FwAssertArgType>(portNum)
835  );
836 
837  return this->m_bufferGetOut_OutputPort[portNum].isConnected();
838  }
839 
842  {
843  FW_ASSERT(
844  (0 <= portNum) && (portNum < this->getNum_productResponseOut_OutputPorts()),
845  static_cast<FwAssertArgType>(portNum)
846  );
847 
848  return this->m_productResponseOut_OutputPort[portNum].isConnected();
849  }
850 
853  {
854  FW_ASSERT(
855  (0 <= portNum) && (portNum < this->getNum_productSendOut_OutputPorts()),
856  static_cast<FwAssertArgType>(portNum)
857  );
858 
859  return this->m_productSendOut_OutputPort[portNum].isConnected();
860  }
861 
862  // ----------------------------------------------------------------------
863  // Port handler base-class functions for typed input ports
864  //
865  // Call these functions directly to bypass the corresponding ports
866  // ----------------------------------------------------------------------
867 
870  FwIndexType portNum,
871  FwDpIdType id,
872  FwSizeType dataSize,
873  Fw::Buffer& buffer
874  )
875  {
876  // Make sure port number is valid
877  FW_ASSERT(
878  (0 <= portNum) && (portNum < this->getNum_productGetIn_InputPorts()),
879  static_cast<FwAssertArgType>(portNum)
880  );
881 
882  Fw::Success retVal;
883 
884  // Call handler function
885  retVal = this->productGetIn_handler(
886  portNum,
887  id,
888  dataSize,
889  buffer
890  );
891 
892  return retVal;
893  }
894 
897  FwIndexType portNum,
898  FwDpIdType id,
899  FwSizeType dataSize
900  )
901  {
902  // Make sure port number is valid
903  FW_ASSERT(
904  (0 <= portNum) && (portNum < this->getNum_productRequestIn_InputPorts()),
905  static_cast<FwAssertArgType>(portNum)
906  );
907 
908  // Call pre-message hook
910  portNum,
911  id,
912  dataSize
913  );
914  ComponentIpcSerializableBuffer msg;
916 
917  // Serialize message ID
918  _status = msg.serializeFrom(
919  static_cast<FwEnumStoreType>(PRODUCTREQUESTIN_DPREQUEST)
920  );
921  FW_ASSERT(
922  _status == Fw::FW_SERIALIZE_OK,
923  static_cast<FwAssertArgType>(_status)
924  );
925 
926  // Serialize port number
927  _status = msg.serializeFrom(portNum);
928  FW_ASSERT(
929  _status == Fw::FW_SERIALIZE_OK,
930  static_cast<FwAssertArgType>(_status)
931  );
932 
933  // Serialize argument id
934  _status = msg.serializeFrom(id);
935  FW_ASSERT(
936  _status == Fw::FW_SERIALIZE_OK,
937  static_cast<FwAssertArgType>(_status)
938  );
939 
940  // Serialize argument dataSize
941  _status = msg.serializeFrom(dataSize);
942  FW_ASSERT(
943  _status == Fw::FW_SERIALIZE_OK,
944  static_cast<FwAssertArgType>(_status)
945  );
946 
947  // Send message
949  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
950 
951  FW_ASSERT(
952  qStatus == Os::Queue::OP_OK,
953  static_cast<FwAssertArgType>(qStatus)
954  );
955  }
956 
959  FwIndexType portNum,
960  FwDpIdType id,
961  const Fw::Buffer& buffer
962  )
963  {
964  // Make sure port number is valid
965  FW_ASSERT(
966  (0 <= portNum) && (portNum < this->getNum_productSendIn_InputPorts()),
967  static_cast<FwAssertArgType>(portNum)
968  );
969 
970  // Call pre-message hook
972  portNum,
973  id,
974  buffer
975  );
976  ComponentIpcSerializableBuffer msg;
978 
979  // Serialize message ID
980  _status = msg.serializeFrom(
981  static_cast<FwEnumStoreType>(PRODUCTSENDIN_DPSEND)
982  );
983  FW_ASSERT(
984  _status == Fw::FW_SERIALIZE_OK,
985  static_cast<FwAssertArgType>(_status)
986  );
987 
988  // Serialize port number
989  _status = msg.serializeFrom(portNum);
990  FW_ASSERT(
991  _status == Fw::FW_SERIALIZE_OK,
992  static_cast<FwAssertArgType>(_status)
993  );
994 
995  // Serialize argument id
996  _status = msg.serializeFrom(id);
997  FW_ASSERT(
998  _status == Fw::FW_SERIALIZE_OK,
999  static_cast<FwAssertArgType>(_status)
1000  );
1001 
1002  // Serialize argument buffer
1003  _status = msg.serializeFrom(buffer);
1004  FW_ASSERT(
1005  _status == Fw::FW_SERIALIZE_OK,
1006  static_cast<FwAssertArgType>(_status)
1007  );
1008 
1009  // Send message
1011  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1012 
1013  FW_ASSERT(
1014  qStatus == Os::Queue::OP_OK,
1015  static_cast<FwAssertArgType>(qStatus)
1016  );
1017  }
1018 
1021  FwIndexType portNum,
1022  U32 context
1023  )
1024  {
1025  // Make sure port number is valid
1026  FW_ASSERT(
1027  (0 <= portNum) && (portNum < this->getNum_schedIn_InputPorts()),
1028  static_cast<FwAssertArgType>(portNum)
1029  );
1030 
1031  // Call pre-message hook
1033  portNum,
1034  context
1035  );
1036  ComponentIpcSerializableBuffer msg;
1038 
1039  // Serialize message ID
1040  _status = msg.serializeFrom(
1041  static_cast<FwEnumStoreType>(SCHEDIN_SCHED)
1042  );
1043  FW_ASSERT(
1044  _status == Fw::FW_SERIALIZE_OK,
1045  static_cast<FwAssertArgType>(_status)
1046  );
1047 
1048  // Serialize port number
1049  _status = msg.serializeFrom(portNum);
1050  FW_ASSERT(
1051  _status == Fw::FW_SERIALIZE_OK,
1052  static_cast<FwAssertArgType>(_status)
1053  );
1054 
1055  // Serialize argument context
1056  _status = msg.serializeFrom(context);
1057  FW_ASSERT(
1058  _status == Fw::FW_SERIALIZE_OK,
1059  static_cast<FwAssertArgType>(_status)
1060  );
1061 
1062  // Send message
1064  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1065 
1066  FW_ASSERT(
1067  qStatus == Os::Queue::OP_OK,
1068  static_cast<FwAssertArgType>(qStatus)
1069  );
1070  }
1071 
1072  // ----------------------------------------------------------------------
1073  // Pre-message hooks for typed async input ports
1074  //
1075  // Each of these functions is invoked just before processing a message
1076  // on the corresponding port. By default, they do nothing. You can
1077  // override them to provide specific pre-message behavior.
1078  // ----------------------------------------------------------------------
1079 
1082  FwIndexType portNum,
1083  FwDpIdType id,
1084  FwSizeType dataSize
1085  )
1086  {
1087  // Default: no-op
1088  }
1089 
1092  FwIndexType portNum,
1093  FwDpIdType id,
1094  const Fw::Buffer& buffer
1095  )
1096  {
1097  // Default: no-op
1098  }
1099 
1102  FwIndexType portNum,
1103  U32 context
1104  )
1105  {
1106  // Default: no-op
1107  }
1108 
1109  // ----------------------------------------------------------------------
1110  // Invocation functions for typed output ports
1111  // ----------------------------------------------------------------------
1112 
1115  FwIndexType portNum,
1116  FwSizeType size
1117  )
1118  {
1119  FW_ASSERT(
1120  (0 <= portNum) && (portNum < this->getNum_bufferGetOut_OutputPorts()),
1121  static_cast<FwAssertArgType>(portNum)
1122  );
1123 
1124  FW_ASSERT(
1125  this->m_bufferGetOut_OutputPort[portNum].isConnected(),
1126  static_cast<FwAssertArgType>(portNum)
1127  );
1128  return this->m_bufferGetOut_OutputPort[portNum].invoke(
1129  size
1130  );
1131  }
1132 
1135  FwIndexType portNum,
1136  FwDpIdType id,
1137  const Fw::Buffer& buffer,
1138  const Fw::Success& status
1139  )
1140  {
1141  FW_ASSERT(
1142  (0 <= portNum) && (portNum < this->getNum_productResponseOut_OutputPorts()),
1143  static_cast<FwAssertArgType>(portNum)
1144  );
1145 
1146  FW_ASSERT(
1147  this->m_productResponseOut_OutputPort[portNum].isConnected(),
1148  static_cast<FwAssertArgType>(portNum)
1149  );
1150  this->m_productResponseOut_OutputPort[portNum].invoke(
1151  id,
1152  buffer,
1153  status
1154  );
1155  }
1156 
1159  FwIndexType portNum,
1160  Fw::Buffer& fwBuffer
1161  )
1162  {
1163  FW_ASSERT(
1164  (0 <= portNum) && (portNum < this->getNum_productSendOut_OutputPorts()),
1165  static_cast<FwAssertArgType>(portNum)
1166  );
1167 
1168  FW_ASSERT(
1169  this->m_productSendOut_OutputPort[portNum].isConnected(),
1170  static_cast<FwAssertArgType>(portNum)
1171  );
1172  this->m_productSendOut_OutputPort[portNum].invoke(
1173  fwBuffer
1174  );
1175  }
1176 
1177  // ----------------------------------------------------------------------
1178  // Command response
1179  // ----------------------------------------------------------------------
1180 
1183  FwOpcodeType opCode,
1184  U32 cmdSeq,
1185  Fw::CmdResponse response
1186  )
1187  {
1188  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
1189  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
1190  }
1191 
1192  // ----------------------------------------------------------------------
1193  // Command handler base-class functions
1194  //
1195  // Call these functions directly to bypass the command input port
1196  // ----------------------------------------------------------------------
1197 
1200  FwOpcodeType opCode,
1201  U32 cmdSeq,
1202  Fw::CmdArgBuffer& args
1203  )
1204  {
1205  // Call pre-message hook
1206  this->CLEAR_EVENT_THROTTLE_preMsgHook(opCode,cmdSeq);
1207 
1208  // Defer deserializing arguments to the message dispatcher
1209  // to avoid deserializing and reserializing just for IPC
1210  ComponentIpcSerializableBuffer msg;
1212 
1213  // Serialize for IPC
1214  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CLEAR_EVENT_THROTTLE));
1215  FW_ASSERT (
1216  _status == Fw::FW_SERIALIZE_OK,
1217  static_cast<FwAssertArgType>(_status)
1218  );
1219 
1220  // Fake port number to make message dequeue work
1221  FwIndexType port = 0;
1222 
1223  _status = msg.serializeFrom(port);
1224  FW_ASSERT (
1225  _status == Fw::FW_SERIALIZE_OK,
1226  static_cast<FwAssertArgType>(_status)
1227  );
1228 
1229  _status = msg.serializeFrom(opCode);
1230  FW_ASSERT (
1231  _status == Fw::FW_SERIALIZE_OK,
1232  static_cast<FwAssertArgType>(_status)
1233  );
1234 
1235  _status = msg.serializeFrom(cmdSeq);
1236  FW_ASSERT (
1237  _status == Fw::FW_SERIALIZE_OK,
1238  static_cast<FwAssertArgType>(_status)
1239  );
1240 
1241  _status = msg.serializeFrom(args);
1242  FW_ASSERT (
1243  _status == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_status)
1245  );
1246 
1247  // Send message
1249  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1250 
1251  FW_ASSERT(
1252  qStatus == Os::Queue::OP_OK,
1253  static_cast<FwAssertArgType>(qStatus)
1254  );
1255  }
1256 
1257  // ----------------------------------------------------------------------
1258  // Pre-message hooks for async commands
1259  //
1260  // Each of these functions is invoked just before processing the
1261  // corresponding command. By default they do nothing. You can
1262  // override them to provide specific pre-command behavior.
1263  // ----------------------------------------------------------------------
1264 
1267  FwOpcodeType opCode,
1268  U32 cmdSeq
1269  )
1270  {
1271  // Defaults to no-op; can be overridden
1272  (void) opCode;
1273  (void) cmdSeq;
1274  }
1275 
1276  // ----------------------------------------------------------------------
1277  // Event logging functions
1278  // ----------------------------------------------------------------------
1279 
1282  {
1283  // Check throttle value
1284  if (this->m_BufferAllocationFailedThrottle >= EVENTID_BUFFERALLOCATIONFAILED_THROTTLE) {
1285  return;
1286  }
1287  else {
1288  this->m_BufferAllocationFailedThrottle++;
1289  }
1290 
1291  // Get the time
1292  Fw::Time _logTime;
1293  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1294  this->m_timeGetOut_OutputPort[0].invoke(_logTime);
1295  }
1296 
1297  FwEventIdType _id = static_cast<FwEventIdType>(0);
1298 
1299  _id = this->getIdBase() + EVENTID_BUFFERALLOCATIONFAILED;
1300 
1301  // Emit the event on the log port
1302  if (this->m_eventOut_OutputPort[0].isConnected()) {
1303  Fw::LogBuffer _logBuff;
1305 
1306 #if FW_AMPCS_COMPATIBLE
1307  // Serialize the number of arguments
1308  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1309  FW_ASSERT(
1310  _status == Fw::FW_SERIALIZE_OK,
1311  static_cast<FwAssertArgType>(_status)
1312  );
1313 #endif
1314 
1315 #if FW_AMPCS_COMPATIBLE
1316  // Serialize the argument size
1317  _status = _logBuff.serializeFrom(
1318  static_cast<U8>(sizeof(FwDpIdType))
1319  );
1320  FW_ASSERT(
1321  _status == Fw::FW_SERIALIZE_OK,
1322  static_cast<FwAssertArgType>(_status)
1323  );
1324 #endif
1325  _status = _logBuff.serializeFrom(id);
1326  FW_ASSERT(
1327  _status == Fw::FW_SERIALIZE_OK,
1328  static_cast<FwAssertArgType>(_status)
1329  );
1330 
1331  this->m_eventOut_OutputPort[0].invoke(
1332  _id,
1333  _logTime,
1335  _logBuff
1336  );
1337  }
1338 
1339  // Emit the event on the text log port
1340 #if FW_ENABLE_TEXT_LOGGING
1341  if (this->m_textEventOut_OutputPort[0].isConnected()) {
1342 #if FW_OBJECT_NAMES == 1
1343  const char* _formatString =
1344  "(%s) %s: Buffer allocation failed for container id %" PRIu32 "";
1345 #else
1346  const char* _formatString =
1347  "%s: Buffer allocation failed for container id %" PRIu32 "";
1348 #endif
1349 
1350  Fw::TextLogString _logString;
1351  _logString.format(
1352  _formatString,
1353 #if FW_OBJECT_NAMES == 1
1354  this->m_objName.toChar(),
1355 #endif
1356  "BufferAllocationFailed ",
1357  id
1358  );
1359 
1360  this->m_textEventOut_OutputPort[0].invoke(
1361  _id,
1362  _logTime,
1364  _logString
1365  );
1366  }
1367 #endif
1368  }
1369 
1370  // ----------------------------------------------------------------------
1371  // Event throttle reset functions
1372  // ----------------------------------------------------------------------
1373 
1376  {
1377  // Reset throttle counter
1378  this->m_BufferAllocationFailedThrottle = 0;
1379  }
1380 
1381  // ----------------------------------------------------------------------
1382  // Telemetry write functions
1383  // ----------------------------------------------------------------------
1384 
1387  U32 arg,
1388  Fw::Time _tlmTime
1389  )
1390  {
1391  // Check to see if it is the first time
1392  if (not this->m_first_update_NumSuccessfulAllocations) {
1393  // Check to see if value has changed. If not, don't write it.
1394  if (arg == this->m_last_NumSuccessfulAllocations) {
1395  return;
1396  }
1397  else {
1398  this->m_last_NumSuccessfulAllocations = arg;
1399  }
1400  }
1401  else {
1402  this->m_first_update_NumSuccessfulAllocations = false;
1403  this->m_last_NumSuccessfulAllocations = arg;
1404  }
1405 
1406  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1407  if (
1408  this->m_timeGetOut_OutputPort[0].isConnected() &&
1409  (_tlmTime == Fw::ZERO_TIME)
1410  ) {
1411  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1412  }
1413 
1414  Fw::TlmBuffer _tlmBuff;
1415  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1416  FW_ASSERT(
1417  _stat == Fw::FW_SERIALIZE_OK,
1418  static_cast<FwAssertArgType>(_stat)
1419  );
1420 
1421  FwChanIdType _id;
1422 
1424 
1425  this->m_tlmOut_OutputPort[0].invoke(
1426  _id,
1427  _tlmTime,
1428  _tlmBuff
1429  );
1430  }
1431  }
1432 
1435  U32 arg,
1436  Fw::Time _tlmTime
1437  )
1438  {
1439  // Check to see if it is the first time
1440  if (not this->m_first_update_NumFailedAllocations) {
1441  // Check to see if value has changed. If not, don't write it.
1442  if (arg == this->m_last_NumFailedAllocations) {
1443  return;
1444  }
1445  else {
1446  this->m_last_NumFailedAllocations = arg;
1447  }
1448  }
1449  else {
1450  this->m_first_update_NumFailedAllocations = false;
1451  this->m_last_NumFailedAllocations = arg;
1452  }
1453 
1454  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1455  if (
1456  this->m_timeGetOut_OutputPort[0].isConnected() &&
1457  (_tlmTime == Fw::ZERO_TIME)
1458  ) {
1459  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1460  }
1461 
1462  Fw::TlmBuffer _tlmBuff;
1463  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1464  FW_ASSERT(
1465  _stat == Fw::FW_SERIALIZE_OK,
1466  static_cast<FwAssertArgType>(_stat)
1467  );
1468 
1469  FwChanIdType _id;
1470 
1471  _id = this->getIdBase() + CHANNELID_NUMFAILEDALLOCATIONS;
1472 
1473  this->m_tlmOut_OutputPort[0].invoke(
1474  _id,
1475  _tlmTime,
1476  _tlmBuff
1477  );
1478  }
1479  }
1480 
1483  U32 arg,
1484  Fw::Time _tlmTime
1485  )
1486  {
1487  // Check to see if it is the first time
1488  if (not this->m_first_update_NumDataProducts) {
1489  // Check to see if value has changed. If not, don't write it.
1490  if (arg == this->m_last_NumDataProducts) {
1491  return;
1492  }
1493  else {
1494  this->m_last_NumDataProducts = arg;
1495  }
1496  }
1497  else {
1498  this->m_first_update_NumDataProducts = false;
1499  this->m_last_NumDataProducts = arg;
1500  }
1501 
1502  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1503  if (
1504  this->m_timeGetOut_OutputPort[0].isConnected() &&
1505  (_tlmTime == Fw::ZERO_TIME)
1506  ) {
1507  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1508  }
1509 
1510  Fw::TlmBuffer _tlmBuff;
1511  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1512  FW_ASSERT(
1513  _stat == Fw::FW_SERIALIZE_OK,
1514  static_cast<FwAssertArgType>(_stat)
1515  );
1516 
1517  FwChanIdType _id;
1518 
1519  _id = this->getIdBase() + CHANNELID_NUMDATAPRODUCTS;
1520 
1521  this->m_tlmOut_OutputPort[0].invoke(
1522  _id,
1523  _tlmTime,
1524  _tlmBuff
1525  );
1526  }
1527  }
1528 
1531  U64 arg,
1532  Fw::Time _tlmTime
1533  )
1534  {
1535  // Check to see if it is the first time
1536  if (not this->m_first_update_NumBytes) {
1537  // Check to see if value has changed. If not, don't write it.
1538  if (arg == this->m_last_NumBytes) {
1539  return;
1540  }
1541  else {
1542  this->m_last_NumBytes = arg;
1543  }
1544  }
1545  else {
1546  this->m_first_update_NumBytes = false;
1547  this->m_last_NumBytes = arg;
1548  }
1549 
1550  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1551  if (
1552  this->m_timeGetOut_OutputPort[0].isConnected() &&
1553  (_tlmTime == Fw::ZERO_TIME)
1554  ) {
1555  this->m_timeGetOut_OutputPort[0].invoke(_tlmTime);
1556  }
1557 
1558  Fw::TlmBuffer _tlmBuff;
1559  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1560  FW_ASSERT(
1561  _stat == Fw::FW_SERIALIZE_OK,
1562  static_cast<FwAssertArgType>(_stat)
1563  );
1564 
1565  FwChanIdType _id;
1566 
1567  _id = this->getIdBase() + CHANNELID_NUMBYTES;
1568 
1569  this->m_tlmOut_OutputPort[0].invoke(
1570  _id,
1571  _tlmTime,
1572  _tlmBuff
1573  );
1574  }
1575  }
1576 
1577  // ----------------------------------------------------------------------
1578  // Time
1579  // ----------------------------------------------------------------------
1580 
1582  getTime() const
1583  {
1584  if (this->m_timeGetOut_OutputPort[0].isConnected()) {
1585  Fw::Time _time;
1586  this->m_timeGetOut_OutputPort[0].invoke(_time);
1587  return _time;
1588  }
1589  else {
1590  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1591  }
1592  }
1593 
1594  // ----------------------------------------------------------------------
1595  // Message dispatch functions
1596  // ----------------------------------------------------------------------
1597 
1598  Fw::QueuedComponentBase::MsgDispatchStatus DpManagerComponentBase ::
1599  doDispatch()
1600  {
1601  ComponentIpcSerializableBuffer _msg;
1602  FwQueuePriorityType _priority = 0;
1603 
1604  Os::Queue::Status _msgStatus = this->m_queue.receive(
1605  _msg,
1607  _priority
1608  );
1609  FW_ASSERT(
1610  _msgStatus == Os::Queue::OP_OK,
1611  static_cast<FwAssertArgType>(_msgStatus)
1612  );
1613 
1614  // Reset to beginning of buffer
1615  _msg.resetDeser();
1616 
1617  FwEnumStoreType _desMsg = 0;
1618  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1619  FW_ASSERT(
1620  _deserStatus == Fw::FW_SERIALIZE_OK,
1621  static_cast<FwAssertArgType>(_deserStatus)
1622  );
1623 
1624  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1625 
1626  if (_msgType == DPMANAGER_COMPONENT_EXIT) {
1627  return MSG_DISPATCH_EXIT;
1628  }
1629 
1630  FwIndexType portNum = 0;
1631  _deserStatus = _msg.deserializeTo(portNum);
1632  FW_ASSERT(
1633  _deserStatus == Fw::FW_SERIALIZE_OK,
1634  static_cast<FwAssertArgType>(_deserStatus)
1635  );
1636 
1637  switch (_msgType) {
1638  // Handle async input port productRequestIn
1639  case PRODUCTREQUESTIN_DPREQUEST: {
1640  // Deserialize argument id
1641  FwDpIdType id;
1642  _deserStatus = _msg.deserializeTo(id);
1643  FW_ASSERT(
1644  _deserStatus == Fw::FW_SERIALIZE_OK,
1645  static_cast<FwAssertArgType>(_deserStatus)
1646  );
1647 
1648  // Deserialize argument dataSize
1649  FwSizeType dataSize;
1650  _deserStatus = _msg.deserializeTo(dataSize);
1651  FW_ASSERT(
1652  _deserStatus == Fw::FW_SERIALIZE_OK,
1653  static_cast<FwAssertArgType>(_deserStatus)
1654  );
1655  // Call handler function
1657  portNum,
1658  id,
1659  dataSize
1660  );
1661 
1662  break;
1663  }
1664 
1665  // Handle async input port productSendIn
1666  case PRODUCTSENDIN_DPSEND: {
1667  // Deserialize argument id
1668  FwDpIdType id;
1669  _deserStatus = _msg.deserializeTo(id);
1670  FW_ASSERT(
1671  _deserStatus == Fw::FW_SERIALIZE_OK,
1672  static_cast<FwAssertArgType>(_deserStatus)
1673  );
1674 
1675  // Deserialize argument buffer
1676  Fw::Buffer buffer;
1677  _deserStatus = _msg.deserializeTo(buffer);
1678  FW_ASSERT(
1679  _deserStatus == Fw::FW_SERIALIZE_OK,
1680  static_cast<FwAssertArgType>(_deserStatus)
1681  );
1682  // Call handler function
1683  this->productSendIn_handler(
1684  portNum,
1685  id,
1686  buffer
1687  );
1688 
1689  break;
1690  }
1691 
1692  // Handle async input port schedIn
1693  case SCHEDIN_SCHED: {
1694  // Deserialize argument context
1695  U32 context;
1696  _deserStatus = _msg.deserializeTo(context);
1697  FW_ASSERT(
1698  _deserStatus == Fw::FW_SERIALIZE_OK,
1699  static_cast<FwAssertArgType>(_deserStatus)
1700  );
1701  // Call handler function
1702  this->schedIn_handler(
1703  portNum,
1704  context
1705  );
1706 
1707  break;
1708  }
1709 
1710  // Handle command CLEAR_EVENT_THROTTLE
1711  case CMD_CLEAR_EVENT_THROTTLE: {
1712  // Deserialize opcode
1713  FwOpcodeType _opCode = 0;
1714  _deserStatus = _msg.deserializeTo(_opCode);
1715  FW_ASSERT (
1716  _deserStatus == Fw::FW_SERIALIZE_OK,
1717  static_cast<FwAssertArgType>(_deserStatus)
1718  );
1719 
1720  // Deserialize command sequence
1721  U32 _cmdSeq = 0;
1722  _deserStatus = _msg.deserializeTo(_cmdSeq);
1723  FW_ASSERT (
1724  _deserStatus == Fw::FW_SERIALIZE_OK,
1725  static_cast<FwAssertArgType>(_deserStatus)
1726  );
1727 
1728  // Deserialize command argument buffer
1729  Fw::CmdArgBuffer args;
1730  _deserStatus = _msg.deserializeTo(args);
1731  FW_ASSERT (
1732  _deserStatus == Fw::FW_SERIALIZE_OK,
1733  static_cast<FwAssertArgType>(_deserStatus)
1734  );
1735 
1736  // Reset buffer
1737  args.resetDeser();
1738 
1739  // Make sure there was no data left over.
1740  // That means the argument buffer size was incorrect.
1741 #if FW_CMD_CHECK_RESIDUAL
1742  if (args.getDeserializeSizeLeft() != 0) {
1743  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1744  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1745  }
1746  // Don't crash the task if bad arguments were passed from the ground
1747  break;
1748  }
1749 #endif
1750 
1751  // Call handler function
1752  this->CLEAR_EVENT_THROTTLE_cmdHandler(_opCode, _cmdSeq);
1753 
1754  break;
1755  }
1756 
1757  default:
1758  return MSG_DISPATCH_ERROR;
1759  }
1760 
1761  return MSG_DISPATCH_OK;
1762  }
1763 
1764  // ----------------------------------------------------------------------
1765  // Calls for messages received on special input ports
1766  // ----------------------------------------------------------------------
1767 
1768  void DpManagerComponentBase ::
1769  m_p_cmdIn_in(
1770  Fw::PassiveComponentBase* callComp,
1771  FwIndexType portNum,
1772  FwOpcodeType opCode,
1773  U32 cmdSeq,
1774  Fw::CmdArgBuffer& args
1775  )
1776  {
1777  FW_ASSERT(callComp);
1778  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1779 
1780  const U32 idBase = callComp->getIdBase();
1781  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1782 
1783  // Select base class function based on opcode
1784  switch (opCode - idBase) {
1786  compPtr->CLEAR_EVENT_THROTTLE_cmdHandlerBase(
1787  opCode,
1788  cmdSeq,
1789  args
1790  );
1791  break;
1792  }
1793  }
1794  }
1795 
1796  // ----------------------------------------------------------------------
1797  // Calls for messages received on typed input ports
1798  // ----------------------------------------------------------------------
1799 
1800  Fw::Success DpManagerComponentBase ::
1801  m_p_productGetIn_in(
1802  Fw::PassiveComponentBase* callComp,
1803  FwIndexType portNum,
1804  FwDpIdType id,
1805  FwSizeType dataSize,
1806  Fw::Buffer& buffer
1807  )
1808  {
1809  FW_ASSERT(callComp);
1810  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1811  return compPtr->productGetIn_handlerBase(
1812  portNum,
1813  id,
1814  dataSize,
1815  buffer
1816  );
1817  }
1818 
1819  void DpManagerComponentBase ::
1820  m_p_productRequestIn_in(
1821  Fw::PassiveComponentBase* callComp,
1822  FwIndexType portNum,
1823  FwDpIdType id,
1824  FwSizeType dataSize
1825  )
1826  {
1827  FW_ASSERT(callComp);
1828  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1829  compPtr->productRequestIn_handlerBase(
1830  portNum,
1831  id,
1832  dataSize
1833  );
1834  }
1835 
1836  void DpManagerComponentBase ::
1837  m_p_productSendIn_in(
1838  Fw::PassiveComponentBase* callComp,
1839  FwIndexType portNum,
1840  FwDpIdType id,
1841  const Fw::Buffer& buffer
1842  )
1843  {
1844  FW_ASSERT(callComp);
1845  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1846  compPtr->productSendIn_handlerBase(
1847  portNum,
1848  id,
1849  buffer
1850  );
1851  }
1852 
1853  void DpManagerComponentBase ::
1854  m_p_schedIn_in(
1855  Fw::PassiveComponentBase* callComp,
1856  FwIndexType portNum,
1857  U32 context
1858  )
1859  {
1860  FW_ASSERT(callComp);
1861  DpManagerComponentBase* compPtr = static_cast<DpManagerComponentBase*>(callComp);
1862  compPtr->schedIn_handlerBase(
1863  portNum,
1864  context
1865  );
1866  }
1867 
1868 }
Serialization/Deserialization operation was successful.
Svc::InputSchedPort * get_schedIn_InputPort(FwIndexType portNum)
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.
static constexpr FwIndexType getNum_cmdIn_InputPorts()
void set_productSendOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to productSendOut[portNum].
static constexpr FwIndexType getNum_productGetIn_InputPorts()
static constexpr FwIndexType getNum_productRequestIn_InputPorts()
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
static constexpr FwIndexType getNum_eventOut_OutputPorts()
static constexpr FwIndexType getNum_bufferGetOut_OutputPorts()
void log_WARNING_HI_BufferAllocationFailed_ThrottleClear()
Reset throttle value for BufferAllocationFailed.
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
PlatformSizeType FwSizeType
bool isConnected_cmdRegIn_OutputPort(FwIndexType portNum)
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
I32 FwEnumStoreType
void 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
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.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
The size of the serial representations of the port arguments.
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
static constexpr FwIndexType getNum_productSendOut_OutputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
const Time ZERO_TIME
Definition: Time.cpp:5
virtual ~DpManagerComponentBase()
Destroy DpManagerComponentBase object.
void addCallPort(InputDpResponsePort *callPort)
Register an input port.
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void productRequestIn_handlerBase(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)
Handler base-class function for input port productRequestIn.
Enum representing a command response.
void tlmWrite_NumSuccessfulAllocations(U32 arg, Fw::Time _tlmTime=Fw::Time())
No time base has been established (Required)
message to exit active component task
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
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:24
Fw::InputDpGetPort * get_productGetIn_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_productResponseOut_OutputPorts()
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:47
virtual Fw::Success productGetIn_handler(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize, Fw::Buffer &buffer)=0
Handler for input port productGetIn.
void init()
Initialization function.
FwIdType FwEventIdType
The type of an event identifier.
virtual void productSendIn_preMsgHook(FwIndexType portNum, FwDpIdType id, const Fw::Buffer &buffer)
Pre-message hook for async input port productSendIn.
The size of the serial representations of the port arguments.
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
Fw::InputDpSendPort * get_productSendIn_InputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TimePortAc.cpp:128
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)
bool isConnected_bufferGetOut_OutputPort(FwIndexType portNum)
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
virtual void schedIn_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port schedIn.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
static constexpr FwIndexType getNum_cmdRegIn_OutputPorts()
virtual void CLEAR_EVENT_THROTTLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
bool isConnected_timeGetOut_OutputPort(FwIndexType portNum)
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
void CLEAR_EVENT_THROTTLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
A serious but recoverable event.
static constexpr FwIndexType getNum_schedIn_InputPorts()
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:38
static constexpr FwIndexType getNum_timeGetOut_OutputPorts()
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:151
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
BlockingType
message type
Definition: Queue.hpp:46
void schedIn_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port schedIn.
void init()
Initialization function.
Fw::Buffer invoke(FwSizeType size) const
Invoke a port interface.
void productSendOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port productSendOut.
static constexpr FwIndexType getNum_productSendIn_InputPorts()
virtual void productRequestIn_handler(FwIndexType portNum, FwDpIdType id, FwSizeType dataSize)=0
Handler for input port productRequestIn.
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
void log_WARNING_HI_BufferAllocationFailed(FwDpIdType id)
void init()
Initialization function.
FwIdType FwDpIdType
The type of a data product identifier.
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
void set_productResponseOut_OutputPort(FwIndexType portNum, Fw::InputDpResponsePort *port)
Connect port to productResponseOut[portNum].
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
A message was sent requesting an exit of the loop.
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
PlatformIndexType FwIndexType
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)
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.
void init()
Initialization function.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
RateGroupDivider component implementation.
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:56
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
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:48
Implementation of malloc based allocator.
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())
Fw::Buffer bufferGetOut_out(FwIndexType portNum, FwSizeType size)
Invoke output port bufferGetOut.
#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.
#define U64(C)
Definition: sha.h:181