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