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::InputBufferSendPort::SERIALIZED_SIZE];
32  BYTE comPacketQueueInPortSize[Fw::InputComPort::SERIALIZED_SIZE];
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  // Connect input port CmdDisp
88  for (
89  FwIndexType port = 0;
90  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
91  port++
92  ) {
93  this->m_CmdDisp_InputPort[port].init();
94  this->m_CmdDisp_InputPort[port].addCallComp(
95  this,
96  m_p_CmdDisp_in
97  );
98  this->m_CmdDisp_InputPort[port].setPortNum(port);
99 
100 #if FW_OBJECT_NAMES == 1
101  Fw::ObjectName portName;
102  portName.format(
103  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
104  this->m_objName.toChar(),
105  port
106  );
107  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
108 #endif
109  }
110 
111  // Connect input port bufferQueueIn
112  for (
113  FwIndexType port = 0;
114  port < static_cast<FwIndexType>(this->getNum_bufferQueueIn_InputPorts());
115  port++
116  ) {
117  this->m_bufferQueueIn_InputPort[port].init();
118  this->m_bufferQueueIn_InputPort[port].addCallComp(
119  this,
120  m_p_bufferQueueIn_in
121  );
122  this->m_bufferQueueIn_InputPort[port].setPortNum(port);
123 
124 #if FW_OBJECT_NAMES == 1
125  Fw::ObjectName portName;
126  portName.format(
127  "%s_bufferQueueIn_InputPort[%" PRI_FwIndexType "]",
128  this->m_objName.toChar(),
129  port
130  );
131  this->m_bufferQueueIn_InputPort[port].setObjName(portName.toChar());
132 #endif
133  }
134 
135  // Connect input port comPacketQueueIn
136  for (
137  FwIndexType port = 0;
138  port < static_cast<FwIndexType>(this->getNum_comPacketQueueIn_InputPorts());
139  port++
140  ) {
141  this->m_comPacketQueueIn_InputPort[port].init();
142  this->m_comPacketQueueIn_InputPort[port].addCallComp(
143  this,
144  m_p_comPacketQueueIn_in
145  );
146  this->m_comPacketQueueIn_InputPort[port].setPortNum(port);
147 
148 #if FW_OBJECT_NAMES == 1
149  Fw::ObjectName portName;
150  portName.format(
151  "%s_comPacketQueueIn_InputPort[%" PRI_FwIndexType "]",
152  this->m_objName.toChar(),
153  port
154  );
155  this->m_comPacketQueueIn_InputPort[port].setObjName(portName.toChar());
156 #endif
157  }
158 
159  // Connect input port comStatusIn
160  for (
161  FwIndexType port = 0;
162  port < static_cast<FwIndexType>(this->getNum_comStatusIn_InputPorts());
163  port++
164  ) {
165  this->m_comStatusIn_InputPort[port].init();
166  this->m_comStatusIn_InputPort[port].addCallComp(
167  this,
168  m_p_comStatusIn_in
169  );
170  this->m_comStatusIn_InputPort[port].setPortNum(port);
171 
172 #if FW_OBJECT_NAMES == 1
173  Fw::ObjectName portName;
174  portName.format(
175  "%s_comStatusIn_InputPort[%" PRI_FwIndexType "]",
176  this->m_objName.toChar(),
177  port
178  );
179  this->m_comStatusIn_InputPort[port].setObjName(portName.toChar());
180 #endif
181  }
182 
183  // Connect input port dataReturnIn
184  for (
185  FwIndexType port = 0;
186  port < static_cast<FwIndexType>(this->getNum_dataReturnIn_InputPorts());
187  port++
188  ) {
189  this->m_dataReturnIn_InputPort[port].init();
190  this->m_dataReturnIn_InputPort[port].addCallComp(
191  this,
192  m_p_dataReturnIn_in
193  );
194  this->m_dataReturnIn_InputPort[port].setPortNum(port);
195 
196 #if FW_OBJECT_NAMES == 1
197  Fw::ObjectName portName;
198  portName.format(
199  "%s_dataReturnIn_InputPort[%" PRI_FwIndexType "]",
200  this->m_objName.toChar(),
201  port
202  );
203  this->m_dataReturnIn_InputPort[port].setObjName(portName.toChar());
204 #endif
205  }
206 
207  // Connect input port run
208  for (
209  FwIndexType port = 0;
210  port < static_cast<FwIndexType>(this->getNum_run_InputPorts());
211  port++
212  ) {
213  this->m_run_InputPort[port].init();
214  this->m_run_InputPort[port].addCallComp(
215  this,
216  m_p_run_in
217  );
218  this->m_run_InputPort[port].setPortNum(port);
219 
220 #if FW_OBJECT_NAMES == 1
221  Fw::ObjectName portName;
222  portName.format(
223  "%s_run_InputPort[%" PRI_FwIndexType "]",
224  this->m_objName.toChar(),
225  port
226  );
227  this->m_run_InputPort[port].setObjName(portName.toChar());
228 #endif
229  }
230 
231  // Connect output port CmdReg
232  for (
233  FwIndexType port = 0;
234  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
235  port++
236  ) {
237  this->m_CmdReg_OutputPort[port].init();
238 
239 #if FW_OBJECT_NAMES == 1
240  Fw::ObjectName portName;
241  portName.format(
242  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
243  this->m_objName.toChar(),
244  port
245  );
246  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
247 #endif
248  }
249 
250  // Connect output port CmdStatus
251  for (
252  FwIndexType port = 0;
253  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
254  port++
255  ) {
256  this->m_CmdStatus_OutputPort[port].init();
257 
258 #if FW_OBJECT_NAMES == 1
259  Fw::ObjectName portName;
260  portName.format(
261  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
262  this->m_objName.toChar(),
263  port
264  );
265  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
266 #endif
267  }
268 
269  // Connect output port Log
270  for (
271  FwIndexType port = 0;
272  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
273  port++
274  ) {
275  this->m_Log_OutputPort[port].init();
276 
277 #if FW_OBJECT_NAMES == 1
278  Fw::ObjectName portName;
279  portName.format(
280  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
281  this->m_objName.toChar(),
282  port
283  );
284  this->m_Log_OutputPort[port].setObjName(portName.toChar());
285 #endif
286  }
287 
288 #if FW_ENABLE_TEXT_LOGGING == 1
289  // Connect output port LogText
290  for (
291  FwIndexType port = 0;
292  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
293  port++
294  ) {
295  this->m_LogText_OutputPort[port].init();
296 
297 #if FW_OBJECT_NAMES == 1
298  Fw::ObjectName portName;
299  portName.format(
300  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
301  this->m_objName.toChar(),
302  port
303  );
304  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
305 #endif
306  }
307 #endif
308 
309  // Connect output port Time
310  for (
311  FwIndexType port = 0;
312  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
313  port++
314  ) {
315  this->m_Time_OutputPort[port].init();
316 
317 #if FW_OBJECT_NAMES == 1
318  Fw::ObjectName portName;
319  portName.format(
320  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
321  this->m_objName.toChar(),
322  port
323  );
324  this->m_Time_OutputPort[port].setObjName(portName.toChar());
325 #endif
326  }
327 
328  // Connect output port Tlm
329  for (
330  FwIndexType port = 0;
331  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
332  port++
333  ) {
334  this->m_Tlm_OutputPort[port].init();
335 
336 #if FW_OBJECT_NAMES == 1
337  Fw::ObjectName portName;
338  portName.format(
339  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
340  this->m_objName.toChar(),
341  port
342  );
343  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
344 #endif
345  }
346 
347  // Connect output port bufferReturnOut
348  for (
349  FwIndexType port = 0;
350  port < static_cast<FwIndexType>(this->getNum_bufferReturnOut_OutputPorts());
351  port++
352  ) {
353  this->m_bufferReturnOut_OutputPort[port].init();
354 
355 #if FW_OBJECT_NAMES == 1
356  Fw::ObjectName portName;
357  portName.format(
358  "%s_bufferReturnOut_OutputPort[%" PRI_FwIndexType "]",
359  this->m_objName.toChar(),
360  port
361  );
362  this->m_bufferReturnOut_OutputPort[port].setObjName(portName.toChar());
363 #endif
364  }
365 
366  // Connect output port dataOut
367  for (
368  FwIndexType port = 0;
369  port < static_cast<FwIndexType>(this->getNum_dataOut_OutputPorts());
370  port++
371  ) {
372  this->m_dataOut_OutputPort[port].init();
373 
374 #if FW_OBJECT_NAMES == 1
375  Fw::ObjectName portName;
376  portName.format(
377  "%s_dataOut_OutputPort[%" PRI_FwIndexType "]",
378  this->m_objName.toChar(),
379  port
380  );
381  this->m_dataOut_OutputPort[port].setObjName(portName.toChar());
382 #endif
383  }
384 
385  // Create the queue
386  Os::Queue::Status qStat = this->createQueue(
387  queueDepth,
388  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
389  );
390  FW_ASSERT(
391  Os::Queue::Status::OP_OK == qStat,
392  static_cast<FwAssertArgType>(qStat)
393  );
394  }
395 
396  // ----------------------------------------------------------------------
397  // Getters for special input ports
398  // ----------------------------------------------------------------------
399 
402  {
403  FW_ASSERT(
404  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
405  static_cast<FwAssertArgType>(portNum)
406  );
407 
408  return &this->m_CmdDisp_InputPort[portNum];
409  }
410 
411  // ----------------------------------------------------------------------
412  // Getters for typed input ports
413  // ----------------------------------------------------------------------
414 
417  {
418  FW_ASSERT(
419  (0 <= portNum) && (portNum < this->getNum_bufferQueueIn_InputPorts()),
420  static_cast<FwAssertArgType>(portNum)
421  );
422 
423  return &this->m_bufferQueueIn_InputPort[portNum];
424  }
425 
428  {
429  FW_ASSERT(
430  (0 <= portNum) && (portNum < this->getNum_comPacketQueueIn_InputPorts()),
431  static_cast<FwAssertArgType>(portNum)
432  );
433 
434  return &this->m_comPacketQueueIn_InputPort[portNum];
435  }
436 
439  {
440  FW_ASSERT(
441  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
442  static_cast<FwAssertArgType>(portNum)
443  );
444 
445  return &this->m_comStatusIn_InputPort[portNum];
446  }
447 
450  {
451  FW_ASSERT(
452  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
453  static_cast<FwAssertArgType>(portNum)
454  );
455 
456  return &this->m_dataReturnIn_InputPort[portNum];
457  }
458 
461  {
462  FW_ASSERT(
463  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
464  static_cast<FwAssertArgType>(portNum)
465  );
466 
467  return &this->m_run_InputPort[portNum];
468  }
469 
470  // ----------------------------------------------------------------------
471  // Connect input ports to special output ports
472  // ----------------------------------------------------------------------
473 
476  FwIndexType portNum,
477  Fw::InputCmdRegPort* port
478  )
479  {
480  FW_ASSERT(
481  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
482  static_cast<FwAssertArgType>(portNum)
483  );
484 
485  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
486  }
487 
490  FwIndexType portNum,
492  )
493  {
494  FW_ASSERT(
495  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
496  static_cast<FwAssertArgType>(portNum)
497  );
498 
499  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
500  }
501 
504  FwIndexType portNum,
505  Fw::InputLogPort* port
506  )
507  {
508  FW_ASSERT(
509  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
510  static_cast<FwAssertArgType>(portNum)
511  );
512 
513  this->m_Log_OutputPort[portNum].addCallPort(port);
514  }
515 
516 #if FW_ENABLE_TEXT_LOGGING == 1
517 
518  void ComQueueComponentBase ::
519  set_LogText_OutputPort(
520  FwIndexType portNum,
522  )
523  {
524  FW_ASSERT(
525  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
526  static_cast<FwAssertArgType>(portNum)
527  );
528 
529  this->m_LogText_OutputPort[portNum].addCallPort(port);
530  }
531 
532 #endif
533 
536  FwIndexType portNum,
537  Fw::InputTimePort* port
538  )
539  {
540  FW_ASSERT(
541  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
542  static_cast<FwAssertArgType>(portNum)
543  );
544 
545  this->m_Time_OutputPort[portNum].addCallPort(port);
546  }
547 
550  FwIndexType portNum,
551  Fw::InputTlmPort* port
552  )
553  {
554  FW_ASSERT(
555  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
556  static_cast<FwAssertArgType>(portNum)
557  );
558 
559  this->m_Tlm_OutputPort[portNum].addCallPort(port);
560  }
561 
562  // ----------------------------------------------------------------------
563  // Connect typed input ports to typed output ports
564  // ----------------------------------------------------------------------
565 
568  FwIndexType portNum,
570  )
571  {
572  FW_ASSERT(
573  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
574  static_cast<FwAssertArgType>(portNum)
575  );
576 
577  this->m_bufferReturnOut_OutputPort[portNum].addCallPort(port);
578  }
579 
582  FwIndexType portNum,
584  )
585  {
586  FW_ASSERT(
587  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
588  static_cast<FwAssertArgType>(portNum)
589  );
590 
591  this->m_dataOut_OutputPort[portNum].addCallPort(port);
592  }
593 
594 #if FW_PORT_SERIALIZATION
595 
596  // ----------------------------------------------------------------------
597  // Connect serial input ports to special output ports
598  // ----------------------------------------------------------------------
599 
602  FwIndexType portNum,
603  Fw::InputSerializePort* port
604  )
605  {
606  FW_ASSERT(
607  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
608  static_cast<FwAssertArgType>(portNum)
609  );
610 
611  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
612  }
613 
616  FwIndexType portNum,
617  Fw::InputSerializePort* port
618  )
619  {
620  FW_ASSERT(
621  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
622  static_cast<FwAssertArgType>(portNum)
623  );
624 
625  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
626  }
627 
630  FwIndexType portNum,
631  Fw::InputSerializePort* port
632  )
633  {
634  FW_ASSERT(
635  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
636  static_cast<FwAssertArgType>(portNum)
637  );
638 
639  this->m_Log_OutputPort[portNum].registerSerialPort(port);
640  }
641 
642 #if FW_ENABLE_TEXT_LOGGING == 1
643 
644  void ComQueueComponentBase ::
645  set_LogText_OutputPort(
646  FwIndexType portNum,
647  Fw::InputSerializePort* port
648  )
649  {
650  FW_ASSERT(
651  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
652  static_cast<FwAssertArgType>(portNum)
653  );
654 
655  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
656  }
657 
658 #endif
659 
662  FwIndexType portNum,
663  Fw::InputSerializePort* port
664  )
665  {
666  FW_ASSERT(
667  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
668  static_cast<FwAssertArgType>(portNum)
669  );
670 
671  this->m_Time_OutputPort[portNum].registerSerialPort(port);
672  }
673 
676  FwIndexType portNum,
677  Fw::InputSerializePort* port
678  )
679  {
680  FW_ASSERT(
681  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
682  static_cast<FwAssertArgType>(portNum)
683  );
684 
685  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
686  }
687 
688 #endif
689 
690 #if FW_PORT_SERIALIZATION
691 
692  // ----------------------------------------------------------------------
693  // Connect serial input ports to typed output ports
694  // ----------------------------------------------------------------------
695 
698  FwIndexType portNum,
699  Fw::InputSerializePort* port
700  )
701  {
702  FW_ASSERT(
703  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
704  static_cast<FwAssertArgType>(portNum)
705  );
706 
707  this->m_bufferReturnOut_OutputPort[portNum].registerSerialPort(port);
708  }
709 
712  FwIndexType portNum,
713  Fw::InputSerializePort* port
714  )
715  {
716  FW_ASSERT(
717  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
718  static_cast<FwAssertArgType>(portNum)
719  );
720 
721  this->m_dataOut_OutputPort[portNum].registerSerialPort(port);
722  }
723 
724 #endif
725 
726  // ----------------------------------------------------------------------
727  // Command registration
728  // ----------------------------------------------------------------------
729 
732  {
733  FW_ASSERT(this->m_CmdReg_OutputPort[0].isConnected());
734 
735  this->m_CmdReg_OutputPort[0].invoke(
736  this->getIdBase() + OPCODE_FLUSH_QUEUE
737  );
738 
739  this->m_CmdReg_OutputPort[0].invoke(
741  );
742 
743  this->m_CmdReg_OutputPort[0].invoke(
745  );
746  }
747 
748  // ----------------------------------------------------------------------
749  // Component construction and destruction
750  // ----------------------------------------------------------------------
751 
753  ComQueueComponentBase(const char* compName) :
754  Fw::ActiveComponentBase(compName)
755  {
756 
757  }
758 
761  {
762 
763  }
764 
765  // ----------------------------------------------------------------------
766  // Connection status queries for special output ports
767  // ----------------------------------------------------------------------
768 
771  {
772  FW_ASSERT(
773  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
774  static_cast<FwAssertArgType>(portNum)
775  );
776 
777  return this->m_CmdReg_OutputPort[portNum].isConnected();
778  }
779 
782  {
783  FW_ASSERT(
784  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
785  static_cast<FwAssertArgType>(portNum)
786  );
787 
788  return this->m_CmdStatus_OutputPort[portNum].isConnected();
789  }
790 
793  {
794  FW_ASSERT(
795  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
796  static_cast<FwAssertArgType>(portNum)
797  );
798 
799  return this->m_Log_OutputPort[portNum].isConnected();
800  }
801 
802 #if FW_ENABLE_TEXT_LOGGING == 1
803 
804  bool ComQueueComponentBase ::
805  isConnected_LogText_OutputPort(FwIndexType portNum)
806  {
807  FW_ASSERT(
808  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
809  static_cast<FwAssertArgType>(portNum)
810  );
811 
812  return this->m_LogText_OutputPort[portNum].isConnected();
813  }
814 
815 #endif
816 
819  {
820  FW_ASSERT(
821  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
822  static_cast<FwAssertArgType>(portNum)
823  );
824 
825  return this->m_Time_OutputPort[portNum].isConnected();
826  }
827 
830  {
831  FW_ASSERT(
832  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
833  static_cast<FwAssertArgType>(portNum)
834  );
835 
836  return this->m_Tlm_OutputPort[portNum].isConnected();
837  }
838 
839  // ----------------------------------------------------------------------
840  // Connection status queries for typed output ports
841  // ----------------------------------------------------------------------
842 
845  {
846  FW_ASSERT(
847  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
848  static_cast<FwAssertArgType>(portNum)
849  );
850 
851  return this->m_bufferReturnOut_OutputPort[portNum].isConnected();
852  }
853 
856  {
857  FW_ASSERT(
858  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
859  static_cast<FwAssertArgType>(portNum)
860  );
861 
862  return this->m_dataOut_OutputPort[portNum].isConnected();
863  }
864 
865  // ----------------------------------------------------------------------
866  // Port handler base-class functions for typed input ports
867  //
868  // Call these functions directly to bypass the corresponding ports
869  // ----------------------------------------------------------------------
870 
873  FwIndexType portNum,
874  Fw::Buffer& fwBuffer
875  )
876  {
877  // Make sure port number is valid
878  FW_ASSERT(
879  (0 <= portNum) && (portNum < this->getNum_bufferQueueIn_InputPorts()),
880  static_cast<FwAssertArgType>(portNum)
881  );
882 
883  // Call pre-message hook
885  portNum,
886  fwBuffer
887  );
888  ComponentIpcSerializableBuffer msg;
890 
891  // Serialize message ID
892  _status = msg.serializeFrom(
893  static_cast<FwEnumStoreType>(BUFFERQUEUEIN_BUFFERSEND)
894  );
895  FW_ASSERT(
896  _status == Fw::FW_SERIALIZE_OK,
897  static_cast<FwAssertArgType>(_status)
898  );
899 
900  // Serialize port number
901  _status = msg.serializeFrom(portNum);
902  FW_ASSERT(
903  _status == Fw::FW_SERIALIZE_OK,
904  static_cast<FwAssertArgType>(_status)
905  );
906 
907  // Serialize argument fwBuffer
908  _status = msg.serializeFrom(fwBuffer);
909  FW_ASSERT(
910  _status == Fw::FW_SERIALIZE_OK,
911  static_cast<FwAssertArgType>(_status)
912  );
913 
914  // Send message
916  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
917 
918  if (qStatus == Os::Queue::Status::FULL) {
919  this->bufferQueueIn_overflowHook(portNum, fwBuffer);
920  return;
921  }
922 
923  FW_ASSERT(
924  qStatus == Os::Queue::OP_OK,
925  static_cast<FwAssertArgType>(qStatus)
926  );
927  }
928 
931  FwIndexType portNum,
932  Fw::ComBuffer& data,
933  U32 context
934  )
935  {
936  // Make sure port number is valid
937  FW_ASSERT(
938  (0 <= portNum) && (portNum < this->getNum_comPacketQueueIn_InputPorts()),
939  static_cast<FwAssertArgType>(portNum)
940  );
941 
942  // Call pre-message hook
944  portNum,
945  data,
946  context
947  );
948  ComponentIpcSerializableBuffer msg;
950 
951  // Serialize message ID
952  _status = msg.serializeFrom(
953  static_cast<FwEnumStoreType>(COMPACKETQUEUEIN_COM)
954  );
955  FW_ASSERT(
956  _status == Fw::FW_SERIALIZE_OK,
957  static_cast<FwAssertArgType>(_status)
958  );
959 
960  // Serialize port number
961  _status = msg.serializeFrom(portNum);
962  FW_ASSERT(
963  _status == Fw::FW_SERIALIZE_OK,
964  static_cast<FwAssertArgType>(_status)
965  );
966 
967  // Serialize argument data
968  _status = msg.serializeFrom(data);
969  FW_ASSERT(
970  _status == Fw::FW_SERIALIZE_OK,
971  static_cast<FwAssertArgType>(_status)
972  );
973 
974  // Serialize argument context
975  _status = msg.serializeFrom(context);
976  FW_ASSERT(
977  _status == Fw::FW_SERIALIZE_OK,
978  static_cast<FwAssertArgType>(_status)
979  );
980 
981  // Send message
983  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
984 
985  if (qStatus == Os::Queue::Status::FULL) {
986  this->incNumMsgDropped();
987  return;
988  }
989 
990  FW_ASSERT(
991  qStatus == Os::Queue::OP_OK,
992  static_cast<FwAssertArgType>(qStatus)
993  );
994  }
995 
998  FwIndexType portNum,
999  Fw::Success& condition
1000  )
1001  {
1002  // Make sure port number is valid
1003  FW_ASSERT(
1004  (0 <= portNum) && (portNum < this->getNum_comStatusIn_InputPorts()),
1005  static_cast<FwAssertArgType>(portNum)
1006  );
1007 
1008  // Call pre-message hook
1010  portNum,
1011  condition
1012  );
1013  ComponentIpcSerializableBuffer msg;
1015 
1016  // Serialize message ID
1017  _status = msg.serializeFrom(
1018  static_cast<FwEnumStoreType>(COMSTATUSIN_SUCCESSCONDITION)
1019  );
1020  FW_ASSERT(
1021  _status == Fw::FW_SERIALIZE_OK,
1022  static_cast<FwAssertArgType>(_status)
1023  );
1024 
1025  // Serialize port number
1026  _status = msg.serializeFrom(portNum);
1027  FW_ASSERT(
1028  _status == Fw::FW_SERIALIZE_OK,
1029  static_cast<FwAssertArgType>(_status)
1030  );
1031 
1032  // Serialize argument condition
1033  _status = msg.serializeFrom(condition);
1034  FW_ASSERT(
1035  _status == Fw::FW_SERIALIZE_OK,
1036  static_cast<FwAssertArgType>(_status)
1037  );
1038 
1039  // Send message
1041  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1042 
1043  FW_ASSERT(
1044  qStatus == Os::Queue::OP_OK,
1045  static_cast<FwAssertArgType>(qStatus)
1046  );
1047  }
1048 
1051  FwIndexType portNum,
1052  Fw::Buffer& data,
1053  const ComCfg::FrameContext& context
1054  )
1055  {
1056  // Make sure port number is valid
1057  FW_ASSERT(
1058  (0 <= portNum) && (portNum < this->getNum_dataReturnIn_InputPorts()),
1059  static_cast<FwAssertArgType>(portNum)
1060  );
1061 
1062  // Call handler function
1063  this->dataReturnIn_handler(
1064  portNum,
1065  data,
1066  context
1067  );
1068  }
1069 
1072  FwIndexType portNum,
1073  U32 context
1074  )
1075  {
1076  // Make sure port number is valid
1077  FW_ASSERT(
1078  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
1079  static_cast<FwAssertArgType>(portNum)
1080  );
1081 
1082  // Call pre-message hook
1084  portNum,
1085  context
1086  );
1087  ComponentIpcSerializableBuffer msg;
1089 
1090  // Serialize message ID
1091  _status = msg.serializeFrom(
1092  static_cast<FwEnumStoreType>(RUN_SCHED)
1093  );
1094  FW_ASSERT(
1095  _status == Fw::FW_SERIALIZE_OK,
1096  static_cast<FwAssertArgType>(_status)
1097  );
1098 
1099  // Serialize port number
1100  _status = msg.serializeFrom(portNum);
1101  FW_ASSERT(
1102  _status == Fw::FW_SERIALIZE_OK,
1103  static_cast<FwAssertArgType>(_status)
1104  );
1105 
1106  // Serialize argument context
1107  _status = msg.serializeFrom(context);
1108  FW_ASSERT(
1109  _status == Fw::FW_SERIALIZE_OK,
1110  static_cast<FwAssertArgType>(_status)
1111  );
1112 
1113  // Send message
1115  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1116 
1117  if (qStatus == Os::Queue::Status::FULL) {
1118  this->incNumMsgDropped();
1119  return;
1120  }
1121 
1122  FW_ASSERT(
1123  qStatus == Os::Queue::OP_OK,
1124  static_cast<FwAssertArgType>(qStatus)
1125  );
1126  }
1127 
1128  // ----------------------------------------------------------------------
1129  // Pre-message hooks for typed async input ports
1130  //
1131  // Each of these functions is invoked just before processing a message
1132  // on the corresponding port. By default, they do nothing. You can
1133  // override them to provide specific pre-message behavior.
1134  // ----------------------------------------------------------------------
1135 
1138  FwIndexType portNum,
1139  Fw::Buffer& fwBuffer
1140  )
1141  {
1142  // Default: no-op
1143  }
1144 
1147  FwIndexType portNum,
1148  Fw::ComBuffer& data,
1149  U32 context
1150  )
1151  {
1152  // Default: no-op
1153  }
1154 
1157  FwIndexType portNum,
1158  Fw::Success& condition
1159  )
1160  {
1161  // Default: no-op
1162  }
1163 
1166  FwIndexType portNum,
1167  U32 context
1168  )
1169  {
1170  // Default: no-op
1171  }
1172 
1173  // ----------------------------------------------------------------------
1174  // Invocation functions for typed output ports
1175  // ----------------------------------------------------------------------
1176 
1179  FwIndexType portNum,
1180  Fw::Buffer& fwBuffer
1181  )
1182  {
1183  FW_ASSERT(
1184  (0 <= portNum) && (portNum < this->getNum_bufferReturnOut_OutputPorts()),
1185  static_cast<FwAssertArgType>(portNum)
1186  );
1187 
1188  FW_ASSERT(
1189  this->m_bufferReturnOut_OutputPort[portNum].isConnected(),
1190  static_cast<FwAssertArgType>(portNum)
1191  );
1192  this->m_bufferReturnOut_OutputPort[portNum].invoke(
1193  fwBuffer
1194  );
1195  }
1196 
1199  FwIndexType portNum,
1200  Fw::Buffer& data,
1201  const ComCfg::FrameContext& context
1202  )
1203  {
1204  FW_ASSERT(
1205  (0 <= portNum) && (portNum < this->getNum_dataOut_OutputPorts()),
1206  static_cast<FwAssertArgType>(portNum)
1207  );
1208 
1209  FW_ASSERT(
1210  this->m_dataOut_OutputPort[portNum].isConnected(),
1211  static_cast<FwAssertArgType>(portNum)
1212  );
1213  this->m_dataOut_OutputPort[portNum].invoke(
1214  data,
1215  context
1216  );
1217  }
1218 
1219  // ----------------------------------------------------------------------
1220  // Command response
1221  // ----------------------------------------------------------------------
1222 
1225  FwOpcodeType opCode,
1226  U32 cmdSeq,
1227  Fw::CmdResponse response
1228  )
1229  {
1230  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
1231  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
1232  }
1233 
1234  // ----------------------------------------------------------------------
1235  // Command handler base-class functions
1236  //
1237  // Call these functions directly to bypass the command input port
1238  // ----------------------------------------------------------------------
1239 
1242  FwOpcodeType opCode,
1243  U32 cmdSeq,
1244  Fw::CmdArgBuffer& args
1245  )
1246  {
1247  // Call pre-message hook
1248  this->FLUSH_QUEUE_preMsgHook(opCode,cmdSeq);
1249 
1250  // Defer deserializing arguments to the message dispatcher
1251  // to avoid deserializing and reserializing just for IPC
1252  ComponentIpcSerializableBuffer msg;
1254 
1255  // Serialize for IPC
1256  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_FLUSH_QUEUE));
1257  FW_ASSERT (
1258  _status == Fw::FW_SERIALIZE_OK,
1259  static_cast<FwAssertArgType>(_status)
1260  );
1261 
1262  // Fake port number to make message dequeue work
1263  FwIndexType port = 0;
1264 
1265  _status = msg.serializeFrom(port);
1266  FW_ASSERT (
1267  _status == Fw::FW_SERIALIZE_OK,
1268  static_cast<FwAssertArgType>(_status)
1269  );
1270 
1271  _status = msg.serializeFrom(opCode);
1272  FW_ASSERT (
1273  _status == Fw::FW_SERIALIZE_OK,
1274  static_cast<FwAssertArgType>(_status)
1275  );
1276 
1277  _status = msg.serializeFrom(cmdSeq);
1278  FW_ASSERT (
1279  _status == Fw::FW_SERIALIZE_OK,
1280  static_cast<FwAssertArgType>(_status)
1281  );
1282 
1283  _status = msg.serializeFrom(args);
1284  FW_ASSERT (
1285  _status == Fw::FW_SERIALIZE_OK,
1286  static_cast<FwAssertArgType>(_status)
1287  );
1288 
1289  // Send message
1291  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1292 
1293  FW_ASSERT(
1294  qStatus == Os::Queue::OP_OK,
1295  static_cast<FwAssertArgType>(qStatus)
1296  );
1297  }
1298 
1301  FwOpcodeType opCode,
1302  U32 cmdSeq,
1303  Fw::CmdArgBuffer& args
1304  )
1305  {
1306  // Call pre-message hook
1307  this->FLUSH_ALL_QUEUES_preMsgHook(opCode,cmdSeq);
1308 
1309  // Defer deserializing arguments to the message dispatcher
1310  // to avoid deserializing and reserializing just for IPC
1311  ComponentIpcSerializableBuffer msg;
1313 
1314  // Serialize for IPC
1315  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_FLUSH_ALL_QUEUES));
1316  FW_ASSERT (
1317  _status == Fw::FW_SERIALIZE_OK,
1318  static_cast<FwAssertArgType>(_status)
1319  );
1320 
1321  // Fake port number to make message dequeue work
1322  FwIndexType port = 0;
1323 
1324  _status = msg.serializeFrom(port);
1325  FW_ASSERT (
1326  _status == Fw::FW_SERIALIZE_OK,
1327  static_cast<FwAssertArgType>(_status)
1328  );
1329 
1330  _status = msg.serializeFrom(opCode);
1331  FW_ASSERT (
1332  _status == Fw::FW_SERIALIZE_OK,
1333  static_cast<FwAssertArgType>(_status)
1334  );
1335 
1336  _status = msg.serializeFrom(cmdSeq);
1337  FW_ASSERT (
1338  _status == Fw::FW_SERIALIZE_OK,
1339  static_cast<FwAssertArgType>(_status)
1340  );
1341 
1342  _status = msg.serializeFrom(args);
1343  FW_ASSERT (
1344  _status == Fw::FW_SERIALIZE_OK,
1345  static_cast<FwAssertArgType>(_status)
1346  );
1347 
1348  // Send message
1350  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1351 
1352  FW_ASSERT(
1353  qStatus == Os::Queue::OP_OK,
1354  static_cast<FwAssertArgType>(qStatus)
1355  );
1356  }
1357 
1360  FwOpcodeType opCode,
1361  U32 cmdSeq,
1362  Fw::CmdArgBuffer& args
1363  )
1364  {
1365  // Call pre-message hook
1366  this->SET_QUEUE_PRIORITY_preMsgHook(opCode,cmdSeq);
1367 
1368  // Defer deserializing arguments to the message dispatcher
1369  // to avoid deserializing and reserializing just for IPC
1370  ComponentIpcSerializableBuffer msg;
1372 
1373  // Serialize for IPC
1374  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SET_QUEUE_PRIORITY));
1375  FW_ASSERT (
1376  _status == Fw::FW_SERIALIZE_OK,
1377  static_cast<FwAssertArgType>(_status)
1378  );
1379 
1380  // Fake port number to make message dequeue work
1381  FwIndexType port = 0;
1382 
1383  _status = msg.serializeFrom(port);
1384  FW_ASSERT (
1385  _status == Fw::FW_SERIALIZE_OK,
1386  static_cast<FwAssertArgType>(_status)
1387  );
1388 
1389  _status = msg.serializeFrom(opCode);
1390  FW_ASSERT (
1391  _status == Fw::FW_SERIALIZE_OK,
1392  static_cast<FwAssertArgType>(_status)
1393  );
1394 
1395  _status = msg.serializeFrom(cmdSeq);
1396  FW_ASSERT (
1397  _status == Fw::FW_SERIALIZE_OK,
1398  static_cast<FwAssertArgType>(_status)
1399  );
1400 
1401  _status = msg.serializeFrom(args);
1402  FW_ASSERT (
1403  _status == Fw::FW_SERIALIZE_OK,
1404  static_cast<FwAssertArgType>(_status)
1405  );
1406 
1407  // Send message
1409  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1410 
1411  FW_ASSERT(
1412  qStatus == Os::Queue::OP_OK,
1413  static_cast<FwAssertArgType>(qStatus)
1414  );
1415  }
1416 
1417  // ----------------------------------------------------------------------
1418  // Pre-message hooks for async commands
1419  //
1420  // Each of these functions is invoked just before processing the
1421  // corresponding command. By default they do nothing. You can
1422  // override them to provide specific pre-command behavior.
1423  // ----------------------------------------------------------------------
1424 
1427  FwOpcodeType opCode,
1428  U32 cmdSeq
1429  )
1430  {
1431  // Defaults to no-op; can be overridden
1432  (void) opCode;
1433  (void) cmdSeq;
1434  }
1435 
1438  FwOpcodeType opCode,
1439  U32 cmdSeq
1440  )
1441  {
1442  // Defaults to no-op; can be overridden
1443  (void) opCode;
1444  (void) cmdSeq;
1445  }
1446 
1449  FwOpcodeType opCode,
1450  U32 cmdSeq
1451  )
1452  {
1453  // Defaults to no-op; can be overridden
1454  (void) opCode;
1455  (void) cmdSeq;
1456  }
1457 
1458  // ----------------------------------------------------------------------
1459  // Event logging functions
1460  // ----------------------------------------------------------------------
1461 
1464  Svc::QueueType queueType,
1465  FwIndexType index
1466  ) const
1467  {
1468  // Get the time
1469  Fw::Time _logTime;
1470  if (this->m_Time_OutputPort[0].isConnected()) {
1471  this->m_Time_OutputPort[0].invoke(_logTime);
1472  }
1473 
1474  FwEventIdType _id = static_cast<FwEventIdType>(0);
1475 
1476  _id = this->getIdBase() + EVENTID_QUEUEOVERFLOW;
1477 
1478  // Emit the event on the log port
1479  if (this->m_Log_OutputPort[0].isConnected()) {
1480  Fw::LogBuffer _logBuff;
1482 
1483 #if FW_AMPCS_COMPATIBLE
1484  // Serialize the number of arguments
1485  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1486  FW_ASSERT(
1487  _status == Fw::FW_SERIALIZE_OK,
1488  static_cast<FwAssertArgType>(_status)
1489  );
1490 #endif
1491 
1492 #if FW_AMPCS_COMPATIBLE
1493  // Serialize the argument size
1494  _status = _logBuff.serializeFrom(
1495  static_cast<U8>(Svc::QueueType::SERIALIZED_SIZE)
1496  );
1497  FW_ASSERT(
1498  _status == Fw::FW_SERIALIZE_OK,
1499  static_cast<FwAssertArgType>(_status)
1500  );
1501 #endif
1502  _status = _logBuff.serializeFrom(queueType);
1503  FW_ASSERT(
1504  _status == Fw::FW_SERIALIZE_OK,
1505  static_cast<FwAssertArgType>(_status)
1506  );
1507 
1508 #if FW_AMPCS_COMPATIBLE
1509  // Serialize the argument size
1510  _status = _logBuff.serializeFrom(
1511  static_cast<U8>(sizeof(FwIndexType))
1512  );
1513  FW_ASSERT(
1514  _status == Fw::FW_SERIALIZE_OK,
1515  static_cast<FwAssertArgType>(_status)
1516  );
1517 #endif
1518  _status = _logBuff.serializeFrom(index);
1519  FW_ASSERT(
1520  _status == Fw::FW_SERIALIZE_OK,
1521  static_cast<FwAssertArgType>(_status)
1522  );
1523 
1524  this->m_Log_OutputPort[0].invoke(
1525  _id,
1526  _logTime,
1528  _logBuff
1529  );
1530  }
1531 
1532  // Emit the event on the text log port
1533 #if FW_ENABLE_TEXT_LOGGING
1534  if (this->m_LogText_OutputPort[0].isConnected()) {
1535 #if FW_OBJECT_NAMES == 1
1536  const char* _formatString =
1537  "(%s) %s: The %s queue at index %" PRIi16 " overflowed";
1538 #else
1539  const char* _formatString =
1540  "%s: The %s queue at index %" PRIi16 " overflowed";
1541 #endif
1542 
1543  Fw::String queueTypeStr;
1544  queueType.toString(queueTypeStr);
1545 
1546  Fw::TextLogString _logString;
1547  _logString.format(
1548  _formatString,
1549 #if FW_OBJECT_NAMES == 1
1550  this->m_objName.toChar(),
1551 #endif
1552  "QueueOverflow ",
1553  queueTypeStr.toChar(),
1554  index
1555  );
1556 
1557  this->m_LogText_OutputPort[0].invoke(
1558  _id,
1559  _logTime,
1561  _logString
1562  );
1563  }
1564 #endif
1565  }
1566 
1569  Svc::QueueType queueType,
1570  FwIndexType indexType,
1571  FwIndexType newPriority
1572  ) const
1573  {
1574  // Get the time
1575  Fw::Time _logTime;
1576  if (this->m_Time_OutputPort[0].isConnected()) {
1577  this->m_Time_OutputPort[0].invoke(_logTime);
1578  }
1579 
1580  FwEventIdType _id = static_cast<FwEventIdType>(0);
1581 
1582  _id = this->getIdBase() + EVENTID_QUEUEPRIORITYCHANGED;
1583 
1584  // Emit the event on the log port
1585  if (this->m_Log_OutputPort[0].isConnected()) {
1586  Fw::LogBuffer _logBuff;
1588 
1589 #if FW_AMPCS_COMPATIBLE
1590  // Serialize the number of arguments
1591  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1592  FW_ASSERT(
1593  _status == Fw::FW_SERIALIZE_OK,
1594  static_cast<FwAssertArgType>(_status)
1595  );
1596 #endif
1597 
1598 #if FW_AMPCS_COMPATIBLE
1599  // Serialize the argument size
1600  _status = _logBuff.serializeFrom(
1601  static_cast<U8>(Svc::QueueType::SERIALIZED_SIZE)
1602  );
1603  FW_ASSERT(
1604  _status == Fw::FW_SERIALIZE_OK,
1605  static_cast<FwAssertArgType>(_status)
1606  );
1607 #endif
1608  _status = _logBuff.serializeFrom(queueType);
1609  FW_ASSERT(
1610  _status == Fw::FW_SERIALIZE_OK,
1611  static_cast<FwAssertArgType>(_status)
1612  );
1613 
1614 #if FW_AMPCS_COMPATIBLE
1615  // Serialize the argument size
1616  _status = _logBuff.serializeFrom(
1617  static_cast<U8>(sizeof(FwIndexType))
1618  );
1619  FW_ASSERT(
1620  _status == Fw::FW_SERIALIZE_OK,
1621  static_cast<FwAssertArgType>(_status)
1622  );
1623 #endif
1624  _status = _logBuff.serializeFrom(indexType);
1625  FW_ASSERT(
1626  _status == Fw::FW_SERIALIZE_OK,
1627  static_cast<FwAssertArgType>(_status)
1628  );
1629 
1630 #if FW_AMPCS_COMPATIBLE
1631  // Serialize the argument size
1632  _status = _logBuff.serializeFrom(
1633  static_cast<U8>(sizeof(FwIndexType))
1634  );
1635  FW_ASSERT(
1636  _status == Fw::FW_SERIALIZE_OK,
1637  static_cast<FwAssertArgType>(_status)
1638  );
1639 #endif
1640  _status = _logBuff.serializeFrom(newPriority);
1641  FW_ASSERT(
1642  _status == Fw::FW_SERIALIZE_OK,
1643  static_cast<FwAssertArgType>(_status)
1644  );
1645 
1646  this->m_Log_OutputPort[0].invoke(
1647  _id,
1648  _logTime,
1650  _logBuff
1651  );
1652  }
1653 
1654  // Emit the event on the text log port
1655 #if FW_ENABLE_TEXT_LOGGING
1656  if (this->m_LogText_OutputPort[0].isConnected()) {
1657 #if FW_OBJECT_NAMES == 1
1658  const char* _formatString =
1659  "(%s) %s: %s %" PRIi16 " priority changed to %" PRIi16 "";
1660 #else
1661  const char* _formatString =
1662  "%s: %s %" PRIi16 " priority changed to %" PRIi16 "";
1663 #endif
1664 
1665  Fw::String queueTypeStr;
1666  queueType.toString(queueTypeStr);
1667 
1668  Fw::TextLogString _logString;
1669  _logString.format(
1670  _formatString,
1671 #if FW_OBJECT_NAMES == 1
1672  this->m_objName.toChar(),
1673 #endif
1674  "QueuePriorityChanged ",
1675  queueTypeStr.toChar(),
1676  indexType,
1677  newPriority
1678  );
1679 
1680  this->m_LogText_OutputPort[0].invoke(
1681  _id,
1682  _logTime,
1684  _logString
1685  );
1686  }
1687 #endif
1688  }
1689 
1690  // ----------------------------------------------------------------------
1691  // Telemetry write functions
1692  // ----------------------------------------------------------------------
1693 
1696  const Svc::ComQueueDepth& arg,
1697  Fw::Time _tlmTime
1698  ) const
1699  {
1700  if (this->m_Tlm_OutputPort[0].isConnected()) {
1701  if (
1702  this->m_Time_OutputPort[0].isConnected() &&
1703  (_tlmTime == Fw::ZERO_TIME)
1704  ) {
1705  this->m_Time_OutputPort[0].invoke(_tlmTime);
1706  }
1707 
1708  Fw::TlmBuffer _tlmBuff;
1709  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1710  FW_ASSERT(
1711  _stat == Fw::FW_SERIALIZE_OK,
1712  static_cast<FwAssertArgType>(_stat)
1713  );
1714 
1715  FwChanIdType _id;
1716 
1717  _id = this->getIdBase() + CHANNELID_COMQUEUEDEPTH;
1718 
1719  this->m_Tlm_OutputPort[0].invoke(
1720  _id,
1721  _tlmTime,
1722  _tlmBuff
1723  );
1724  }
1725  }
1726 
1729  const Svc::BuffQueueDepth& arg,
1730  Fw::Time _tlmTime
1731  ) const
1732  {
1733  if (this->m_Tlm_OutputPort[0].isConnected()) {
1734  if (
1735  this->m_Time_OutputPort[0].isConnected() &&
1736  (_tlmTime == Fw::ZERO_TIME)
1737  ) {
1738  this->m_Time_OutputPort[0].invoke(_tlmTime);
1739  }
1740 
1741  Fw::TlmBuffer _tlmBuff;
1742  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1743  FW_ASSERT(
1744  _stat == Fw::FW_SERIALIZE_OK,
1745  static_cast<FwAssertArgType>(_stat)
1746  );
1747 
1748  FwChanIdType _id;
1749 
1750  _id = this->getIdBase() + CHANNELID_BUFFQUEUEDEPTH;
1751 
1752  this->m_Tlm_OutputPort[0].invoke(
1753  _id,
1754  _tlmTime,
1755  _tlmBuff
1756  );
1757  }
1758  }
1759 
1760  // ----------------------------------------------------------------------
1761  // Time
1762  // ----------------------------------------------------------------------
1763 
1765  getTime() const
1766  {
1767  if (this->m_Time_OutputPort[0].isConnected()) {
1768  Fw::Time _time;
1769  this->m_Time_OutputPort[0].invoke(_time);
1770  return _time;
1771  }
1772  else {
1773  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1774  }
1775  }
1776 
1777  // ----------------------------------------------------------------------
1778  // Message dispatch functions
1779  // ----------------------------------------------------------------------
1780 
1781  Fw::QueuedComponentBase::MsgDispatchStatus ComQueueComponentBase ::
1782  doDispatch()
1783  {
1784  ComponentIpcSerializableBuffer _msg;
1785  FwQueuePriorityType _priority = 0;
1786 
1787  Os::Queue::Status _msgStatus = this->m_queue.receive(
1788  _msg,
1790  _priority
1791  );
1792  FW_ASSERT(
1793  _msgStatus == Os::Queue::OP_OK,
1794  static_cast<FwAssertArgType>(_msgStatus)
1795  );
1796 
1797  // Reset to beginning of buffer
1798  _msg.resetDeser();
1799 
1800  FwEnumStoreType _desMsg = 0;
1801  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1802  FW_ASSERT(
1803  _deserStatus == Fw::FW_SERIALIZE_OK,
1804  static_cast<FwAssertArgType>(_deserStatus)
1805  );
1806 
1807  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1808 
1809  if (_msgType == COMQUEUE_COMPONENT_EXIT) {
1810  return MSG_DISPATCH_EXIT;
1811  }
1812 
1813  FwIndexType portNum = 0;
1814  _deserStatus = _msg.deserializeTo(portNum);
1815  FW_ASSERT(
1816  _deserStatus == Fw::FW_SERIALIZE_OK,
1817  static_cast<FwAssertArgType>(_deserStatus)
1818  );
1819 
1820  switch (_msgType) {
1821  // Handle async input port bufferQueueIn
1822  case BUFFERQUEUEIN_BUFFERSEND: {
1823  // Deserialize argument fwBuffer
1824  Fw::Buffer fwBuffer;
1825  _deserStatus = _msg.deserializeTo(fwBuffer);
1826  FW_ASSERT(
1827  _deserStatus == Fw::FW_SERIALIZE_OK,
1828  static_cast<FwAssertArgType>(_deserStatus)
1829  );
1830  // Call handler function
1831  this->bufferQueueIn_handler(
1832  portNum,
1833  fwBuffer
1834  );
1835 
1836  break;
1837  }
1838 
1839  // Handle async input port comPacketQueueIn
1840  case COMPACKETQUEUEIN_COM: {
1841  // Deserialize argument data
1842  Fw::ComBuffer data;
1843  _deserStatus = _msg.deserializeTo(data);
1844  FW_ASSERT(
1845  _deserStatus == Fw::FW_SERIALIZE_OK,
1846  static_cast<FwAssertArgType>(_deserStatus)
1847  );
1848 
1849  // Deserialize argument context
1850  U32 context;
1851  _deserStatus = _msg.deserializeTo(context);
1852  FW_ASSERT(
1853  _deserStatus == Fw::FW_SERIALIZE_OK,
1854  static_cast<FwAssertArgType>(_deserStatus)
1855  );
1856  // Call handler function
1858  portNum,
1859  data,
1860  context
1861  );
1862 
1863  break;
1864  }
1865 
1866  // Handle async input port comStatusIn
1867  case COMSTATUSIN_SUCCESSCONDITION: {
1868  // Deserialize argument condition
1869  Fw::Success condition;
1870  _deserStatus = _msg.deserializeTo(condition);
1871  FW_ASSERT(
1872  _deserStatus == Fw::FW_SERIALIZE_OK,
1873  static_cast<FwAssertArgType>(_deserStatus)
1874  );
1875  // Call handler function
1876  this->comStatusIn_handler(
1877  portNum,
1878  condition
1879  );
1880 
1881  break;
1882  }
1883 
1884  // Handle async input port run
1885  case RUN_SCHED: {
1886  // Deserialize argument context
1887  U32 context;
1888  _deserStatus = _msg.deserializeTo(context);
1889  FW_ASSERT(
1890  _deserStatus == Fw::FW_SERIALIZE_OK,
1891  static_cast<FwAssertArgType>(_deserStatus)
1892  );
1893  // Call handler function
1894  this->run_handler(
1895  portNum,
1896  context
1897  );
1898 
1899  break;
1900  }
1901 
1902  // Handle command FLUSH_QUEUE
1903  case CMD_FLUSH_QUEUE: {
1904  // Deserialize opcode
1905  FwOpcodeType _opCode = 0;
1906  _deserStatus = _msg.deserializeTo(_opCode);
1907  FW_ASSERT (
1908  _deserStatus == Fw::FW_SERIALIZE_OK,
1909  static_cast<FwAssertArgType>(_deserStatus)
1910  );
1911 
1912  // Deserialize command sequence
1913  U32 _cmdSeq = 0;
1914  _deserStatus = _msg.deserializeTo(_cmdSeq);
1915  FW_ASSERT (
1916  _deserStatus == Fw::FW_SERIALIZE_OK,
1917  static_cast<FwAssertArgType>(_deserStatus)
1918  );
1919 
1920  // Deserialize command argument buffer
1921  Fw::CmdArgBuffer args;
1922  _deserStatus = _msg.deserializeTo(args);
1923  FW_ASSERT (
1924  _deserStatus == Fw::FW_SERIALIZE_OK,
1925  static_cast<FwAssertArgType>(_deserStatus)
1926  );
1927 
1928  // Reset buffer
1929  args.resetDeser();
1930 
1931  // Deserialize argument queueType
1932  Svc::QueueType queueType;
1933  _deserStatus = args.deserializeTo(queueType);
1934  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1935  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1936  this->cmdResponse_out(
1937  _opCode,
1938  _cmdSeq,
1940  );
1941  }
1942  // Don't crash the task if bad arguments were passed from the ground
1943  break;
1944  }
1945 
1946  // Deserialize argument indexType
1947  FwIndexType indexType;
1948  _deserStatus = args.deserializeTo(indexType);
1949  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1950  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1951  this->cmdResponse_out(
1952  _opCode,
1953  _cmdSeq,
1955  );
1956  }
1957  // Don't crash the task if bad arguments were passed from the ground
1958  break;
1959  }
1960 
1961  // Make sure there was no data left over.
1962  // That means the argument buffer size was incorrect.
1963 #if FW_CMD_CHECK_RESIDUAL
1964  if (args.getDeserializeSizeLeft() != 0) {
1965  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1966  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1967  }
1968  // Don't crash the task if bad arguments were passed from the ground
1969  break;
1970  }
1971 #endif
1972 
1973  // Call handler function
1974  this->FLUSH_QUEUE_cmdHandler(
1975  _opCode, _cmdSeq,
1976  queueType,
1977  indexType
1978  );
1979 
1980  break;
1981  }
1982 
1983  // Handle command FLUSH_ALL_QUEUES
1984  case CMD_FLUSH_ALL_QUEUES: {
1985  // Deserialize opcode
1986  FwOpcodeType _opCode = 0;
1987  _deserStatus = _msg.deserializeTo(_opCode);
1988  FW_ASSERT (
1989  _deserStatus == Fw::FW_SERIALIZE_OK,
1990  static_cast<FwAssertArgType>(_deserStatus)
1991  );
1992 
1993  // Deserialize command sequence
1994  U32 _cmdSeq = 0;
1995  _deserStatus = _msg.deserializeTo(_cmdSeq);
1996  FW_ASSERT (
1997  _deserStatus == Fw::FW_SERIALIZE_OK,
1998  static_cast<FwAssertArgType>(_deserStatus)
1999  );
2000 
2001  // Deserialize command argument buffer
2002  Fw::CmdArgBuffer args;
2003  _deserStatus = _msg.deserializeTo(args);
2004  FW_ASSERT (
2005  _deserStatus == Fw::FW_SERIALIZE_OK,
2006  static_cast<FwAssertArgType>(_deserStatus)
2007  );
2008 
2009  // Reset buffer
2010  args.resetDeser();
2011 
2012  // Make sure there was no data left over.
2013  // That means the argument buffer size was incorrect.
2014 #if FW_CMD_CHECK_RESIDUAL
2015  if (args.getDeserializeSizeLeft() != 0) {
2016  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2017  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2018  }
2019  // Don't crash the task if bad arguments were passed from the ground
2020  break;
2021  }
2022 #endif
2023 
2024  // Call handler function
2025  this->FLUSH_ALL_QUEUES_cmdHandler(_opCode, _cmdSeq);
2026 
2027  break;
2028  }
2029 
2030  // Handle command SET_QUEUE_PRIORITY
2031  case CMD_SET_QUEUE_PRIORITY: {
2032  // Deserialize opcode
2033  FwOpcodeType _opCode = 0;
2034  _deserStatus = _msg.deserializeTo(_opCode);
2035  FW_ASSERT (
2036  _deserStatus == Fw::FW_SERIALIZE_OK,
2037  static_cast<FwAssertArgType>(_deserStatus)
2038  );
2039 
2040  // Deserialize command sequence
2041  U32 _cmdSeq = 0;
2042  _deserStatus = _msg.deserializeTo(_cmdSeq);
2043  FW_ASSERT (
2044  _deserStatus == Fw::FW_SERIALIZE_OK,
2045  static_cast<FwAssertArgType>(_deserStatus)
2046  );
2047 
2048  // Deserialize command argument buffer
2049  Fw::CmdArgBuffer args;
2050  _deserStatus = _msg.deserializeTo(args);
2051  FW_ASSERT (
2052  _deserStatus == Fw::FW_SERIALIZE_OK,
2053  static_cast<FwAssertArgType>(_deserStatus)
2054  );
2055 
2056  // Reset buffer
2057  args.resetDeser();
2058 
2059  // Deserialize argument queueType
2060  Svc::QueueType queueType;
2061  _deserStatus = args.deserializeTo(queueType);
2062  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2063  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2064  this->cmdResponse_out(
2065  _opCode,
2066  _cmdSeq,
2068  );
2069  }
2070  // Don't crash the task if bad arguments were passed from the ground
2071  break;
2072  }
2073 
2074  // Deserialize argument indexType
2075  FwIndexType indexType;
2076  _deserStatus = args.deserializeTo(indexType);
2077  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2078  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2079  this->cmdResponse_out(
2080  _opCode,
2081  _cmdSeq,
2083  );
2084  }
2085  // Don't crash the task if bad arguments were passed from the ground
2086  break;
2087  }
2088 
2089  // Deserialize argument newPriority
2090  FwIndexType newPriority;
2091  _deserStatus = args.deserializeTo(newPriority);
2092  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
2093  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2094  this->cmdResponse_out(
2095  _opCode,
2096  _cmdSeq,
2098  );
2099  }
2100  // Don't crash the task if bad arguments were passed from the ground
2101  break;
2102  }
2103 
2104  // Make sure there was no data left over.
2105  // That means the argument buffer size was incorrect.
2106 #if FW_CMD_CHECK_RESIDUAL
2107  if (args.getDeserializeSizeLeft() != 0) {
2108  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
2109  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
2110  }
2111  // Don't crash the task if bad arguments were passed from the ground
2112  break;
2113  }
2114 #endif
2115 
2116  // Call handler function
2118  _opCode, _cmdSeq,
2119  queueType,
2120  indexType,
2121  newPriority
2122  );
2123 
2124  break;
2125  }
2126 
2127  default:
2128  return MSG_DISPATCH_ERROR;
2129  }
2130 
2131  return MSG_DISPATCH_OK;
2132  }
2133 
2134  // ----------------------------------------------------------------------
2135  // Calls for messages received on special input ports
2136  // ----------------------------------------------------------------------
2137 
2138  void ComQueueComponentBase ::
2139  m_p_CmdDisp_in(
2140  Fw::PassiveComponentBase* callComp,
2141  FwIndexType portNum,
2142  FwOpcodeType opCode,
2143  U32 cmdSeq,
2144  Fw::CmdArgBuffer& args
2145  )
2146  {
2147  FW_ASSERT(callComp);
2148  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2149 
2150  const U32 idBase = callComp->getIdBase();
2151  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2152 
2153  // Select base class function based on opcode
2154  switch (opCode - idBase) {
2155  case OPCODE_FLUSH_QUEUE: {
2156  compPtr->FLUSH_QUEUE_cmdHandlerBase(
2157  opCode,
2158  cmdSeq,
2159  args
2160  );
2161  break;
2162  }
2163 
2164  case OPCODE_FLUSH_ALL_QUEUES: {
2165  compPtr->FLUSH_ALL_QUEUES_cmdHandlerBase(
2166  opCode,
2167  cmdSeq,
2168  args
2169  );
2170  break;
2171  }
2172 
2174  compPtr->SET_QUEUE_PRIORITY_cmdHandlerBase(
2175  opCode,
2176  cmdSeq,
2177  args
2178  );
2179  break;
2180  }
2181  }
2182  }
2183 
2184  // ----------------------------------------------------------------------
2185  // Calls for messages received on typed input ports
2186  // ----------------------------------------------------------------------
2187 
2188  void ComQueueComponentBase ::
2189  m_p_bufferQueueIn_in(
2190  Fw::PassiveComponentBase* callComp,
2191  FwIndexType portNum,
2192  Fw::Buffer& fwBuffer
2193  )
2194  {
2195  FW_ASSERT(callComp);
2196  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2197  compPtr->bufferQueueIn_handlerBase(
2198  portNum,
2199  fwBuffer
2200  );
2201  }
2202 
2203  void ComQueueComponentBase ::
2204  m_p_comPacketQueueIn_in(
2205  Fw::PassiveComponentBase* callComp,
2206  FwIndexType portNum,
2207  Fw::ComBuffer& data,
2208  U32 context
2209  )
2210  {
2211  FW_ASSERT(callComp);
2212  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2213  compPtr->comPacketQueueIn_handlerBase(
2214  portNum,
2215  data,
2216  context
2217  );
2218  }
2219 
2220  void ComQueueComponentBase ::
2221  m_p_comStatusIn_in(
2222  Fw::PassiveComponentBase* callComp,
2223  FwIndexType portNum,
2224  Fw::Success& condition
2225  )
2226  {
2227  FW_ASSERT(callComp);
2228  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2229  compPtr->comStatusIn_handlerBase(
2230  portNum,
2231  condition
2232  );
2233  }
2234 
2235  void ComQueueComponentBase ::
2236  m_p_dataReturnIn_in(
2237  Fw::PassiveComponentBase* callComp,
2238  FwIndexType portNum,
2239  Fw::Buffer& data,
2240  const ComCfg::FrameContext& context
2241  )
2242  {
2243  FW_ASSERT(callComp);
2244  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2245  compPtr->dataReturnIn_handlerBase(
2246  portNum,
2247  data,
2248  context
2249  );
2250  }
2251 
2252  void ComQueueComponentBase ::
2253  m_p_run_in(
2254  Fw::PassiveComponentBase* callComp,
2255  FwIndexType portNum,
2256  U32 context
2257  )
2258  {
2259  FW_ASSERT(callComp);
2260  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
2261  compPtr->run_handlerBase(
2262  portNum,
2263  context
2264  );
2265  }
2266 
2267 }
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:134
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual ~ComQueueComponentBase()
Destroy ComQueueComponentBase object.
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()
message to exit active component task
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].
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:56
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:56
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Invoke output port dataOut.
virtual void SET_QUEUE_PRIORITY_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::QueueType queueType, FwIndexType indexType, FwIndexType newPriority)=0
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()
void set_bufferReturnOut_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to bufferReturnOut[portNum].
const Time ZERO_TIME
Definition: Time.cpp:5
bool isConnected_bufferReturnOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
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.
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:150
An enumeration of queue data types.
bool isConnected_Log_OutputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
void init()
Initialization function.
Definition: ComPortAc.cpp:56
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:62
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 interface.
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:31
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:62
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
bool isConnected_Time_OutputPort(FwIndexType portNum)
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port interface.
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 interface.
Definition: TimePortAc.cpp:147
static constexpr FwIndexType getNum_bufferQueueIn_InputPorts()
Array of queue depths for Fw::Buffer types.
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
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 interface.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
FwSizeType SizeType
void invoke(Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke a port interface.
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].
The size of the serial representations of the port arguments.
Definition: ComPortAc.hpp:37
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 interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:38
virtual void bufferQueueIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port bufferQueueIn.
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:151
virtual void SET_QUEUE_PRIORITY_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_QUEUE_PRIORITY.
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)
Set the priority of a specific queue at runtime.
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.
The size of the serial representations of the port arguments.
Important informational events.
void init()
Initialization function.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
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:62
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 interface.
Definition: LogPortAc.cpp:170
A message was sent requesting an exit of the loop.
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
ComQueueComponentBase(const char *compName="")
Construct ComQueueComponentBase object.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
The size of the serial representation.
void init()
Initialization function.
Type used to pass context info between components during framing/deframing.
void incNumMsgDropped()
increment the number of messages dropped
The size of the serial representations of the port arguments.
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.
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].
virtual void bufferQueueIn_overflowHook(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Overflow hook for async input port bufferQueueIn.
void init()
Initialization function.
bool isConnected_dataOut_OutputPort(FwIndexType portNum)
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Success/Failure.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_run_InputPorts()
void init()
Initialization function.
void bufferQueueIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port bufferQueueIn.
void bufferReturnOut_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port bufferReturnOut.