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