F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ComQueueComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComQueueComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ComQueue 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  COMQUEUE_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  BUFFERQUEUEIN_BUFFERSEND,
20  COMPACKETQUEUEIN_COM,
21  COMSTATUSIN_SUCCESSCONDITION,
22  CMD_FLUSH_QUEUE,
23  CMD_FLUSH_ALL_QUEUES,
24  CMD_SET_QUEUE_PRIORITY,
25  INT_IF_RUNINTERNAL,
26  };
27 
28  // Get the max size by constructing a union of the async input, command, and
29  // internal port serialization sizes
30  union BuffUnion {
31  BYTE bufferQueueInPortSize[Fw::BufferSendPortBuffer::CAPACITY];
32  BYTE comPacketQueueInPortSize[Fw::ComPortBuffer::CAPACITY];
35  };
36 
37  // Define a message buffer class large enough to handle all the
38  // asynchronous inputs to the component
39  class ComponentIpcSerializableBuffer :
41  {
42 
43  public:
44 
45  enum {
46  // Offset into data in buffer: Size of message ID and port number
47  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
48  // Max data size
49  MAX_DATA_SIZE = sizeof(BuffUnion),
50  // Max message size: Size of message id + size of port + max data size
51  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
52  };
53 
54  ComponentIpcSerializableBuffer() : Fw::LinearBufferBase(m_buff, sizeof(m_buff)) {
55 
56  }
57 
58  private:
59  // Should be the max of all the input ports serialized sizes...
60  U8 m_buff[SERIALIZATION_SIZE];
61 
62  };
63  }
64 
65  // ----------------------------------------------------------------------
66  // Component initialization
67  // ----------------------------------------------------------------------
68 
71  FwSizeType queueDepth,
72  FwEnumStoreType instance
73  )
74  {
75  // Initialize base class
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect input port CmdDisp
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
83  port++
84  ) {
85  this->m_CmdDisp_InputPort[port].init();
86  this->m_CmdDisp_InputPort[port].addCallComp(
87  this,
88  m_p_CmdDisp_in
89  );
90  this->m_CmdDisp_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  Fw::ObjectName portName;
94  portName.format(
95  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
96  this->m_objName.toChar(),
97  port
98  );
99  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
100 #endif
101  }
102 #endif
103 
104 #if !FW_DIRECT_PORT_CALLS
105  // Connect input port bufferQueueIn
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_bufferQueueIn_InputPorts());
109  port++
110  ) {
111  this->m_bufferQueueIn_InputPort[port].init();
112  this->m_bufferQueueIn_InputPort[port].addCallComp(
113  this,
114  m_p_bufferQueueIn_in
115  );
116  this->m_bufferQueueIn_InputPort[port].setPortNum(port);
117 
118 #if FW_OBJECT_NAMES == 1
119  Fw::ObjectName portName;
120  portName.format(
121  "%s_bufferQueueIn_InputPort[%" PRI_FwIndexType "]",
122  this->m_objName.toChar(),
123  port
124  );
125  this->m_bufferQueueIn_InputPort[port].setObjName(portName.toChar());
126 #endif
127  }
128 #endif
129 
130 #if !FW_DIRECT_PORT_CALLS
131  // Connect input port comPacketQueueIn
132  for (
133  FwIndexType port = 0;
134  port < static_cast<FwIndexType>(this->getNum_comPacketQueueIn_InputPorts());
135  port++
136  ) {
137  this->m_comPacketQueueIn_InputPort[port].init();
138  this->m_comPacketQueueIn_InputPort[port].addCallComp(
139  this,
140  m_p_comPacketQueueIn_in
141  );
142  this->m_comPacketQueueIn_InputPort[port].setPortNum(port);
143 
144 #if FW_OBJECT_NAMES == 1
145  Fw::ObjectName portName;
146  portName.format(
147  "%s_comPacketQueueIn_InputPort[%" PRI_FwIndexType "]",
148  this->m_objName.toChar(),
149  port
150  );
151  this->m_comPacketQueueIn_InputPort[port].setObjName(portName.toChar());
152 #endif
153  }
154 #endif
155 
156 #if !FW_DIRECT_PORT_CALLS
157  // Connect input port comStatusIn
158  for (
159  FwIndexType port = 0;
160  port < static_cast<FwIndexType>(this->getNum_comStatusIn_InputPorts());
161  port++
162  ) {
163  this->m_comStatusIn_InputPort[port].init();
164  this->m_comStatusIn_InputPort[port].addCallComp(
165  this,
166  m_p_comStatusIn_in
167  );
168  this->m_comStatusIn_InputPort[port].setPortNum(port);
169 
170 #if FW_OBJECT_NAMES == 1
171  Fw::ObjectName portName;
172  portName.format(
173  "%s_comStatusIn_InputPort[%" PRI_FwIndexType "]",
174  this->m_objName.toChar(),
175  port
176  );
177  this->m_comStatusIn_InputPort[port].setObjName(portName.toChar());
178 #endif
179  }
180 #endif
181 
182 #if !FW_DIRECT_PORT_CALLS
183  // Connect input port dataReturnIn
184  for (
185  FwIndexType port = 0;
186  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
187  port++
188  ) {
189  this->m_dataReturnIn_InputPort[port].init();
190  this->m_dataReturnIn_InputPort[port].addCallComp(
191  this,
192  m_p_dataReturnIn_in
193  );
194  this->m_dataReturnIn_InputPort[port].setPortNum(port);
195 
196 #if FW_OBJECT_NAMES == 1
197  Fw::ObjectName portName;
198  portName.format(
199  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
200  this->m_objName.toChar(),
201  port
202  );
203  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
204 #endif
205  }
206 #endif
207 
208 #if !FW_DIRECT_PORT_CALLS
209  // Connect input port run
210  for (
211  FwIndexType port = 0;
212  port < static_cast<FwIndexType>(this->getNum_run_InputPorts());
213  port++
214  ) {
215  this->m_run_InputPort[port].init();
216  this->m_run_InputPort[port].addCallComp(
217  this,
218  m_p_run_in
219  );
220  this->m_run_InputPort[port].setPortNum(port);
221 
222 #if FW_OBJECT_NAMES == 1
223  Fw::ObjectName portName;
224  portName.format(
225  "%s_run_InputPort[%" PRI_FwIndexType "]",
226  this->m_objName.toChar(),
227  port
228  );
229  this->m_run_InputPort[port].setObjName(portName.toChar());
230 #endif
231  }
232 #endif
233 
234 #if !FW_DIRECT_PORT_CALLS
235  // Connect output port CmdReg
236  for (
237  FwIndexType port = 0;
238  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
239  port++
240  ) {
241  this->m_CmdReg_OutputPort[port].init();
242 
243 #if FW_OBJECT_NAMES == 1
244  Fw::ObjectName portName;
245  portName.format(
246  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
247  this->m_objName.toChar(),
248  port
249  );
250  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
251 #endif
252  }
253 #endif
254 
255 #if !FW_DIRECT_PORT_CALLS
256  // Connect output port CmdStatus
257  for (
258  FwIndexType port = 0;
259  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
260  port++
261  ) {
262  this->m_CmdStatus_OutputPort[port].init();
263 
264 #if FW_OBJECT_NAMES == 1
265  Fw::ObjectName portName;
266  portName.format(
267  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
268  this->m_objName.toChar(),
269  port
270  );
271  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
272 #endif
273  }
274 #endif
275 
276 #if !FW_DIRECT_PORT_CALLS
277  // Connect output port Log
278  for (
279  FwIndexType port = 0;
280  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
281  port++
282  ) {
283  this->m_Log_OutputPort[port].init();
284 
285 #if FW_OBJECT_NAMES == 1
286  Fw::ObjectName portName;
287  portName.format(
288  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
289  this->m_objName.toChar(),
290  port
291  );
292  this->m_Log_OutputPort[port].setObjName(portName.toChar());
293 #endif
294  }
295 #endif
296 
297 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
298  // Connect output port LogText
299  for (
300  FwIndexType port = 0;
301  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
302  port++
303  ) {
304  this->m_LogText_OutputPort[port].init();
305 
306 #if FW_OBJECT_NAMES == 1
307  Fw::ObjectName portName;
308  portName.format(
309  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
310  this->m_objName.toChar(),
311  port
312  );
313  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
314 #endif
315  }
316 #endif
317 
318 #if !FW_DIRECT_PORT_CALLS
319  // Connect output port Time
320  for (
321  FwIndexType port = 0;
322  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
323  port++
324  ) {
325  this->m_Time_OutputPort[port].init();
326 
327 #if FW_OBJECT_NAMES == 1
328  Fw::ObjectName portName;
329  portName.format(
330  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
331  this->m_objName.toChar(),
332  port
333  );
334  this->m_Time_OutputPort[port].setObjName(portName.toChar());
335 #endif
336  }
337 #endif
338 
339 #if !FW_DIRECT_PORT_CALLS
340  // Connect output port Tlm
341  for (
342  FwIndexType port = 0;
343  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
344  port++
345  ) {
346  this->m_Tlm_OutputPort[port].init();
347 
348 #if FW_OBJECT_NAMES == 1
349  Fw::ObjectName portName;
350  portName.format(
351  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
352  this->m_objName.toChar(),
353  port
354  );
355  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
356 #endif
357  }
358 #endif
359 
360 #if !FW_DIRECT_PORT_CALLS
361  // Connect output port bufferReturnOut
362  for (
363  FwIndexType port = 0;
364  port < static_cast<FwIndexType>(this->getNum_bufferReturnOut_OutputPorts());
365  port++
366  ) {
367  this->m_bufferReturnOut_OutputPort[port].init();
368 
369 #if FW_OBJECT_NAMES == 1
370  Fw::ObjectName portName;
371  portName.format(
372  "%s_bufferReturnOut_OutputPort[%" PRI_FwIndexType "]",
373  this->m_objName.toChar(),
374  port
375  );
376  this->m_bufferReturnOut_OutputPort[port].setObjName(portName.toChar());
377 #endif
378  }
379 #endif
380 
381 #if !FW_DIRECT_PORT_CALLS
382  // Connect output port dataOut
383  for (
384  FwIndexType port = 0;
385  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
386  port++
387  ) {
388  this->m_dataOut_OutputPort[port].init();
389 
390 #if FW_OBJECT_NAMES == 1
391  Fw::ObjectName portName;
392  portName.format(
393  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
394  this->m_objName.toChar(),
395  port
396  );
397  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
398 #endif
399  }
400 #endif
401 
402  // Create the queue
403  Os::Queue::Status qStat = this->createQueue(
404  queueDepth,
405  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
406  );
407  FW_ASSERT(
408  Os::Queue::Status::OP_OK == qStat,
409  static_cast<FwAssertArgType>(qStat)
410  );
411  }
412 
413 #if !FW_DIRECT_PORT_CALLS
414 
415  // ----------------------------------------------------------------------
416  // Getters for special input ports
417  // ----------------------------------------------------------------------
418 
421  {
422  FW_ASSERT(
423  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
424  static_cast<FwAssertArgType>(portNum)
425  );
426 
427  return &this->m_CmdDisp_InputPort[portNum];
428  }
429 
430 #endif
431 
432 #if !FW_DIRECT_PORT_CALLS
433 
434  // ----------------------------------------------------------------------
435  // Getters for typed input ports
436  // ----------------------------------------------------------------------
437 
440  {
441  FW_ASSERT(
442  (0 <= portNum) && (portNum < this->getNum_bufferQueueIn_InputPorts()),
443  static_cast<FwAssertArgType>(portNum)
444  );
445 
446  return &this->m_bufferQueueIn_InputPort[portNum];
447  }
448 
451  {
452  FW_ASSERT(
453  (0 <= portNum) && (portNum < this->getNum_comPacketQueueIn_InputPorts()),
454  static_cast<FwAssertArgType>(portNum)
455  );
456 
457  return &this->m_comPacketQueueIn_InputPort[portNum];
458  }
459 
462  {
463  FW_ASSERT(
464  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
465  static_cast<FwAssertArgType>(portNum)
466  );
467 
468  return &this->m_comStatusIn_InputPort[portNum];
469  }
470 
473  {
474  FW_ASSERT(
475  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
476  static_cast<FwAssertArgType>(portNum)
477  );
478 
479  return &this->m_dataReturnIn_InputPort[portNum];
480  }
481 
484  {
485  FW_ASSERT(
486  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
487  static_cast<FwAssertArgType>(portNum)
488  );
489 
490  return &this->m_run_InputPort[portNum];
491  }
492 
493 #endif
494 
495 #if !FW_DIRECT_PORT_CALLS
496 
497  // ----------------------------------------------------------------------
498  // Connect input ports to special output ports
499  // ----------------------------------------------------------------------
500 
503  FwIndexType portNum,
504  Fw::InputCmdRegPort* port
505  )
506  {
507  FW_ASSERT(
508  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
509  static_cast<FwAssertArgType>(portNum)
510  );
511 
512  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
513  }
514 
517  FwIndexType portNum,
519  )
520  {
521  FW_ASSERT(
522  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
523  static_cast<FwAssertArgType>(portNum)
524  );
525 
526  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
527  }
528 
531  FwIndexType portNum,
532  Fw::InputLogPort* port
533  )
534  {
535  FW_ASSERT(
536  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
537  static_cast<FwAssertArgType>(portNum)
538  );
539 
540  this->m_Log_OutputPort[portNum].addCallPort(port);
541  }
542 
543 #if FW_ENABLE_TEXT_LOGGING == 1
544 
545  void ComQueueComponentBase ::
546  set_LogText_OutputPort(
547  FwIndexType portNum,
549  )
550  {
551  FW_ASSERT(
552  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
553  static_cast<FwAssertArgType>(portNum)
554  );
555 
556  this->m_LogText_OutputPort[portNum].addCallPort(port);
557  }
558 
559 #endif
560 
563  FwIndexType portNum,
564  Fw::InputTimePort* port
565  )
566  {
567  FW_ASSERT(
568  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
569  static_cast<FwAssertArgType>(portNum)
570  );
571 
572  this->m_Time_OutputPort[portNum].addCallPort(port);
573  }
574 
577  FwIndexType portNum,
578  Fw::InputTlmPort* port
579  )
580  {
581  FW_ASSERT(
582  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
583  static_cast<FwAssertArgType>(portNum)
584  );
585 
586  this->m_Tlm_OutputPort[portNum].addCallPort(port);
587  }
588 
589 #endif
590 
591 #if !FW_DIRECT_PORT_CALLS
592 
593  // ----------------------------------------------------------------------
594  // Connect typed input ports to typed output ports
595  // ----------------------------------------------------------------------
596 
599  FwIndexType portNum,
601  )
602  {
603  FW_ASSERT(
604  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
605  static_cast<FwAssertArgType>(portNum)
606  );
607 
608  this->m_bufferReturnOut_OutputPort[portNum].addCallPort(port);
609  }
610 
613  FwIndexType portNum,
615  )
616  {
617  FW_ASSERT(
618  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
619  static_cast<FwAssertArgType>(portNum)
620  );
621 
622  this->m_dataOut_OutputPort[portNum].addCallPort(port);
623  }
624 
625 #endif
626 
627 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
628 
629  // ----------------------------------------------------------------------
630  // Connect serial input ports to special output ports
631  // ----------------------------------------------------------------------
632 
635  FwIndexType portNum,
636  Fw::InputSerializePort* port
637  )
638  {
639  FW_ASSERT(
640  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
641  static_cast<FwAssertArgType>(portNum)
642  );
643 
644  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
645  }
646 
649  FwIndexType portNum,
650  Fw::InputSerializePort* port
651  )
652  {
653  FW_ASSERT(
654  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
655  static_cast<FwAssertArgType>(portNum)
656  );
657 
658  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
659  }
660 
663  FwIndexType portNum,
664  Fw::InputSerializePort* port
665  )
666  {
667  FW_ASSERT(
668  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
669  static_cast<FwAssertArgType>(portNum)
670  );
671 
672  this->m_Log_OutputPort[portNum].registerSerialPort(port);
673  }
674 
675 #if FW_ENABLE_TEXT_LOGGING == 1
676 
677  void ComQueueComponentBase ::
678  set_LogText_OutputPort(
679  FwIndexType portNum,
680  Fw::InputSerializePort* port
681  )
682  {
683  FW_ASSERT(
684  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
685  static_cast<FwAssertArgType>(portNum)
686  );
687 
688  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
689  }
690 
691 #endif
692 
695  FwIndexType portNum,
696  Fw::InputSerializePort* port
697  )
698  {
699  FW_ASSERT(
700  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
701  static_cast<FwAssertArgType>(portNum)
702  );
703 
704  this->m_Time_OutputPort[portNum].registerSerialPort(port);
705  }
706 
709  FwIndexType portNum,
710  Fw::InputSerializePort* port
711  )
712  {
713  FW_ASSERT(
714  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
715  static_cast<FwAssertArgType>(portNum)
716  );
717 
718  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
719  }
720 
721 #endif
722 
723 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
724 
725  // ----------------------------------------------------------------------
726  // Connect serial input ports to typed output ports
727  // ----------------------------------------------------------------------
728 
731  FwIndexType portNum,
732  Fw::InputSerializePort* port
733  )
734  {
735  FW_ASSERT(
736  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
737  static_cast<FwAssertArgType>(portNum)
738  );
739 
740  this->m_bufferReturnOut_OutputPort[portNum].registerSerialPort(port);
741  }
742 
745  FwIndexType portNum,
746  Fw::InputSerializePort* port
747  )
748  {
749  FW_ASSERT(
750  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
751  static_cast<FwAssertArgType>(portNum)
752  );
753 
754  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
755  }
756 
757 #endif
758 
759  // ----------------------------------------------------------------------
760  // Command registration
761  // ----------------------------------------------------------------------
762 
765  {
767 
768  this->CmdReg_out(
769  0,
770  this->getIdBase() + OPCODE_FLUSH_QUEUE
771  );
772 
773  this->CmdReg_out(
774  0,
776  );
777 
778  this->CmdReg_out(
779  0,
781  );
782  }
783 
784  // ----------------------------------------------------------------------
785  // Component construction and destruction
786  // ----------------------------------------------------------------------
787 
789  ComQueueComponentBase(const char* compName) :
790  Fw::ActiveComponentBase(compName)
791  {
792 
793  }
794 
797  {
798 
799  }
800 
801 #if !FW_DIRECT_PORT_CALLS
802 
803  // ----------------------------------------------------------------------
804  // Connection status queries for special output ports
805  // ----------------------------------------------------------------------
806 
809  {
810  FW_ASSERT(
811  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
812  static_cast<FwAssertArgType>(portNum)
813  );
814 
815  return this->m_CmdReg_OutputPort[portNum].isConnected();
816  }
817 
820  {
821  FW_ASSERT(
822  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
823  static_cast<FwAssertArgType>(portNum)
824  );
825 
826  return this->m_CmdStatus_OutputPort[portNum].isConnected();
827  }
828 
831  {
832  FW_ASSERT(
833  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
834  static_cast<FwAssertArgType>(portNum)
835  );
836 
837  return this->m_Log_OutputPort[portNum].isConnected();
838  }
839 
840 #if FW_ENABLE_TEXT_LOGGING == 1
841 
842  bool ComQueueComponentBase ::
843  isConnected_LogText_OutputPort(FwIndexType portNum) const
844  {
845  FW_ASSERT(
846  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
847  static_cast<FwAssertArgType>(portNum)
848  );
849 
850  return this->m_LogText_OutputPort[portNum].isConnected();
851  }
852 
853 #endif
854 
857  {
858  FW_ASSERT(
859  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
860  static_cast<FwAssertArgType>(portNum)
861  );
862 
863  return this->m_Time_OutputPort[portNum].isConnected();
864  }
865 
868  {
869  FW_ASSERT(
870  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
871  static_cast<FwAssertArgType>(portNum)
872  );
873 
874  return this->m_Tlm_OutputPort[portNum].isConnected();
875  }
876 
877 #endif
878 
879 #if !FW_DIRECT_PORT_CALLS
880 
881  // ----------------------------------------------------------------------
882  // Connection status queries for typed output ports
883  // ----------------------------------------------------------------------
884 
887  {
888  FW_ASSERT(
889  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
890  static_cast<FwAssertArgType>(portNum)
891  );
892 
893  return this->m_bufferReturnOut_OutputPort[portNum].isConnected();
894  }
895 
898  {
899  FW_ASSERT(
900  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
901  static_cast<FwAssertArgType>(portNum)
902  );
903 
904  return this->m_dataOut_OutputPort[portNum].isConnected();
905  }
906 
907 #endif
908 
909  // ----------------------------------------------------------------------
910  // Port handler base-class functions for special input ports
911  //
912  // Call these functions directly to bypass the corresponding ports
913  // ----------------------------------------------------------------------
914 
917  FwIndexType portNum,
918  FwOpcodeType opCode,
919  U32 cmdSeq,
920  Fw::CmdArgBuffer& args
921  )
922  {
923 
924  const U32 idBase = this->getIdBase();
925  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
926 
927  // Select base class function based on opcode
928  switch (opCode - idBase) {
929  case OPCODE_FLUSH_QUEUE: {
931  opCode,
932  cmdSeq,
933  args
934  );
935  break;
936  }
937 
940  opCode,
941  cmdSeq,
942  args
943  );
944  break;
945  }
946 
949  opCode,
950  cmdSeq,
951  args
952  );
953  break;
954  }
955  default:
956  // Unknown opcode: ignore it
957  break;
958  }
959  }
960 
961  // ----------------------------------------------------------------------
962  // Port handler base-class functions for typed input ports
963  //
964  // Call these functions directly to bypass the corresponding ports
965  // ----------------------------------------------------------------------
966 
969  FwIndexType portNum,
970  Fw::Buffer& fwBuffer
971  )
972  {
973  // Make sure port number is valid
974  FW_ASSERT(
975  (0 <= portNum) && (portNum < this->getNum_bufferQueueIn_InputPorts()),
976  static_cast<FwAssertArgType>(portNum)
977  );
978 
979  // Call pre-message hook
981  portNum,
982  fwBuffer
983  );
984  ComponentIpcSerializableBuffer msg;
986 
987  // Serialize message ID
988  _status = msg.serializeFrom(
989  static_cast<FwEnumStoreType>(BUFFERQUEUEIN_BUFFERSEND)
990  );
991  FW_ASSERT(
992  _status == Fw::FW_SERIALIZE_OK,
993  static_cast<FwAssertArgType>(_status)
994  );
995 
996  // Serialize port number
997  _status = msg.serializeFrom(portNum);
998  FW_ASSERT(
999  _status == Fw::FW_SERIALIZE_OK,
1000  static_cast<FwAssertArgType>(_status)
1001  );
1002 
1003  // Serialize argument fwBuffer
1004  _status = msg.serializeFrom(fwBuffer);
1005  FW_ASSERT(
1006  _status == Fw::FW_SERIALIZE_OK,
1007  static_cast<FwAssertArgType>(_status)
1008  );
1009 
1010  // Send message
1012  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1013 
1014  if (qStatus == Os::Queue::Status::FULL) {
1015  this->bufferQueueIn_overflowHook(portNum, fwBuffer);
1016  return;
1017  }
1018 
1019  FW_ASSERT(
1020  qStatus == Os::Queue::OP_OK,
1021  static_cast<FwAssertArgType>(qStatus)
1022  );
1023  }
1024 
1027  FwIndexType portNum,
1028  Fw::ComBuffer& data,
1029  U32 context
1030  )
1031  {
1032  // Make sure port number is valid
1033  FW_ASSERT(
1034  (0 <= portNum) && (portNum < this->getNum_comPacketQueueIn_InputPorts()),
1035  static_cast<FwAssertArgType>(portNum)
1036  );
1037 
1038  // Call pre-message hook
1040  portNum,
1041  data,
1042  context
1043  );
1044  ComponentIpcSerializableBuffer msg;
1046 
1047  // Serialize message ID
1048  _status = msg.serializeFrom(
1049  static_cast<FwEnumStoreType>(COMPACKETQUEUEIN_COM)
1050  );
1051  FW_ASSERT(
1052  _status == Fw::FW_SERIALIZE_OK,
1053  static_cast<FwAssertArgType>(_status)
1054  );
1055 
1056  // Serialize port number
1057  _status = msg.serializeFrom(portNum);
1058  FW_ASSERT(
1059  _status == Fw::FW_SERIALIZE_OK,
1060  static_cast<FwAssertArgType>(_status)
1061  );
1062 
1063  // Serialize argument data
1064  _status = msg.serializeFrom(data);
1065  FW_ASSERT(
1066  _status == Fw::FW_SERIALIZE_OK,
1067  static_cast<FwAssertArgType>(_status)
1068  );
1069 
1070  // Serialize argument context
1071  _status = msg.serializeFrom(context);
1072  FW_ASSERT(
1073  _status == Fw::FW_SERIALIZE_OK,
1074  static_cast<FwAssertArgType>(_status)
1075  );
1076 
1077  // Send message
1079  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1080 
1081  if (qStatus == Os::Queue::Status::FULL) {
1082  this->comPacketQueueIn_overflowHook(portNum, data, context);
1083  return;
1084  }
1085 
1086  FW_ASSERT(
1087  qStatus == Os::Queue::OP_OK,
1088  static_cast<FwAssertArgType>(qStatus)
1089  );
1090  }
1091 
1094  FwIndexType portNum,
1095  Fw::Success& condition
1096  )
1097  {
1098  // Make sure port number is valid
1099  FW_ASSERT(
1100  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
1101  static_cast<FwAssertArgType>(portNum)
1102  );
1103 
1104  // Call pre-message hook
1106  portNum,
1107  condition
1108  );
1109  ComponentIpcSerializableBuffer msg;
1111 
1112  // Serialize message ID
1113  _status = msg.serializeFrom(
1114  static_cast<FwEnumStoreType>(COMSTATUSIN_SUCCESSCONDITION)
1115  );
1116  FW_ASSERT(
1117  _status == Fw::FW_SERIALIZE_OK,
1118  static_cast<FwAssertArgType>(_status)
1119  );
1120 
1121  // Serialize port number
1122  _status = msg.serializeFrom(portNum);
1123  FW_ASSERT(
1124  _status == Fw::FW_SERIALIZE_OK,
1125  static_cast<FwAssertArgType>(_status)
1126  );
1127 
1128  // Serialize argument condition
1129  _status = msg.serializeFrom(condition);
1130  FW_ASSERT(
1131  _status == Fw::FW_SERIALIZE_OK,
1132  static_cast<FwAssertArgType>(_status)
1133  );
1134 
1135  // Send message
1137  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1138 
1139  FW_ASSERT(
1140  qStatus == Os::Queue::OP_OK,
1141  static_cast<FwAssertArgType>(qStatus)
1142  );
1143  }
1144 
1147  FwIndexType portNum,
1148  Fw::Buffer& data,
1149  const ComCfg::FrameContext& context
1150  )
1151  {
1152  // Make sure port number is valid
1153  FW_ASSERT(
1154  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
1155  static_cast<FwAssertArgType>(portNum)
1156  );
1157 
1158  // Call handler function
1159  this->dataReturnIn_handler(
1160  portNum,
1161  data,
1162  context
1163  );
1164  }
1165 
1168  FwIndexType portNum,
1169  U32 context
1170  )
1171  {
1172  // Make sure port number is valid
1173  FW_ASSERT(
1174  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
1175  static_cast<FwAssertArgType>(portNum)
1176  );
1177 
1178  // Call handler function
1179  this->run_handler(
1180  portNum,
1181  context
1182  );
1183  }
1184 
1185  // ----------------------------------------------------------------------
1186  // Pre-message hooks for typed async input ports
1187  //
1188  // Each of these functions is invoked just before processing a message
1189  // on the corresponding port. By default, they do nothing. You can
1190  // override them to provide specific pre-message behavior.
1191  // ----------------------------------------------------------------------
1192 
1195  FwIndexType portNum,
1196  Fw::Buffer& fwBuffer
1197  )
1198  {
1199  // Default: no-op
1200  }
1201 
1204  FwIndexType portNum,
1205  Fw::ComBuffer& data,
1206  U32 context
1207  )
1208  {
1209  // Default: no-op
1210  }
1211 
1214  FwIndexType portNum,
1215  Fw::Success& condition
1216  )
1217  {
1218  // Default: no-op
1219  }
1220 
1221 #if !FW_DIRECT_PORT_CALLS
1222 
1223  // ----------------------------------------------------------------------
1224  // Invocation functions for typed output ports
1225  // ----------------------------------------------------------------------
1226 
1229  FwIndexType portNum,
1230  Fw::Buffer& fwBuffer
1231  ) const
1232  {
1233  FW_ASSERT(
1234  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
1235  static_cast<FwAssertArgType>(portNum)
1236  );
1237 
1238  FW_ASSERT(
1239  this->m_bufferReturnOut_OutputPort[portNum].isConnected(),
1240  static_cast<FwAssertArgType>(portNum)
1241  );
1242  this->m_bufferReturnOut_OutputPort[portNum].invoke(
1243  fwBuffer
1244  );
1245  }
1246 
1249  FwIndexType portNum,
1250  Fw::Buffer& data,
1251  const ComCfg::FrameContext& context
1252  ) const
1253  {
1254  FW_ASSERT(
1255  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
1256  static_cast<FwAssertArgType>(portNum)
1257  );
1258 
1259  FW_ASSERT(
1260  this->m_dataOut_OutputPort[portNum].isConnected(),
1261  static_cast<FwAssertArgType>(portNum)
1262  );
1263  this->m_dataOut_OutputPort[portNum].invoke(
1264  data,
1265  context
1266  );
1267  }
1268 
1269 #endif
1270 
1271  // ----------------------------------------------------------------------
1272  // Hooks for internal ports
1273  //
1274  // Each of these functions is invoked just before dropping a message
1275  // on the corresponding internal port. You should override them to provide
1276  // specific drop behavior.
1277  // ----------------------------------------------------------------------
1278 
1279  // ----------------------------------------------------------------------
1280  // Internal interface base-class functions
1281  // ----------------------------------------------------------------------
1282 
1285  {
1286  ComponentIpcSerializableBuffer msg;
1288 
1289  // Serialize the message ID
1290  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(INT_IF_RUNINTERNAL));
1291  FW_ASSERT (
1292  _status == Fw::FW_SERIALIZE_OK,
1293  static_cast<FwAssertArgType>(_status)
1294  );
1295 
1296  // Fake port number to make message dequeue work
1297  _status = msg.serializeFrom(static_cast<FwIndexType>(0));
1298  FW_ASSERT (
1299  _status == Fw::FW_SERIALIZE_OK,
1300  static_cast<FwAssertArgType>(_status)
1301  );
1302 
1303  // Send message
1305  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1306 
1307  if (qStatus == Os::Queue::Status::FULL) {
1308  this->runInternal_overflowHook();
1309  return;
1310  }
1311 
1312  FW_ASSERT(
1313  qStatus == Os::Queue::OP_OK,
1314  static_cast<FwAssertArgType>(qStatus)
1315  );
1316  }
1317 
1318  // ----------------------------------------------------------------------
1319  // Command response
1320  // ----------------------------------------------------------------------
1321 
1324  FwOpcodeType opCode,
1325  U32 cmdSeq,
1326  Fw::CmdResponse response
1327  )
1328  {
1330  this->CmdStatus_out(0, opCode, cmdSeq, response);
1331  }
1332 
1333  // ----------------------------------------------------------------------
1334  // Command handler base-class functions
1335  //
1336  // Call these functions directly to bypass the command input port
1337  // ----------------------------------------------------------------------
1338 
1341  FwOpcodeType opCode,
1342  U32 cmdSeq,
1343  Fw::CmdArgBuffer& args
1344  )
1345  {
1346  // Call pre-message hook
1347  this->FLUSH_QUEUE_preMsgHook(opCode,cmdSeq);
1348 
1349  // Defer deserializing arguments to the message dispatcher
1350  // to avoid deserializing and reserializing just for IPC
1351  ComponentIpcSerializableBuffer msg;
1353 
1354  // Serialize for IPC
1355  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_FLUSH_QUEUE));
1356  FW_ASSERT (
1357  _status == Fw::FW_SERIALIZE_OK,
1358  static_cast<FwAssertArgType>(_status)
1359  );
1360 
1361  // Fake port number to make message dequeue work
1362  FwIndexType port = 0;
1363 
1364  _status = msg.serializeFrom(port);
1365  FW_ASSERT (
1366  _status == Fw::FW_SERIALIZE_OK,
1367  static_cast<FwAssertArgType>(_status)
1368  );
1369 
1370  _status = msg.serializeFrom(opCode);
1371  FW_ASSERT (
1372  _status == Fw::FW_SERIALIZE_OK,
1373  static_cast<FwAssertArgType>(_status)
1374  );
1375 
1376  _status = msg.serializeFrom(cmdSeq);
1377  FW_ASSERT (
1378  _status == Fw::FW_SERIALIZE_OK,
1379  static_cast<FwAssertArgType>(_status)
1380  );
1381 
1382  _status = msg.serializeFrom(args);
1383  FW_ASSERT (
1384  _status == Fw::FW_SERIALIZE_OK,
1385  static_cast<FwAssertArgType>(_status)
1386  );
1387 
1388  // Send message
1390  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1391 
1392  FW_ASSERT(
1393  qStatus == Os::Queue::OP_OK,
1394  static_cast<FwAssertArgType>(qStatus)
1395  );
1396  }
1397 
1400  FwOpcodeType opCode,
1401  U32 cmdSeq,
1402  Fw::CmdArgBuffer& args
1403  )
1404  {
1405  // Call pre-message hook
1406  this->FLUSH_ALL_QUEUES_preMsgHook(opCode,cmdSeq);
1407 
1408  // Defer deserializing arguments to the message dispatcher
1409  // to avoid deserializing and reserializing just for IPC
1410  ComponentIpcSerializableBuffer msg;
1412 
1413  // Serialize for IPC
1414  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_FLUSH_ALL_QUEUES));
1415  FW_ASSERT (
1416  _status == Fw::FW_SERIALIZE_OK,
1417  static_cast<FwAssertArgType>(_status)
1418  );
1419 
1420  // Fake port number to make message dequeue work
1421  FwIndexType port = 0;
1422 
1423  _status = msg.serializeFrom(port);
1424  FW_ASSERT (
1425  _status == Fw::FW_SERIALIZE_OK,
1426  static_cast<FwAssertArgType>(_status)
1427  );
1428 
1429  _status = msg.serializeFrom(opCode);
1430  FW_ASSERT (
1431  _status == Fw::FW_SERIALIZE_OK,
1432  static_cast<FwAssertArgType>(_status)
1433  );
1434 
1435  _status = msg.serializeFrom(cmdSeq);
1436  FW_ASSERT (
1437  _status == Fw::FW_SERIALIZE_OK,
1438  static_cast<FwAssertArgType>(_status)
1439  );
1440 
1441  _status = msg.serializeFrom(args);
1442  FW_ASSERT (
1443  _status == Fw::FW_SERIALIZE_OK,
1444  static_cast<FwAssertArgType>(_status)
1445  );
1446 
1447  // Send message
1449  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1450 
1451  FW_ASSERT(
1452  qStatus == Os::Queue::OP_OK,
1453  static_cast<FwAssertArgType>(qStatus)
1454  );
1455  }
1456 
1459  FwOpcodeType opCode,
1460  U32 cmdSeq,
1461  Fw::CmdArgBuffer& args
1462  )
1463  {
1464  // Call pre-message hook
1465  this->SET_QUEUE_PRIORITY_preMsgHook(opCode,cmdSeq);
1466 
1467  // Defer deserializing arguments to the message dispatcher
1468  // to avoid deserializing and reserializing just for IPC
1469  ComponentIpcSerializableBuffer msg;
1471 
1472  // Serialize for IPC
1473  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SET_QUEUE_PRIORITY));
1474  FW_ASSERT (
1475  _status == Fw::FW_SERIALIZE_OK,
1476  static_cast<FwAssertArgType>(_status)
1477  );
1478 
1479  // Fake port number to make message dequeue work
1480  FwIndexType port = 0;
1481 
1482  _status = msg.serializeFrom(port);
1483  FW_ASSERT (
1484  _status == Fw::FW_SERIALIZE_OK,
1485  static_cast<FwAssertArgType>(_status)
1486  );
1487 
1488  _status = msg.serializeFrom(opCode);
1489  FW_ASSERT (
1490  _status == Fw::FW_SERIALIZE_OK,
1491  static_cast<FwAssertArgType>(_status)
1492  );
1493 
1494  _status = msg.serializeFrom(cmdSeq);
1495  FW_ASSERT (
1496  _status == Fw::FW_SERIALIZE_OK,
1497  static_cast<FwAssertArgType>(_status)
1498  );
1499 
1500  _status = msg.serializeFrom(args);
1501  FW_ASSERT (
1502  _status == Fw::FW_SERIALIZE_OK,
1503  static_cast<FwAssertArgType>(_status)
1504  );
1505 
1506  // Send message
1508  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1509 
1510  FW_ASSERT(
1511  qStatus == Os::Queue::OP_OK,
1512  static_cast<FwAssertArgType>(qStatus)
1513  );
1514  }
1515 
1516  // ----------------------------------------------------------------------
1517  // Pre-message hooks for async commands
1518  //
1519  // Each of these functions is invoked just before processing the
1520  // corresponding command. By default they do nothing. You can
1521  // override them to provide specific pre-command behavior.
1522  // ----------------------------------------------------------------------
1523 
1526  FwOpcodeType opCode,
1527  U32 cmdSeq
1528  )
1529  {
1530  // Defaults to no-op; can be overridden
1531  (void) opCode;
1532  (void) cmdSeq;
1533  }
1534 
1537  FwOpcodeType opCode,
1538  U32 cmdSeq
1539  )
1540  {
1541  // Defaults to no-op; can be overridden
1542  (void) opCode;
1543  (void) cmdSeq;
1544  }
1545 
1548  FwOpcodeType opCode,
1549  U32 cmdSeq
1550  )
1551  {
1552  // Defaults to no-op; can be overridden
1553  (void) opCode;
1554  (void) cmdSeq;
1555  }
1556 
1557  // ----------------------------------------------------------------------
1558  // Event logging functions
1559  // ----------------------------------------------------------------------
1560 
1563  const Svc::QueueType& queueType,
1564  FwIndexType index
1565  ) const
1566  {
1567  // Get the time
1568  Fw::Time _logTime;
1569  if (this->isConnected_Time_OutputPort(0)) {
1570  this->Time_out(0, _logTime);
1571  }
1572 
1573  const FwEventIdType _id = this->getIdBase() + EVENTID_QUEUEOVERFLOW;
1574 
1575  // Emit the event on the log port
1576  if (this->isConnected_Log_OutputPort(0)) {
1577  Fw::LogBuffer _logBuff;
1579 
1580 #if FW_AMPCS_COMPATIBLE
1581  // Serialize the number of arguments
1582  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1583  FW_ASSERT(
1584  _status == Fw::FW_SERIALIZE_OK,
1585  static_cast<FwAssertArgType>(_status)
1586  );
1587 #endif
1588 
1589 #if FW_AMPCS_COMPATIBLE
1590  // Serialize the argument size
1591  _status = _logBuff.serializeFrom(
1592  static_cast<U8>(Svc::QueueType::SERIALIZED_SIZE)
1593  );
1594  FW_ASSERT(
1595  _status == Fw::FW_SERIALIZE_OK,
1596  static_cast<FwAssertArgType>(_status)
1597  );
1598 #endif
1599  _status = _logBuff.serializeFrom(queueType);
1600  FW_ASSERT(
1601  _status == Fw::FW_SERIALIZE_OK,
1602  static_cast<FwAssertArgType>(_status)
1603  );
1604 
1605 #if FW_AMPCS_COMPATIBLE
1606  // Serialize the argument size
1607  _status = _logBuff.serializeFrom(
1608  static_cast<U8>(sizeof(FwIndexType))
1609  );
1610  FW_ASSERT(
1611  _status == Fw::FW_SERIALIZE_OK,
1612  static_cast<FwAssertArgType>(_status)
1613  );
1614 #endif
1615  _status = _logBuff.serializeFrom(index);
1616  FW_ASSERT(
1617  _status == Fw::FW_SERIALIZE_OK,
1618  static_cast<FwAssertArgType>(_status)
1619  );
1620 
1621  this->Log_out(
1622  0,
1623  _id,
1624  _logTime,
1626  _logBuff
1627  );
1628  }
1629 
1630  // Emit the event on the text log port
1631 #if FW_ENABLE_TEXT_LOGGING
1632  if (this->isConnected_LogText_OutputPort(0)) {
1633 #if FW_OBJECT_NAMES == 1
1634  const char* _formatString =
1635  "(%s) %s: The %s queue at index %" PRIi16 " overflowed";
1636 #else
1637  const char* _formatString =
1638  "%s: The %s queue at index %" PRIi16 " overflowed";
1639 #endif
1640 
1641  Fw::String queueTypeStr;
1642  queueType.toString(queueTypeStr);
1643 
1644  Fw::TextLogString _logString;
1645  (void) _logString.format(
1646  _formatString,
1647 #if FW_OBJECT_NAMES == 1
1648  this->m_objName.toChar(),
1649 #endif
1650  "QueueOverflow ",
1651  queueTypeStr.toChar(),
1652  index
1653  );
1654 
1655  this->LogText_out(
1656  0,
1657  _id,
1658  _logTime,
1660  _logString
1661  );
1662  }
1663 #endif
1664  }
1665 
1668  const Svc::QueueType& queueType,
1669  FwIndexType indexType,
1670  FwIndexType newPriority
1671  ) const
1672  {
1673  // Get the time
1674  Fw::Time _logTime;
1675  if (this->isConnected_Time_OutputPort(0)) {
1676  this->Time_out(0, _logTime);
1677  }
1678 
1680 
1681  // Emit the event on the log port
1682  if (this->isConnected_Log_OutputPort(0)) {
1683  Fw::LogBuffer _logBuff;
1685 
1686 #if FW_AMPCS_COMPATIBLE
1687  // Serialize the number of arguments
1688  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1689  FW_ASSERT(
1690  _status == Fw::FW_SERIALIZE_OK,
1691  static_cast<FwAssertArgType>(_status)
1692  );
1693 #endif
1694 
1695 #if FW_AMPCS_COMPATIBLE
1696  // Serialize the argument size
1697  _status = _logBuff.serializeFrom(
1698  static_cast<U8>(Svc::QueueType::SERIALIZED_SIZE)
1699  );
1700  FW_ASSERT(
1701  _status == Fw::FW_SERIALIZE_OK,
1702  static_cast<FwAssertArgType>(_status)
1703  );
1704 #endif
1705  _status = _logBuff.serializeFrom(queueType);
1706  FW_ASSERT(
1707  _status == Fw::FW_SERIALIZE_OK,
1708  static_cast<FwAssertArgType>(_status)
1709  );
1710 
1711 #if FW_AMPCS_COMPATIBLE
1712  // Serialize the argument size
1713  _status = _logBuff.serializeFrom(
1714  static_cast<U8>(sizeof(FwIndexType))
1715  );
1716  FW_ASSERT(
1717  _status == Fw::FW_SERIALIZE_OK,
1718  static_cast<FwAssertArgType>(_status)
1719  );
1720 #endif
1721  _status = _logBuff.serializeFrom(indexType);
1722  FW_ASSERT(
1723  _status == Fw::FW_SERIALIZE_OK,
1724  static_cast<FwAssertArgType>(_status)
1725  );
1726 
1727 #if FW_AMPCS_COMPATIBLE
1728  // Serialize the argument size
1729  _status = _logBuff.serializeFrom(
1730  static_cast<U8>(sizeof(FwIndexType))
1731  );
1732  FW_ASSERT(
1733  _status == Fw::FW_SERIALIZE_OK,
1734  static_cast<FwAssertArgType>(_status)
1735  );
1736 #endif
1737  _status = _logBuff.serializeFrom(newPriority);
1738  FW_ASSERT(
1739  _status == Fw::FW_SERIALIZE_OK,
1740  static_cast<FwAssertArgType>(_status)
1741  );
1742 
1743  this->Log_out(
1744  0,
1745  _id,
1746  _logTime,
1748  _logBuff
1749  );
1750  }
1751 
1752  // Emit the event on the text log port
1753 #if FW_ENABLE_TEXT_LOGGING
1754  if (this->isConnected_LogText_OutputPort(0)) {
1755 #if FW_OBJECT_NAMES == 1
1756  const char* _formatString =
1757  "(%s) %s: %s %" PRIi16 " priority changed to %" PRIi16 "";
1758 #else
1759  const char* _formatString =
1760  "%s: %s %" PRIi16 " priority changed to %" PRIi16 "";
1761 #endif
1762 
1763  Fw::String queueTypeStr;
1764  queueType.toString(queueTypeStr);
1765 
1766  Fw::TextLogString _logString;
1767  (void) _logString.format(
1768  _formatString,
1769 #if FW_OBJECT_NAMES == 1
1770  this->m_objName.toChar(),
1771 #endif
1772  "QueuePriorityChanged ",
1773  queueTypeStr.toChar(),
1774  indexType,
1775  newPriority
1776  );
1777 
1778  this->LogText_out(
1779  0,
1780  _id,
1781  _logTime,
1783  _logString
1784  );
1785  }
1786 #endif
1787  }
1788 
1789  // ----------------------------------------------------------------------
1790  // Telemetry serialized write
1791  // ----------------------------------------------------------------------
1792 
1795  FwChanIdType id,
1796  Fw::TlmBuffer& _tlmBuff,
1797  Fw::Time _tlmTime
1798  ) const
1799  {
1800  if (this->isConnected_Tlm_OutputPort(0)) {
1801  if (
1802  this->isConnected_Time_OutputPort(0) &&
1803  (_tlmTime == Fw::ZERO_TIME)
1804  ) {
1805  this->Time_out(0, _tlmTime);
1806  }
1807 
1808  FwChanIdType _id;
1809  _id = this->getIdBase() + id;
1810 
1811  this->Tlm_out(
1812  0,
1813  _id,
1814  _tlmTime,
1815  _tlmBuff
1816  );
1817  }
1818  }
1819 
1820  // ----------------------------------------------------------------------
1821  // Telemetry write functions
1822  // ----------------------------------------------------------------------
1823 
1826  const Svc::ComQueueDepth& arg,
1827  Fw::Time _tlmTime
1828  ) const
1829  {
1830  if (this->isConnected_Tlm_OutputPort(0)) {
1831  Fw::TlmBuffer _tlmBuff;
1832  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1833  FW_ASSERT(
1834  _stat == Fw::FW_SERIALIZE_OK,
1835  static_cast<FwAssertArgType>(_stat)
1836  );
1837 
1838  this->tlmWrite(
1840  _tlmBuff,
1841  _tlmTime
1842  );
1843  }
1844  }
1845 
1848  const Svc::BuffQueueDepth& arg,
1849  Fw::Time _tlmTime
1850  ) const
1851  {
1852  if (this->isConnected_Tlm_OutputPort(0)) {
1853  Fw::TlmBuffer _tlmBuff;
1854  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1855  FW_ASSERT(
1856  _stat == Fw::FW_SERIALIZE_OK,
1857  static_cast<FwAssertArgType>(_stat)
1858  );
1859 
1860  this->tlmWrite(
1862  _tlmBuff,
1863  _tlmTime
1864  );
1865  }
1866  }
1867 
1870  const Svc::ComQueueIngressDrops& arg,
1871  Fw::Time _tlmTime
1872  )
1873  {
1874  // Check to see if it is the first time
1875  if (not this->m_first_update_comIngressDropped) {
1876  // Check to see if value has changed. If not, don't write it.
1877  if (arg == this->m_last_comIngressDropped) {
1878  return;
1879  }
1880  else {
1881  this->m_last_comIngressDropped = arg;
1882  }
1883  }
1884  else {
1885  this->m_first_update_comIngressDropped = false;
1886  this->m_last_comIngressDropped = arg;
1887  }
1888 
1889  if (this->isConnected_Tlm_OutputPort(0)) {
1890  Fw::TlmBuffer _tlmBuff;
1891  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1892  FW_ASSERT(
1893  _stat == Fw::FW_SERIALIZE_OK,
1894  static_cast<FwAssertArgType>(_stat)
1895  );
1896 
1897  this->tlmWrite(
1899  _tlmBuff,
1900  _tlmTime
1901  );
1902  }
1903  }
1904 
1907  const Svc::BuffQueueIngressDrops& arg,
1908  Fw::Time _tlmTime
1909  )
1910  {
1911  // Check to see if it is the first time
1912  if (not this->m_first_update_buffIngressDropped) {
1913  // Check to see if value has changed. If not, don't write it.
1914  if (arg == this->m_last_buffIngressDropped) {
1915  return;
1916  }
1917  else {
1918  this->m_last_buffIngressDropped = arg;
1919  }
1920  }
1921  else {
1922  this->m_first_update_buffIngressDropped = false;
1923  this->m_last_buffIngressDropped = arg;
1924  }
1925 
1926  if (this->isConnected_Tlm_OutputPort(0)) {
1927  Fw::TlmBuffer _tlmBuff;
1928  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1929  FW_ASSERT(
1930  _stat == Fw::FW_SERIALIZE_OK,
1931  static_cast<FwAssertArgType>(_stat)
1932  );
1933 
1934  this->tlmWrite(
1936  _tlmBuff,
1937  _tlmTime
1938  );
1939  }
1940  }
1941 
1944  const Svc::ComQueueManagedDrops& arg,
1945  Fw::Time _tlmTime
1946  )
1947  {
1948  // Check to see if it is the first time
1949  if (not this->m_first_update_comManagedDropped) {
1950  // Check to see if value has changed. If not, don't write it.
1951  if (arg == this->m_last_comManagedDropped) {
1952  return;
1953  }
1954  else {
1955  this->m_last_comManagedDropped = arg;
1956  }
1957  }
1958  else {
1959  this->m_first_update_comManagedDropped = false;
1960  this->m_last_comManagedDropped = arg;
1961  }
1962 
1963  if (this->isConnected_Tlm_OutputPort(0)) {
1964  Fw::TlmBuffer _tlmBuff;
1965  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1966  FW_ASSERT(
1967  _stat == Fw::FW_SERIALIZE_OK,
1968  static_cast<FwAssertArgType>(_stat)
1969  );
1970 
1971  this->tlmWrite(
1973  _tlmBuff,
1974  _tlmTime
1975  );
1976  }
1977  }
1978 
1981  const Svc::BuffQueueManagedDrops& arg,
1982  Fw::Time _tlmTime
1983  )
1984  {
1985  // Check to see if it is the first time
1986  if (not this->m_first_update_buffManagedDropped) {
1987  // Check to see if value has changed. If not, don't write it.
1988  if (arg == this->m_last_buffManagedDropped) {
1989  return;
1990  }
1991  else {
1992  this->m_last_buffManagedDropped = arg;
1993  }
1994  }
1995  else {
1996  this->m_first_update_buffManagedDropped = false;
1997  this->m_last_buffManagedDropped = arg;
1998  }
1999 
2000  if (this->isConnected_Tlm_OutputPort(0)) {
2001  Fw::TlmBuffer _tlmBuff;
2002  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2003  FW_ASSERT(
2004  _stat == Fw::FW_SERIALIZE_OK,
2005  static_cast<FwAssertArgType>(_stat)
2006  );
2007 
2008  this->tlmWrite(
2010  _tlmBuff,
2011  _tlmTime
2012  );
2013  }
2014  }
2015 
2016  // ----------------------------------------------------------------------
2017  // Time
2018  // ----------------------------------------------------------------------
2019 
2021  getTime() const
2022  {
2023  if (this->isConnected_Time_OutputPort(0)) {
2024  Fw::Time _time;
2025  this->Time_out(0, _time);
2026  return _time;
2027  }
2028  else {
2029  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2030  }
2031  }
2032 
2033  // ----------------------------------------------------------------------
2034  // Message dispatch functions
2035  // ----------------------------------------------------------------------
2036 
2037  Fw::QueuedComponentBase::MsgDispatchStatus ComQueueComponentBase ::
2038  doDispatch()
2039  {
2040  ComponentIpcSerializableBuffer _msg;
2041  FwQueuePriorityType _priority = 0;
2042 
2043  Os::Queue::Status _msgStatus = this->m_queue.receive(
2044  _msg,
2046  _priority
2047  );
2048  FW_ASSERT(
2049  _msgStatus == Os::Queue::OP_OK,
2050  static_cast<FwAssertArgType>(_msgStatus)
2051  );
2052 
2053  // Reset to beginning of buffer
2054  _msg.resetDeser();
2055 
2056  FwEnumStoreType _desMsg = 0;
2057  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2058  FW_ASSERT(
2059  _deserStatus == Fw::FW_SERIALIZE_OK,
2060  static_cast<FwAssertArgType>(_deserStatus)
2061  );
2062 
2063  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2064 
2065  if (_msgType == COMQUEUE_COMPONENT_EXIT) {
2066  return MSG_DISPATCH_EXIT;
2067  }
2068 
2069  FwIndexType portNum = 0;
2070  _deserStatus = _msg.deserializeTo(portNum);
2071  FW_ASSERT(
2072  _deserStatus == Fw::FW_SERIALIZE_OK,
2073  static_cast<FwAssertArgType>(_deserStatus)
2074  );
2075 
2076  switch (_msgType) {
2077  // Handle async input port bufferQueueIn
2078  case BUFFERQUEUEIN_BUFFERSEND: {
2079  // Deserialize argument fwBuffer
2080  Fw::Buffer fwBuffer;
2081  _deserStatus = _msg.deserializeTo(fwBuffer);
2082  FW_ASSERT(
2083  _deserStatus == Fw::FW_SERIALIZE_OK,
2084  static_cast<FwAssertArgType>(_deserStatus)
2085  );
2086  // Call handler function
2087  this->bufferQueueIn_handler(
2088  portNum,
2089  fwBuffer
2090  );
2091 
2092  break;
2093  }
2094 
2095  // Handle async input port comPacketQueueIn
2096  case COMPACKETQUEUEIN_COM: {
2097  // Deserialize argument data
2098  Fw::ComBuffer data;
2099  _deserStatus = _msg.deserializeTo(data);
2100  FW_ASSERT(
2101  _deserStatus == Fw::FW_SERIALIZE_OK,
2102  static_cast<FwAssertArgType>(_deserStatus)
2103  );
2104 
2105  // Deserialize argument context
2106  U32 context;
2107  _deserStatus = _msg.deserializeTo(context);
2108  FW_ASSERT(
2109  _deserStatus == Fw::FW_SERIALIZE_OK,
2110  static_cast<FwAssertArgType>(_deserStatus)
2111  );
2112  // Call handler function
2114  portNum,
2115  data,
2116  context
2117  );
2118 
2119  break;
2120  }
2121 
2122  // Handle async input port comStatusIn
2123  case COMSTATUSIN_SUCCESSCONDITION: {
2124  // Deserialize argument condition
2125  Fw::Success condition;
2126  _deserStatus = _msg.deserializeTo(condition);
2127  FW_ASSERT(
2128  _deserStatus == Fw::FW_SERIALIZE_OK,
2129  static_cast<FwAssertArgType>(_deserStatus)
2130  );
2131  // Call handler function
2132  this->comStatusIn_handler(
2133  portNum,
2134  condition
2135  );
2136 
2137  break;
2138  }
2139 
2140  // Handle command FLUSH_QUEUE
2141  case CMD_FLUSH_QUEUE: {
2142  // Deserialize opcode
2143  FwOpcodeType _opCode = 0;
2144  _deserStatus = _msg.deserializeTo(_opCode);
2145  FW_ASSERT (
2146  _deserStatus == Fw::FW_SERIALIZE_OK,
2147  static_cast<FwAssertArgType>(_deserStatus)
2148  );
2149 
2150  // Deserialize command sequence
2151  U32 _cmdSeq = 0;
2152  _deserStatus = _msg.deserializeTo(_cmdSeq);
2153  FW_ASSERT (
2154  _deserStatus == Fw::FW_SERIALIZE_OK,
2155  static_cast<FwAssertArgType>(_deserStatus)
2156  );
2157 
2158  // Deserialize command argument buffer
2159  Fw::CmdArgBuffer args;
2160  _deserStatus = _msg.deserializeTo(args);
2161  FW_ASSERT (
2162  _deserStatus == Fw::FW_SERIALIZE_OK,
2163  static_cast<FwAssertArgType>(_deserStatus)
2164  );
2165 
2166  // Reset buffer
2167  args.resetDeser();
2168 
2169  // Deserialize argument queueType
2170  Svc::QueueType queueType;
2171  _deserStatus = args.deserializeTo(queueType);
2172  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2173  if (this->isConnected_CmdStatus_OutputPort(0)) {
2174  this->cmdResponse_out(
2175  _opCode,
2176  _cmdSeq,
2178  );
2179  }
2180  // Don't crash the task if bad arguments were passed from the ground
2181  break;
2182  }
2183 
2184  // Deserialize argument indexType
2185  FwIndexType indexType;
2186  _deserStatus = args.deserializeTo(indexType);
2187  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2188  if (this->isConnected_CmdStatus_OutputPort(0)) {
2189  this->cmdResponse_out(
2190  _opCode,
2191  _cmdSeq,
2193  );
2194  }
2195  // Don't crash the task if bad arguments were passed from the ground
2196  break;
2197  }
2198 
2199  // Make sure there was no data left over.
2200  // That means the argument buffer size was incorrect.
2201 #if FW_CMD_CHECK_RESIDUAL
2202  if (args.getDeserializeSizeLeft() != 0) {
2203  if (this->isConnected_CmdStatus_OutputPort(0)) {
2204  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2205  }
2206  // Don't crash the task if bad arguments were passed from the ground
2207  break;
2208  }
2209 #endif
2210 
2211  // Call handler function
2212  this->FLUSH_QUEUE_cmdHandler(
2213  _opCode, _cmdSeq,
2214  queueType,
2215  indexType
2216  );
2217 
2218  break;
2219  }
2220 
2221  // Handle command FLUSH_ALL_QUEUES
2222  case CMD_FLUSH_ALL_QUEUES: {
2223  // Deserialize opcode
2224  FwOpcodeType _opCode = 0;
2225  _deserStatus = _msg.deserializeTo(_opCode);
2226  FW_ASSERT (
2227  _deserStatus == Fw::FW_SERIALIZE_OK,
2228  static_cast<FwAssertArgType>(_deserStatus)
2229  );
2230 
2231  // Deserialize command sequence
2232  U32 _cmdSeq = 0;
2233  _deserStatus = _msg.deserializeTo(_cmdSeq);
2234  FW_ASSERT (
2235  _deserStatus == Fw::FW_SERIALIZE_OK,
2236  static_cast<FwAssertArgType>(_deserStatus)
2237  );
2238 
2239  // Deserialize command argument buffer
2240  Fw::CmdArgBuffer args;
2241  _deserStatus = _msg.deserializeTo(args);
2242  FW_ASSERT (
2243  _deserStatus == Fw::FW_SERIALIZE_OK,
2244  static_cast<FwAssertArgType>(_deserStatus)
2245  );
2246 
2247  // Reset buffer
2248  args.resetDeser();
2249 
2250  // Make sure there was no data left over.
2251  // That means the argument buffer size was incorrect.
2252 #if FW_CMD_CHECK_RESIDUAL
2253  if (args.getDeserializeSizeLeft() != 0) {
2254  if (this->isConnected_CmdStatus_OutputPort(0)) {
2255  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2256  }
2257  // Don't crash the task if bad arguments were passed from the ground
2258  break;
2259  }
2260 #endif
2261 
2262  // Call handler function
2263  this->FLUSH_ALL_QUEUES_cmdHandler(_opCode, _cmdSeq);
2264 
2265  break;
2266  }
2267 
2268  // Handle command SET_QUEUE_PRIORITY
2269  case CMD_SET_QUEUE_PRIORITY: {
2270  // Deserialize opcode
2271  FwOpcodeType _opCode = 0;
2272  _deserStatus = _msg.deserializeTo(_opCode);
2273  FW_ASSERT (
2274  _deserStatus == Fw::FW_SERIALIZE_OK,
2275  static_cast<FwAssertArgType>(_deserStatus)
2276  );
2277 
2278  // Deserialize command sequence
2279  U32 _cmdSeq = 0;
2280  _deserStatus = _msg.deserializeTo(_cmdSeq);
2281  FW_ASSERT (
2282  _deserStatus == Fw::FW_SERIALIZE_OK,
2283  static_cast<FwAssertArgType>(_deserStatus)
2284  );
2285 
2286  // Deserialize command argument buffer
2287  Fw::CmdArgBuffer args;
2288  _deserStatus = _msg.deserializeTo(args);
2289  FW_ASSERT (
2290  _deserStatus == Fw::FW_SERIALIZE_OK,
2291  static_cast<FwAssertArgType>(_deserStatus)
2292  );
2293 
2294  // Reset buffer
2295  args.resetDeser();
2296 
2297  // Deserialize argument queueType
2298  Svc::QueueType queueType;
2299  _deserStatus = args.deserializeTo(queueType);
2300  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2301  if (this->isConnected_CmdStatus_OutputPort(0)) {
2302  this->cmdResponse_out(
2303  _opCode,
2304  _cmdSeq,
2306  );
2307  }
2308  // Don't crash the task if bad arguments were passed from the ground
2309  break;
2310  }
2311 
2312  // Deserialize argument indexType
2313  FwIndexType indexType;
2314  _deserStatus = args.deserializeTo(indexType);
2315  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2316  if (this->isConnected_CmdStatus_OutputPort(0)) {
2317  this->cmdResponse_out(
2318  _opCode,
2319  _cmdSeq,
2321  );
2322  }
2323  // Don't crash the task if bad arguments were passed from the ground
2324  break;
2325  }
2326 
2327  // Deserialize argument newPriority
2328  FwIndexType newPriority;
2329  _deserStatus = args.deserializeTo(newPriority);
2330  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2331  if (this->isConnected_CmdStatus_OutputPort(0)) {
2332  this->cmdResponse_out(
2333  _opCode,
2334  _cmdSeq,
2336  );
2337  }
2338  // Don't crash the task if bad arguments were passed from the ground
2339  break;
2340  }
2341 
2342  // Make sure there was no data left over.
2343  // That means the argument buffer size was incorrect.
2344 #if FW_CMD_CHECK_RESIDUAL
2345  if (args.getDeserializeSizeLeft() != 0) {
2346  if (this->isConnected_CmdStatus_OutputPort(0)) {
2347  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2348  }
2349  // Don't crash the task if bad arguments were passed from the ground
2350  break;
2351  }
2352 #endif
2353 
2354  // Call handler function
2356  _opCode, _cmdSeq,
2357  queueType,
2358  indexType,
2359  newPriority
2360  );
2361 
2362  break;
2363  }
2364 
2365  // Handle internal interface runInternal
2366  case INT_IF_RUNINTERNAL: {
2367  // Make sure there was no data left over.
2368  // That means the buffer size was incorrect.
2369  FW_ASSERT(
2370  _msg.getDeserializeSizeLeft() == 0,
2371  static_cast<FwAssertArgType>(_msg.getDeserializeSizeLeft())
2372  );
2373 
2374  // Call handler function
2376 
2377  break;
2378  }
2379 
2380  default:
2381  return MSG_DISPATCH_ERROR;
2382  }
2383 
2384  return MSG_DISPATCH_OK;
2385  }
2386 
2387  // ----------------------------------------------------------------------
2388  // Calls for messages received on special input ports
2389  // ----------------------------------------------------------------------
2390 
2391  void ComQueueComponentBase ::
2392  m_p_CmdDisp_in(
2393  Fw::PassiveComponentBase* callComp,
2394  FwIndexType portNum,
2395  FwOpcodeType opCode,
2396  U32 cmdSeq,
2397  Fw::CmdArgBuffer& args
2398  )
2399  {
2400  FW_ASSERT(callComp != nullptr);
2401  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2402  compPtr->CmdDisp_handlerBase(
2403  portNum,
2404  opCode,
2405  cmdSeq,
2406  args
2407  );
2408  }
2409 
2410  // ----------------------------------------------------------------------
2411  // Calls for messages received on typed input ports
2412  // ----------------------------------------------------------------------
2413 
2414  void ComQueueComponentBase ::
2415  m_p_bufferQueueIn_in(
2416  Fw::PassiveComponentBase* callComp,
2417  FwIndexType portNum,
2418  Fw::Buffer& fwBuffer
2419  )
2420  {
2421  FW_ASSERT(callComp != nullptr);
2422  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2423  compPtr->bufferQueueIn_handlerBase(
2424  portNum,
2425  fwBuffer
2426  );
2427  }
2428 
2429  void ComQueueComponentBase ::
2430  m_p_comPacketQueueIn_in(
2431  Fw::PassiveComponentBase* callComp,
2432  FwIndexType portNum,
2433  Fw::ComBuffer& data,
2434  U32 context
2435  )
2436  {
2437  FW_ASSERT(callComp != nullptr);
2438  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2439  compPtr->comPacketQueueIn_handlerBase(
2440  portNum,
2441  data,
2442  context
2443  );
2444  }
2445 
2446  void ComQueueComponentBase ::
2447  m_p_comStatusIn_in(
2448  Fw::PassiveComponentBase* callComp,
2449  FwIndexType portNum,
2450  Fw::Success& condition
2451  )
2452  {
2453  FW_ASSERT(callComp != nullptr);
2454  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2455  compPtr->comStatusIn_handlerBase(
2456  portNum,
2457  condition
2458  );
2459  }
2460 
2461  void ComQueueComponentBase ::
2462  m_p_dataReturnIn_in(
2463  Fw::PassiveComponentBase* callComp,
2464  FwIndexType portNum,
2465  Fw::Buffer& data,
2466  const ComCfg::FrameContext& context
2467  )
2468  {
2469  FW_ASSERT(callComp != nullptr);
2470  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2471  compPtr->dataReturnIn_handlerBase(
2472  portNum,
2473  data,
2474  context
2475  );
2476  }
2477 
2478  void ComQueueComponentBase ::
2479  m_p_run_in(
2480  Fw::PassiveComponentBase* callComp,
2481  FwIndexType portNum,
2482  U32 context
2483  )
2484  {
2485  FW_ASSERT(callComp != nullptr);
2486  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2487  compPtr->run_handlerBase(
2488  portNum,
2489  context
2490  );
2491  }
2492 
2493 #if !FW_DIRECT_PORT_CALLS
2494 
2495  // ----------------------------------------------------------------------
2496  // Invocation functions for special output ports
2497  // ----------------------------------------------------------------------
2498 
2499  void ComQueueComponentBase ::
2500  CmdReg_out(
2501  FwIndexType portNum,
2502  FwOpcodeType opCode
2503  ) const
2504  {
2505  FW_ASSERT(
2506  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
2507  static_cast<FwAssertArgType>(portNum)
2508  );
2509 
2510  FW_ASSERT(
2511  this->m_CmdReg_OutputPort[portNum].isConnected(),
2512  static_cast<FwAssertArgType>(portNum)
2513  );
2514  this->m_CmdReg_OutputPort[portNum].invoke(
2515  opCode
2516  );
2517  }
2518 
2519  void ComQueueComponentBase ::
2520  CmdStatus_out(
2521  FwIndexType portNum,
2522  FwOpcodeType opCode,
2523  U32 cmdSeq,
2524  const Fw::CmdResponse& response
2525  ) const
2526  {
2527  FW_ASSERT(
2528  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
2529  static_cast<FwAssertArgType>(portNum)
2530  );
2531 
2532  FW_ASSERT(
2533  this->m_CmdStatus_OutputPort[portNum].isConnected(),
2534  static_cast<FwAssertArgType>(portNum)
2535  );
2536  this->m_CmdStatus_OutputPort[portNum].invoke(
2537  opCode,
2538  cmdSeq,
2539  response
2540  );
2541  }
2542 
2543  void ComQueueComponentBase ::
2544  Log_out(
2545  FwIndexType portNum,
2546  FwEventIdType id,
2547  Fw::Time& timeTag,
2548  const Fw::LogSeverity& severity,
2549  Fw::LogBuffer& args
2550  ) const
2551  {
2552  FW_ASSERT(
2553  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
2554  static_cast<FwAssertArgType>(portNum)
2555  );
2556 
2557  FW_ASSERT(
2558  this->m_Log_OutputPort[portNum].isConnected(),
2559  static_cast<FwAssertArgType>(portNum)
2560  );
2561  this->m_Log_OutputPort[portNum].invoke(
2562  id,
2563  timeTag,
2564  severity,
2565  args
2566  );
2567  }
2568 
2569 #if FW_ENABLE_TEXT_LOGGING
2570 
2571  void ComQueueComponentBase ::
2572  LogText_out(
2573  FwIndexType portNum,
2574  FwEventIdType id,
2575  Fw::Time& timeTag,
2576  const Fw::LogSeverity& severity,
2577  Fw::TextLogString& text
2578  ) const
2579  {
2580  FW_ASSERT(
2581  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
2582  static_cast<FwAssertArgType>(portNum)
2583  );
2584 
2585  FW_ASSERT(
2586  this->m_LogText_OutputPort[portNum].isConnected(),
2587  static_cast<FwAssertArgType>(portNum)
2588  );
2589  this->m_LogText_OutputPort[portNum].invoke(
2590  id,
2591  timeTag,
2592  severity,
2593  text
2594  );
2595  }
2596 
2597 #endif
2598 
2599  void ComQueueComponentBase ::
2600  Time_out(
2601  FwIndexType portNum,
2602  Fw::Time& time
2603  ) const
2604  {
2605  FW_ASSERT(
2606  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
2607  static_cast<FwAssertArgType>(portNum)
2608  );
2609 
2610  FW_ASSERT(
2611  this->m_Time_OutputPort[portNum].isConnected(),
2612  static_cast<FwAssertArgType>(portNum)
2613  );
2614  this->m_Time_OutputPort[portNum].invoke(
2615  time
2616  );
2617  }
2618 
2619  void ComQueueComponentBase ::
2620  Tlm_out(
2621  FwIndexType portNum,
2622  FwChanIdType id,
2623  Fw::Time& timeTag,
2624  Fw::TlmBuffer& val
2625  ) const
2626  {
2627  FW_ASSERT(
2628  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
2629  static_cast<FwAssertArgType>(portNum)
2630  );
2631 
2632  FW_ASSERT(
2633  this->m_Tlm_OutputPort[portNum].isConnected(),
2634  static_cast<FwAssertArgType>(portNum)
2635  );
2636  this->m_Tlm_OutputPort[portNum].invoke(
2637  id,
2638  timeTag,
2639  val
2640  );
2641  }
2642 
2643 #endif
2644 
2645 }
Serialization/Deserialization operation was successful.
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
static constexpr FwIndexType getNum_Tlm_OutputPorts()
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual ~ComQueueComponentBase()
Destroy ComQueueComponentBase object.
static constexpr FwSizeType CAPACITY
Definition: CmdPortAc.hpp:36
virtual void FLUSH_QUEUE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Svc::QueueType &queueType, FwIndexType indexType)=0
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
void FLUSH_QUEUE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
FwIdType FwOpcodeType
The type of a command opcode.
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
Operation succeeded.
Definition: Os.hpp:27
static constexpr FwIndexType getNum_bufferReturnOut_OutputPorts()
PlatformSizeType FwSizeType
void tlmWrite_buffQueueDepth(const Svc::BuffQueueDepth &arg, Fw::Time _tlmTime=Fw::Time()) const
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 set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
bool isConnected_Log_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
Status
status returned from the queue send function
Definition: Queue.hpp:30
virtual void FLUSH_ALL_QUEUES_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command FLUSH_ALL_QUEUES.
static constexpr FwIndexType getNum_CmdReg_OutputPorts()
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
void init()
Initialization function.
Definition: CmdPortAc.cpp:89
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
static constexpr FwSizeType CAPACITY
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
void log_ACTIVITY_HI_QueuePriorityChanged(const Svc::QueueType &queueType, FwIndexType indexType, FwIndexType newPriority) const
virtual void FLUSH_ALL_QUEUES_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
static constexpr FwIndexType getNum_comPacketQueueIn_InputPorts()
static constexpr FwSizeType CAPACITY
void set_bufferReturnOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferReturnOut[portNum].
const Time ZERO_TIME
Definition: Time.cpp:5
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
Enum representing a command response.
virtual void FLUSH_QUEUE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command FLUSH_QUEUE.
Per-port counts of async ingress drops for Fw::Buffer.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
No time base has been established (Required)
void FLUSH_ALL_QUEUES_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
bool isConnected_Time_OutputPort(FwIndexType portNum) const
Os::Queue m_queue
queue object for active component
Set the priority of a specific queue at runtime.
void addCallPort(InputComDataWithContextPort *callPort)
Register an input port.
Array of queue depths for Fw::Com types.
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
An enumeration of queue data types.
virtual void runInternal_overflowHook()=0
Overflow hook for async input port runInternal.
void init()
Object initializer.
Definition: ObjBase.cpp:24
message to exit active component task
void init()
Initialization function.
Definition: ComPortAc.cpp:81
void SET_QUEUE_PRIORITY_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void comStatusIn_handlerBase(FwIndexType portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
void tlmWrite_comManagedDropped(const Svc::ComQueueManagedDrops &arg, Fw::Time _tlmTime=Fw::Time())
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:95
Message will block until space is available.
Definition: Queue.hpp:47
void log_WARNING_HI_QueueOverflow(const Svc::QueueType &queueType, FwIndexType index) const
virtual void bufferQueueIn_preMsgHook(FwIndexType portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port bufferQueueIn.
FwIdType FwEventIdType
The type of an event identifier.
void invoke(FwOpcodeType opCode) const
Invoke a port connection.
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
void tlmWrite_buffManagedDropped(const Svc::BuffQueueManagedDrops &arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_Tlm_OutputPort(FwIndexType portNum) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:87
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
static constexpr FwSizeType CAPACITY
Definition: ComPortAc.hpp:35
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
static constexpr FwIndexType getNum_bufferQueueIn_InputPorts()
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
Array of queue depths for Fw::Buffer types.
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void bufferReturnOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port bufferReturnOut.
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port connection.
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
virtual void comPacketQueueIn_overflowHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Overflow hook for async input port comPacketQueueIn.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
Fw::InputComPort * get_comPacketQueueIn_InputPort(FwIndexType portNum)
A serious but recoverable event.
void init()
Initialization function.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
virtual void bufferQueueIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferQueueIn.
Enum representing event severity.
virtual void comPacketQueueIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comPacketQueueIn.
void comPacketQueueIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comPacketQueueIn.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
virtual void SET_QUEUE_PRIORITY_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_QUEUE_PRIORITY.
void CmdDisp_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port CmdDisp.
Per-port counts of async ingress drops for Fw::ComBuffer.
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
virtual void comPacketQueueIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comPacketQueueIn.
void setPortNum(FwIndexType portNum)
Fw::InputBufferSendPort * get_bufferQueueIn_InputPort(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
BlockingType
message type
Definition: Queue.hpp:46
void tlmWrite_comIngressDropped(const Svc::ComQueueIngressDrops &arg, Fw::Time _tlmTime=Fw::Time())
virtual void runInternal_internalInterfaceHandler()=0
Internal interface handler for runInternal.
static constexpr FwIndexType getNum_dataOut_OutputPorts()
Command failed to deserialize.
void init()
Initialization function.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
Important informational events.
void init()
Initialization function.
static constexpr FwIndexType getNum_comStatusIn_InputPorts()
static constexpr FwIndexType getNum_Log_OutputPorts()
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:79
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
virtual void SET_QUEUE_PRIORITY_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Svc::QueueType &queueType, FwIndexType indexType, FwIndexType newPriority)=0
A message was sent requesting an exit of the loop.
ComQueueComponentBase(const char *compName="")
Construct ComQueueComponentBase object.
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void init()
Initialization function.
Type used to pass context info between components during framing/deframing.
void tlmWrite_buffIngressDropped(const Svc::BuffQueueIngressDrops &arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_bufferReturnOut_OutputPort(FwIndexType portNum) const
void tlmWrite_comQueueDepth(const Svc::ComQueueDepth &arg, Fw::Time _tlmTime=Fw::Time()) const
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:57
static constexpr FwIndexType getNum_Time_OutputPorts()
void regCommands()
Register commands with the Command Dispatcher.
virtual void comStatusIn_preMsgHook(FwIndexType portNum, Fw::Success &condition)
Pre-message hook for async input port comStatusIn.
Per-port counts of managed queue overflow drops for Fw::Buffer.
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
Implementation of malloc based allocator.
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum) const
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
virtual void bufferQueueIn_overflowHook(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Overflow hook for async input port bufferQueueIn.
Per-port counts of managed queue overflow drops for Fw::ComBuffer.
void init()
Initialization function.
The size of the serial representation.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Success/Failure.
void runInternal_internalInterfaceInvoke()
Internal interface base-class function for runInternal.
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
static constexpr FwIndexType getNum_run_InputPorts()
void init()
Initialization function.
BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY]
void bufferQueueIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferQueueIn.