F´ Flight Software - C/C++ Documentation  devel
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 <cstdio>
8 
10 #include "Fw/Types/Assert.hpp"
11 #if FW_ENABLE_TEXT_LOGGING
12 #include "Fw/Types/String.hpp"
13 #endif
14 
15 namespace Svc {
16 
17  namespace {
18  enum MsgTypeEnum {
19  COMQUEUE_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
20  BUFFQUEUEIN_BUFFERSEND,
21  COMQUEUEIN_COM,
22  COMSTATUSIN_SUCCESSCONDITION,
23  RUN_SCHED,
24  };
25 
26  // Get the max size by constructing a union of the async input, command, and
27  // internal port serialization sizes
28  union BuffUnion {
30  BYTE comQueueInPortSize[Fw::InputComPort::SERIALIZED_SIZE];
33  };
34 
35  // Define a message buffer class large enough to handle all the
36  // asynchronous inputs to the component
37  class ComponentIpcSerializableBuffer :
39  {
40 
41  public:
42 
43  enum {
44  // Max. message size = size of data + message id + port
45  SERIALIZATION_SIZE =
46  sizeof(BuffUnion) +
47  sizeof(NATIVE_INT_TYPE) +
48  sizeof(NATIVE_INT_TYPE)
49  };
50 
51  NATIVE_UINT_TYPE getBuffCapacity() const {
52  return sizeof(m_buff);
53  }
54 
55  U8* getBuffAddr() {
56  return m_buff;
57  }
58 
59  const U8* getBuffAddr() const {
60  return m_buff;
61  }
62 
63  private:
64  // Should be the max of all the input ports serialized sizes...
65  U8 m_buff[SERIALIZATION_SIZE];
66 
67  };
68  }
69 
70  // ----------------------------------------------------------------------
71  // Component initialization
72  // ----------------------------------------------------------------------
73 
75  init(
76  NATIVE_INT_TYPE queueDepth,
77  NATIVE_INT_TYPE instance
78  )
79  {
80  // Initialize base class
82 
83  // Connect input port buffQueueIn
84  for (
85  PlatformIntType port = 0;
86  port < static_cast<PlatformIntType>(this->getNum_buffQueueIn_InputPorts());
87  port++
88  ) {
89  this->m_buffQueueIn_InputPort[port].init();
90  this->m_buffQueueIn_InputPort[port].addCallComp(
91  this,
92  m_p_buffQueueIn_in
93  );
94  this->m_buffQueueIn_InputPort[port].setPortNum(port);
95 
96 #if FW_OBJECT_NAMES == 1
97  // The port name consists of this->m_objName and some extra info.
98  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
99  // However, the compiler may assume that this->m_objName fills
100  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
101  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
102  // bytes to cover the extra info.
103  char portName[2*FW_OBJ_NAME_MAX_SIZE];
104  (void) snprintf(
105  portName,
106  sizeof(portName),
107  "%s_buffQueueIn_InputPort[%" PRI_PlatformIntType "]",
108  this->m_objName,
109  port
110  );
111  this->m_buffQueueIn_InputPort[port].setObjName(portName);
112 #endif
113  }
114 
115  // Connect input port comQueueIn
116  for (
117  PlatformIntType port = 0;
118  port < static_cast<PlatformIntType>(this->getNum_comQueueIn_InputPorts());
119  port++
120  ) {
121  this->m_comQueueIn_InputPort[port].init();
122  this->m_comQueueIn_InputPort[port].addCallComp(
123  this,
124  m_p_comQueueIn_in
125  );
126  this->m_comQueueIn_InputPort[port].setPortNum(port);
127 
128 #if FW_OBJECT_NAMES == 1
129  // The port name consists of this->m_objName and some extra info.
130  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
131  // However, the compiler may assume that this->m_objName fills
132  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
133  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
134  // bytes to cover the extra info.
135  char portName[2*FW_OBJ_NAME_MAX_SIZE];
136  (void) snprintf(
137  portName,
138  sizeof(portName),
139  "%s_comQueueIn_InputPort[%" PRI_PlatformIntType "]",
140  this->m_objName,
141  port
142  );
143  this->m_comQueueIn_InputPort[port].setObjName(portName);
144 #endif
145  }
146 
147  // Connect input port comStatusIn
148  for (
149  PlatformIntType port = 0;
150  port < static_cast<PlatformIntType>(this->getNum_comStatusIn_InputPorts());
151  port++
152  ) {
153  this->m_comStatusIn_InputPort[port].init();
154  this->m_comStatusIn_InputPort[port].addCallComp(
155  this,
156  m_p_comStatusIn_in
157  );
158  this->m_comStatusIn_InputPort[port].setPortNum(port);
159 
160 #if FW_OBJECT_NAMES == 1
161  // The port name consists of this->m_objName and some extra info.
162  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
163  // However, the compiler may assume that this->m_objName fills
164  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
165  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
166  // bytes to cover the extra info.
167  char portName[2*FW_OBJ_NAME_MAX_SIZE];
168  (void) snprintf(
169  portName,
170  sizeof(portName),
171  "%s_comStatusIn_InputPort[%" PRI_PlatformIntType "]",
172  this->m_objName,
173  port
174  );
175  this->m_comStatusIn_InputPort[port].setObjName(portName);
176 #endif
177  }
178 
179  // Connect input port run
180  for (
181  PlatformIntType port = 0;
182  port < static_cast<PlatformIntType>(this->getNum_run_InputPorts());
183  port++
184  ) {
185  this->m_run_InputPort[port].init();
186  this->m_run_InputPort[port].addCallComp(
187  this,
188  m_p_run_in
189  );
190  this->m_run_InputPort[port].setPortNum(port);
191 
192 #if FW_OBJECT_NAMES == 1
193  // The port name consists of this->m_objName and some extra info.
194  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
195  // However, the compiler may assume that this->m_objName fills
196  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
197  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
198  // bytes to cover the extra info.
199  char portName[2*FW_OBJ_NAME_MAX_SIZE];
200  (void) snprintf(
201  portName,
202  sizeof(portName),
203  "%s_run_InputPort[%" PRI_PlatformIntType "]",
204  this->m_objName,
205  port
206  );
207  this->m_run_InputPort[port].setObjName(portName);
208 #endif
209  }
210 
211  // Connect output port Log
212  for (
213  PlatformIntType port = 0;
214  port < static_cast<PlatformIntType>(this->getNum_Log_OutputPorts());
215  port++
216  ) {
217  this->m_Log_OutputPort[port].init();
218 
219 #if FW_OBJECT_NAMES == 1
220  // The port name consists of this->m_objName and some extra info.
221  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
222  // However, the compiler may assume that this->m_objName fills
223  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
224  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
225  // bytes to cover the extra info.
226  char portName[2*FW_OBJ_NAME_MAX_SIZE];
227  (void) snprintf(
228  portName,
229  sizeof(portName),
230  "%s_Log_OutputPort[%" PRI_PlatformIntType "]",
231  this->m_objName,
232  port
233  );
234  this->m_Log_OutputPort[port].setObjName(portName);
235 #endif
236  }
237 
238 #if FW_ENABLE_TEXT_LOGGING == 1
239  // Connect output port LogText
240  for (
241  PlatformIntType port = 0;
242  port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
243  port++
244  ) {
245  this->m_LogText_OutputPort[port].init();
246 
247 #if FW_OBJECT_NAMES == 1
248  // The port name consists of this->m_objName and some extra info.
249  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
250  // However, the compiler may assume that this->m_objName fills
251  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
252  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
253  // bytes to cover the extra info.
254  char portName[2*FW_OBJ_NAME_MAX_SIZE];
255  (void) snprintf(
256  portName,
257  sizeof(portName),
258  "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
259  this->m_objName,
260  port
261  );
262  this->m_LogText_OutputPort[port].setObjName(portName);
263 #endif
264  }
265 #endif
266 
267  // Connect output port Time
268  for (
269  PlatformIntType port = 0;
270  port < static_cast<PlatformIntType>(this->getNum_Time_OutputPorts());
271  port++
272  ) {
273  this->m_Time_OutputPort[port].init();
274 
275 #if FW_OBJECT_NAMES == 1
276  // The port name consists of this->m_objName and some extra info.
277  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
278  // However, the compiler may assume that this->m_objName fills
279  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
280  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
281  // bytes to cover the extra info.
282  char portName[2*FW_OBJ_NAME_MAX_SIZE];
283  (void) snprintf(
284  portName,
285  sizeof(portName),
286  "%s_Time_OutputPort[%" PRI_PlatformIntType "]",
287  this->m_objName,
288  port
289  );
290  this->m_Time_OutputPort[port].setObjName(portName);
291 #endif
292  }
293 
294  // Connect output port Tlm
295  for (
296  PlatformIntType port = 0;
297  port < static_cast<PlatformIntType>(this->getNum_Tlm_OutputPorts());
298  port++
299  ) {
300  this->m_Tlm_OutputPort[port].init();
301 
302 #if FW_OBJECT_NAMES == 1
303  // The port name consists of this->m_objName and some extra info.
304  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
305  // However, the compiler may assume that this->m_objName fills
306  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
307  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
308  // bytes to cover the extra info.
309  char portName[2*FW_OBJ_NAME_MAX_SIZE];
310  (void) snprintf(
311  portName,
312  sizeof(portName),
313  "%s_Tlm_OutputPort[%" PRI_PlatformIntType "]",
314  this->m_objName,
315  port
316  );
317  this->m_Tlm_OutputPort[port].setObjName(portName);
318 #endif
319  }
320 
321  // Connect output port buffQueueSend
322  for (
323  PlatformIntType port = 0;
324  port < static_cast<PlatformIntType>(this->getNum_buffQueueSend_OutputPorts());
325  port++
326  ) {
327  this->m_buffQueueSend_OutputPort[port].init();
328 
329 #if FW_OBJECT_NAMES == 1
330  // The port name consists of this->m_objName and some extra info.
331  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
332  // However, the compiler may assume that this->m_objName fills
333  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
334  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
335  // bytes to cover the extra info.
336  char portName[2*FW_OBJ_NAME_MAX_SIZE];
337  (void) snprintf(
338  portName,
339  sizeof(portName),
340  "%s_buffQueueSend_OutputPort[%" PRI_PlatformIntType "]",
341  this->m_objName,
342  port
343  );
344  this->m_buffQueueSend_OutputPort[port].setObjName(portName);
345 #endif
346  }
347 
348  // Connect output port comQueueSend
349  for (
350  PlatformIntType port = 0;
351  port < static_cast<PlatformIntType>(this->getNum_comQueueSend_OutputPorts());
352  port++
353  ) {
354  this->m_comQueueSend_OutputPort[port].init();
355 
356 #if FW_OBJECT_NAMES == 1
357  // The port name consists of this->m_objName and some extra info.
358  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
359  // However, the compiler may assume that this->m_objName fills
360  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
361  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
362  // bytes to cover the extra info.
363  char portName[2*FW_OBJ_NAME_MAX_SIZE];
364  (void) snprintf(
365  portName,
366  sizeof(portName),
367  "%s_comQueueSend_OutputPort[%" PRI_PlatformIntType "]",
368  this->m_objName,
369  port
370  );
371  this->m_comQueueSend_OutputPort[port].setObjName(portName);
372 #endif
373  }
374 
375  Os::Queue::QueueStatus qStat = this->createQueue(
376  queueDepth,
377  ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
378  );
379  FW_ASSERT(
380  Os::Queue::QUEUE_OK == qStat,
381  static_cast<FwAssertArgType>(qStat)
382  );
383  }
384 
385  // ----------------------------------------------------------------------
386  // Getters for typed input ports
387  // ----------------------------------------------------------------------
388 
391  {
392  FW_ASSERT(
393  portNum < this->getNum_buffQueueIn_InputPorts(),
394  static_cast<FwAssertArgType>(portNum)
395  );
396 
397  return &this->m_buffQueueIn_InputPort[portNum];
398  }
399 
402  {
403  FW_ASSERT(
404  portNum < this->getNum_comQueueIn_InputPorts(),
405  static_cast<FwAssertArgType>(portNum)
406  );
407 
408  return &this->m_comQueueIn_InputPort[portNum];
409  }
410 
413  {
414  FW_ASSERT(
415  portNum < this->getNum_comStatusIn_InputPorts(),
416  static_cast<FwAssertArgType>(portNum)
417  );
418 
419  return &this->m_comStatusIn_InputPort[portNum];
420  }
421 
424  {
425  FW_ASSERT(
426  portNum < this->getNum_run_InputPorts(),
427  static_cast<FwAssertArgType>(portNum)
428  );
429 
430  return &this->m_run_InputPort[portNum];
431  }
432 
433  // ----------------------------------------------------------------------
434  // Connect input ports to special output ports
435  // ----------------------------------------------------------------------
436 
439  NATIVE_INT_TYPE portNum,
440  Fw::InputLogPort* port
441  )
442  {
443  FW_ASSERT(
444  portNum < this->getNum_Log_OutputPorts(),
445  static_cast<FwAssertArgType>(portNum)
446  );
447 
448  this->m_Log_OutputPort[portNum].addCallPort(port);
449  }
450 
451 #if FW_ENABLE_TEXT_LOGGING == 1
452 
453  void ComQueueComponentBase ::
454  set_LogText_OutputPort(
455  NATIVE_INT_TYPE portNum,
457  )
458  {
459  FW_ASSERT(
460  portNum < this->getNum_LogText_OutputPorts(),
461  static_cast<FwAssertArgType>(portNum)
462  );
463 
464  this->m_LogText_OutputPort[portNum].addCallPort(port);
465  }
466 
467 #endif
468 
471  NATIVE_INT_TYPE portNum,
472  Fw::InputTimePort* port
473  )
474  {
475  FW_ASSERT(
476  portNum < this->getNum_Time_OutputPorts(),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_Time_OutputPort[portNum].addCallPort(port);
481  }
482 
485  NATIVE_INT_TYPE portNum,
486  Fw::InputTlmPort* port
487  )
488  {
489  FW_ASSERT(
490  portNum < this->getNum_Tlm_OutputPorts(),
491  static_cast<FwAssertArgType>(portNum)
492  );
493 
494  this->m_Tlm_OutputPort[portNum].addCallPort(port);
495  }
496 
497  // ----------------------------------------------------------------------
498  // Connect typed input ports to typed output ports
499  // ----------------------------------------------------------------------
500 
503  NATIVE_INT_TYPE portNum,
505  )
506  {
507  FW_ASSERT(
508  portNum < this->getNum_buffQueueSend_OutputPorts(),
509  static_cast<FwAssertArgType>(portNum)
510  );
511 
512  this->m_buffQueueSend_OutputPort[portNum].addCallPort(port);
513  }
514 
517  NATIVE_INT_TYPE portNum,
518  Fw::InputComPort* port
519  )
520  {
521  FW_ASSERT(
522  portNum < this->getNum_comQueueSend_OutputPorts(),
523  static_cast<FwAssertArgType>(portNum)
524  );
525 
526  this->m_comQueueSend_OutputPort[portNum].addCallPort(port);
527  }
528 
529 #if FW_PORT_SERIALIZATION
530 
531  // ----------------------------------------------------------------------
532  // Connect serial input ports to special output ports
533  // ----------------------------------------------------------------------
534 
537  NATIVE_INT_TYPE portNum,
538  Fw::InputSerializePort* port
539  )
540  {
541  FW_ASSERT(
542  portNum < this->getNum_Log_OutputPorts(),
543  static_cast<FwAssertArgType>(portNum)
544  );
545 
546  this->m_Log_OutputPort[portNum].registerSerialPort(port);
547  }
548 
549 #if FW_ENABLE_TEXT_LOGGING == 1
550 
551  void ComQueueComponentBase ::
552  set_LogText_OutputPort(
553  NATIVE_INT_TYPE portNum,
554  Fw::InputSerializePort* port
555  )
556  {
557  FW_ASSERT(
558  portNum < this->getNum_LogText_OutputPorts(),
559  static_cast<FwAssertArgType>(portNum)
560  );
561 
562  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
563  }
564 
565 #endif
566 
569  NATIVE_INT_TYPE portNum,
570  Fw::InputSerializePort* port
571  )
572  {
573  FW_ASSERT(
574  portNum < this->getNum_Time_OutputPorts(),
575  static_cast<FwAssertArgType>(portNum)
576  );
577 
578  this->m_Time_OutputPort[portNum].registerSerialPort(port);
579  }
580 
583  NATIVE_INT_TYPE portNum,
584  Fw::InputSerializePort* port
585  )
586  {
587  FW_ASSERT(
588  portNum < this->getNum_Tlm_OutputPorts(),
589  static_cast<FwAssertArgType>(portNum)
590  );
591 
592  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
593  }
594 
595 #endif
596 
597 #if FW_PORT_SERIALIZATION
598 
599  // ----------------------------------------------------------------------
600  // Connect serial input ports to typed output ports
601  // ----------------------------------------------------------------------
602 
605  NATIVE_INT_TYPE portNum,
606  Fw::InputSerializePort* port
607  )
608  {
609  FW_ASSERT(
610  portNum < this->getNum_buffQueueSend_OutputPorts(),
611  static_cast<FwAssertArgType>(portNum)
612  );
613 
614  this->m_buffQueueSend_OutputPort[portNum].registerSerialPort(port);
615  }
616 
619  NATIVE_INT_TYPE portNum,
620  Fw::InputSerializePort* port
621  )
622  {
623  FW_ASSERT(
624  portNum < this->getNum_comQueueSend_OutputPorts(),
625  static_cast<FwAssertArgType>(portNum)
626  );
627 
628  this->m_comQueueSend_OutputPort[portNum].registerSerialPort(port);
629  }
630 
631 #endif
632 
633  // ----------------------------------------------------------------------
634  // Component construction and destruction
635  // ----------------------------------------------------------------------
636 
638  ComQueueComponentBase(const char* compName) :
639  Fw::ActiveComponentBase(compName)
640  {
641 
642  }
643 
646  {
647 
648  }
649 
650  // ----------------------------------------------------------------------
651  // Getters for numbers of typed input ports
652  // ----------------------------------------------------------------------
653 
656  {
657  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_buffQueueIn_InputPort));
658  }
659 
662  {
663  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_comQueueIn_InputPort));
664  }
665 
668  {
669  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_comStatusIn_InputPort));
670  }
671 
674  {
675  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_run_InputPort));
676  }
677 
678  // ----------------------------------------------------------------------
679  // Getters for numbers of special output ports
680  // ----------------------------------------------------------------------
681 
684  {
685  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
686  }
687 
688 #if FW_ENABLE_TEXT_LOGGING == 1
689 
690  NATIVE_INT_TYPE ComQueueComponentBase ::
691  getNum_LogText_OutputPorts() const
692  {
693  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
694  }
695 
696 #endif
697 
700  {
701  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
702  }
703 
706  {
707  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Tlm_OutputPort));
708  }
709 
710  // ----------------------------------------------------------------------
711  // Getters for numbers of typed output ports
712  // ----------------------------------------------------------------------
713 
716  {
717  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_buffQueueSend_OutputPort));
718  }
719 
722  {
723  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_comQueueSend_OutputPort));
724  }
725 
726  // ----------------------------------------------------------------------
727  // Connection status queries for special output ports
728  // ----------------------------------------------------------------------
729 
732  {
733  FW_ASSERT(
734  portNum < this->getNum_Log_OutputPorts(),
735  static_cast<FwAssertArgType>(portNum)
736  );
737 
738  return this->m_Log_OutputPort[portNum].isConnected();
739  }
740 
741 #if FW_ENABLE_TEXT_LOGGING == 1
742 
743  bool ComQueueComponentBase ::
744  isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
745  {
746  FW_ASSERT(
747  portNum < this->getNum_LogText_OutputPorts(),
748  static_cast<FwAssertArgType>(portNum)
749  );
750 
751  return this->m_LogText_OutputPort[portNum].isConnected();
752  }
753 
754 #endif
755 
758  {
759  FW_ASSERT(
760  portNum < this->getNum_Time_OutputPorts(),
761  static_cast<FwAssertArgType>(portNum)
762  );
763 
764  return this->m_Time_OutputPort[portNum].isConnected();
765  }
766 
769  {
770  FW_ASSERT(
771  portNum < this->getNum_Tlm_OutputPorts(),
772  static_cast<FwAssertArgType>(portNum)
773  );
774 
775  return this->m_Tlm_OutputPort[portNum].isConnected();
776  }
777 
778  // ----------------------------------------------------------------------
779  // Connection status queries for typed output ports
780  // ----------------------------------------------------------------------
781 
784  {
785  FW_ASSERT(
786  portNum < this->getNum_buffQueueSend_OutputPorts(),
787  static_cast<FwAssertArgType>(portNum)
788  );
789 
790  return this->m_buffQueueSend_OutputPort[portNum].isConnected();
791  }
792 
795  {
796  FW_ASSERT(
797  portNum < this->getNum_comQueueSend_OutputPorts(),
798  static_cast<FwAssertArgType>(portNum)
799  );
800 
801  return this->m_comQueueSend_OutputPort[portNum].isConnected();
802  }
803 
804  // ----------------------------------------------------------------------
805  // Port handler base-class functions for typed input ports
806  //
807  // Call these functions directly to bypass the corresponding ports
808  // ----------------------------------------------------------------------
809 
812  NATIVE_INT_TYPE portNum,
813  Fw::Buffer& fwBuffer
814  )
815  {
816  // Make sure port number is valid
817  FW_ASSERT(
818  portNum < this->getNum_buffQueueIn_InputPorts(),
819  static_cast<FwAssertArgType>(portNum)
820  );
821 
822  // Call pre-message hook
824  portNum,
825  fwBuffer
826  );
827  ComponentIpcSerializableBuffer msg;
829 
830  // Serialize message ID
831  _status = msg.serialize(
832  static_cast<NATIVE_INT_TYPE>(BUFFQUEUEIN_BUFFERSEND)
833  );
834  FW_ASSERT(
835  _status == Fw::FW_SERIALIZE_OK,
836  static_cast<FwAssertArgType>(_status)
837  );
838 
839  // Serialize port number
840  _status = msg.serialize(portNum);
841  FW_ASSERT(
842  _status == Fw::FW_SERIALIZE_OK,
843  static_cast<FwAssertArgType>(_status)
844  );
845 
846  // Serialize argument fwBuffer
847  _status = msg.serialize(fwBuffer);
848  FW_ASSERT(
849  _status == Fw::FW_SERIALIZE_OK,
850  static_cast<FwAssertArgType>(_status)
851  );
852 
853  // Send message
855  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
856 
857  if (qStatus == Os::Queue::QUEUE_FULL) {
858  this->incNumMsgDropped();
859  return;
860  }
861 
862  FW_ASSERT(
863  qStatus == Os::Queue::QUEUE_OK,
864  static_cast<FwAssertArgType>(qStatus)
865  );
866  }
867 
870  NATIVE_INT_TYPE portNum,
871  Fw::ComBuffer& data,
872  U32 context
873  )
874  {
875  // Make sure port number is valid
876  FW_ASSERT(
877  portNum < this->getNum_comQueueIn_InputPorts(),
878  static_cast<FwAssertArgType>(portNum)
879  );
880 
881  // Call pre-message hook
883  portNum,
884  data,
885  context
886  );
887  ComponentIpcSerializableBuffer msg;
889 
890  // Serialize message ID
891  _status = msg.serialize(
892  static_cast<NATIVE_INT_TYPE>(COMQUEUEIN_COM)
893  );
894  FW_ASSERT(
895  _status == Fw::FW_SERIALIZE_OK,
896  static_cast<FwAssertArgType>(_status)
897  );
898 
899  // Serialize port number
900  _status = msg.serialize(portNum);
901  FW_ASSERT(
902  _status == Fw::FW_SERIALIZE_OK,
903  static_cast<FwAssertArgType>(_status)
904  );
905 
906  // Serialize argument data
907  _status = msg.serialize(data);
908  FW_ASSERT(
909  _status == Fw::FW_SERIALIZE_OK,
910  static_cast<FwAssertArgType>(_status)
911  );
912 
913  // Serialize argument context
914  _status = msg.serialize(context);
915  FW_ASSERT(
916  _status == Fw::FW_SERIALIZE_OK,
917  static_cast<FwAssertArgType>(_status)
918  );
919 
920  // Send message
922  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
923 
924  if (qStatus == Os::Queue::QUEUE_FULL) {
925  this->incNumMsgDropped();
926  return;
927  }
928 
929  FW_ASSERT(
930  qStatus == Os::Queue::QUEUE_OK,
931  static_cast<FwAssertArgType>(qStatus)
932  );
933  }
934 
937  NATIVE_INT_TYPE portNum,
938  Fw::Success& condition
939  )
940  {
941  // Make sure port number is valid
942  FW_ASSERT(
943  portNum < this->getNum_comStatusIn_InputPorts(),
944  static_cast<FwAssertArgType>(portNum)
945  );
946 
947  // Call pre-message hook
949  portNum,
950  condition
951  );
952  ComponentIpcSerializableBuffer msg;
954 
955  // Serialize message ID
956  _status = msg.serialize(
957  static_cast<NATIVE_INT_TYPE>(COMSTATUSIN_SUCCESSCONDITION)
958  );
959  FW_ASSERT(
960  _status == Fw::FW_SERIALIZE_OK,
961  static_cast<FwAssertArgType>(_status)
962  );
963 
964  // Serialize port number
965  _status = msg.serialize(portNum);
966  FW_ASSERT(
967  _status == Fw::FW_SERIALIZE_OK,
968  static_cast<FwAssertArgType>(_status)
969  );
970 
971  // Serialize argument condition
972  _status = msg.serialize(condition);
973  FW_ASSERT(
974  _status == Fw::FW_SERIALIZE_OK,
975  static_cast<FwAssertArgType>(_status)
976  );
977 
978  // Send message
980  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
981 
982  FW_ASSERT(
983  qStatus == Os::Queue::QUEUE_OK,
984  static_cast<FwAssertArgType>(qStatus)
985  );
986  }
987 
990  NATIVE_INT_TYPE portNum,
991  NATIVE_UINT_TYPE context
992  )
993  {
994  // Make sure port number is valid
995  FW_ASSERT(
996  portNum < this->getNum_run_InputPorts(),
997  static_cast<FwAssertArgType>(portNum)
998  );
999 
1000  // Call pre-message hook
1002  portNum,
1003  context
1004  );
1005  ComponentIpcSerializableBuffer msg;
1007 
1008  // Serialize message ID
1009  _status = msg.serialize(
1010  static_cast<NATIVE_INT_TYPE>(RUN_SCHED)
1011  );
1012  FW_ASSERT(
1013  _status == Fw::FW_SERIALIZE_OK,
1014  static_cast<FwAssertArgType>(_status)
1015  );
1016 
1017  // Serialize port number
1018  _status = msg.serialize(portNum);
1019  FW_ASSERT(
1020  _status == Fw::FW_SERIALIZE_OK,
1021  static_cast<FwAssertArgType>(_status)
1022  );
1023 
1024  // Serialize argument context
1025  _status = msg.serialize(context);
1026  FW_ASSERT(
1027  _status == Fw::FW_SERIALIZE_OK,
1028  static_cast<FwAssertArgType>(_status)
1029  );
1030 
1031  // Send message
1033  Os::Queue::QueueStatus qStatus = this->m_queue.send(msg, 0, _block);
1034 
1035  if (qStatus == Os::Queue::QUEUE_FULL) {
1036  this->incNumMsgDropped();
1037  return;
1038  }
1039 
1040  FW_ASSERT(
1041  qStatus == Os::Queue::QUEUE_OK,
1042  static_cast<FwAssertArgType>(qStatus)
1043  );
1044  }
1045 
1046  // ----------------------------------------------------------------------
1047  // Pre-message hooks for typed async input ports
1048  //
1049  // Each of these functions is invoked just before processing a message
1050  // on the corresponding port. By default, they do nothing. You can
1051  // override them to provide specific pre-message behavior.
1052  // ----------------------------------------------------------------------
1053 
1056  NATIVE_INT_TYPE portNum,
1057  Fw::Buffer& fwBuffer
1058  )
1059  {
1060  // Default: no-op
1061  }
1062 
1065  NATIVE_INT_TYPE portNum,
1066  Fw::ComBuffer& data,
1067  U32 context
1068  )
1069  {
1070  // Default: no-op
1071  }
1072 
1075  NATIVE_INT_TYPE portNum,
1076  Fw::Success& condition
1077  )
1078  {
1079  // Default: no-op
1080  }
1081 
1084  NATIVE_INT_TYPE portNum,
1085  NATIVE_UINT_TYPE context
1086  )
1087  {
1088  // Default: no-op
1089  }
1090 
1091  // ----------------------------------------------------------------------
1092  // Invocation functions for typed output ports
1093  // ----------------------------------------------------------------------
1094 
1097  NATIVE_INT_TYPE portNum,
1098  Fw::Buffer& fwBuffer
1099  )
1100  {
1101  FW_ASSERT(
1102  portNum < this->getNum_buffQueueSend_OutputPorts(),
1103  static_cast<FwAssertArgType>(portNum)
1104  );
1105  this->m_buffQueueSend_OutputPort[portNum].invoke(
1106  fwBuffer
1107  );
1108  }
1109 
1112  NATIVE_INT_TYPE portNum,
1113  Fw::ComBuffer& data,
1114  U32 context
1115  )
1116  {
1117  FW_ASSERT(
1118  portNum < this->getNum_comQueueSend_OutputPorts(),
1119  static_cast<FwAssertArgType>(portNum)
1120  );
1121  this->m_comQueueSend_OutputPort[portNum].invoke(
1122  data,
1123  context
1124  );
1125  }
1126 
1127  // ----------------------------------------------------------------------
1128  // Event logging functions
1129  // ----------------------------------------------------------------------
1130 
1133  Svc::QueueType queueType,
1134  U32 index
1135  )
1136  {
1137  // Get the time
1138  Fw::Time _logTime;
1139  if (this->m_Time_OutputPort[0].isConnected()) {
1140  this->m_Time_OutputPort[0].invoke(_logTime);
1141  }
1142 
1143  FwEventIdType _id = static_cast<FwEventIdType>(0);
1144 
1145  _id = this->getIdBase() + EVENTID_QUEUEOVERFLOW;
1146 
1147  // Emit the event on the log port
1148  if (this->m_Log_OutputPort[0].isConnected()) {
1149  Fw::LogBuffer _logBuff;
1151 
1152 #if FW_AMPCS_COMPATIBLE
1153  // Serialize the number of arguments
1154  _status = _logBuff.serialize(static_cast<U8>(2));
1155  FW_ASSERT(
1156  _status == Fw::FW_SERIALIZE_OK,
1157  static_cast<FwAssertArgType>(_status)
1158  );
1159 #endif
1160 
1161 #if FW_AMPCS_COMPATIBLE
1162  // Serialize the argument size
1163  _status = _logBuff.serialize(
1164  static_cast<U8>(Svc::QueueType::SERIALIZED_SIZE)
1165  );
1166  FW_ASSERT(
1167  _status == Fw::FW_SERIALIZE_OK,
1168  static_cast<FwAssertArgType>(_status)
1169  );
1170 #endif
1171  _status = _logBuff.serialize(queueType);
1172  FW_ASSERT(
1173  _status == Fw::FW_SERIALIZE_OK,
1174  static_cast<FwAssertArgType>(_status)
1175  );
1176 
1177 #if FW_AMPCS_COMPATIBLE
1178  // Serialize the argument size
1179  _status = _logBuff.serialize(
1180  static_cast<U8>(sizeof(U32))
1181  );
1182  FW_ASSERT(
1183  _status == Fw::FW_SERIALIZE_OK,
1184  static_cast<FwAssertArgType>(_status)
1185  );
1186 #endif
1187  _status = _logBuff.serialize(index);
1188  FW_ASSERT(
1189  _status == Fw::FW_SERIALIZE_OK,
1190  static_cast<FwAssertArgType>(_status)
1191  );
1192 
1193  this->m_Log_OutputPort[0].invoke(
1194  _id,
1195  _logTime,
1197  _logBuff
1198  );
1199  }
1200 
1201  // Emit the event on the text log port
1202 #if FW_ENABLE_TEXT_LOGGING
1203  if (this->m_LogText_OutputPort[0].isConnected()) {
1204 #if FW_OBJECT_NAMES == 1
1205  const char* _formatString =
1206  "(%s) %s: The %s queue at index %" PRIu32 " overflowed";
1207 #else
1208  const char* _formatString =
1209  "%s: The %s queue at index %" PRIu32 " overflowed";
1210 #endif
1211 
1212  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1213 
1214  Fw::String queueTypeStr;
1215  queueType.toString(queueTypeStr);
1216 
1217  (void) snprintf(
1218  _textBuffer,
1220  _formatString,
1221 #if FW_OBJECT_NAMES == 1
1222  this->m_objName,
1223 #endif
1224  "QueueOverflow ",
1225  queueTypeStr.toChar(),
1226  index
1227  );
1228 
1229  // Null terminate
1230  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1231  Fw::TextLogString _logString = _textBuffer;
1232  this->m_LogText_OutputPort[0].invoke(
1233  _id,
1234  _logTime,
1236  _logString
1237  );
1238  }
1239 #endif
1240  }
1241 
1242  // ----------------------------------------------------------------------
1243  // Telemetry write functions
1244  // ----------------------------------------------------------------------
1245 
1248  const Svc::ComQueueDepth& arg,
1249  Fw::Time _tlmTime
1250  )
1251  {
1252  if (this->m_Tlm_OutputPort[0].isConnected()) {
1253  if (
1254  this->m_Time_OutputPort[0].isConnected() &&
1255  (_tlmTime == Fw::ZERO_TIME)
1256  ) {
1257  this->m_Time_OutputPort[0].invoke(_tlmTime);
1258  }
1259 
1260  Fw::TlmBuffer _tlmBuff;
1261  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1262  FW_ASSERT(
1263  _stat == Fw::FW_SERIALIZE_OK,
1264  static_cast<FwAssertArgType>(_stat)
1265  );
1266 
1267  FwChanIdType _id;
1268 
1269  _id = this->getIdBase() + CHANNELID_COMQUEUEDEPTH;
1270 
1271  this->m_Tlm_OutputPort[0].invoke(
1272  _id,
1273  _tlmTime,
1274  _tlmBuff
1275  );
1276  }
1277  }
1278 
1281  const Svc::BuffQueueDepth& arg,
1282  Fw::Time _tlmTime
1283  )
1284  {
1285  if (this->m_Tlm_OutputPort[0].isConnected()) {
1286  if (
1287  this->m_Time_OutputPort[0].isConnected() &&
1288  (_tlmTime == Fw::ZERO_TIME)
1289  ) {
1290  this->m_Time_OutputPort[0].invoke(_tlmTime);
1291  }
1292 
1293  Fw::TlmBuffer _tlmBuff;
1294  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1295  FW_ASSERT(
1296  _stat == Fw::FW_SERIALIZE_OK,
1297  static_cast<FwAssertArgType>(_stat)
1298  );
1299 
1300  FwChanIdType _id;
1301 
1302  _id = this->getIdBase() + CHANNELID_BUFFQUEUEDEPTH;
1303 
1304  this->m_Tlm_OutputPort[0].invoke(
1305  _id,
1306  _tlmTime,
1307  _tlmBuff
1308  );
1309  }
1310  }
1311 
1312  // ----------------------------------------------------------------------
1313  // Time
1314  // ----------------------------------------------------------------------
1315 
1317  getTime()
1318  {
1319  if (this->m_Time_OutputPort[0].isConnected()) {
1320  Fw::Time _time;
1321  this->m_Time_OutputPort[0].invoke(_time);
1322  return _time;
1323  }
1324  else {
1325  return Fw::Time(TB_NONE, 0, 0);
1326  }
1327  }
1328 
1329  // ----------------------------------------------------------------------
1330  // Message dispatch functions
1331  // ----------------------------------------------------------------------
1332 
1333  Fw::QueuedComponentBase::MsgDispatchStatus ComQueueComponentBase ::
1334  doDispatch()
1335  {
1336  ComponentIpcSerializableBuffer msg;
1337  NATIVE_INT_TYPE priority = 0;
1338 
1339  Os::Queue::QueueStatus msgStatus = this->m_queue.receive(
1340  msg,
1341  priority,
1343  );
1344  FW_ASSERT(
1345  msgStatus == Os::Queue::QUEUE_OK,
1346  static_cast<FwAssertArgType>(msgStatus)
1347  );
1348 
1349  // Reset to beginning of buffer
1350  msg.resetDeser();
1351 
1352  NATIVE_INT_TYPE desMsg = 0;
1353  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1354  FW_ASSERT(
1355  deserStatus == Fw::FW_SERIALIZE_OK,
1356  static_cast<FwAssertArgType>(deserStatus)
1357  );
1358 
1359  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1360 
1361  if (msgType == COMQUEUE_COMPONENT_EXIT) {
1362  return MSG_DISPATCH_EXIT;
1363  }
1364 
1365  NATIVE_INT_TYPE portNum = 0;
1366  deserStatus = msg.deserialize(portNum);
1367  FW_ASSERT(
1368  deserStatus == Fw::FW_SERIALIZE_OK,
1369  static_cast<FwAssertArgType>(deserStatus)
1370  );
1371 
1372  switch (msgType) {
1373  // Handle async input port buffQueueIn
1374  case BUFFQUEUEIN_BUFFERSEND: {
1375  // Deserialize argument fwBuffer
1376  Fw::Buffer fwBuffer;
1377  deserStatus = msg.deserialize(fwBuffer);
1378  FW_ASSERT(
1379  deserStatus == Fw::FW_SERIALIZE_OK,
1380  static_cast<FwAssertArgType>(deserStatus)
1381  );
1382  // Call handler function
1383  this->buffQueueIn_handler(
1384  portNum,
1385  fwBuffer
1386  );
1387 
1388  break;
1389  }
1390 
1391  // Handle async input port comQueueIn
1392  case COMQUEUEIN_COM: {
1393  // Deserialize argument data
1394  Fw::ComBuffer data;
1395  deserStatus = msg.deserialize(data);
1396  FW_ASSERT(
1397  deserStatus == Fw::FW_SERIALIZE_OK,
1398  static_cast<FwAssertArgType>(deserStatus)
1399  );
1400 
1401  // Deserialize argument context
1402  U32 context;
1403  deserStatus = msg.deserialize(context);
1404  FW_ASSERT(
1405  deserStatus == Fw::FW_SERIALIZE_OK,
1406  static_cast<FwAssertArgType>(deserStatus)
1407  );
1408  // Call handler function
1409  this->comQueueIn_handler(
1410  portNum,
1411  data,
1412  context
1413  );
1414 
1415  break;
1416  }
1417 
1418  // Handle async input port comStatusIn
1419  case COMSTATUSIN_SUCCESSCONDITION: {
1420  // Deserialize argument condition
1421  Fw::Success condition;
1422  deserStatus = msg.deserialize(condition);
1423  FW_ASSERT(
1424  deserStatus == Fw::FW_SERIALIZE_OK,
1425  static_cast<FwAssertArgType>(deserStatus)
1426  );
1427  // Call handler function
1428  this->comStatusIn_handler(
1429  portNum,
1430  condition
1431  );
1432 
1433  break;
1434  }
1435 
1436  // Handle async input port run
1437  case RUN_SCHED: {
1438  // Deserialize argument context
1439  NATIVE_UINT_TYPE context;
1440  deserStatus = msg.deserialize(context);
1441  FW_ASSERT(
1442  deserStatus == Fw::FW_SERIALIZE_OK,
1443  static_cast<FwAssertArgType>(deserStatus)
1444  );
1445  // Call handler function
1446  this->run_handler(
1447  portNum,
1448  context
1449  );
1450 
1451  break;
1452  }
1453 
1454  default:
1455  return MSG_DISPATCH_ERROR;
1456  }
1457 
1458  return MSG_DISPATCH_OK;
1459  }
1460 
1461  // ----------------------------------------------------------------------
1462  // Calls for messages received on typed input ports
1463  // ----------------------------------------------------------------------
1464 
1465  void ComQueueComponentBase ::
1466  m_p_buffQueueIn_in(
1467  Fw::PassiveComponentBase* callComp,
1468  NATIVE_INT_TYPE portNum,
1469  Fw::Buffer& fwBuffer
1470  )
1471  {
1472  FW_ASSERT(callComp);
1473  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
1474  compPtr->buffQueueIn_handlerBase(
1475  portNum,
1476  fwBuffer
1477  );
1478  }
1479 
1480  void ComQueueComponentBase ::
1481  m_p_comQueueIn_in(
1482  Fw::PassiveComponentBase* callComp,
1483  NATIVE_INT_TYPE portNum,
1484  Fw::ComBuffer& data,
1485  U32 context
1486  )
1487  {
1488  FW_ASSERT(callComp);
1489  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
1490  compPtr->comQueueIn_handlerBase(
1491  portNum,
1492  data,
1493  context
1494  );
1495  }
1496 
1497  void ComQueueComponentBase ::
1498  m_p_comStatusIn_in(
1499  Fw::PassiveComponentBase* callComp,
1500  NATIVE_INT_TYPE portNum,
1501  Fw::Success& condition
1502  )
1503  {
1504  FW_ASSERT(callComp);
1505  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
1506  compPtr->comStatusIn_handlerBase(
1507  portNum,
1508  condition
1509  );
1510  }
1511 
1512  void ComQueueComponentBase ::
1513  m_p_run_in(
1514  Fw::PassiveComponentBase* callComp,
1515  NATIVE_INT_TYPE portNum,
1516  NATIVE_UINT_TYPE context
1517  )
1518  {
1519  FW_ASSERT(callComp);
1520  ComQueueComponentBase* compPtr = static_cast<ComQueueComponentBase*>(callComp);
1521  compPtr->run_handlerBase(
1522  portNum,
1523  context
1524  );
1525  }
1526 
1527 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
U8 BYTE
byte type
Definition: BasicTypes.h:27
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:26
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:66
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:52
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition: FpConfig.h:39
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:21
U32 FwChanIdType
Definition: FpConfig.h:59
U32 FwEventIdType
Definition: FpConfig.h:62
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition: FpConfig.h:299
#define FW_OBJ_NAME_MAX_SIZE
Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80.
Definition: FpConfig.h:184
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition: FpConfig.h:88
@ ACTIVE_COMPONENT_EXIT
message to exit active component task
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Definition: Buffer.cpp:134
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
void init()
Initialization function.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: ComPortAc.hpp:37
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:62
void init()
Initialization function.
Definition: ComPortAc.cpp:56
void setPortNum(NATIVE_INT_TYPE portNum)
void init()
Initialization function.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
@ WARNING_HI
A serious but recoverable event.
void init()
Object initializer.
Definition: ObjBase.cpp:27
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Buffer &fwBuffer)
Invoke a port interface.
void init()
Initialization function.
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:143
void init()
Initialization function.
Definition: ComPortAc.cpp:137
void invoke(Fw::ComBuffer &data, U32 context)
Invoke a port interface.
Definition: ComPortAc.cpp:156
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Invoke a port interface.
Definition: LogPortAc.cpp:170
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void invoke(Fw::Time &time)
Invoke a port interface.
Definition: TimePortAc.cpp:147
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected()
Definition: PortBase.cpp:41
Os::Queue::QueueStatus createQueue(NATIVE_INT_TYPE depth, NATIVE_INT_TYPE msgSize)
Os::Queue m_queue
queue object for active component
void incNumMsgDropped()
increment the number of messages dropped
@ MSG_DISPATCH_OK
Dispatch was normal.
@ MSG_DISPATCH_EXIT
A message was sent requesting an exit of the loop.
@ MSG_DISPATCH_ERROR
Errors dispatching messages.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
gets char buffer
Definition: String.cpp:48
Success/Failure.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
Definition: Time.hpp:9
QueueStatus
Definition: Queue.hpp:27
@ QUEUE_OK
message sent/received okay
Definition: Queue.hpp:28
@ QUEUE_FULL
queue was full when attempting to send a message
Definition: Queue.hpp:36
QueueStatus send(const Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE priority, QueueBlocking block)
send a message
Definition: QueueCommon.cpp:13
QueueStatus receive(Fw::SerializeBufferBase &buffer, NATIVE_INT_TYPE &priority, QueueBlocking block)
receive a message
Definition: QueueCommon.cpp:22
QueueBlocking
Definition: Queue.hpp:40
@ QUEUE_BLOCKING
Queue receive blocks until a message arrives.
Definition: Queue.hpp:41
@ QUEUE_NONBLOCKING
Queue receive always returns even if there is no message.
Definition: Queue.hpp:42
Array of queue depths for Fw::Buffer types.
bool isConnected_Tlm_OutputPort(NATIVE_INT_TYPE portNum)
void buffQueueSend_out(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Invoke output port buffQueueSend.
Fw::InputComPort * get_comQueueIn_InputPort(NATIVE_INT_TYPE portNum)
void comQueueSend_out(NATIVE_INT_TYPE portNum, Fw::ComBuffer &data, U32 context)
Invoke output port comQueueSend.
NATIVE_INT_TYPE getNum_Time_OutputPorts() const
void comQueueIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comQueueIn.
void tlmWrite_comQueueDepth(const Svc::ComQueueDepth &arg, Fw::Time _tlmTime=Fw::Time())
NATIVE_INT_TYPE getNum_comQueueSend_OutputPorts() const
bool isConnected_comQueueSend_OutputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_buffQueueSend_OutputPorts() const
NATIVE_INT_TYPE getNum_Log_OutputPorts() const
void set_Log_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void tlmWrite_buffQueueDepth(const Svc::BuffQueueDepth &arg, Fw::Time _tlmTime=Fw::Time())
void buffQueueIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port buffQueueIn.
void set_comQueueSend_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputComPort *port)
Connect port to comQueueSend[portNum].
virtual void comStatusIn_handler(NATIVE_INT_TYPE portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
ComQueueComponentBase(const char *compName="")
Construct ComQueueComponentBase object.
NATIVE_INT_TYPE getNum_comStatusIn_InputPorts() const
Svc::InputSchedPort * get_run_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_buffQueueIn_InputPorts() const
@ EVENTID_QUEUEOVERFLOW
Queue overflow event.
virtual void buffQueueIn_preMsgHook(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Pre-message hook for async input port buffQueueIn.
virtual void comQueueIn_handler(NATIVE_INT_TYPE portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comQueueIn.
bool isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
virtual void buffQueueIn_handler(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)=0
Handler for input port buffQueueIn.
virtual void comQueueIn_preMsgHook(NATIVE_INT_TYPE portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comQueueIn.
virtual ~ComQueueComponentBase()
Destroy ComQueueComponentBase object.
void set_buffQueueSend_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferSendPort *port)
Connect port to buffQueueSend[portNum].
NATIVE_INT_TYPE getNum_Tlm_OutputPorts() const
virtual void run_preMsgHook(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)
Pre-message hook for async input port run.
void set_Time_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
virtual void run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)=0
Handler for input port run.
bool isConnected_buffQueueSend_OutputPort(NATIVE_INT_TYPE portNum)
void set_Tlm_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void run_handlerBase(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)
Handler base-class function for input port run.
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(NATIVE_INT_TYPE portNum)
NATIVE_INT_TYPE getNum_comQueueIn_InputPorts() const
void log_WARNING_HI_QueueOverflow(Svc::QueueType queueType, U32 index)
NATIVE_INT_TYPE getNum_run_InputPorts() const
bool isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
@ CHANNELID_BUFFQUEUEDEPTH
Channel ID for buffQueueDepth.
@ CHANNELID_COMQUEUEDEPTH
Channel ID for comQueueDepth.
virtual void comStatusIn_preMsgHook(NATIVE_INT_TYPE portNum, Fw::Success &condition)
Pre-message hook for async input port comStatusIn.
Fw::InputBufferSendPort * get_buffQueueIn_InputPort(NATIVE_INT_TYPE portNum)
void comStatusIn_handlerBase(NATIVE_INT_TYPE portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
Array of queue depths for Fw::Com types.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: SchedPortAc.hpp:36
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
An enumeration of queue data types.
@ SERIALIZED_SIZE
The size of the serial representation.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
const Time ZERO_TIME
Definition: Time.cpp:5