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  RUN_SCHED,
23  CMD_FLUSH_QUEUE,
24  CMD_FLUSH_ALL_QUEUES,
25  CMD_SET_QUEUE_PRIORITY,
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  BYTE cmdPortSize[Fw::CmdPortBuffer::CAPACITY];
36  };
37 
38  // Define a message buffer class large enough to handle all the
39  // asynchronous inputs to the component
40  class ComponentIpcSerializableBuffer :
42  {
43 
44  public:
45 
46  enum {
47  // Offset into data in buffer: Size of message ID and port number
48  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
49  // Max data size
50  MAX_DATA_SIZE = sizeof(BuffUnion),
51  // Max message size: Size of message id + size of port + max data size
52  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
53  };
54 
55  Fw::Serializable::SizeType getCapacity() const {
56  return sizeof(m_buff);
57  }
58 
59  U8* getBuffAddr() {
60  return m_buff;
61  }
62 
63  const U8* getBuffAddr() const {
64  return m_buff;
65  }
66 
67  private:
68  // Should be the max of all the input ports serialized sizes...
69  U8 m_buff[SERIALIZATION_SIZE];
70 
71  };
72  }
73 
74  // ----------------------------------------------------------------------
75  // Component initialization
76  // ----------------------------------------------------------------------
77 
80  FwSizeType queueDepth,
81  FwEnumStoreType instance
82  )
83  {
84  // Initialize base class
86 
87 #if !FW_DIRECT_PORT_CALLS
88  // Connect input port CmdDisp
89  for (
90  FwIndexType port = 0;
91  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
92  port++
93  ) {
94  this->m_CmdDisp_InputPort[port].init();
95  this->m_CmdDisp_InputPort[port].addCallComp(
96  this,
97  m_p_CmdDisp_in
98  );
99  this->m_CmdDisp_InputPort[port].setPortNum(port);
100 
101 #if FW_OBJECT_NAMES == 1
102  Fw::ObjectName portName;
103  portName.format(
104  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
105  this->m_objName.toChar(),
106  port
107  );
108  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
109 #endif
110  }
111 #endif
112 
113 #if !FW_DIRECT_PORT_CALLS
114  // Connect input port bufferQueueIn
115  for (
116  FwIndexType port = 0;
117  port < static_cast<FwIndexType>(this->getNum_bufferQueueIn_InputPorts());
118  port++
119  ) {
120  this->m_bufferQueueIn_InputPort[port].init();
121  this->m_bufferQueueIn_InputPort[port].addCallComp(
122  this,
123  m_p_bufferQueueIn_in
124  );
125  this->m_bufferQueueIn_InputPort[port].setPortNum(port);
126 
127 #if FW_OBJECT_NAMES == 1
128  Fw::ObjectName portName;
129  portName.format(
130  "%s_bufferQueueIn_InputPort[%" PRI_FwIndexType "]",
131  this->m_objName.toChar(),
132  port
133  );
134  this->m_bufferQueueIn_InputPort[port].setObjName(portName.toChar());
135 #endif
136  }
137 #endif
138 
139 #if !FW_DIRECT_PORT_CALLS
140  // Connect input port comPacketQueueIn
141  for (
142  FwIndexType port = 0;
143  port < static_cast<FwIndexType>(this->getNum_comPacketQueueIn_InputPorts());
144  port++
145  ) {
146  this->m_comPacketQueueIn_InputPort[port].init();
147  this->m_comPacketQueueIn_InputPort[port].addCallComp(
148  this,
149  m_p_comPacketQueueIn_in
150  );
151  this->m_comPacketQueueIn_InputPort[port].setPortNum(port);
152 
153 #if FW_OBJECT_NAMES == 1
154  Fw::ObjectName portName;
155  portName.format(
156  "%s_comPacketQueueIn_InputPort[%" PRI_FwIndexType "]",
157  this->m_objName.toChar(),
158  port
159  );
160  this->m_comPacketQueueIn_InputPort[port].setObjName(portName.toChar());
161 #endif
162  }
163 #endif
164 
165 #if !FW_DIRECT_PORT_CALLS
166  // Connect input port comStatusIn
167  for (
168  FwIndexType port = 0;
169  port < static_cast<FwIndexType>(this->getNum_comStatusIn_InputPorts());
170  port++
171  ) {
172  this->m_comStatusIn_InputPort[port].init();
173  this->m_comStatusIn_InputPort[port].addCallComp(
174  this,
175  m_p_comStatusIn_in
176  );
177  this->m_comStatusIn_InputPort[port].setPortNum(port);
178 
179 #if FW_OBJECT_NAMES == 1
180  Fw::ObjectName portName;
181  portName.format(
182  "%s_comStatusIn_InputPort[%" PRI_FwIndexType "]",
183  this->m_objName.toChar(),
184  port
185  );
186  this->m_comStatusIn_InputPort[port].setObjName(portName.toChar());
187 #endif
188  }
189 #endif
190 
191 #if !FW_DIRECT_PORT_CALLS
192  // Connect input port dataReturnIn
193  for (
194  FwIndexType port = 0;
195  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
196  port++
197  ) {
198  this->m_dataReturnIn_InputPort[port].init();
199  this->m_dataReturnIn_InputPort[port].addCallComp(
200  this,
201  m_p_dataReturnIn_in
202  );
203  this->m_dataReturnIn_InputPort[port].setPortNum(port);
204 
205 #if FW_OBJECT_NAMES == 1
206  Fw::ObjectName portName;
207  portName.format(
208  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
209  this->m_objName.toChar(),
210  port
211  );
212  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
213 #endif
214  }
215 #endif
216 
217 #if !FW_DIRECT_PORT_CALLS
218  // Connect input port run
219  for (
220  FwIndexType port = 0;
221  port < static_cast<FwIndexType>(this->getNum_run_InputPorts());
222  port++
223  ) {
224  this->m_run_InputPort[port].init();
225  this->m_run_InputPort[port].addCallComp(
226  this,
227  m_p_run_in
228  );
229  this->m_run_InputPort[port].setPortNum(port);
230 
231 #if FW_OBJECT_NAMES == 1
232  Fw::ObjectName portName;
233  portName.format(
234  "%s_run_InputPort[%" PRI_FwIndexType "]",
235  this->m_objName.toChar(),
236  port
237  );
238  this->m_run_InputPort[port].setObjName(portName.toChar());
239 #endif
240  }
241 #endif
242 
243 #if !FW_DIRECT_PORT_CALLS
244  // Connect output port CmdReg
245  for (
246  FwIndexType port = 0;
247  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
248  port++
249  ) {
250  this->m_CmdReg_OutputPort[port].init();
251 
252 #if FW_OBJECT_NAMES == 1
253  Fw::ObjectName portName;
254  portName.format(
255  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
256  this->m_objName.toChar(),
257  port
258  );
259  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
260 #endif
261  }
262 #endif
263 
264 #if !FW_DIRECT_PORT_CALLS
265  // Connect output port CmdStatus
266  for (
267  FwIndexType port = 0;
268  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
269  port++
270  ) {
271  this->m_CmdStatus_OutputPort[port].init();
272 
273 #if FW_OBJECT_NAMES == 1
274  Fw::ObjectName portName;
275  portName.format(
276  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
277  this->m_objName.toChar(),
278  port
279  );
280  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
281 #endif
282  }
283 #endif
284 
285 #if !FW_DIRECT_PORT_CALLS
286  // Connect output port Log
287  for (
288  FwIndexType port = 0;
289  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
290  port++
291  ) {
292  this->m_Log_OutputPort[port].init();
293 
294 #if FW_OBJECT_NAMES == 1
295  Fw::ObjectName portName;
296  portName.format(
297  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
298  this->m_objName.toChar(),
299  port
300  );
301  this->m_Log_OutputPort[port].setObjName(portName.toChar());
302 #endif
303  }
304 #endif
305 
306 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
307  // Connect output port LogText
308  for (
309  FwIndexType port = 0;
310  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
311  port++
312  ) {
313  this->m_LogText_OutputPort[port].init();
314 
315 #if FW_OBJECT_NAMES == 1
316  Fw::ObjectName portName;
317  portName.format(
318  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
319  this->m_objName.toChar(),
320  port
321  );
322  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
323 #endif
324  }
325 #endif
326 
327 #if !FW_DIRECT_PORT_CALLS
328  // Connect output port Time
329  for (
330  FwIndexType port = 0;
331  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
332  port++
333  ) {
334  this->m_Time_OutputPort[port].init();
335 
336 #if FW_OBJECT_NAMES == 1
337  Fw::ObjectName portName;
338  portName.format(
339  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
340  this->m_objName.toChar(),
341  port
342  );
343  this->m_Time_OutputPort[port].setObjName(portName.toChar());
344 #endif
345  }
346 #endif
347 
348 #if !FW_DIRECT_PORT_CALLS
349  // Connect output port Tlm
350  for (
351  FwIndexType port = 0;
352  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
353  port++
354  ) {
355  this->m_Tlm_OutputPort[port].init();
356 
357 #if FW_OBJECT_NAMES == 1
358  Fw::ObjectName portName;
359  portName.format(
360  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
361  this->m_objName.toChar(),
362  port
363  );
364  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
365 #endif
366  }
367 #endif
368 
369 #if !FW_DIRECT_PORT_CALLS
370  // Connect output port bufferReturnOut
371  for (
372  FwIndexType port = 0;
373  port < static_cast<FwIndexType>(this->getNum_bufferReturnOut_OutputPorts());
374  port++
375  ) {
376  this->m_bufferReturnOut_OutputPort[port].init();
377 
378 #if FW_OBJECT_NAMES == 1
379  Fw::ObjectName portName;
380  portName.format(
381  "%s_bufferReturnOut_OutputPort[%" PRI_FwIndexType "]",
382  this->m_objName.toChar(),
383  port
384  );
385  this->m_bufferReturnOut_OutputPort[port].setObjName(portName.toChar());
386 #endif
387  }
388 #endif
389 
390 #if !FW_DIRECT_PORT_CALLS
391  // Connect output port dataOut
392  for (
393  FwIndexType port = 0;
394  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
395  port++
396  ) {
397  this->m_dataOut_OutputPort[port].init();
398 
399 #if FW_OBJECT_NAMES == 1
400  Fw::ObjectName portName;
401  portName.format(
402  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
403  this->m_objName.toChar(),
404  port
405  );
406  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
407 #endif
408  }
409 #endif
410 
411  // Create the queue
412  Os::Queue::Status qStat = this->createQueue(
413  queueDepth,
414  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
415  );
416  FW_ASSERT(
417  Os::Queue::Status::OP_OK == qStat,
418  static_cast<FwAssertArgType>(qStat)
419  );
420  }
421 
422 #if !FW_DIRECT_PORT_CALLS
423 
424  // ----------------------------------------------------------------------
425  // Getters for special input ports
426  // ----------------------------------------------------------------------
427 
430  {
431  FW_ASSERT(
432  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
433  static_cast<FwAssertArgType>(portNum)
434  );
435 
436  return &this->m_CmdDisp_InputPort[portNum];
437  }
438 
439 #endif
440 
441 #if !FW_DIRECT_PORT_CALLS
442 
443  // ----------------------------------------------------------------------
444  // Getters for typed input ports
445  // ----------------------------------------------------------------------
446 
449  {
450  FW_ASSERT(
451  (0 <= portNum) && (portNum < this->getNum_bufferQueueIn_InputPorts()),
452  static_cast<FwAssertArgType>(portNum)
453  );
454 
455  return &this->m_bufferQueueIn_InputPort[portNum];
456  }
457 
460  {
461  FW_ASSERT(
462  (0 <= portNum) && (portNum < this->getNum_comPacketQueueIn_InputPorts()),
463  static_cast<FwAssertArgType>(portNum)
464  );
465 
466  return &this->m_comPacketQueueIn_InputPort[portNum];
467  }
468 
471  {
472  FW_ASSERT(
473  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
474  static_cast<FwAssertArgType>(portNum)
475  );
476 
477  return &this->m_comStatusIn_InputPort[portNum];
478  }
479 
482  {
483  FW_ASSERT(
484  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
485  static_cast<FwAssertArgType>(portNum)
486  );
487 
488  return &this->m_dataReturnIn_InputPort[portNum];
489  }
490 
493  {
494  FW_ASSERT(
495  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
496  static_cast<FwAssertArgType>(portNum)
497  );
498 
499  return &this->m_run_InputPort[portNum];
500  }
501 
502 #endif
503 
504 #if !FW_DIRECT_PORT_CALLS
505 
506  // ----------------------------------------------------------------------
507  // Connect input ports to special output ports
508  // ----------------------------------------------------------------------
509 
512  FwIndexType portNum,
513  Fw::InputCmdRegPort* port
514  )
515  {
516  FW_ASSERT(
517  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
518  static_cast<FwAssertArgType>(portNum)
519  );
520 
521  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
522  }
523 
526  FwIndexType portNum,
528  )
529  {
530  FW_ASSERT(
531  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
532  static_cast<FwAssertArgType>(portNum)
533  );
534 
535  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
536  }
537 
540  FwIndexType portNum,
541  Fw::InputLogPort* port
542  )
543  {
544  FW_ASSERT(
545  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
546  static_cast<FwAssertArgType>(portNum)
547  );
548 
549  this->m_Log_OutputPort[portNum].addCallPort(port);
550  }
551 
552 #if FW_ENABLE_TEXT_LOGGING == 1
553 
554  void ComQueueComponentBase ::
555  set_LogText_OutputPort(
556  FwIndexType portNum,
558  )
559  {
560  FW_ASSERT(
561  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
562  static_cast<FwAssertArgType>(portNum)
563  );
564 
565  this->m_LogText_OutputPort[portNum].addCallPort(port);
566  }
567 
568 #endif
569 
572  FwIndexType portNum,
573  Fw::InputTimePort* port
574  )
575  {
576  FW_ASSERT(
577  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
578  static_cast<FwAssertArgType>(portNum)
579  );
580 
581  this->m_Time_OutputPort[portNum].addCallPort(port);
582  }
583 
586  FwIndexType portNum,
587  Fw::InputTlmPort* port
588  )
589  {
590  FW_ASSERT(
591  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
592  static_cast<FwAssertArgType>(portNum)
593  );
594 
595  this->m_Tlm_OutputPort[portNum].addCallPort(port);
596  }
597 
598 #endif
599 
600 #if !FW_DIRECT_PORT_CALLS
601 
602  // ----------------------------------------------------------------------
603  // Connect typed input ports to typed output ports
604  // ----------------------------------------------------------------------
605 
608  FwIndexType portNum,
610  )
611  {
612  FW_ASSERT(
613  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
614  static_cast<FwAssertArgType>(portNum)
615  );
616 
617  this->m_bufferReturnOut_OutputPort[portNum].addCallPort(port);
618  }
619 
622  FwIndexType portNum,
624  )
625  {
626  FW_ASSERT(
627  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
628  static_cast<FwAssertArgType>(portNum)
629  );
630 
631  this->m_dataOut_OutputPort[portNum].addCallPort(port);
632  }
633 
634 #endif
635 
636 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
637 
638  // ----------------------------------------------------------------------
639  // Connect serial input ports to special output ports
640  // ----------------------------------------------------------------------
641 
644  FwIndexType portNum,
645  Fw::InputSerializePort* port
646  )
647  {
648  FW_ASSERT(
649  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
650  static_cast<FwAssertArgType>(portNum)
651  );
652 
653  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
654  }
655 
658  FwIndexType portNum,
659  Fw::InputSerializePort* port
660  )
661  {
662  FW_ASSERT(
663  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
664  static_cast<FwAssertArgType>(portNum)
665  );
666 
667  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
668  }
669 
672  FwIndexType portNum,
673  Fw::InputSerializePort* port
674  )
675  {
676  FW_ASSERT(
677  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
678  static_cast<FwAssertArgType>(portNum)
679  );
680 
681  this->m_Log_OutputPort[portNum].registerSerialPort(port);
682  }
683 
684 #if FW_ENABLE_TEXT_LOGGING == 1
685 
686  void ComQueueComponentBase ::
687  set_LogText_OutputPort(
688  FwIndexType portNum,
689  Fw::InputSerializePort* port
690  )
691  {
692  FW_ASSERT(
693  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
694  static_cast<FwAssertArgType>(portNum)
695  );
696 
697  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
698  }
699 
700 #endif
701 
704  FwIndexType portNum,
705  Fw::InputSerializePort* port
706  )
707  {
708  FW_ASSERT(
709  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
710  static_cast<FwAssertArgType>(portNum)
711  );
712 
713  this->m_Time_OutputPort[portNum].registerSerialPort(port);
714  }
715 
718  FwIndexType portNum,
719  Fw::InputSerializePort* port
720  )
721  {
722  FW_ASSERT(
723  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
724  static_cast<FwAssertArgType>(portNum)
725  );
726 
727  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
728  }
729 
730 #endif
731 
732 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
733 
734  // ----------------------------------------------------------------------
735  // Connect serial input ports to typed output ports
736  // ----------------------------------------------------------------------
737 
740  FwIndexType portNum,
741  Fw::InputSerializePort* port
742  )
743  {
744  FW_ASSERT(
745  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
746  static_cast<FwAssertArgType>(portNum)
747  );
748 
749  this->m_bufferReturnOut_OutputPort[portNum].registerSerialPort(port);
750  }
751 
754  FwIndexType portNum,
755  Fw::InputSerializePort* port
756  )
757  {
758  FW_ASSERT(
759  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
760  static_cast<FwAssertArgType>(portNum)
761  );
762 
763  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
764  }
765 
766 #endif
767 
768  // ----------------------------------------------------------------------
769  // Command registration
770  // ----------------------------------------------------------------------
771 
774  {
776 
777  this->CmdReg_out(
778  0,
779  this->getIdBase() + OPCODE_FLUSH_QUEUE
780  );
781 
782  this->CmdReg_out(
783  0,
785  );
786 
787  this->CmdReg_out(
788  0,
790  );
791  }
792 
793  // ----------------------------------------------------------------------
794  // Component construction and destruction
795  // ----------------------------------------------------------------------
796 
798  ComQueueComponentBase(const char* compName) :
799  Fw::ActiveComponentBase(compName)
800  {
801 
802  }
803 
806  {
807 
808  }
809 
810 #if !FW_DIRECT_PORT_CALLS
811 
812  // ----------------------------------------------------------------------
813  // Connection status queries for special output ports
814  // ----------------------------------------------------------------------
815 
818  {
819  FW_ASSERT(
820  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
821  static_cast<FwAssertArgType>(portNum)
822  );
823 
824  return this->m_CmdReg_OutputPort[portNum].isConnected();
825  }
826 
829  {
830  FW_ASSERT(
831  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
832  static_cast<FwAssertArgType>(portNum)
833  );
834 
835  return this->m_CmdStatus_OutputPort[portNum].isConnected();
836  }
837 
840  {
841  FW_ASSERT(
842  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
843  static_cast<FwAssertArgType>(portNum)
844  );
845 
846  return this->m_Log_OutputPort[portNum].isConnected();
847  }
848 
849 #if FW_ENABLE_TEXT_LOGGING == 1
850 
851  bool ComQueueComponentBase ::
852  isConnected_LogText_OutputPort(FwIndexType portNum) const
853  {
854  FW_ASSERT(
855  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
856  static_cast<FwAssertArgType>(portNum)
857  );
858 
859  return this->m_LogText_OutputPort[portNum].isConnected();
860  }
861 
862 #endif
863 
866  {
867  FW_ASSERT(
868  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
869  static_cast<FwAssertArgType>(portNum)
870  );
871 
872  return this->m_Time_OutputPort[portNum].isConnected();
873  }
874 
877  {
878  FW_ASSERT(
879  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
880  static_cast<FwAssertArgType>(portNum)
881  );
882 
883  return this->m_Tlm_OutputPort[portNum].isConnected();
884  }
885 
886 #endif
887 
888 #if !FW_DIRECT_PORT_CALLS
889 
890  // ----------------------------------------------------------------------
891  // Connection status queries for typed output ports
892  // ----------------------------------------------------------------------
893 
896  {
897  FW_ASSERT(
898  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
899  static_cast<FwAssertArgType>(portNum)
900  );
901 
902  return this->m_bufferReturnOut_OutputPort[portNum].isConnected();
903  }
904 
907  {
908  FW_ASSERT(
909  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
910  static_cast<FwAssertArgType>(portNum)
911  );
912 
913  return this->m_dataOut_OutputPort[portNum].isConnected();
914  }
915 
916 #endif
917 
918  // ----------------------------------------------------------------------
919  // Port handler base-class functions for special input ports
920  //
921  // Call these functions directly to bypass the corresponding ports
922  // ----------------------------------------------------------------------
923 
926  FwIndexType portNum,
927  FwOpcodeType opCode,
928  U32 cmdSeq,
929  Fw::CmdArgBuffer& args
930  )
931  {
932 
933  const U32 idBase = this->getIdBase();
934  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
935 
936  // Select base class function based on opcode
937  switch (opCode - idBase) {
938  case OPCODE_FLUSH_QUEUE: {
940  opCode,
941  cmdSeq,
942  args
943  );
944  break;
945  }
946 
949  opCode,
950  cmdSeq,
951  args
952  );
953  break;
954  }
955 
958  opCode,
959  cmdSeq,
960  args
961  );
962  break;
963  }
964  default:
965  // Unknown opcode: ignore it
966  break;
967  }
968  }
969 
970  // ----------------------------------------------------------------------
971  // Port handler base-class functions for typed input ports
972  //
973  // Call these functions directly to bypass the corresponding ports
974  // ----------------------------------------------------------------------
975 
978  FwIndexType portNum,
979  Fw::Buffer& fwBuffer
980  )
981  {
982  // Make sure port number is valid
983  FW_ASSERT(
984  (0 <= portNum) && (portNum < this->getNum_bufferQueueIn_InputPorts()),
985  static_cast<FwAssertArgType>(portNum)
986  );
987 
988  // Call pre-message hook
990  portNum,
991  fwBuffer
992  );
993  ComponentIpcSerializableBuffer msg;
995 
996  // Serialize message ID
997  _status = msg.serializeFrom(
998  static_cast<FwEnumStoreType>(BUFFERQUEUEIN_BUFFERSEND)
999  );
1000  FW_ASSERT(
1001  _status == Fw::FW_SERIALIZE_OK,
1002  static_cast<FwAssertArgType>(_status)
1003  );
1004 
1005  // Serialize port number
1006  _status = msg.serializeFrom(portNum);
1007  FW_ASSERT(
1008  _status == Fw::FW_SERIALIZE_OK,
1009  static_cast<FwAssertArgType>(_status)
1010  );
1011 
1012  // Serialize argument fwBuffer
1013  _status = msg.serializeFrom(fwBuffer);
1014  FW_ASSERT(
1015  _status == Fw::FW_SERIALIZE_OK,
1016  static_cast<FwAssertArgType>(_status)
1017  );
1018 
1019  // Send message
1021  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1022 
1023  if (qStatus == Os::Queue::Status::FULL) {
1024  this->bufferQueueIn_overflowHook(portNum, fwBuffer);
1025  return;
1026  }
1027 
1028  FW_ASSERT(
1029  qStatus == Os::Queue::OP_OK,
1030  static_cast<FwAssertArgType>(qStatus)
1031  );
1032  }
1033 
1036  FwIndexType portNum,
1037  Fw::ComBuffer& data,
1038  U32 context
1039  )
1040  {
1041  // Make sure port number is valid
1042  FW_ASSERT(
1043  (0 <= portNum) && (portNum < this->getNum_comPacketQueueIn_InputPorts()),
1044  static_cast<FwAssertArgType>(portNum)
1045  );
1046 
1047  // Call pre-message hook
1049  portNum,
1050  data,
1051  context
1052  );
1053  ComponentIpcSerializableBuffer msg;
1055 
1056  // Serialize message ID
1057  _status = msg.serializeFrom(
1058  static_cast<FwEnumStoreType>(COMPACKETQUEUEIN_COM)
1059  );
1060  FW_ASSERT(
1061  _status == Fw::FW_SERIALIZE_OK,
1062  static_cast<FwAssertArgType>(_status)
1063  );
1064 
1065  // Serialize port number
1066  _status = msg.serializeFrom(portNum);
1067  FW_ASSERT(
1068  _status == Fw::FW_SERIALIZE_OK,
1069  static_cast<FwAssertArgType>(_status)
1070  );
1071 
1072  // Serialize argument data
1073  _status = msg.serializeFrom(data);
1074  FW_ASSERT(
1075  _status == Fw::FW_SERIALIZE_OK,
1076  static_cast<FwAssertArgType>(_status)
1077  );
1078 
1079  // Serialize argument context
1080  _status = msg.serializeFrom(context);
1081  FW_ASSERT(
1082  _status == Fw::FW_SERIALIZE_OK,
1083  static_cast<FwAssertArgType>(_status)
1084  );
1085 
1086  // Send message
1088  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1089 
1090  if (qStatus == Os::Queue::Status::FULL) {
1091  this->incNumMsgDropped();
1092  return;
1093  }
1094 
1095  FW_ASSERT(
1096  qStatus == Os::Queue::OP_OK,
1097  static_cast<FwAssertArgType>(qStatus)
1098  );
1099  }
1100 
1103  FwIndexType portNum,
1104  Fw::Success& condition
1105  )
1106  {
1107  // Make sure port number is valid
1108  FW_ASSERT(
1109  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
1110  static_cast<FwAssertArgType>(portNum)
1111  );
1112 
1113  // Call pre-message hook
1115  portNum,
1116  condition
1117  );
1118  ComponentIpcSerializableBuffer msg;
1120 
1121  // Serialize message ID
1122  _status = msg.serializeFrom(
1123  static_cast<FwEnumStoreType>(COMSTATUSIN_SUCCESSCONDITION)
1124  );
1125  FW_ASSERT(
1126  _status == Fw::FW_SERIALIZE_OK,
1127  static_cast<FwAssertArgType>(_status)
1128  );
1129 
1130  // Serialize port number
1131  _status = msg.serializeFrom(portNum);
1132  FW_ASSERT(
1133  _status == Fw::FW_SERIALIZE_OK,
1134  static_cast<FwAssertArgType>(_status)
1135  );
1136 
1137  // Serialize argument condition
1138  _status = msg.serializeFrom(condition);
1139  FW_ASSERT(
1140  _status == Fw::FW_SERIALIZE_OK,
1141  static_cast<FwAssertArgType>(_status)
1142  );
1143 
1144  // Send message
1146  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1147 
1148  FW_ASSERT(
1149  qStatus == Os::Queue::OP_OK,
1150  static_cast<FwAssertArgType>(qStatus)
1151  );
1152  }
1153 
1156  FwIndexType portNum,
1157  Fw::Buffer& data,
1158  const ComCfg::FrameContext& context
1159  )
1160  {
1161  // Make sure port number is valid
1162  FW_ASSERT(
1163  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
1164  static_cast<FwAssertArgType>(portNum)
1165  );
1166 
1167  // Call handler function
1168  this->dataReturnIn_handler(
1169  portNum,
1170  data,
1171  context
1172  );
1173  }
1174 
1177  FwIndexType portNum,
1178  U32 context
1179  )
1180  {
1181  // Make sure port number is valid
1182  FW_ASSERT(
1183  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
1184  static_cast<FwAssertArgType>(portNum)
1185  );
1186 
1187  // Call pre-message hook
1189  portNum,
1190  context
1191  );
1192  ComponentIpcSerializableBuffer msg;
1194 
1195  // Serialize message ID
1196  _status = msg.serializeFrom(
1197  static_cast<FwEnumStoreType>(RUN_SCHED)
1198  );
1199  FW_ASSERT(
1200  _status == Fw::FW_SERIALIZE_OK,
1201  static_cast<FwAssertArgType>(_status)
1202  );
1203 
1204  // Serialize port number
1205  _status = msg.serializeFrom(portNum);
1206  FW_ASSERT(
1207  _status == Fw::FW_SERIALIZE_OK,
1208  static_cast<FwAssertArgType>(_status)
1209  );
1210 
1211  // Serialize argument context
1212  _status = msg.serializeFrom(context);
1213  FW_ASSERT(
1214  _status == Fw::FW_SERIALIZE_OK,
1215  static_cast<FwAssertArgType>(_status)
1216  );
1217 
1218  // Send message
1220  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1221 
1222  if (qStatus == Os::Queue::Status::FULL) {
1223  this->incNumMsgDropped();
1224  return;
1225  }
1226 
1227  FW_ASSERT(
1228  qStatus == Os::Queue::OP_OK,
1229  static_cast<FwAssertArgType>(qStatus)
1230  );
1231  }
1232 
1233  // ----------------------------------------------------------------------
1234  // Pre-message hooks for typed async input ports
1235  //
1236  // Each of these functions is invoked just before processing a message
1237  // on the corresponding port. By default, they do nothing. You can
1238  // override them to provide specific pre-message behavior.
1239  // ----------------------------------------------------------------------
1240 
1243  FwIndexType portNum,
1244  Fw::Buffer& fwBuffer
1245  )
1246  {
1247  // Default: no-op
1248  }
1249 
1252  FwIndexType portNum,
1253  Fw::ComBuffer& data,
1254  U32 context
1255  )
1256  {
1257  // Default: no-op
1258  }
1259 
1262  FwIndexType portNum,
1263  Fw::Success& condition
1264  )
1265  {
1266  // Default: no-op
1267  }
1268 
1271  FwIndexType portNum,
1272  U32 context
1273  )
1274  {
1275  // Default: no-op
1276  }
1277 
1278 #if !FW_DIRECT_PORT_CALLS
1279 
1280  // ----------------------------------------------------------------------
1281  // Invocation functions for typed output ports
1282  // ----------------------------------------------------------------------
1283 
1286  FwIndexType portNum,
1287  Fw::Buffer& fwBuffer
1288  ) const
1289  {
1290  FW_ASSERT(
1291  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
1292  static_cast<FwAssertArgType>(portNum)
1293  );
1294 
1295  FW_ASSERT(
1296  this->m_bufferReturnOut_OutputPort[portNum].isConnected(),
1297  static_cast<FwAssertArgType>(portNum)
1298  );
1299  this->m_bufferReturnOut_OutputPort[portNum].invoke(
1300  fwBuffer
1301  );
1302  }
1303 
1306  FwIndexType portNum,
1307  Fw::Buffer& data,
1308  const ComCfg::FrameContext& context
1309  ) const
1310  {
1311  FW_ASSERT(
1312  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
1313  static_cast<FwAssertArgType>(portNum)
1314  );
1315 
1316  FW_ASSERT(
1317  this->m_dataOut_OutputPort[portNum].isConnected(),
1318  static_cast<FwAssertArgType>(portNum)
1319  );
1320  this->m_dataOut_OutputPort[portNum].invoke(
1321  data,
1322  context
1323  );
1324  }
1325 
1326 #endif
1327 
1328  // ----------------------------------------------------------------------
1329  // Command response
1330  // ----------------------------------------------------------------------
1331 
1334  FwOpcodeType opCode,
1335  U32 cmdSeq,
1336  Fw::CmdResponse response
1337  )
1338  {
1340  this->CmdStatus_out(0, opCode, cmdSeq, response);
1341  }
1342 
1343  // ----------------------------------------------------------------------
1344  // Command handler base-class functions
1345  //
1346  // Call these functions directly to bypass the command input port
1347  // ----------------------------------------------------------------------
1348 
1351  FwOpcodeType opCode,
1352  U32 cmdSeq,
1353  Fw::CmdArgBuffer& args
1354  )
1355  {
1356  // Call pre-message hook
1357  this->FLUSH_QUEUE_preMsgHook(opCode,cmdSeq);
1358 
1359  // Defer deserializing arguments to the message dispatcher
1360  // to avoid deserializing and reserializing just for IPC
1361  ComponentIpcSerializableBuffer msg;
1363 
1364  // Serialize for IPC
1365  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_FLUSH_QUEUE));
1366  FW_ASSERT (
1367  _status == Fw::FW_SERIALIZE_OK,
1368  static_cast<FwAssertArgType>(_status)
1369  );
1370 
1371  // Fake port number to make message dequeue work
1372  FwIndexType port = 0;
1373 
1374  _status = msg.serializeFrom(port);
1375  FW_ASSERT (
1376  _status == Fw::FW_SERIALIZE_OK,
1377  static_cast<FwAssertArgType>(_status)
1378  );
1379 
1380  _status = msg.serializeFrom(opCode);
1381  FW_ASSERT (
1382  _status == Fw::FW_SERIALIZE_OK,
1383  static_cast<FwAssertArgType>(_status)
1384  );
1385 
1386  _status = msg.serializeFrom(cmdSeq);
1387  FW_ASSERT (
1388  _status == Fw::FW_SERIALIZE_OK,
1389  static_cast<FwAssertArgType>(_status)
1390  );
1391 
1392  _status = msg.serializeFrom(args);
1393  FW_ASSERT (
1394  _status == Fw::FW_SERIALIZE_OK,
1395  static_cast<FwAssertArgType>(_status)
1396  );
1397 
1398  // Send message
1400  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1401 
1402  FW_ASSERT(
1403  qStatus == Os::Queue::OP_OK,
1404  static_cast<FwAssertArgType>(qStatus)
1405  );
1406  }
1407 
1410  FwOpcodeType opCode,
1411  U32 cmdSeq,
1412  Fw::CmdArgBuffer& args
1413  )
1414  {
1415  // Call pre-message hook
1416  this->FLUSH_ALL_QUEUES_preMsgHook(opCode,cmdSeq);
1417 
1418  // Defer deserializing arguments to the message dispatcher
1419  // to avoid deserializing and reserializing just for IPC
1420  ComponentIpcSerializableBuffer msg;
1422 
1423  // Serialize for IPC
1424  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_FLUSH_ALL_QUEUES));
1425  FW_ASSERT (
1426  _status == Fw::FW_SERIALIZE_OK,
1427  static_cast<FwAssertArgType>(_status)
1428  );
1429 
1430  // Fake port number to make message dequeue work
1431  FwIndexType port = 0;
1432 
1433  _status = msg.serializeFrom(port);
1434  FW_ASSERT (
1435  _status == Fw::FW_SERIALIZE_OK,
1436  static_cast<FwAssertArgType>(_status)
1437  );
1438 
1439  _status = msg.serializeFrom(opCode);
1440  FW_ASSERT (
1441  _status == Fw::FW_SERIALIZE_OK,
1442  static_cast<FwAssertArgType>(_status)
1443  );
1444 
1445  _status = msg.serializeFrom(cmdSeq);
1446  FW_ASSERT (
1447  _status == Fw::FW_SERIALIZE_OK,
1448  static_cast<FwAssertArgType>(_status)
1449  );
1450 
1451  _status = msg.serializeFrom(args);
1452  FW_ASSERT (
1453  _status == Fw::FW_SERIALIZE_OK,
1454  static_cast<FwAssertArgType>(_status)
1455  );
1456 
1457  // Send message
1459  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1460 
1461  FW_ASSERT(
1462  qStatus == Os::Queue::OP_OK,
1463  static_cast<FwAssertArgType>(qStatus)
1464  );
1465  }
1466 
1469  FwOpcodeType opCode,
1470  U32 cmdSeq,
1471  Fw::CmdArgBuffer& args
1472  )
1473  {
1474  // Call pre-message hook
1475  this->SET_QUEUE_PRIORITY_preMsgHook(opCode,cmdSeq);
1476 
1477  // Defer deserializing arguments to the message dispatcher
1478  // to avoid deserializing and reserializing just for IPC
1479  ComponentIpcSerializableBuffer msg;
1481 
1482  // Serialize for IPC
1483  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SET_QUEUE_PRIORITY));
1484  FW_ASSERT (
1485  _status == Fw::FW_SERIALIZE_OK,
1486  static_cast<FwAssertArgType>(_status)
1487  );
1488 
1489  // Fake port number to make message dequeue work
1490  FwIndexType port = 0;
1491 
1492  _status = msg.serializeFrom(port);
1493  FW_ASSERT (
1494  _status == Fw::FW_SERIALIZE_OK,
1495  static_cast<FwAssertArgType>(_status)
1496  );
1497 
1498  _status = msg.serializeFrom(opCode);
1499  FW_ASSERT (
1500  _status == Fw::FW_SERIALIZE_OK,
1501  static_cast<FwAssertArgType>(_status)
1502  );
1503 
1504  _status = msg.serializeFrom(cmdSeq);
1505  FW_ASSERT (
1506  _status == Fw::FW_SERIALIZE_OK,
1507  static_cast<FwAssertArgType>(_status)
1508  );
1509 
1510  _status = msg.serializeFrom(args);
1511  FW_ASSERT (
1512  _status == Fw::FW_SERIALIZE_OK,
1513  static_cast<FwAssertArgType>(_status)
1514  );
1515 
1516  // Send message
1518  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1519 
1520  FW_ASSERT(
1521  qStatus == Os::Queue::OP_OK,
1522  static_cast<FwAssertArgType>(qStatus)
1523  );
1524  }
1525 
1526  // ----------------------------------------------------------------------
1527  // Pre-message hooks for async commands
1528  //
1529  // Each of these functions is invoked just before processing the
1530  // corresponding command. By default they do nothing. You can
1531  // override them to provide specific pre-command behavior.
1532  // ----------------------------------------------------------------------
1533 
1536  FwOpcodeType opCode,
1537  U32 cmdSeq
1538  )
1539  {
1540  // Defaults to no-op; can be overridden
1541  (void) opCode;
1542  (void) cmdSeq;
1543  }
1544 
1547  FwOpcodeType opCode,
1548  U32 cmdSeq
1549  )
1550  {
1551  // Defaults to no-op; can be overridden
1552  (void) opCode;
1553  (void) cmdSeq;
1554  }
1555 
1558  FwOpcodeType opCode,
1559  U32 cmdSeq
1560  )
1561  {
1562  // Defaults to no-op; can be overridden
1563  (void) opCode;
1564  (void) cmdSeq;
1565  }
1566 
1567  // ----------------------------------------------------------------------
1568  // Event logging functions
1569  // ----------------------------------------------------------------------
1570 
1573  Svc::QueueType queueType,
1574  FwIndexType index
1575  ) const
1576  {
1577  // Get the time
1578  Fw::Time _logTime;
1579  if (this->isConnected_Time_OutputPort(0)) {
1580  this->Time_out(0, _logTime);
1581  }
1582 
1583  const FwEventIdType _id = this->getIdBase() + EVENTID_QUEUEOVERFLOW;
1584 
1585  // Emit the event on the log port
1586  if (this->isConnected_Log_OutputPort(0)) {
1587  Fw::LogBuffer _logBuff;
1589 
1590 #if FW_AMPCS_COMPATIBLE
1591  // Serialize the number of arguments
1592  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1593  FW_ASSERT(
1594  _status == Fw::FW_SERIALIZE_OK,
1595  static_cast<FwAssertArgType>(_status)
1596  );
1597 #endif
1598 
1599 #if FW_AMPCS_COMPATIBLE
1600  // Serialize the argument size
1601  _status = _logBuff.serializeFrom(
1602  static_cast<U8>(Svc::QueueType::SERIALIZED_SIZE)
1603  );
1604  FW_ASSERT(
1605  _status == Fw::FW_SERIALIZE_OK,
1606  static_cast<FwAssertArgType>(_status)
1607  );
1608 #endif
1609  _status = _logBuff.serializeFrom(queueType);
1610  FW_ASSERT(
1611  _status == Fw::FW_SERIALIZE_OK,
1612  static_cast<FwAssertArgType>(_status)
1613  );
1614 
1615 #if FW_AMPCS_COMPATIBLE
1616  // Serialize the argument size
1617  _status = _logBuff.serializeFrom(
1618  static_cast<U8>(sizeof(FwIndexType))
1619  );
1620  FW_ASSERT(
1621  _status == Fw::FW_SERIALIZE_OK,
1622  static_cast<FwAssertArgType>(_status)
1623  );
1624 #endif
1625  _status = _logBuff.serializeFrom(index);
1626  FW_ASSERT(
1627  _status == Fw::FW_SERIALIZE_OK,
1628  static_cast<FwAssertArgType>(_status)
1629  );
1630 
1631  this->Log_out(
1632  0,
1633  _id,
1634  _logTime,
1636  _logBuff
1637  );
1638  }
1639 
1640  // Emit the event on the text log port
1641 #if FW_ENABLE_TEXT_LOGGING
1642  if (this->isConnected_LogText_OutputPort(0)) {
1643 #if FW_OBJECT_NAMES == 1
1644  const char* _formatString =
1645  "(%s) %s: The %s queue at index %" PRIi16 " overflowed";
1646 #else
1647  const char* _formatString =
1648  "%s: The %s queue at index %" PRIi16 " overflowed";
1649 #endif
1650 
1651  Fw::String queueTypeStr;
1652  queueType.toString(queueTypeStr);
1653 
1654  Fw::TextLogString _logString;
1655  _logString.format(
1656  _formatString,
1657 #if FW_OBJECT_NAMES == 1
1658  this->m_objName.toChar(),
1659 #endif
1660  "QueueOverflow ",
1661  queueTypeStr.toChar(),
1662  index
1663  );
1664 
1665  this->LogText_out(
1666  0,
1667  _id,
1668  _logTime,
1670  _logString
1671  );
1672  }
1673 #endif
1674  }
1675 
1678  Svc::QueueType queueType,
1679  FwIndexType indexType,
1680  FwIndexType newPriority
1681  ) const
1682  {
1683  // Get the time
1684  Fw::Time _logTime;
1685  if (this->isConnected_Time_OutputPort(0)) {
1686  this->Time_out(0, _logTime);
1687  }
1688 
1690 
1691  // Emit the event on the log port
1692  if (this->isConnected_Log_OutputPort(0)) {
1693  Fw::LogBuffer _logBuff;
1695 
1696 #if FW_AMPCS_COMPATIBLE
1697  // Serialize the number of arguments
1698  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1699  FW_ASSERT(
1700  _status == Fw::FW_SERIALIZE_OK,
1701  static_cast<FwAssertArgType>(_status)
1702  );
1703 #endif
1704 
1705 #if FW_AMPCS_COMPATIBLE
1706  // Serialize the argument size
1707  _status = _logBuff.serializeFrom(
1708  static_cast<U8>(Svc::QueueType::SERIALIZED_SIZE)
1709  );
1710  FW_ASSERT(
1711  _status == Fw::FW_SERIALIZE_OK,
1712  static_cast<FwAssertArgType>(_status)
1713  );
1714 #endif
1715  _status = _logBuff.serializeFrom(queueType);
1716  FW_ASSERT(
1717  _status == Fw::FW_SERIALIZE_OK,
1718  static_cast<FwAssertArgType>(_status)
1719  );
1720 
1721 #if FW_AMPCS_COMPATIBLE
1722  // Serialize the argument size
1723  _status = _logBuff.serializeFrom(
1724  static_cast<U8>(sizeof(FwIndexType))
1725  );
1726  FW_ASSERT(
1727  _status == Fw::FW_SERIALIZE_OK,
1728  static_cast<FwAssertArgType>(_status)
1729  );
1730 #endif
1731  _status = _logBuff.serializeFrom(indexType);
1732  FW_ASSERT(
1733  _status == Fw::FW_SERIALIZE_OK,
1734  static_cast<FwAssertArgType>(_status)
1735  );
1736 
1737 #if FW_AMPCS_COMPATIBLE
1738  // Serialize the argument size
1739  _status = _logBuff.serializeFrom(
1740  static_cast<U8>(sizeof(FwIndexType))
1741  );
1742  FW_ASSERT(
1743  _status == Fw::FW_SERIALIZE_OK,
1744  static_cast<FwAssertArgType>(_status)
1745  );
1746 #endif
1747  _status = _logBuff.serializeFrom(newPriority);
1748  FW_ASSERT(
1749  _status == Fw::FW_SERIALIZE_OK,
1750  static_cast<FwAssertArgType>(_status)
1751  );
1752 
1753  this->Log_out(
1754  0,
1755  _id,
1756  _logTime,
1758  _logBuff
1759  );
1760  }
1761 
1762  // Emit the event on the text log port
1763 #if FW_ENABLE_TEXT_LOGGING
1764  if (this->isConnected_LogText_OutputPort(0)) {
1765 #if FW_OBJECT_NAMES == 1
1766  const char* _formatString =
1767  "(%s) %s: %s %" PRIi16 " priority changed to %" PRIi16 "";
1768 #else
1769  const char* _formatString =
1770  "%s: %s %" PRIi16 " priority changed to %" PRIi16 "";
1771 #endif
1772 
1773  Fw::String queueTypeStr;
1774  queueType.toString(queueTypeStr);
1775 
1776  Fw::TextLogString _logString;
1777  _logString.format(
1778  _formatString,
1779 #if FW_OBJECT_NAMES == 1
1780  this->m_objName.toChar(),
1781 #endif
1782  "QueuePriorityChanged ",
1783  queueTypeStr.toChar(),
1784  indexType,
1785  newPriority
1786  );
1787 
1788  this->LogText_out(
1789  0,
1790  _id,
1791  _logTime,
1793  _logString
1794  );
1795  }
1796 #endif
1797  }
1798 
1799  // ----------------------------------------------------------------------
1800  // Telemetry serialized write
1801  // ----------------------------------------------------------------------
1802 
1805  FwChanIdType id,
1806  Fw::TlmBuffer& _tlmBuff,
1807  Fw::Time _tlmTime
1808  ) const
1809  {
1810  if (this->isConnected_Tlm_OutputPort(0)) {
1811  if (
1812  this->isConnected_Time_OutputPort(0) &&
1813  (_tlmTime == Fw::ZERO_TIME)
1814  ) {
1815  this->Time_out(0, _tlmTime);
1816  }
1817 
1818  FwChanIdType _id;
1819  _id = this->getIdBase() + id;
1820 
1821  this->Tlm_out(
1822  0,
1823  _id,
1824  _tlmTime,
1825  _tlmBuff
1826  );
1827  }
1828  }
1829 
1830  // ----------------------------------------------------------------------
1831  // Telemetry write functions
1832  // ----------------------------------------------------------------------
1833 
1836  const Svc::ComQueueDepth& arg,
1837  Fw::Time _tlmTime
1838  ) const
1839  {
1840  if (this->isConnected_Tlm_OutputPort(0)) {
1841  Fw::TlmBuffer _tlmBuff;
1842  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1843  FW_ASSERT(
1844  _stat == Fw::FW_SERIALIZE_OK,
1845  static_cast<FwAssertArgType>(_stat)
1846  );
1847 
1848  this->tlmWrite(
1850  _tlmBuff,
1851  _tlmTime
1852  );
1853  }
1854  }
1855 
1858  const Svc::BuffQueueDepth& arg,
1859  Fw::Time _tlmTime
1860  ) const
1861  {
1862  if (this->isConnected_Tlm_OutputPort(0)) {
1863  Fw::TlmBuffer _tlmBuff;
1864  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1865  FW_ASSERT(
1866  _stat == Fw::FW_SERIALIZE_OK,
1867  static_cast<FwAssertArgType>(_stat)
1868  );
1869 
1870  this->tlmWrite(
1872  _tlmBuff,
1873  _tlmTime
1874  );
1875  }
1876  }
1877 
1878  // ----------------------------------------------------------------------
1879  // Time
1880  // ----------------------------------------------------------------------
1881 
1883  getTime() const
1884  {
1885  if (this->isConnected_Time_OutputPort(0)) {
1886  Fw::Time _time;
1887  this->Time_out(0, _time);
1888  return _time;
1889  }
1890  else {
1891  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1892  }
1893  }
1894 
1895  // ----------------------------------------------------------------------
1896  // Message dispatch functions
1897  // ----------------------------------------------------------------------
1898 
1899  Fw::QueuedComponentBase::MsgDispatchStatus ComQueueComponentBase ::
1900  doDispatch()
1901  {
1902  ComponentIpcSerializableBuffer _msg;
1903  FwQueuePriorityType _priority = 0;
1904 
1905  Os::Queue::Status _msgStatus = this->m_queue.receive(
1906  _msg,
1908  _priority
1909  );
1910  FW_ASSERT(
1911  _msgStatus == Os::Queue::OP_OK,
1912  static_cast<FwAssertArgType>(_msgStatus)
1913  );
1914 
1915  // Reset to beginning of buffer
1916  _msg.resetDeser();
1917 
1918  FwEnumStoreType _desMsg = 0;
1919  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1920  FW_ASSERT(
1921  _deserStatus == Fw::FW_SERIALIZE_OK,
1922  static_cast<FwAssertArgType>(_deserStatus)
1923  );
1924 
1925  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1926 
1927  if (_msgType == COMQUEUE_COMPONENT_EXIT) {
1928  return MSG_DISPATCH_EXIT;
1929  }
1930 
1931  FwIndexType portNum = 0;
1932  _deserStatus = _msg.deserializeTo(portNum);
1933  FW_ASSERT(
1934  _deserStatus == Fw::FW_SERIALIZE_OK,
1935  static_cast<FwAssertArgType>(_deserStatus)
1936  );
1937 
1938  switch (_msgType) {
1939  // Handle async input port bufferQueueIn
1940  case BUFFERQUEUEIN_BUFFERSEND: {
1941  // Deserialize argument fwBuffer
1942  Fw::Buffer fwBuffer;
1943  _deserStatus = _msg.deserializeTo(fwBuffer);
1944  FW_ASSERT(
1945  _deserStatus == Fw::FW_SERIALIZE_OK,
1946  static_cast<FwAssertArgType>(_deserStatus)
1947  );
1948  // Call handler function
1949  this->bufferQueueIn_handler(
1950  portNum,
1951  fwBuffer
1952  );
1953 
1954  break;
1955  }
1956 
1957  // Handle async input port comPacketQueueIn
1958  case COMPACKETQUEUEIN_COM: {
1959  // Deserialize argument data
1960  Fw::ComBuffer data;
1961  _deserStatus = _msg.deserializeTo(data);
1962  FW_ASSERT(
1963  _deserStatus == Fw::FW_SERIALIZE_OK,
1964  static_cast<FwAssertArgType>(_deserStatus)
1965  );
1966 
1967  // Deserialize argument context
1968  U32 context;
1969  _deserStatus = _msg.deserializeTo(context);
1970  FW_ASSERT(
1971  _deserStatus == Fw::FW_SERIALIZE_OK,
1972  static_cast<FwAssertArgType>(_deserStatus)
1973  );
1974  // Call handler function
1976  portNum,
1977  data,
1978  context
1979  );
1980 
1981  break;
1982  }
1983 
1984  // Handle async input port comStatusIn
1985  case COMSTATUSIN_SUCCESSCONDITION: {
1986  // Deserialize argument condition
1987  Fw::Success condition;
1988  _deserStatus = _msg.deserializeTo(condition);
1989  FW_ASSERT(
1990  _deserStatus == Fw::FW_SERIALIZE_OK,
1991  static_cast<FwAssertArgType>(_deserStatus)
1992  );
1993  // Call handler function
1994  this->comStatusIn_handler(
1995  portNum,
1996  condition
1997  );
1998 
1999  break;
2000  }
2001 
2002  // Handle async input port run
2003  case RUN_SCHED: {
2004  // Deserialize argument context
2005  U32 context;
2006  _deserStatus = _msg.deserializeTo(context);
2007  FW_ASSERT(
2008  _deserStatus == Fw::FW_SERIALIZE_OK,
2009  static_cast<FwAssertArgType>(_deserStatus)
2010  );
2011  // Call handler function
2012  this->run_handler(
2013  portNum,
2014  context
2015  );
2016 
2017  break;
2018  }
2019 
2020  // Handle command FLUSH_QUEUE
2021  case CMD_FLUSH_QUEUE: {
2022  // Deserialize opcode
2023  FwOpcodeType _opCode = 0;
2024  _deserStatus = _msg.deserializeTo(_opCode);
2025  FW_ASSERT (
2026  _deserStatus == Fw::FW_SERIALIZE_OK,
2027  static_cast<FwAssertArgType>(_deserStatus)
2028  );
2029 
2030  // Deserialize command sequence
2031  U32 _cmdSeq = 0;
2032  _deserStatus = _msg.deserializeTo(_cmdSeq);
2033  FW_ASSERT (
2034  _deserStatus == Fw::FW_SERIALIZE_OK,
2035  static_cast<FwAssertArgType>(_deserStatus)
2036  );
2037 
2038  // Deserialize command argument buffer
2039  Fw::CmdArgBuffer args;
2040  _deserStatus = _msg.deserializeTo(args);
2041  FW_ASSERT (
2042  _deserStatus == Fw::FW_SERIALIZE_OK,
2043  static_cast<FwAssertArgType>(_deserStatus)
2044  );
2045 
2046  // Reset buffer
2047  args.resetDeser();
2048 
2049  // Deserialize argument queueType
2050  Svc::QueueType queueType;
2051  _deserStatus = args.deserializeTo(queueType);
2052  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2053  if (this->isConnected_CmdStatus_OutputPort(0)) {
2054  this->cmdResponse_out(
2055  _opCode,
2056  _cmdSeq,
2058  );
2059  }
2060  // Don't crash the task if bad arguments were passed from the ground
2061  break;
2062  }
2063 
2064  // Deserialize argument indexType
2065  FwIndexType indexType;
2066  _deserStatus = args.deserializeTo(indexType);
2067  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2068  if (this->isConnected_CmdStatus_OutputPort(0)) {
2069  this->cmdResponse_out(
2070  _opCode,
2071  _cmdSeq,
2073  );
2074  }
2075  // Don't crash the task if bad arguments were passed from the ground
2076  break;
2077  }
2078 
2079  // Make sure there was no data left over.
2080  // That means the argument buffer size was incorrect.
2081 #if FW_CMD_CHECK_RESIDUAL
2082  if (args.getDeserializeSizeLeft() != 0) {
2083  if (this->isConnected_CmdStatus_OutputPort(0)) {
2084  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2085  }
2086  // Don't crash the task if bad arguments were passed from the ground
2087  break;
2088  }
2089 #endif
2090 
2091  // Call handler function
2092  this->FLUSH_QUEUE_cmdHandler(
2093  _opCode, _cmdSeq,
2094  queueType,
2095  indexType
2096  );
2097 
2098  break;
2099  }
2100 
2101  // Handle command FLUSH_ALL_QUEUES
2102  case CMD_FLUSH_ALL_QUEUES: {
2103  // Deserialize opcode
2104  FwOpcodeType _opCode = 0;
2105  _deserStatus = _msg.deserializeTo(_opCode);
2106  FW_ASSERT (
2107  _deserStatus == Fw::FW_SERIALIZE_OK,
2108  static_cast<FwAssertArgType>(_deserStatus)
2109  );
2110 
2111  // Deserialize command sequence
2112  U32 _cmdSeq = 0;
2113  _deserStatus = _msg.deserializeTo(_cmdSeq);
2114  FW_ASSERT (
2115  _deserStatus == Fw::FW_SERIALIZE_OK,
2116  static_cast<FwAssertArgType>(_deserStatus)
2117  );
2118 
2119  // Deserialize command argument buffer
2120  Fw::CmdArgBuffer args;
2121  _deserStatus = _msg.deserializeTo(args);
2122  FW_ASSERT (
2123  _deserStatus == Fw::FW_SERIALIZE_OK,
2124  static_cast<FwAssertArgType>(_deserStatus)
2125  );
2126 
2127  // Reset buffer
2128  args.resetDeser();
2129 
2130  // Make sure there was no data left over.
2131  // That means the argument buffer size was incorrect.
2132 #if FW_CMD_CHECK_RESIDUAL
2133  if (args.getDeserializeSizeLeft() != 0) {
2134  if (this->isConnected_CmdStatus_OutputPort(0)) {
2135  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2136  }
2137  // Don't crash the task if bad arguments were passed from the ground
2138  break;
2139  }
2140 #endif
2141 
2142  // Call handler function
2143  this->FLUSH_ALL_QUEUES_cmdHandler(_opCode, _cmdSeq);
2144 
2145  break;
2146  }
2147 
2148  // Handle command SET_QUEUE_PRIORITY
2149  case CMD_SET_QUEUE_PRIORITY: {
2150  // Deserialize opcode
2151  FwOpcodeType _opCode = 0;
2152  _deserStatus = _msg.deserializeTo(_opCode);
2153  FW_ASSERT (
2154  _deserStatus == Fw::FW_SERIALIZE_OK,
2155  static_cast<FwAssertArgType>(_deserStatus)
2156  );
2157 
2158  // Deserialize command sequence
2159  U32 _cmdSeq = 0;
2160  _deserStatus = _msg.deserializeTo(_cmdSeq);
2161  FW_ASSERT (
2162  _deserStatus == Fw::FW_SERIALIZE_OK,
2163  static_cast<FwAssertArgType>(_deserStatus)
2164  );
2165 
2166  // Deserialize command argument buffer
2167  Fw::CmdArgBuffer args;
2168  _deserStatus = _msg.deserializeTo(args);
2169  FW_ASSERT (
2170  _deserStatus == Fw::FW_SERIALIZE_OK,
2171  static_cast<FwAssertArgType>(_deserStatus)
2172  );
2173 
2174  // Reset buffer
2175  args.resetDeser();
2176 
2177  // Deserialize argument queueType
2178  Svc::QueueType queueType;
2179  _deserStatus = args.deserializeTo(queueType);
2180  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2181  if (this->isConnected_CmdStatus_OutputPort(0)) {
2182  this->cmdResponse_out(
2183  _opCode,
2184  _cmdSeq,
2186  );
2187  }
2188  // Don't crash the task if bad arguments were passed from the ground
2189  break;
2190  }
2191 
2192  // Deserialize argument indexType
2193  FwIndexType indexType;
2194  _deserStatus = args.deserializeTo(indexType);
2195  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2196  if (this->isConnected_CmdStatus_OutputPort(0)) {
2197  this->cmdResponse_out(
2198  _opCode,
2199  _cmdSeq,
2201  );
2202  }
2203  // Don't crash the task if bad arguments were passed from the ground
2204  break;
2205  }
2206 
2207  // Deserialize argument newPriority
2208  FwIndexType newPriority;
2209  _deserStatus = args.deserializeTo(newPriority);
2210  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2211  if (this->isConnected_CmdStatus_OutputPort(0)) {
2212  this->cmdResponse_out(
2213  _opCode,
2214  _cmdSeq,
2216  );
2217  }
2218  // Don't crash the task if bad arguments were passed from the ground
2219  break;
2220  }
2221 
2222  // Make sure there was no data left over.
2223  // That means the argument buffer size was incorrect.
2224 #if FW_CMD_CHECK_RESIDUAL
2225  if (args.getDeserializeSizeLeft() != 0) {
2226  if (this->isConnected_CmdStatus_OutputPort(0)) {
2227  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2228  }
2229  // Don't crash the task if bad arguments were passed from the ground
2230  break;
2231  }
2232 #endif
2233 
2234  // Call handler function
2236  _opCode, _cmdSeq,
2237  queueType,
2238  indexType,
2239  newPriority
2240  );
2241 
2242  break;
2243  }
2244 
2245  default:
2246  return MSG_DISPATCH_ERROR;
2247  }
2248 
2249  return MSG_DISPATCH_OK;
2250  }
2251 
2252  // ----------------------------------------------------------------------
2253  // Calls for messages received on special input ports
2254  // ----------------------------------------------------------------------
2255 
2256  void ComQueueComponentBase ::
2257  m_p_CmdDisp_in(
2258  Fw::PassiveComponentBase* callComp,
2259  FwIndexType portNum,
2260  FwOpcodeType opCode,
2261  U32 cmdSeq,
2262  Fw::CmdArgBuffer& args
2263  )
2264  {
2265  FW_ASSERT(callComp);
2266  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2267  compPtr->CmdDisp_handlerBase(
2268  portNum,
2269  opCode,
2270  cmdSeq,
2271  args
2272  );
2273  }
2274 
2275  // ----------------------------------------------------------------------
2276  // Calls for messages received on typed input ports
2277  // ----------------------------------------------------------------------
2278 
2279  void ComQueueComponentBase ::
2280  m_p_bufferQueueIn_in(
2281  Fw::PassiveComponentBase* callComp,
2282  FwIndexType portNum,
2283  Fw::Buffer& fwBuffer
2284  )
2285  {
2286  FW_ASSERT(callComp);
2287  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2288  compPtr->bufferQueueIn_handlerBase(
2289  portNum,
2290  fwBuffer
2291  );
2292  }
2293 
2294  void ComQueueComponentBase ::
2295  m_p_comPacketQueueIn_in(
2296  Fw::PassiveComponentBase* callComp,
2297  FwIndexType portNum,
2298  Fw::ComBuffer& data,
2299  U32 context
2300  )
2301  {
2302  FW_ASSERT(callComp);
2303  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2304  compPtr->comPacketQueueIn_handlerBase(
2305  portNum,
2306  data,
2307  context
2308  );
2309  }
2310 
2311  void ComQueueComponentBase ::
2312  m_p_comStatusIn_in(
2313  Fw::PassiveComponentBase* callComp,
2314  FwIndexType portNum,
2315  Fw::Success& condition
2316  )
2317  {
2318  FW_ASSERT(callComp);
2319  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2320  compPtr->comStatusIn_handlerBase(
2321  portNum,
2322  condition
2323  );
2324  }
2325 
2326  void ComQueueComponentBase ::
2327  m_p_dataReturnIn_in(
2328  Fw::PassiveComponentBase* callComp,
2329  FwIndexType portNum,
2330  Fw::Buffer& data,
2331  const ComCfg::FrameContext& context
2332  )
2333  {
2334  FW_ASSERT(callComp);
2335  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2336  compPtr->dataReturnIn_handlerBase(
2337  portNum,
2338  data,
2339  context
2340  );
2341  }
2342 
2343  void ComQueueComponentBase ::
2344  m_p_run_in(
2345  Fw::PassiveComponentBase* callComp,
2346  FwIndexType portNum,
2347  U32 context
2348  )
2349  {
2350  FW_ASSERT(callComp);
2351  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2352  compPtr->run_handlerBase(
2353  portNum,
2354  context
2355  );
2356  }
2357 
2358 #if !FW_DIRECT_PORT_CALLS
2359 
2360  // ----------------------------------------------------------------------
2361  // Invocation functions for special output ports
2362  // ----------------------------------------------------------------------
2363 
2364  void ComQueueComponentBase ::
2365  CmdReg_out(
2366  FwIndexType portNum,
2367  FwOpcodeType opCode
2368  ) const
2369  {
2370  FW_ASSERT(
2371  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
2372  static_cast<FwAssertArgType>(portNum)
2373  );
2374 
2375  FW_ASSERT(
2376  this->m_CmdReg_OutputPort[portNum].isConnected(),
2377  static_cast<FwAssertArgType>(portNum)
2378  );
2379  this->m_CmdReg_OutputPort[portNum].invoke(
2380  opCode
2381  );
2382  }
2383 
2384  void ComQueueComponentBase ::
2385  CmdStatus_out(
2386  FwIndexType portNum,
2387  FwOpcodeType opCode,
2388  U32 cmdSeq,
2389  const Fw::CmdResponse& response
2390  ) const
2391  {
2392  FW_ASSERT(
2393  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
2394  static_cast<FwAssertArgType>(portNum)
2395  );
2396 
2397  FW_ASSERT(
2398  this->m_CmdStatus_OutputPort[portNum].isConnected(),
2399  static_cast<FwAssertArgType>(portNum)
2400  );
2401  this->m_CmdStatus_OutputPort[portNum].invoke(
2402  opCode,
2403  cmdSeq,
2404  response
2405  );
2406  }
2407 
2408  void ComQueueComponentBase ::
2409  Log_out(
2410  FwIndexType portNum,
2411  FwEventIdType id,
2412  Fw::Time& timeTag,
2413  const Fw::LogSeverity& severity,
2414  Fw::LogBuffer& args
2415  ) const
2416  {
2417  FW_ASSERT(
2418  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
2419  static_cast<FwAssertArgType>(portNum)
2420  );
2421 
2422  FW_ASSERT(
2423  this->m_Log_OutputPort[portNum].isConnected(),
2424  static_cast<FwAssertArgType>(portNum)
2425  );
2426  this->m_Log_OutputPort[portNum].invoke(
2427  id,
2428  timeTag,
2429  severity,
2430  args
2431  );
2432  }
2433 
2434 #if FW_ENABLE_TEXT_LOGGING
2435 
2436  void ComQueueComponentBase ::
2437  LogText_out(
2438  FwIndexType portNum,
2439  FwEventIdType id,
2440  Fw::Time& timeTag,
2441  const Fw::LogSeverity& severity,
2442  Fw::TextLogString& text
2443  ) const
2444  {
2445  FW_ASSERT(
2446  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
2447  static_cast<FwAssertArgType>(portNum)
2448  );
2449 
2450  FW_ASSERT(
2451  this->m_LogText_OutputPort[portNum].isConnected(),
2452  static_cast<FwAssertArgType>(portNum)
2453  );
2454  this->m_LogText_OutputPort[portNum].invoke(
2455  id,
2456  timeTag,
2457  severity,
2458  text
2459  );
2460  }
2461 
2462 #endif
2463 
2464  void ComQueueComponentBase ::
2465  Time_out(
2466  FwIndexType portNum,
2467  Fw::Time& time
2468  ) const
2469  {
2470  FW_ASSERT(
2471  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
2472  static_cast<FwAssertArgType>(portNum)
2473  );
2474 
2475  FW_ASSERT(
2476  this->m_Time_OutputPort[portNum].isConnected(),
2477  static_cast<FwAssertArgType>(portNum)
2478  );
2479  this->m_Time_OutputPort[portNum].invoke(
2480  time
2481  );
2482  }
2483 
2484  void ComQueueComponentBase ::
2485  Tlm_out(
2486  FwIndexType portNum,
2487  FwChanIdType id,
2488  Fw::Time& timeTag,
2489  Fw::TlmBuffer& val
2490  ) const
2491  {
2492  FW_ASSERT(
2493  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
2494  static_cast<FwAssertArgType>(portNum)
2495  );
2496 
2497  FW_ASSERT(
2498  this->m_Tlm_OutputPort[portNum].isConnected(),
2499  static_cast<FwAssertArgType>(portNum)
2500  );
2501  this->m_Tlm_OutputPort[portNum].invoke(
2502  id,
2503  timeTag,
2504  val
2505  );
2506  }
2507 
2508 #endif
2509 
2510 }
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
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:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
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.
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
virtual void FLUSH_QUEUE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::QueueType queueType, FwIndexType indexType)=0
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
virtual void SET_QUEUE_PRIORITY_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::QueueType queueType, FwIndexType indexType, FwIndexType newPriority)=0
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(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
The size of the serial representation.
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.
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)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
bool isConnected_Time_OutputPort(FwIndexType portNum) const
Os::Queue m_queue
queue object for active component
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.
void init()
Object initializer.
Definition: ObjBase.cpp:24
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.
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(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
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.
virtual void run_preMsgHook(FwIndexType portNum, U32 context)
Pre-message hook for async input port run.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port connection.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
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].
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
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:39
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.
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:53
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
BlockingType
message type
Definition: Queue.hpp:46
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
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 incNumMsgDropped()
increment the number of messages dropped
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
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
U8 BYTE
byte type
Definition: BasicTypes.h:56
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.
Set the priority of a specific queue at runtime.
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.
void init()
Initialization function.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
static constexpr FwSizeType CAPACITY
Definition: SchedPortAc.hpp:34
Success/Failure.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
static constexpr FwIndexType getNum_run_InputPorts()
void init()
Initialization function.
message to exit active component task
void bufferQueueIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferQueueIn.