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 getCapacity() 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  // Connection status queries for special output ports
416  // ----------------------------------------------------------------------
417 
420  {
421  FW_ASSERT(
422  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
423  static_cast<FwAssertArgType>(portNum)
424  );
425 
426  return this->m_logOut_OutputPort[portNum].isConnected();
427  }
428 
429 #if FW_ENABLE_TEXT_LOGGING == 1
430 
431  bool ActivePhaserComponentBase ::
432  isConnected_logTextOut_OutputPort(FwIndexType portNum)
433  {
434  FW_ASSERT(
435  (0 <= portNum) && (portNum < this->getNum_logTextOut_OutputPorts()),
436  static_cast<FwAssertArgType>(portNum)
437  );
438 
439  return this->m_logTextOut_OutputPort[portNum].isConnected();
440  }
441 
442 #endif
443 
446  {
447  FW_ASSERT(
448  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
449  static_cast<FwAssertArgType>(portNum)
450  );
451 
452  return this->m_timeCaller_OutputPort[portNum].isConnected();
453  }
454 
457  {
458  FW_ASSERT(
459  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
460  static_cast<FwAssertArgType>(portNum)
461  );
462 
463  return this->m_tlmOut_OutputPort[portNum].isConnected();
464  }
465 
466  // ----------------------------------------------------------------------
467  // Connection status queries for typed output ports
468  // ----------------------------------------------------------------------
469 
472  {
473  FW_ASSERT(
474  (0 <= portNum) && (portNum < this->getNum_PhaserMemberOut_OutputPorts()),
475  static_cast<FwAssertArgType>(portNum)
476  );
477 
478  return this->m_PhaserMemberOut_OutputPort[portNum].isConnected();
479  }
480 
481  // ----------------------------------------------------------------------
482  // Port handler base-class functions for typed input ports
483  //
484  // Call these functions directly to bypass the corresponding ports
485  // ----------------------------------------------------------------------
486 
489  FwIndexType portNum,
490  Os::RawTime& cycleStart
491  )
492  {
493  // Make sure port number is valid
494  FW_ASSERT(
495  (0 <= portNum) && (portNum < this->getNum_CycleIn_InputPorts()),
496  static_cast<FwAssertArgType>(portNum)
497  );
498 
499  // Call pre-message hook
501  portNum,
502  cycleStart
503  );
504  ComponentIpcSerializableBuffer msg;
506 
507  // Serialize message ID
508  _status = msg.serializeFrom(
509  static_cast<FwEnumStoreType>(CYCLEIN_CYCLE)
510  );
511  FW_ASSERT(
512  _status == Fw::FW_SERIALIZE_OK,
513  static_cast<FwAssertArgType>(_status)
514  );
515 
516  // Serialize port number
517  _status = msg.serializeFrom(portNum);
518  FW_ASSERT(
519  _status == Fw::FW_SERIALIZE_OK,
520  static_cast<FwAssertArgType>(_status)
521  );
522 
523  // Serialize argument cycleStart
524  _status = msg.serializeFrom(cycleStart);
525  FW_ASSERT(
526  _status == Fw::FW_SERIALIZE_OK,
527  static_cast<FwAssertArgType>(_status)
528  );
529 
530  // Send message
532  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
533 
534  if (qStatus == Os::Queue::Status::FULL) {
535  this->incNumMsgDropped();
536  return;
537  }
538 
539  FW_ASSERT(
540  qStatus == Os::Queue::OP_OK,
541  static_cast<FwAssertArgType>(qStatus)
542  );
543  }
544 
545  // ----------------------------------------------------------------------
546  // Pre-message hooks for typed async input ports
547  //
548  // Each of these functions is invoked just before processing a message
549  // on the corresponding port. By default, they do nothing. You can
550  // override them to provide specific pre-message behavior.
551  // ----------------------------------------------------------------------
552 
555  FwIndexType portNum,
556  Os::RawTime& cycleStart
557  )
558  {
559  // Default: no-op
560  }
561 
562  // ----------------------------------------------------------------------
563  // Invocation functions for typed output ports
564  // ----------------------------------------------------------------------
565 
568  FwIndexType portNum,
569  U32 context
570  )
571  {
572  FW_ASSERT(
573  (0 <= portNum) && (portNum < this->getNum_PhaserMemberOut_OutputPorts()),
574  static_cast<FwAssertArgType>(portNum)
575  );
576 
577  FW_ASSERT(
578  this->m_PhaserMemberOut_OutputPort[portNum].isConnected(),
579  static_cast<FwAssertArgType>(portNum)
580  );
581  this->m_PhaserMemberOut_OutputPort[portNum].invoke(
582  context
583  );
584  }
585 
586  // ----------------------------------------------------------------------
587  // Internal interface base-class functions
588  // ----------------------------------------------------------------------
589 
592  {
593  ComponentIpcSerializableBuffer msg;
595 
596  // Serialize the message ID
597  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(INT_IF_TICK));
598  FW_ASSERT (
599  _status == Fw::FW_SERIALIZE_OK,
600  static_cast<FwAssertArgType>(_status)
601  );
602 
603  // Fake port number to make message dequeue work
604  _status = msg.serializeFrom(static_cast<FwIndexType>(0));
605  FW_ASSERT (
606  _status == Fw::FW_SERIALIZE_OK,
607  static_cast<FwAssertArgType>(_status)
608  );
609 
610  // Send message
612  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
613 
614  if (qStatus == Os::Queue::Status::FULL) {
615  this->incNumMsgDropped();
616  return;
617  }
618 
619  FW_ASSERT(
620  qStatus == Os::Queue::OP_OK,
621  static_cast<FwAssertArgType>(qStatus)
622  );
623  }
624 
625  // ----------------------------------------------------------------------
626  // Event logging functions
627  // ----------------------------------------------------------------------
628 
631  FwIndexType p,
632  U32 start,
633  U32 length,
634  U32 ticks
635  )
636  {
637  // Check throttle value
638  if (this->m_MissedDeadlineThrottle >= EVENTID_MISSEDDEADLINE_THROTTLE) {
639  return;
640  }
641  else {
642  this->m_MissedDeadlineThrottle++;
643  }
644 
645  // Get the time
646  Fw::Time _logTime;
647  if (this->m_timeCaller_OutputPort[0].isConnected()) {
648  this->m_timeCaller_OutputPort[0].invoke(_logTime);
649  }
650 
651  FwEventIdType _id = static_cast<FwEventIdType>(0);
652 
653  _id = this->getIdBase() + EVENTID_MISSEDDEADLINE;
654 
655  // Emit the event on the log port
656  if (this->m_logOut_OutputPort[0].isConnected()) {
657  Fw::LogBuffer _logBuff;
659 
660 #if FW_AMPCS_COMPATIBLE
661  // Serialize the number of arguments
662  _status = _logBuff.serializeFrom(static_cast<U8>(4));
663  FW_ASSERT(
664  _status == Fw::FW_SERIALIZE_OK,
665  static_cast<FwAssertArgType>(_status)
666  );
667 #endif
668 
669 #if FW_AMPCS_COMPATIBLE
670  // Serialize the argument size
671  _status = _logBuff.serializeFrom(
672  static_cast<U8>(sizeof(FwIndexType))
673  );
674  FW_ASSERT(
675  _status == Fw::FW_SERIALIZE_OK,
676  static_cast<FwAssertArgType>(_status)
677  );
678 #endif
679  _status = _logBuff.serializeFrom(p);
680  FW_ASSERT(
681  _status == Fw::FW_SERIALIZE_OK,
682  static_cast<FwAssertArgType>(_status)
683  );
684 
685 #if FW_AMPCS_COMPATIBLE
686  // Serialize the argument size
687  _status = _logBuff.serializeFrom(
688  static_cast<U8>(sizeof(U32))
689  );
690  FW_ASSERT(
691  _status == Fw::FW_SERIALIZE_OK,
692  static_cast<FwAssertArgType>(_status)
693  );
694 #endif
695  _status = _logBuff.serializeFrom(start);
696  FW_ASSERT(
697  _status == Fw::FW_SERIALIZE_OK,
698  static_cast<FwAssertArgType>(_status)
699  );
700 
701 #if FW_AMPCS_COMPATIBLE
702  // Serialize the argument size
703  _status = _logBuff.serializeFrom(
704  static_cast<U8>(sizeof(U32))
705  );
706  FW_ASSERT(
707  _status == Fw::FW_SERIALIZE_OK,
708  static_cast<FwAssertArgType>(_status)
709  );
710 #endif
711  _status = _logBuff.serializeFrom(length);
712  FW_ASSERT(
713  _status == Fw::FW_SERIALIZE_OK,
714  static_cast<FwAssertArgType>(_status)
715  );
716 
717 #if FW_AMPCS_COMPATIBLE
718  // Serialize the argument size
719  _status = _logBuff.serializeFrom(
720  static_cast<U8>(sizeof(U32))
721  );
722  FW_ASSERT(
723  _status == Fw::FW_SERIALIZE_OK,
724  static_cast<FwAssertArgType>(_status)
725  );
726 #endif
727  _status = _logBuff.serializeFrom(ticks);
728  FW_ASSERT(
729  _status == Fw::FW_SERIALIZE_OK,
730  static_cast<FwAssertArgType>(_status)
731  );
732 
733  this->m_logOut_OutputPort[0].invoke(
734  _id,
735  _logTime,
737  _logBuff
738  );
739  }
740 
741  // Emit the event on the text log port
742 #if FW_ENABLE_TEXT_LOGGING
743  if (this->m_logTextOut_OutputPort[0].isConnected()) {
744 #if FW_OBJECT_NAMES == 1
745  const char* _formatString =
746  "(%s) %s: Port %" PRIi16 " schedule at %" PRIu32 " for %" PRIu32 " ticks was long by %" PRIu32 " ticks";
747 #else
748  const char* _formatString =
749  "%s: Port %" PRIi16 " schedule at %" PRIu32 " for %" PRIu32 " ticks was long by %" PRIu32 " ticks";
750 #endif
751 
752  Fw::TextLogString _logString;
753  _logString.format(
754  _formatString,
755 #if FW_OBJECT_NAMES == 1
756  this->m_objName.toChar(),
757 #endif
758  "MissedDeadline ",
759  p,
760  start,
761  length,
762  ticks
763  );
764 
765  this->m_logTextOut_OutputPort[0].invoke(
766  _id,
767  _logTime,
769  _logString
770  );
771  }
772 #endif
773  }
774 
775  // ----------------------------------------------------------------------
776  // Event throttle reset functions
777  // ----------------------------------------------------------------------
778 
781  {
782  // Reset throttle counter
783  this->m_MissedDeadlineThrottle = 0;
784  }
785 
786  // ----------------------------------------------------------------------
787  // Time
788  // ----------------------------------------------------------------------
789 
791  getTime() const
792  {
793  if (this->m_timeCaller_OutputPort[0].isConnected()) {
794  Fw::Time _time;
795  this->m_timeCaller_OutputPort[0].invoke(_time);
796  return _time;
797  }
798  else {
799  return Fw::Time(TimeBase::TB_NONE, 0, 0);
800  }
801  }
802 
803  // ----------------------------------------------------------------------
804  // Message dispatch functions
805  // ----------------------------------------------------------------------
806 
807  Fw::QueuedComponentBase::MsgDispatchStatus ActivePhaserComponentBase ::
808  doDispatch()
809  {
810  ComponentIpcSerializableBuffer _msg;
811  FwQueuePriorityType _priority = 0;
812 
813  Os::Queue::Status _msgStatus = this->m_queue.receive(
814  _msg,
816  _priority
817  );
818  FW_ASSERT(
819  _msgStatus == Os::Queue::OP_OK,
820  static_cast<FwAssertArgType>(_msgStatus)
821  );
822 
823  // Reset to beginning of buffer
824  _msg.resetDeser();
825 
826  FwEnumStoreType _desMsg = 0;
827  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
828  FW_ASSERT(
829  _deserStatus == Fw::FW_SERIALIZE_OK,
830  static_cast<FwAssertArgType>(_deserStatus)
831  );
832 
833  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
834 
835  if (_msgType == ACTIVEPHASER_COMPONENT_EXIT) {
836  return MSG_DISPATCH_EXIT;
837  }
838 
839  FwIndexType portNum = 0;
840  _deserStatus = _msg.deserializeTo(portNum);
841  FW_ASSERT(
842  _deserStatus == Fw::FW_SERIALIZE_OK,
843  static_cast<FwAssertArgType>(_deserStatus)
844  );
845 
846  switch (_msgType) {
847  // Handle async input port CycleIn
848  case CYCLEIN_CYCLE: {
849  // Deserialize argument cycleStart
850  Os::RawTime cycleStart;
851  _deserStatus = _msg.deserializeTo(cycleStart);
852  FW_ASSERT(
853  _deserStatus == Fw::FW_SERIALIZE_OK,
854  static_cast<FwAssertArgType>(_deserStatus)
855  );
856  // Call handler function
857  this->CycleIn_handler(
858  portNum,
859  cycleStart
860  );
861 
862  break;
863  }
864 
865  // Handle internal interface Tick
866  case INT_IF_TICK: {
867  // Make sure there was no data left over.
868  // That means the buffer size was incorrect.
869  FW_ASSERT(
870  _msg.getDeserializeSizeLeft() == 0,
871  static_cast<FwAssertArgType>(_msg.getDeserializeSizeLeft())
872  );
873 
874  // Call handler function
876 
877  break;
878  }
879 
880  default:
881  return MSG_DISPATCH_ERROR;
882  }
883 
884  return MSG_DISPATCH_OK;
885  }
886 
887  // ----------------------------------------------------------------------
888  // Calls for messages received on typed input ports
889  // ----------------------------------------------------------------------
890 
891  void ActivePhaserComponentBase ::
892  m_p_CycleIn_in(
893  Fw::PassiveComponentBase* callComp,
894  FwIndexType portNum,
895  Os::RawTime& cycleStart
896  )
897  {
898  FW_ASSERT(callComp);
899  ActivePhaserComponentBase* compPtr = static_cast<ActivePhaserComponentBase*>(callComp);
900  compPtr->CycleIn_handlerBase(
901  portNum,
902  cycleStart
903  );
904  }
905 
906 }
Serialization/Deserialization operation was successful.
static constexpr FwIndexType getNum_CycleIn_InputPorts()
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
The size of the serial representations of the port arguments.
Definition: CyclePortAc.hpp:37
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:71
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
Warning event that rate group has had a missed deadline.
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
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:26
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
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
message to exit active component task
const char * toChar() const
Convert to a C-style char*.
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:54
A serious but recoverable event.
bool isConnected() const
Definition: PortBase.cpp:38
#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
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)
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.
static constexpr FwIndexType getNum_PhaserMemberOut_OutputPorts()
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].
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
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
Implementation of malloc based allocator.
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
static constexpr FwIndexType getNum_logOut_OutputPorts()
void addCallPort(InputSchedPort *callPort)
Register an input port.
void log_WARNING_HI_MissedDeadline(FwIndexType p, U32 start, U32 length, U32 ticks)