F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActivePhaserComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ActivePhaserComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ActivePhaser 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  ACTIVEPHASER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  CYCLEIN_CYCLE,
20  INT_IF_TICK,
21  };
22 
23  // Get the max size by constructing a union of the async input, command, and
24  // internal port serialization sizes
25  union BuffUnion {
27  };
28 
29  // Define a message buffer class large enough to handle all the
30  // asynchronous inputs to the component
31  class ComponentIpcSerializableBuffer :
33  {
34 
35  public:
36 
37  enum {
38  // Offset into data in buffer: Size of message ID and port number
39  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
40  // Max data size
41  MAX_DATA_SIZE = sizeof(BuffUnion),
42  // Max message size: Size of message id + size of port + max data size
43  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
44  };
45 
46  Fw::Serializable::SizeType getBuffCapacity() const {
47  return sizeof(m_buff);
48  }
49 
50  U8* getBuffAddr() {
51  return m_buff;
52  }
53 
54  const U8* getBuffAddr() const {
55  return m_buff;
56  }
57 
58  private:
59  // Should be the max of all the input ports serialized sizes...
60  U8 m_buff[SERIALIZATION_SIZE];
61 
62  };
63  }
64 
65  // ----------------------------------------------------------------------
66  // Component initialization
67  // ----------------------------------------------------------------------
68 
71  FwSizeType queueDepth,
72  FwEnumStoreType instance
73  )
74  {
75  // Initialize base class
77 
78  // Connect input port CycleIn
79  for (
80  FwIndexType port = 0;
81  port < static_cast<FwIndexType>(this->getNum_CycleIn_InputPorts());
82  port++
83  ) {
84  this->m_CycleIn_InputPort[port].init();
85  this->m_CycleIn_InputPort[port].addCallComp(
86  this,
87  m_p_CycleIn_in
88  );
89  this->m_CycleIn_InputPort[port].setPortNum(port);
90 
91 #if FW_OBJECT_NAMES == 1
92  Fw::ObjectName portName;
93  portName.format(
94  "%s_CycleIn_InputPort[%" PRI_FwIndexType "]",
95  this->m_objName.toChar(),
96  port
97  );
98  this->m_CycleIn_InputPort[port].setObjName(portName.toChar());
99 #endif
100  }
101 
102  // Connect output port logOut
103  for (
104  FwIndexType port = 0;
105  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
106  port++
107  ) {
108  this->m_logOut_OutputPort[port].init();
109 
110 #if FW_OBJECT_NAMES == 1
111  Fw::ObjectName portName;
112  portName.format(
113  "%s_logOut_OutputPort[%" PRI_FwIndexType "]",
114  this->m_objName.toChar(),
115  port
116  );
117  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
118 #endif
119  }
120 
121 #if FW_ENABLE_TEXT_LOGGING == 1
122  // Connect output port logTextOut
123  for (
124  FwIndexType port = 0;
125  port < static_cast<FwIndexType>(this->getNum_logTextOut_OutputPorts());
126  port++
127  ) {
128  this->m_logTextOut_OutputPort[port].init();
129 
130 #if FW_OBJECT_NAMES == 1
131  Fw::ObjectName portName;
132  portName.format(
133  "%s_logTextOut_OutputPort[%" PRI_FwIndexType "]",
134  this->m_objName.toChar(),
135  port
136  );
137  this->m_logTextOut_OutputPort[port].setObjName(portName.toChar());
138 #endif
139  }
140 #endif
141 
142  // Connect output port timeCaller
143  for (
144  FwIndexType port = 0;
145  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
146  port++
147  ) {
148  this->m_timeCaller_OutputPort[port].init();
149 
150 #if FW_OBJECT_NAMES == 1
151  Fw::ObjectName portName;
152  portName.format(
153  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
154  this->m_objName.toChar(),
155  port
156  );
157  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
158 #endif
159  }
160 
161  // Connect output port tlmOut
162  for (
163  FwIndexType port = 0;
164  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
165  port++
166  ) {
167  this->m_tlmOut_OutputPort[port].init();
168 
169 #if FW_OBJECT_NAMES == 1
170  Fw::ObjectName portName;
171  portName.format(
172  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
173  this->m_objName.toChar(),
174  port
175  );
176  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
177 #endif
178  }
179 
180  // Connect output port PhaserMemberOut
181  for (
182  FwIndexType port = 0;
183  port < static_cast<FwIndexType>(this->getNum_PhaserMemberOut_OutputPorts());
184  port++
185  ) {
186  this->m_PhaserMemberOut_OutputPort[port].init();
187 
188 #if FW_OBJECT_NAMES == 1
189  Fw::ObjectName portName;
190  portName.format(
191  "%s_PhaserMemberOut_OutputPort[%" PRI_FwIndexType "]",
192  this->m_objName.toChar(),
193  port
194  );
195  this->m_PhaserMemberOut_OutputPort[port].setObjName(portName.toChar());
196 #endif
197  }
198 
199  // Create the queue
200  Os::Queue::Status qStat = this->createQueue(
201  queueDepth,
202  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
203  );
204  FW_ASSERT(
205  Os::Queue::Status::OP_OK == qStat,
206  static_cast<FwAssertArgType>(qStat)
207  );
208  }
209 
210  // ----------------------------------------------------------------------
211  // Getters for typed input ports
212  // ----------------------------------------------------------------------
213 
216  {
217  FW_ASSERT(
218  (0 <= portNum) && (portNum < this->getNum_CycleIn_InputPorts()),
219  static_cast<FwAssertArgType>(portNum)
220  );
221 
222  return &this->m_CycleIn_InputPort[portNum];
223  }
224 
225  // ----------------------------------------------------------------------
226  // Connect input ports to special output ports
227  // ----------------------------------------------------------------------
228 
231  FwIndexType portNum,
232  Fw::InputLogPort* port
233  )
234  {
235  FW_ASSERT(
236  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
237  static_cast<FwAssertArgType>(portNum)
238  );
239 
240  this->m_logOut_OutputPort[portNum].addCallPort(port);
241  }
242 
243 #if FW_ENABLE_TEXT_LOGGING == 1
244 
245  void ActivePhaserComponentBase ::
246  set_logTextOut_OutputPort(
247  FwIndexType portNum,
249  )
250  {
251  FW_ASSERT(
252  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
253  static_cast<FwAssertArgType>(portNum)
254  );
255 
256  this->m_logTextOut_OutputPort[portNum].addCallPort(port);
257  }
258 
259 #endif
260 
263  FwIndexType portNum,
264  Fw::InputTimePort* port
265  )
266  {
267  FW_ASSERT(
268  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
269  static_cast<FwAssertArgType>(portNum)
270  );
271 
272  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
273  }
274 
277  FwIndexType portNum,
278  Fw::InputTlmPort* port
279  )
280  {
281  FW_ASSERT(
282  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
283  static_cast<FwAssertArgType>(portNum)
284  );
285 
286  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
287  }
288 
289  // ----------------------------------------------------------------------
290  // Connect typed input ports to typed output ports
291  // ----------------------------------------------------------------------
292 
295  FwIndexType portNum,
296  Svc::InputSchedPort* port
297  )
298  {
299  FW_ASSERT(
300  (0 <= portNum) && (portNum < this->getNum_PhaserMemberOut_OutputPorts()),
301  static_cast<FwAssertArgType>(portNum)
302  );
303 
304  this->m_PhaserMemberOut_OutputPort[portNum].addCallPort(port);
305  }
306 
307 #if FW_PORT_SERIALIZATION
308 
309  // ----------------------------------------------------------------------
310  // Connect serial input ports to special output ports
311  // ----------------------------------------------------------------------
312 
315  FwIndexType portNum,
316  Fw::InputSerializePort* port
317  )
318  {
319  FW_ASSERT(
320  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
321  static_cast<FwAssertArgType>(portNum)
322  );
323 
324  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
325  }
326 
327 #if FW_ENABLE_TEXT_LOGGING == 1
328 
329  void ActivePhaserComponentBase ::
330  set_logTextOut_OutputPort(
331  FwIndexType portNum,
332  Fw::InputSerializePort* port
333  )
334  {
335  FW_ASSERT(
336  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
337  static_cast<FwAssertArgType>(portNum)
338  );
339 
340  this->m_logTextOut_OutputPort[portNum].registerSerialPort(port);
341  }
342 
343 #endif
344 
347  FwIndexType portNum,
348  Fw::InputSerializePort* port
349  )
350  {
351  FW_ASSERT(
352  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
353  static_cast<FwAssertArgType>(portNum)
354  );
355 
356  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
357  }
358 
361  FwIndexType portNum,
362  Fw::InputSerializePort* port
363  )
364  {
365  FW_ASSERT(
366  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
367  static_cast<FwAssertArgType>(portNum)
368  );
369 
370  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
371  }
372 
373 #endif
374 
375 #if FW_PORT_SERIALIZATION
376 
377  // ----------------------------------------------------------------------
378  // Connect serial input ports to typed output ports
379  // ----------------------------------------------------------------------
380 
383  FwIndexType portNum,
384  Fw::InputSerializePort* port
385  )
386  {
387  FW_ASSERT(
388  (0 <= portNum) && (portNum < this->getNum_PhaserMemberOut_OutputPorts()),
389  static_cast<FwAssertArgType>(portNum)
390  );
391 
392  this->m_PhaserMemberOut_OutputPort[portNum].registerSerialPort(port);
393  }
394 
395 #endif
396 
397  // ----------------------------------------------------------------------
398  // Component construction and destruction
399  // ----------------------------------------------------------------------
400 
402  ActivePhaserComponentBase(const char* compName) :
403  Fw::ActiveComponentBase(compName)
404  {
405  this->m_MissedDeadlineThrottle = 0;
406  }
407 
410  {
411 
412  }
413 
414  // ----------------------------------------------------------------------
415  // Getters for numbers of typed input ports
416  // ----------------------------------------------------------------------
417 
420  {
421  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CycleIn_InputPort));
422  }
423 
424  // ----------------------------------------------------------------------
425  // Getters for numbers of special output ports
426  // ----------------------------------------------------------------------
427 
430  {
431  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
432  }
433 
434 #if FW_ENABLE_TEXT_LOGGING == 1
435 
436  FwIndexType ActivePhaserComponentBase ::
437  getNum_logTextOut_OutputPorts() const
438  {
439  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logTextOut_OutputPort));
440  }
441 
442 #endif
443 
446  {
447  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
448  }
449 
452  {
453  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
454  }
455 
456  // ----------------------------------------------------------------------
457  // Getters for numbers of typed output ports
458  // ----------------------------------------------------------------------
459 
462  {
463  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_PhaserMemberOut_OutputPort));
464  }
465 
466  // ----------------------------------------------------------------------
467  // Connection status queries for special output ports
468  // ----------------------------------------------------------------------
469 
472  {
473  FW_ASSERT(
474  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
475  static_cast<FwAssertArgType>(portNum)
476  );
477 
478  return this->m_logOut_OutputPort[portNum].isConnected();
479  }
480 
481 #if FW_ENABLE_TEXT_LOGGING == 1
482 
483  bool ActivePhaserComponentBase ::
484  isConnected_logTextOut_OutputPort(FwIndexType portNum)
485  {
486  FW_ASSERT(
487  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
488  static_cast<FwAssertArgType>(portNum)
489  );
490 
491  return this->m_logTextOut_OutputPort[portNum].isConnected();
492  }
493 
494 #endif
495 
498  {
499  FW_ASSERT(
500  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
501  static_cast<FwAssertArgType>(portNum)
502  );
503 
504  return this->m_timeCaller_OutputPort[portNum].isConnected();
505  }
506 
509  {
510  FW_ASSERT(
511  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
512  static_cast<FwAssertArgType>(portNum)
513  );
514 
515  return this->m_tlmOut_OutputPort[portNum].isConnected();
516  }
517 
518  // ----------------------------------------------------------------------
519  // Connection status queries for typed output ports
520  // ----------------------------------------------------------------------
521 
524  {
525  FW_ASSERT(
526  (0 <= portNum) && (portNum < this->getNum_PhaserMemberOut_OutputPorts()),
527  static_cast<FwAssertArgType>(portNum)
528  );
529 
530  return this->m_PhaserMemberOut_OutputPort[portNum].isConnected();
531  }
532 
533  // ----------------------------------------------------------------------
534  // Port handler base-class functions for typed input ports
535  //
536  // Call these functions directly to bypass the corresponding ports
537  // ----------------------------------------------------------------------
538 
541  FwIndexType portNum,
542  Os::RawTime& cycleStart
543  )
544  {
545  // Make sure port number is valid
546  FW_ASSERT(
547  (0 <= portNum) && (portNum < this->getNum_CycleIn_InputPorts()),
548  static_cast<FwAssertArgType>(portNum)
549  );
550 
551  // Call pre-message hook
553  portNum,
554  cycleStart
555  );
556  ComponentIpcSerializableBuffer msg;
558 
559  // Serialize message ID
560  _status = msg.serializeFrom(
561  static_cast<FwEnumStoreType>(CYCLEIN_CYCLE)
562  );
563  FW_ASSERT(
564  _status == Fw::FW_SERIALIZE_OK,
565  static_cast<FwAssertArgType>(_status)
566  );
567 
568  // Serialize port number
569  _status = msg.serializeFrom(portNum);
570  FW_ASSERT(
571  _status == Fw::FW_SERIALIZE_OK,
572  static_cast<FwAssertArgType>(_status)
573  );
574 
575  // Serialize argument cycleStart
576  _status = msg.serializeFrom(cycleStart);
577  FW_ASSERT(
578  _status == Fw::FW_SERIALIZE_OK,
579  static_cast<FwAssertArgType>(_status)
580  );
581 
582  // Send message
584  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
585 
586  if (qStatus == Os::Queue::Status::FULL) {
587  this->incNumMsgDropped();
588  return;
589  }
590 
591  FW_ASSERT(
592  qStatus == Os::Queue::OP_OK,
593  static_cast<FwAssertArgType>(qStatus)
594  );
595  }
596 
597  // ----------------------------------------------------------------------
598  // Pre-message hooks for typed async input ports
599  //
600  // Each of these functions is invoked just before processing a message
601  // on the corresponding port. By default, they do nothing. You can
602  // override them to provide specific pre-message behavior.
603  // ----------------------------------------------------------------------
604 
607  FwIndexType portNum,
608  Os::RawTime& cycleStart
609  )
610  {
611  // Default: no-op
612  }
613 
614  // ----------------------------------------------------------------------
615  // Invocation functions for typed output ports
616  // ----------------------------------------------------------------------
617 
620  FwIndexType portNum,
621  U32 context
622  )
623  {
624  FW_ASSERT(
625  (0 <= portNum) && (portNum < this->getNum_PhaserMemberOut_OutputPorts()),
626  static_cast<FwAssertArgType>(portNum)
627  );
628 
629  FW_ASSERT(
630  this->m_PhaserMemberOut_OutputPort[portNum].isConnected(),
631  static_cast<FwAssertArgType>(portNum)
632  );
633  this->m_PhaserMemberOut_OutputPort[portNum].invoke(
634  context
635  );
636  }
637 
638  // ----------------------------------------------------------------------
639  // Internal interface base-class functions
640  // ----------------------------------------------------------------------
641 
644  {
645  ComponentIpcSerializableBuffer msg;
647 
648  // Serialize the message ID
649  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(INT_IF_TICK));
650  FW_ASSERT (
651  _status == Fw::FW_SERIALIZE_OK,
652  static_cast<FwAssertArgType>(_status)
653  );
654 
655  // Fake port number to make message dequeue work
656  _status = msg.serializeFrom(static_cast<FwIndexType>(0));
657  FW_ASSERT (
658  _status == Fw::FW_SERIALIZE_OK,
659  static_cast<FwAssertArgType>(_status)
660  );
661 
662  // Send message
664  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
665 
666  if (qStatus == Os::Queue::Status::FULL) {
667  this->incNumMsgDropped();
668  return;
669  }
670 
671  FW_ASSERT(
672  qStatus == Os::Queue::OP_OK,
673  static_cast<FwAssertArgType>(qStatus)
674  );
675  }
676 
677  // ----------------------------------------------------------------------
678  // Event logging functions
679  // ----------------------------------------------------------------------
680 
683  FwIndexType p,
684  U32 start,
685  U32 length,
686  U32 ticks
687  )
688  {
689  // Check throttle value
690  if (this->m_MissedDeadlineThrottle >= EVENTID_MISSEDDEADLINE_THROTTLE) {
691  return;
692  }
693  else {
694  (void) this->m_MissedDeadlineThrottle.fetch_add(1);
695  }
696 
697  // Get the time
698  Fw::Time _logTime;
699  if (this->m_timeCaller_OutputPort[0].isConnected()) {
700  this->m_timeCaller_OutputPort[0].invoke(_logTime);
701  }
702 
703  FwEventIdType _id = static_cast<FwEventIdType>(0);
704 
705  _id = this->getIdBase() + EVENTID_MISSEDDEADLINE;
706 
707  // Emit the event on the log port
708  if (this->m_logOut_OutputPort[0].isConnected()) {
709  Fw::LogBuffer _logBuff;
711 
712 #if FW_AMPCS_COMPATIBLE
713  // Serialize the number of arguments
714  _status = _logBuff.serializeFrom(static_cast<U8>(4));
715  FW_ASSERT(
716  _status == Fw::FW_SERIALIZE_OK,
717  static_cast<FwAssertArgType>(_status)
718  );
719 #endif
720 
721 #if FW_AMPCS_COMPATIBLE
722  // Serialize the argument size
723  _status = _logBuff.serializeFrom(
724  static_cast<U8>(sizeof(FwIndexType))
725  );
726  FW_ASSERT(
727  _status == Fw::FW_SERIALIZE_OK,
728  static_cast<FwAssertArgType>(_status)
729  );
730 #endif
731  _status = _logBuff.serializeFrom(p);
732  FW_ASSERT(
733  _status == Fw::FW_SERIALIZE_OK,
734  static_cast<FwAssertArgType>(_status)
735  );
736 
737 #if FW_AMPCS_COMPATIBLE
738  // Serialize the argument size
739  _status = _logBuff.serializeFrom(
740  static_cast<U8>(sizeof(U32))
741  );
742  FW_ASSERT(
743  _status == Fw::FW_SERIALIZE_OK,
744  static_cast<FwAssertArgType>(_status)
745  );
746 #endif
747  _status = _logBuff.serializeFrom(start);
748  FW_ASSERT(
749  _status == Fw::FW_SERIALIZE_OK,
750  static_cast<FwAssertArgType>(_status)
751  );
752 
753 #if FW_AMPCS_COMPATIBLE
754  // Serialize the argument size
755  _status = _logBuff.serializeFrom(
756  static_cast<U8>(sizeof(U32))
757  );
758  FW_ASSERT(
759  _status == Fw::FW_SERIALIZE_OK,
760  static_cast<FwAssertArgType>(_status)
761  );
762 #endif
763  _status = _logBuff.serializeFrom(length);
764  FW_ASSERT(
765  _status == Fw::FW_SERIALIZE_OK,
766  static_cast<FwAssertArgType>(_status)
767  );
768 
769 #if FW_AMPCS_COMPATIBLE
770  // Serialize the argument size
771  _status = _logBuff.serializeFrom(
772  static_cast<U8>(sizeof(U32))
773  );
774  FW_ASSERT(
775  _status == Fw::FW_SERIALIZE_OK,
776  static_cast<FwAssertArgType>(_status)
777  );
778 #endif
779  _status = _logBuff.serializeFrom(ticks);
780  FW_ASSERT(
781  _status == Fw::FW_SERIALIZE_OK,
782  static_cast<FwAssertArgType>(_status)
783  );
784 
785  this->m_logOut_OutputPort[0].invoke(
786  _id,
787  _logTime,
789  _logBuff
790  );
791  }
792 
793  // Emit the event on the text log port
794 #if FW_ENABLE_TEXT_LOGGING
795  if (this->m_logTextOut_OutputPort[0].isConnected()) {
796 #if FW_OBJECT_NAMES == 1
797  const char* _formatString =
798  "(%s) %s: Port %" PRIi16 " schedule at %" PRIu32 " for %" PRIu32 " ticks was long by %" PRIu32 " ticks";
799 #else
800  const char* _formatString =
801  "%s: Port %" PRIi16 " schedule at %" PRIu32 " for %" PRIu32 " ticks was long by %" PRIu32 " ticks";
802 #endif
803 
804  Fw::TextLogString _logString;
805  _logString.format(
806  _formatString,
807 #if FW_OBJECT_NAMES == 1
808  this->m_objName.toChar(),
809 #endif
810  "MissedDeadline ",
811  p,
812  start,
813  length,
814  ticks
815  );
816 
817  this->m_logTextOut_OutputPort[0].invoke(
818  _id,
819  _logTime,
821  _logString
822  );
823  }
824 #endif
825  }
826 
827  // ----------------------------------------------------------------------
828  // Event throttle reset functions
829  // ----------------------------------------------------------------------
830 
833  {
834  // Reset throttle counter
835  this->m_MissedDeadlineThrottle = 0;
836  }
837 
838  // ----------------------------------------------------------------------
839  // Time
840  // ----------------------------------------------------------------------
841 
843  getTime() const
844  {
845  if (this->m_timeCaller_OutputPort[0].isConnected()) {
846  Fw::Time _time;
847  this->m_timeCaller_OutputPort[0].invoke(_time);
848  return _time;
849  }
850  else {
851  return Fw::Time(TimeBase::TB_NONE, 0, 0);
852  }
853  }
854 
855  // ----------------------------------------------------------------------
856  // Message dispatch functions
857  // ----------------------------------------------------------------------
858 
859  Fw::QueuedComponentBase::MsgDispatchStatus ActivePhaserComponentBase ::
860  doDispatch()
861  {
862  ComponentIpcSerializableBuffer _msg;
863  FwQueuePriorityType _priority = 0;
864 
865  Os::Queue::Status _msgStatus = this->m_queue.receive(
866  _msg,
868  _priority
869  );
870  FW_ASSERT(
871  _msgStatus == Os::Queue::OP_OK,
872  static_cast<FwAssertArgType>(_msgStatus)
873  );
874 
875  // Reset to beginning of buffer
876  _msg.resetDeser();
877 
878  FwEnumStoreType _desMsg = 0;
879  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
880  FW_ASSERT(
881  _deserStatus == Fw::FW_SERIALIZE_OK,
882  static_cast<FwAssertArgType>(_deserStatus)
883  );
884 
885  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
886 
887  if (_msgType == ACTIVEPHASER_COMPONENT_EXIT) {
888  return MSG_DISPATCH_EXIT;
889  }
890 
891  FwIndexType portNum = 0;
892  _deserStatus = _msg.deserializeTo(portNum);
893  FW_ASSERT(
894  _deserStatus == Fw::FW_SERIALIZE_OK,
895  static_cast<FwAssertArgType>(_deserStatus)
896  );
897 
898  switch (_msgType) {
899  // Handle async input port CycleIn
900  case CYCLEIN_CYCLE: {
901  // Deserialize argument cycleStart
902  Os::RawTime cycleStart;
903  _deserStatus = _msg.deserializeTo(cycleStart);
904  FW_ASSERT(
905  _deserStatus == Fw::FW_SERIALIZE_OK,
906  static_cast<FwAssertArgType>(_deserStatus)
907  );
908  // Call handler function
909  this->CycleIn_handler(
910  portNum,
911  cycleStart
912  );
913 
914  break;
915  }
916 
917  // Handle internal interface Tick
918  case INT_IF_TICK: {
919  // Make sure there was no data left over.
920  // That means the buffer size was incorrect.
921  FW_ASSERT(
922  _msg.getBuffLeft() == 0,
923  static_cast<FwAssertArgType>(_msg.getBuffLeft())
924  );
925 
926  // Call handler function
928 
929  break;
930  }
931 
932  default:
933  return MSG_DISPATCH_ERROR;
934  }
935 
936  return MSG_DISPATCH_OK;
937  }
938 
939  // ----------------------------------------------------------------------
940  // Calls for messages received on typed input ports
941  // ----------------------------------------------------------------------
942 
943  void ActivePhaserComponentBase ::
944  m_p_CycleIn_in(
945  Fw::PassiveComponentBase* callComp,
946  FwIndexType portNum,
947  Os::RawTime& cycleStart
948  )
949  {
950  FW_ASSERT(callComp);
951  ActivePhaserComponentBase* compPtr = static_cast<ActivePhaserComponentBase*>(callComp);
952  compPtr->CycleIn_handlerBase(
953  portNum,
954  cycleStart
955  );
956  }
957 
958 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
message to exit active component task
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Operation succeeded.
Definition: Os.hpp:26
PlatformSizeType FwSizeType
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:63
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CyclePortAc.cpp:62
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_PhaserMemberOut_OutputPort(FwIndexType portNum, Svc::InputSchedPort *port)
Connect port to PhaserMemberOut[portNum].
bool isConnected_PhaserMemberOut_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
No time base has been established (Required)
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
Warning event that rate group has had a missed deadline.
Message will block until space is available.
Definition: Queue.hpp:47
FwIdType FwEventIdType
The type of an event identifier.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:128
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
void invoke(U32 context) const
Invoke a port interface.
ActivePhaserComponentBase(const char *compName="")
Construct ActivePhaserComponentBase object.
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
const char * toChar() const
Definition: ObjectName.hpp:50
FwSizeType SizeType
virtual ~ActivePhaserComponentBase()
Destroy ActivePhaserComponentBase object.
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:46
A serious but recoverable event.
bool isConnected() const
Definition: PortBase.cpp:38
The size of the serial representations of the port arguments.
Definition: CyclePortAc.hpp:37
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void PhaserMemberOut_out(FwIndexType portNum, U32 context)
Invoke output port PhaserMemberOut.
void setPortNum(FwIndexType portNum)
void Tick_internalInterfaceInvoke()
Internal interface base-class function for Tick.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
BlockingType
message type
Definition: Queue.hpp:46
void init()
Initialization function.
Definition: CyclePortAc.cpp:56
Svc::InputCyclePort * get_CycleIn_InputPort(FwIndexType portNum)
FwIndexType getNum_PhaserMemberOut_OutputPorts() const
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
virtual void Tick_internalInterfaceHandler()=0
Internal interface handler for Tick.
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:90
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void log_WARNING_HI_MissedDeadline_ThrottleClear()
Reset throttle value for MissedDeadline.
void init()
Initialization function.
void CycleIn_handlerBase(FwIndexType portNum, Os::RawTime &cycleStart)
Handler base-class function for input port CycleIn.
virtual void CycleIn_handler(FwIndexType portNum, Os::RawTime &cycleStart)=0
Handler for input port CycleIn.
void incNumMsgDropped()
increment the number of messages dropped
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:56
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
virtual void CycleIn_preMsgHook(FwIndexType portNum, Os::RawTime &cycleStart)
Pre-message hook for async input port CycleIn.
void start(FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, FwSizeType stackSize=Os::Task::TASK_DEFAULT, FwSizeType cpuAffinity=Os::Task::TASK_DEFAULT, FwTaskIdType identifier=static_cast< FwTaskIdType >(Os::Task::TASK_DEFAULT))
called by instantiator when task is to be started
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
void addCallPort(InputSchedPort *callPort)
Register an input port.
void log_WARNING_HI_MissedDeadline(FwIndexType p, U32 start, U32 length, U32 ticks)