F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
EventManagerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title EventManagerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for EventManager 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  EVENTMANAGER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  PINGIN_PING,
20  CMD_SET_ID_FILTER,
21  CMD_DUMP_FILTER_STATE,
22  INT_IF_LOQQUEUE,
23  };
24 
25  // Get the max size by constructing a union of the async input, command, and
26  // internal port serialization sizes
27  union BuffUnion {
30  // Size of loqQueue argument list
31  BYTE loqQueueIntIfSize[
32  sizeof(FwEventIdType) +
36  ];
37  };
38 
39  // Define a message buffer class large enough to handle all the
40  // asynchronous inputs to the component
41  class ComponentIpcSerializableBuffer :
43  {
44 
45  public:
46 
47  enum {
48  // Offset into data in buffer: Size of message ID and port number
49  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
50  // Max data size
51  MAX_DATA_SIZE = sizeof(BuffUnion),
52  // Max message size: Size of message id + size of port + max data size
53  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
54  };
55 
56  Fw::Serializable::SizeType getCapacity() const {
57  return sizeof(m_buff);
58  }
59 
60  U8* getBuffAddr() {
61  return m_buff;
62  }
63 
64  const U8* getBuffAddr() const {
65  return m_buff;
66  }
67 
68  private:
69  // Should be the max of all the input ports serialized sizes...
70  U8 m_buff[SERIALIZATION_SIZE];
71 
72  };
73  }
74 
75  // ----------------------------------------------------------------------
76  // Component initialization
77  // ----------------------------------------------------------------------
78 
81  FwSizeType queueDepth,
82  FwEnumStoreType instance
83  )
84  {
85  // Initialize base class
87 
88  // Connect input port CmdDisp
89  for (
90  FwIndexType port = 0;
91  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
92  port++
93  ) {
94  this->m_CmdDisp_InputPort[port].init();
95  this->m_CmdDisp_InputPort[port].addCallComp(
96  this,
97  m_p_CmdDisp_in
98  );
99  this->m_CmdDisp_InputPort[port].setPortNum(port);
100 
101 #if FW_OBJECT_NAMES == 1
102  Fw::ObjectName portName;
103  portName.format(
104  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
105  this->m_objName.toChar(),
106  port
107  );
108  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
109 #endif
110  }
111 
112  // Connect input port LogRecv
113  for (
114  FwIndexType port = 0;
115  port < static_cast<FwIndexType>(this->getNum_LogRecv_InputPorts());
116  port++
117  ) {
118  this->m_LogRecv_InputPort[port].init();
119  this->m_LogRecv_InputPort[port].addCallComp(
120  this,
121  m_p_LogRecv_in
122  );
123  this->m_LogRecv_InputPort[port].setPortNum(port);
124 
125 #if FW_OBJECT_NAMES == 1
126  Fw::ObjectName portName;
127  portName.format(
128  "%s_LogRecv_InputPort[%" PRI_FwIndexType "]",
129  this->m_objName.toChar(),
130  port
131  );
132  this->m_LogRecv_InputPort[port].setObjName(portName.toChar());
133 #endif
134  }
135 
136  // Connect input port pingIn
137  for (
138  FwIndexType port = 0;
139  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
140  port++
141  ) {
142  this->m_pingIn_InputPort[port].init();
143  this->m_pingIn_InputPort[port].addCallComp(
144  this,
145  m_p_pingIn_in
146  );
147  this->m_pingIn_InputPort[port].setPortNum(port);
148 
149 #if FW_OBJECT_NAMES == 1
150  Fw::ObjectName portName;
151  portName.format(
152  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
153  this->m_objName.toChar(),
154  port
155  );
156  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
157 #endif
158  }
159 
160  // Connect output port CmdReg
161  for (
162  FwIndexType port = 0;
163  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
164  port++
165  ) {
166  this->m_CmdReg_OutputPort[port].init();
167 
168 #if FW_OBJECT_NAMES == 1
169  Fw::ObjectName portName;
170  portName.format(
171  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
172  this->m_objName.toChar(),
173  port
174  );
175  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
176 #endif
177  }
178 
179  // Connect output port CmdStatus
180  for (
181  FwIndexType port = 0;
182  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
183  port++
184  ) {
185  this->m_CmdStatus_OutputPort[port].init();
186 
187 #if FW_OBJECT_NAMES == 1
188  Fw::ObjectName portName;
189  portName.format(
190  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
191  this->m_objName.toChar(),
192  port
193  );
194  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
195 #endif
196  }
197 
198  // Connect output port Log
199  for (
200  FwIndexType port = 0;
201  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
202  port++
203  ) {
204  this->m_Log_OutputPort[port].init();
205 
206 #if FW_OBJECT_NAMES == 1
207  Fw::ObjectName portName;
208  portName.format(
209  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
210  this->m_objName.toChar(),
211  port
212  );
213  this->m_Log_OutputPort[port].setObjName(portName.toChar());
214 #endif
215  }
216 
217 #if FW_ENABLE_TEXT_LOGGING == 1
218  // Connect output port LogText
219  for (
220  FwIndexType port = 0;
221  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
222  port++
223  ) {
224  this->m_LogText_OutputPort[port].init();
225 
226 #if FW_OBJECT_NAMES == 1
227  Fw::ObjectName portName;
228  portName.format(
229  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
230  this->m_objName.toChar(),
231  port
232  );
233  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
234 #endif
235  }
236 #endif
237 
238  // Connect output port Time
239  for (
240  FwIndexType port = 0;
241  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
242  port++
243  ) {
244  this->m_Time_OutputPort[port].init();
245 
246 #if FW_OBJECT_NAMES == 1
247  Fw::ObjectName portName;
248  portName.format(
249  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
250  this->m_objName.toChar(),
251  port
252  );
253  this->m_Time_OutputPort[port].setObjName(portName.toChar());
254 #endif
255  }
256 
257  // Connect output port FatalAnnounce
258  for (
259  FwIndexType port = 0;
260  port < static_cast<FwIndexType>(this->getNum_FatalAnnounce_OutputPorts());
261  port++
262  ) {
263  this->m_FatalAnnounce_OutputPort[port].init();
264 
265 #if FW_OBJECT_NAMES == 1
266  Fw::ObjectName portName;
267  portName.format(
268  "%s_FatalAnnounce_OutputPort[%" PRI_FwIndexType "]",
269  this->m_objName.toChar(),
270  port
271  );
272  this->m_FatalAnnounce_OutputPort[port].setObjName(portName.toChar());
273 #endif
274  }
275 
276  // Connect output port PktSend
277  for (
278  FwIndexType port = 0;
279  port < static_cast<FwIndexType>(this->getNum_PktSend_OutputPorts());
280  port++
281  ) {
282  this->m_PktSend_OutputPort[port].init();
283 
284 #if FW_OBJECT_NAMES == 1
285  Fw::ObjectName portName;
286  portName.format(
287  "%s_PktSend_OutputPort[%" PRI_FwIndexType "]",
288  this->m_objName.toChar(),
289  port
290  );
291  this->m_PktSend_OutputPort[port].setObjName(portName.toChar());
292 #endif
293  }
294 
295  // Connect output port pingOut
296  for (
297  FwIndexType port = 0;
298  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
299  port++
300  ) {
301  this->m_pingOut_OutputPort[port].init();
302 
303 #if FW_OBJECT_NAMES == 1
304  Fw::ObjectName portName;
305  portName.format(
306  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
307  this->m_objName.toChar(),
308  port
309  );
310  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
311 #endif
312  }
313 
314  // Create the queue
315  Os::Queue::Status qStat = this->createQueue(
316  queueDepth,
317  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
318  );
319  FW_ASSERT(
320  Os::Queue::Status::OP_OK == qStat,
321  static_cast<FwAssertArgType>(qStat)
322  );
323  }
324 
325  // ----------------------------------------------------------------------
326  // Getters for special input ports
327  // ----------------------------------------------------------------------
328 
331  {
332  FW_ASSERT(
333  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
334  static_cast<FwAssertArgType>(portNum)
335  );
336 
337  return &this->m_CmdDisp_InputPort[portNum];
338  }
339 
340  // ----------------------------------------------------------------------
341  // Getters for typed input ports
342  // ----------------------------------------------------------------------
343 
346  {
347  FW_ASSERT(
348  (0 <= portNum) && (portNum < this->getNum_LogRecv_InputPorts()),
349  static_cast<FwAssertArgType>(portNum)
350  );
351 
352  return &this->m_LogRecv_InputPort[portNum];
353  }
354 
357  {
358  FW_ASSERT(
359  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
360  static_cast<FwAssertArgType>(portNum)
361  );
362 
363  return &this->m_pingIn_InputPort[portNum];
364  }
365 
366  // ----------------------------------------------------------------------
367  // Connect input ports to special output ports
368  // ----------------------------------------------------------------------
369 
372  FwIndexType portNum,
373  Fw::InputCmdRegPort* port
374  )
375  {
376  FW_ASSERT(
377  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
378  static_cast<FwAssertArgType>(portNum)
379  );
380 
381  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
382  }
383 
386  FwIndexType portNum,
388  )
389  {
390  FW_ASSERT(
391  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
392  static_cast<FwAssertArgType>(portNum)
393  );
394 
395  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
396  }
397 
400  FwIndexType portNum,
401  Fw::InputLogPort* port
402  )
403  {
404  FW_ASSERT(
405  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
406  static_cast<FwAssertArgType>(portNum)
407  );
408 
409  this->m_Log_OutputPort[portNum].addCallPort(port);
410  }
411 
412 #if FW_ENABLE_TEXT_LOGGING == 1
413 
414  void EventManagerComponentBase ::
415  set_LogText_OutputPort(
416  FwIndexType portNum,
418  )
419  {
420  FW_ASSERT(
421  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
422  static_cast<FwAssertArgType>(portNum)
423  );
424 
425  this->m_LogText_OutputPort[portNum].addCallPort(port);
426  }
427 
428 #endif
429 
432  FwIndexType portNum,
433  Fw::InputTimePort* port
434  )
435  {
436  FW_ASSERT(
437  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
438  static_cast<FwAssertArgType>(portNum)
439  );
440 
441  this->m_Time_OutputPort[portNum].addCallPort(port);
442  }
443 
444  // ----------------------------------------------------------------------
445  // Connect typed input ports to typed output ports
446  // ----------------------------------------------------------------------
447 
450  FwIndexType portNum,
452  )
453  {
454  FW_ASSERT(
455  (0 <= portNum) && (portNum < this->getNum_FatalAnnounce_OutputPorts()),
456  static_cast<FwAssertArgType>(portNum)
457  );
458 
459  this->m_FatalAnnounce_OutputPort[portNum].addCallPort(port);
460  }
461 
464  FwIndexType portNum,
465  Fw::InputComPort* port
466  )
467  {
468  FW_ASSERT(
469  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
470  static_cast<FwAssertArgType>(portNum)
471  );
472 
473  this->m_PktSend_OutputPort[portNum].addCallPort(port);
474  }
475 
478  FwIndexType portNum,
479  Svc::InputPingPort* port
480  )
481  {
482  FW_ASSERT(
483  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
484  static_cast<FwAssertArgType>(portNum)
485  );
486 
487  this->m_pingOut_OutputPort[portNum].addCallPort(port);
488  }
489 
490 #if FW_PORT_SERIALIZATION
491 
492  // ----------------------------------------------------------------------
493  // Connect serial input ports to special output ports
494  // ----------------------------------------------------------------------
495 
498  FwIndexType portNum,
499  Fw::InputSerializePort* port
500  )
501  {
502  FW_ASSERT(
503  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
504  static_cast<FwAssertArgType>(portNum)
505  );
506 
507  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
508  }
509 
512  FwIndexType portNum,
513  Fw::InputSerializePort* port
514  )
515  {
516  FW_ASSERT(
517  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
518  static_cast<FwAssertArgType>(portNum)
519  );
520 
521  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
522  }
523 
526  FwIndexType portNum,
527  Fw::InputSerializePort* port
528  )
529  {
530  FW_ASSERT(
531  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
532  static_cast<FwAssertArgType>(portNum)
533  );
534 
535  this->m_Log_OutputPort[portNum].registerSerialPort(port);
536  }
537 
538 #if FW_ENABLE_TEXT_LOGGING == 1
539 
540  void EventManagerComponentBase ::
541  set_LogText_OutputPort(
542  FwIndexType portNum,
543  Fw::InputSerializePort* port
544  )
545  {
546  FW_ASSERT(
547  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
548  static_cast<FwAssertArgType>(portNum)
549  );
550 
551  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
552  }
553 
554 #endif
555 
558  FwIndexType portNum,
559  Fw::InputSerializePort* port
560  )
561  {
562  FW_ASSERT(
563  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
564  static_cast<FwAssertArgType>(portNum)
565  );
566 
567  this->m_Time_OutputPort[portNum].registerSerialPort(port);
568  }
569 
570 #endif
571 
572 #if FW_PORT_SERIALIZATION
573 
574  // ----------------------------------------------------------------------
575  // Connect serial input ports to typed output ports
576  // ----------------------------------------------------------------------
577 
580  FwIndexType portNum,
581  Fw::InputSerializePort* port
582  )
583  {
584  FW_ASSERT(
585  (0 <= portNum) && (portNum < this->getNum_FatalAnnounce_OutputPorts()),
586  static_cast<FwAssertArgType>(portNum)
587  );
588 
589  this->m_FatalAnnounce_OutputPort[portNum].registerSerialPort(port);
590  }
591 
594  FwIndexType portNum,
595  Fw::InputSerializePort* port
596  )
597  {
598  FW_ASSERT(
599  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
600  static_cast<FwAssertArgType>(portNum)
601  );
602 
603  this->m_PktSend_OutputPort[portNum].registerSerialPort(port);
604  }
605 
608  FwIndexType portNum,
609  Fw::InputSerializePort* port
610  )
611  {
612  FW_ASSERT(
613  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
614  static_cast<FwAssertArgType>(portNum)
615  );
616 
617  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
618  }
619 
620 #endif
621 
622  // ----------------------------------------------------------------------
623  // Command registration
624  // ----------------------------------------------------------------------
625 
628  {
629  FW_ASSERT(this->m_CmdReg_OutputPort[0].isConnected());
630 
631  this->m_CmdReg_OutputPort[0].invoke(
633  );
634 
635  this->m_CmdReg_OutputPort[0].invoke(
637  );
638 
639  this->m_CmdReg_OutputPort[0].invoke(
641  );
642  }
643 
644  // ----------------------------------------------------------------------
645  // Component construction and destruction
646  // ----------------------------------------------------------------------
647 
649  EventManagerComponentBase(const char* compName) :
650  Fw::ActiveComponentBase(compName)
651  {
652 
653  }
654 
657  {
658 
659  }
660 
661  // ----------------------------------------------------------------------
662  // Connection status queries for special output ports
663  // ----------------------------------------------------------------------
664 
667  {
668  FW_ASSERT(
669  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
670  static_cast<FwAssertArgType>(portNum)
671  );
672 
673  return this->m_CmdReg_OutputPort[portNum].isConnected();
674  }
675 
678  {
679  FW_ASSERT(
680  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
681  static_cast<FwAssertArgType>(portNum)
682  );
683 
684  return this->m_CmdStatus_OutputPort[portNum].isConnected();
685  }
686 
689  {
690  FW_ASSERT(
691  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
692  static_cast<FwAssertArgType>(portNum)
693  );
694 
695  return this->m_Log_OutputPort[portNum].isConnected();
696  }
697 
698 #if FW_ENABLE_TEXT_LOGGING == 1
699 
700  bool EventManagerComponentBase ::
701  isConnected_LogText_OutputPort(FwIndexType portNum)
702  {
703  FW_ASSERT(
704  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
705  static_cast<FwAssertArgType>(portNum)
706  );
707 
708  return this->m_LogText_OutputPort[portNum].isConnected();
709  }
710 
711 #endif
712 
715  {
716  FW_ASSERT(
717  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
718  static_cast<FwAssertArgType>(portNum)
719  );
720 
721  return this->m_Time_OutputPort[portNum].isConnected();
722  }
723 
724  // ----------------------------------------------------------------------
725  // Connection status queries for typed output ports
726  // ----------------------------------------------------------------------
727 
730  {
731  FW_ASSERT(
732  (0 <= portNum) && (portNum < this->getNum_FatalAnnounce_OutputPorts()),
733  static_cast<FwAssertArgType>(portNum)
734  );
735 
736  return this->m_FatalAnnounce_OutputPort[portNum].isConnected();
737  }
738 
741  {
742  FW_ASSERT(
743  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
744  static_cast<FwAssertArgType>(portNum)
745  );
746 
747  return this->m_PktSend_OutputPort[portNum].isConnected();
748  }
749 
752  {
753  FW_ASSERT(
754  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
755  static_cast<FwAssertArgType>(portNum)
756  );
757 
758  return this->m_pingOut_OutputPort[portNum].isConnected();
759  }
760 
761  // ----------------------------------------------------------------------
762  // Port handler base-class functions for typed input ports
763  //
764  // Call these functions directly to bypass the corresponding ports
765  // ----------------------------------------------------------------------
766 
769  FwIndexType portNum,
770  FwEventIdType id,
771  Fw::Time& timeTag,
772  const Fw::LogSeverity& severity,
773  Fw::LogBuffer& args
774  )
775  {
776  // Make sure port number is valid
777  FW_ASSERT(
778  (0 <= portNum) && (portNum < this->getNum_LogRecv_InputPorts()),
779  static_cast<FwAssertArgType>(portNum)
780  );
781 
782  // Call handler function
783  this->LogRecv_handler(
784  portNum,
785  id,
786  timeTag,
787  severity,
788  args
789  );
790  }
791 
794  FwIndexType portNum,
795  U32 key
796  )
797  {
798  // Make sure port number is valid
799  FW_ASSERT(
800  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
801  static_cast<FwAssertArgType>(portNum)
802  );
803 
804  // Call pre-message hook
806  portNum,
807  key
808  );
809  ComponentIpcSerializableBuffer msg;
811 
812  // Serialize message ID
813  _status = msg.serializeFrom(
814  static_cast<FwEnumStoreType>(PINGIN_PING)
815  );
816  FW_ASSERT(
817  _status == Fw::FW_SERIALIZE_OK,
818  static_cast<FwAssertArgType>(_status)
819  );
820 
821  // Serialize port number
822  _status = msg.serializeFrom(portNum);
823  FW_ASSERT(
824  _status == Fw::FW_SERIALIZE_OK,
825  static_cast<FwAssertArgType>(_status)
826  );
827 
828  // Serialize argument key
829  _status = msg.serializeFrom(key);
830  FW_ASSERT(
831  _status == Fw::FW_SERIALIZE_OK,
832  static_cast<FwAssertArgType>(_status)
833  );
834 
835  // Send message
837  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
838 
839  FW_ASSERT(
840  qStatus == Os::Queue::OP_OK,
841  static_cast<FwAssertArgType>(qStatus)
842  );
843  }
844 
845  // ----------------------------------------------------------------------
846  // Pre-message hooks for typed async input ports
847  //
848  // Each of these functions is invoked just before processing a message
849  // on the corresponding port. By default, they do nothing. You can
850  // override them to provide specific pre-message behavior.
851  // ----------------------------------------------------------------------
852 
855  FwIndexType portNum,
856  U32 key
857  )
858  {
859  // Default: no-op
860  }
861 
862  // ----------------------------------------------------------------------
863  // Invocation functions for typed output ports
864  // ----------------------------------------------------------------------
865 
868  FwIndexType portNum,
869  FwEventIdType Id
870  )
871  {
872  FW_ASSERT(
873  (0 <= portNum) && (portNum < this->getNum_FatalAnnounce_OutputPorts()),
874  static_cast<FwAssertArgType>(portNum)
875  );
876 
877  FW_ASSERT(
878  this->m_FatalAnnounce_OutputPort[portNum].isConnected(),
879  static_cast<FwAssertArgType>(portNum)
880  );
881  this->m_FatalAnnounce_OutputPort[portNum].invoke(
882  Id
883  );
884  }
885 
888  FwIndexType portNum,
889  Fw::ComBuffer& data,
890  U32 context
891  )
892  {
893  FW_ASSERT(
894  (0 <= portNum) && (portNum < this->getNum_PktSend_OutputPorts()),
895  static_cast<FwAssertArgType>(portNum)
896  );
897 
898  FW_ASSERT(
899  this->m_PktSend_OutputPort[portNum].isConnected(),
900  static_cast<FwAssertArgType>(portNum)
901  );
902  this->m_PktSend_OutputPort[portNum].invoke(
903  data,
904  context
905  );
906  }
907 
910  FwIndexType portNum,
911  U32 key
912  )
913  {
914  FW_ASSERT(
915  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
916  static_cast<FwAssertArgType>(portNum)
917  );
918 
919  FW_ASSERT(
920  this->m_pingOut_OutputPort[portNum].isConnected(),
921  static_cast<FwAssertArgType>(portNum)
922  );
923  this->m_pingOut_OutputPort[portNum].invoke(
924  key
925  );
926  }
927 
928  // ----------------------------------------------------------------------
929  // Internal interface base-class functions
930  // ----------------------------------------------------------------------
931 
934  FwEventIdType id,
935  const Fw::Time& timeTag,
936  const Fw::LogSeverity& severity,
937  const Fw::LogBuffer& args
938  )
939  {
940  ComponentIpcSerializableBuffer msg;
942 
943  // Serialize the message ID
944  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(INT_IF_LOQQUEUE));
945  FW_ASSERT (
946  _status == Fw::FW_SERIALIZE_OK,
947  static_cast<FwAssertArgType>(_status)
948  );
949 
950  // Fake port number to make message dequeue work
951  _status = msg.serializeFrom(static_cast<FwIndexType>(0));
952  FW_ASSERT (
953  _status == Fw::FW_SERIALIZE_OK,
954  static_cast<FwAssertArgType>(_status)
955  );
956 
957  _status = msg.serializeFrom(id);
958  FW_ASSERT(
959  _status == Fw::FW_SERIALIZE_OK,
960  static_cast<FwAssertArgType>(_status)
961  );
962 
963  _status = msg.serializeFrom(timeTag);
964  FW_ASSERT(
965  _status == Fw::FW_SERIALIZE_OK,
966  static_cast<FwAssertArgType>(_status)
967  );
968 
969  _status = msg.serializeFrom(severity);
970  FW_ASSERT(
971  _status == Fw::FW_SERIALIZE_OK,
972  static_cast<FwAssertArgType>(_status)
973  );
974 
975  _status = msg.serializeFrom(args);
976  FW_ASSERT(
977  _status == Fw::FW_SERIALIZE_OK,
978  static_cast<FwAssertArgType>(_status)
979  );
980 
981  // Send message
983  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
984 
985  if (qStatus == Os::Queue::Status::FULL) {
986  this->incNumMsgDropped();
987  return;
988  }
989 
990  FW_ASSERT(
991  qStatus == Os::Queue::OP_OK,
992  static_cast<FwAssertArgType>(qStatus)
993  );
994  }
995 
996  // ----------------------------------------------------------------------
997  // Command response
998  // ----------------------------------------------------------------------
999 
1002  FwOpcodeType opCode,
1003  U32 cmdSeq,
1004  Fw::CmdResponse response
1005  )
1006  {
1007  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
1008  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
1009  }
1010 
1011  // ----------------------------------------------------------------------
1012  // Command handler base-class functions
1013  //
1014  // Call these functions directly to bypass the command input port
1015  // ----------------------------------------------------------------------
1016 
1019  FwOpcodeType opCode,
1020  U32 cmdSeq,
1021  Fw::CmdArgBuffer& args
1022  )
1023  {
1024  // Deserialize the arguments
1026 
1027  // Reset the buffer
1028  args.resetDeser();
1029 
1031  _status = args.deserializeTo(filterLevel);
1032  if (_status != Fw::FW_SERIALIZE_OK) {
1033  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1034  this->m_CmdStatus_OutputPort[0].invoke(
1035  opCode,
1036  cmdSeq,
1038  );
1039  }
1040  return;
1041  }
1042 
1043  Svc::EventManager_Enabled filterEnabled;
1044  _status = args.deserializeTo(filterEnabled);
1045  if (_status != Fw::FW_SERIALIZE_OK) {
1046  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1047  this->m_CmdStatus_OutputPort[0].invoke(
1048  opCode,
1049  cmdSeq,
1051  );
1052  }
1053  return;
1054  }
1055 
1056 #if FW_CMD_CHECK_RESIDUAL
1057  // Make sure there was no data left over.
1058  // That means the argument buffer size was incorrect.
1059  if (args.getDeserializeSizeLeft() != 0) {
1060  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1061  this->m_CmdStatus_OutputPort[0].invoke(
1062  opCode,
1063  cmdSeq,
1065  );
1066  }
1067  return;
1068  }
1069 #endif
1070 
1072  opCode, cmdSeq,
1073  filterLevel,
1074  filterEnabled
1075  );
1076  }
1077 
1080  FwOpcodeType opCode,
1081  U32 cmdSeq,
1082  Fw::CmdArgBuffer& args
1083  )
1084  {
1085  // Call pre-message hook
1086  this->SET_ID_FILTER_preMsgHook(opCode,cmdSeq);
1087 
1088  // Defer deserializing arguments to the message dispatcher
1089  // to avoid deserializing and reserializing just for IPC
1090  ComponentIpcSerializableBuffer msg;
1092 
1093  // Serialize for IPC
1094  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_SET_ID_FILTER));
1095  FW_ASSERT (
1096  _status == Fw::FW_SERIALIZE_OK,
1097  static_cast<FwAssertArgType>(_status)
1098  );
1099 
1100  // Fake port number to make message dequeue work
1101  FwIndexType port = 0;
1102 
1103  _status = msg.serializeFrom(port);
1104  FW_ASSERT (
1105  _status == Fw::FW_SERIALIZE_OK,
1106  static_cast<FwAssertArgType>(_status)
1107  );
1108 
1109  _status = msg.serializeFrom(opCode);
1110  FW_ASSERT (
1111  _status == Fw::FW_SERIALIZE_OK,
1112  static_cast<FwAssertArgType>(_status)
1113  );
1114 
1115  _status = msg.serializeFrom(cmdSeq);
1116  FW_ASSERT (
1117  _status == Fw::FW_SERIALIZE_OK,
1118  static_cast<FwAssertArgType>(_status)
1119  );
1120 
1121  _status = msg.serializeFrom(args);
1122  FW_ASSERT (
1123  _status == Fw::FW_SERIALIZE_OK,
1124  static_cast<FwAssertArgType>(_status)
1125  );
1126 
1127  // Send message
1129  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1130 
1131  FW_ASSERT(
1132  qStatus == Os::Queue::OP_OK,
1133  static_cast<FwAssertArgType>(qStatus)
1134  );
1135  }
1136 
1139  FwOpcodeType opCode,
1140  U32 cmdSeq,
1141  Fw::CmdArgBuffer& args
1142  )
1143  {
1144  // Call pre-message hook
1145  this->DUMP_FILTER_STATE_preMsgHook(opCode,cmdSeq);
1146 
1147  // Defer deserializing arguments to the message dispatcher
1148  // to avoid deserializing and reserializing just for IPC
1149  ComponentIpcSerializableBuffer msg;
1151 
1152  // Serialize for IPC
1153  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_DUMP_FILTER_STATE));
1154  FW_ASSERT (
1155  _status == Fw::FW_SERIALIZE_OK,
1156  static_cast<FwAssertArgType>(_status)
1157  );
1158 
1159  // Fake port number to make message dequeue work
1160  FwIndexType port = 0;
1161 
1162  _status = msg.serializeFrom(port);
1163  FW_ASSERT (
1164  _status == Fw::FW_SERIALIZE_OK,
1165  static_cast<FwAssertArgType>(_status)
1166  );
1167 
1168  _status = msg.serializeFrom(opCode);
1169  FW_ASSERT (
1170  _status == Fw::FW_SERIALIZE_OK,
1171  static_cast<FwAssertArgType>(_status)
1172  );
1173 
1174  _status = msg.serializeFrom(cmdSeq);
1175  FW_ASSERT (
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 
1180  _status = msg.serializeFrom(args);
1181  FW_ASSERT (
1182  _status == Fw::FW_SERIALIZE_OK,
1183  static_cast<FwAssertArgType>(_status)
1184  );
1185 
1186  // Send message
1188  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1189 
1190  FW_ASSERT(
1191  qStatus == Os::Queue::OP_OK,
1192  static_cast<FwAssertArgType>(qStatus)
1193  );
1194  }
1195 
1196  // ----------------------------------------------------------------------
1197  // Pre-message hooks for async commands
1198  //
1199  // Each of these functions is invoked just before processing the
1200  // corresponding command. By default they do nothing. You can
1201  // override them to provide specific pre-command behavior.
1202  // ----------------------------------------------------------------------
1203 
1206  FwOpcodeType opCode,
1207  U32 cmdSeq
1208  )
1209  {
1210  // Defaults to no-op; can be overridden
1211  (void) opCode;
1212  (void) cmdSeq;
1213  }
1214 
1217  FwOpcodeType opCode,
1218  U32 cmdSeq
1219  )
1220  {
1221  // Defaults to no-op; can be overridden
1222  (void) opCode;
1223  (void) cmdSeq;
1224  }
1225 
1226  // ----------------------------------------------------------------------
1227  // Event logging functions
1228  // ----------------------------------------------------------------------
1229 
1233  bool enabled
1234  ) const
1235  {
1236  // Get the time
1237  Fw::Time _logTime;
1238  if (this->m_Time_OutputPort[0].isConnected()) {
1239  this->m_Time_OutputPort[0].invoke(_logTime);
1240  }
1241 
1242  FwEventIdType _id = static_cast<FwEventIdType>(0);
1243 
1244  _id = this->getIdBase() + EVENTID_SEVERITY_FILTER_STATE;
1245 
1246  // Emit the event on the log port
1247  if (this->m_Log_OutputPort[0].isConnected()) {
1248  Fw::LogBuffer _logBuff;
1250 
1251 #if FW_AMPCS_COMPATIBLE
1252  // Serialize the number of arguments
1253  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1254  FW_ASSERT(
1255  _status == Fw::FW_SERIALIZE_OK,
1256  static_cast<FwAssertArgType>(_status)
1257  );
1258 #endif
1259 
1260 #if FW_AMPCS_COMPATIBLE
1261  // Serialize the argument size
1262  _status = _logBuff.serializeFrom(
1264  );
1265  FW_ASSERT(
1266  _status == Fw::FW_SERIALIZE_OK,
1267  static_cast<FwAssertArgType>(_status)
1268  );
1269 #endif
1270  _status = _logBuff.serializeFrom(severity);
1271  FW_ASSERT(
1272  _status == Fw::FW_SERIALIZE_OK,
1273  static_cast<FwAssertArgType>(_status)
1274  );
1275 
1276 #if FW_AMPCS_COMPATIBLE
1277  // Serialize the argument size
1278  _status = _logBuff.serializeFrom(
1279  static_cast<U8>(sizeof(U8))
1280  );
1281  FW_ASSERT(
1282  _status == Fw::FW_SERIALIZE_OK,
1283  static_cast<FwAssertArgType>(_status)
1284  );
1285 #endif
1286  _status = _logBuff.serializeFrom(enabled);
1287  FW_ASSERT(
1288  _status == Fw::FW_SERIALIZE_OK,
1289  static_cast<FwAssertArgType>(_status)
1290  );
1291 
1292  this->m_Log_OutputPort[0].invoke(
1293  _id,
1294  _logTime,
1296  _logBuff
1297  );
1298  }
1299 
1300  // Emit the event on the text log port
1301 #if FW_ENABLE_TEXT_LOGGING
1302  if (this->m_LogText_OutputPort[0].isConnected()) {
1303 #if FW_OBJECT_NAMES == 1
1304  const char* _formatString =
1305  "(%s) %s: %s filter state. %d";
1306 #else
1307  const char* _formatString =
1308  "%s: %s filter state. %d";
1309 #endif
1310 
1311  Fw::String severityStr;
1312  severity.toString(severityStr);
1313 
1314  Fw::TextLogString _logString;
1315  _logString.format(
1316  _formatString,
1317 #if FW_OBJECT_NAMES == 1
1318  this->m_objName.toChar(),
1319 #endif
1320  "SEVERITY_FILTER_STATE ",
1321  severityStr.toChar(),
1322  enabled
1323  );
1324 
1325  this->m_LogText_OutputPort[0].invoke(
1326  _id,
1327  _logTime,
1329  _logString
1330  );
1331  }
1332 #endif
1333  }
1334 
1337  {
1338  // Get the time
1339  Fw::Time _logTime;
1340  if (this->m_Time_OutputPort[0].isConnected()) {
1341  this->m_Time_OutputPort[0].invoke(_logTime);
1342  }
1343 
1344  FwEventIdType _id = static_cast<FwEventIdType>(0);
1345 
1346  _id = this->getIdBase() + EVENTID_ID_FILTER_ENABLED;
1347 
1348  // Emit the event on the log port
1349  if (this->m_Log_OutputPort[0].isConnected()) {
1350  Fw::LogBuffer _logBuff;
1352 
1353 #if FW_AMPCS_COMPATIBLE
1354  // Serialize the number of arguments
1355  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1356  FW_ASSERT(
1357  _status == Fw::FW_SERIALIZE_OK,
1358  static_cast<FwAssertArgType>(_status)
1359  );
1360 #endif
1361 
1362 #if FW_AMPCS_COMPATIBLE
1363  // Serialize the argument size
1364  _status = _logBuff.serializeFrom(
1365  static_cast<U8>(sizeof(FwEventIdType))
1366  );
1367  FW_ASSERT(
1368  _status == Fw::FW_SERIALIZE_OK,
1369  static_cast<FwAssertArgType>(_status)
1370  );
1371 #endif
1372  _status = _logBuff.serializeFrom(ID);
1373  FW_ASSERT(
1374  _status == Fw::FW_SERIALIZE_OK,
1375  static_cast<FwAssertArgType>(_status)
1376  );
1377 
1378  this->m_Log_OutputPort[0].invoke(
1379  _id,
1380  _logTime,
1382  _logBuff
1383  );
1384  }
1385 
1386  // Emit the event on the text log port
1387 #if FW_ENABLE_TEXT_LOGGING
1388  if (this->m_LogText_OutputPort[0].isConnected()) {
1389 #if FW_OBJECT_NAMES == 1
1390  const char* _formatString =
1391  "(%s) %s: ID %" PRIu32 " is filtered.";
1392 #else
1393  const char* _formatString =
1394  "%s: ID %" PRIu32 " is filtered.";
1395 #endif
1396 
1397  Fw::TextLogString _logString;
1398  _logString.format(
1399  _formatString,
1400 #if FW_OBJECT_NAMES == 1
1401  this->m_objName.toChar(),
1402 #endif
1403  "ID_FILTER_ENABLED ",
1404  ID
1405  );
1406 
1407  this->m_LogText_OutputPort[0].invoke(
1408  _id,
1409  _logTime,
1411  _logString
1412  );
1413  }
1414 #endif
1415  }
1416 
1419  {
1420  // Get the time
1421  Fw::Time _logTime;
1422  if (this->m_Time_OutputPort[0].isConnected()) {
1423  this->m_Time_OutputPort[0].invoke(_logTime);
1424  }
1425 
1426  FwEventIdType _id = static_cast<FwEventIdType>(0);
1427 
1428  _id = this->getIdBase() + EVENTID_ID_FILTER_LIST_FULL;
1429 
1430  // Emit the event on the log port
1431  if (this->m_Log_OutputPort[0].isConnected()) {
1432  Fw::LogBuffer _logBuff;
1434 
1435 #if FW_AMPCS_COMPATIBLE
1436  // Serialize the number of arguments
1437  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1438  FW_ASSERT(
1439  _status == Fw::FW_SERIALIZE_OK,
1440  static_cast<FwAssertArgType>(_status)
1441  );
1442 #endif
1443 
1444 #if FW_AMPCS_COMPATIBLE
1445  // Serialize the argument size
1446  _status = _logBuff.serializeFrom(
1447  static_cast<U8>(sizeof(FwEventIdType))
1448  );
1449  FW_ASSERT(
1450  _status == Fw::FW_SERIALIZE_OK,
1451  static_cast<FwAssertArgType>(_status)
1452  );
1453 #endif
1454  _status = _logBuff.serializeFrom(ID);
1455  FW_ASSERT(
1456  _status == Fw::FW_SERIALIZE_OK,
1457  static_cast<FwAssertArgType>(_status)
1458  );
1459 
1460  this->m_Log_OutputPort[0].invoke(
1461  _id,
1462  _logTime,
1464  _logBuff
1465  );
1466  }
1467 
1468  // Emit the event on the text log port
1469 #if FW_ENABLE_TEXT_LOGGING
1470  if (this->m_LogText_OutputPort[0].isConnected()) {
1471 #if FW_OBJECT_NAMES == 1
1472  const char* _formatString =
1473  "(%s) %s: ID filter list is full. Cannot filter %" PRIu32 " .";
1474 #else
1475  const char* _formatString =
1476  "%s: ID filter list is full. Cannot filter %" PRIu32 " .";
1477 #endif
1478 
1479  Fw::TextLogString _logString;
1480  _logString.format(
1481  _formatString,
1482 #if FW_OBJECT_NAMES == 1
1483  this->m_objName.toChar(),
1484 #endif
1485  "ID_FILTER_LIST_FULL ",
1486  ID
1487  );
1488 
1489  this->m_LogText_OutputPort[0].invoke(
1490  _id,
1491  _logTime,
1493  _logString
1494  );
1495  }
1496 #endif
1497  }
1498 
1501  {
1502  // Get the time
1503  Fw::Time _logTime;
1504  if (this->m_Time_OutputPort[0].isConnected()) {
1505  this->m_Time_OutputPort[0].invoke(_logTime);
1506  }
1507 
1508  FwEventIdType _id = static_cast<FwEventIdType>(0);
1509 
1510  _id = this->getIdBase() + EVENTID_ID_FILTER_REMOVED;
1511 
1512  // Emit the event on the log port
1513  if (this->m_Log_OutputPort[0].isConnected()) {
1514  Fw::LogBuffer _logBuff;
1516 
1517 #if FW_AMPCS_COMPATIBLE
1518  // Serialize the number of arguments
1519  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1520  FW_ASSERT(
1521  _status == Fw::FW_SERIALIZE_OK,
1522  static_cast<FwAssertArgType>(_status)
1523  );
1524 #endif
1525 
1526 #if FW_AMPCS_COMPATIBLE
1527  // Serialize the argument size
1528  _status = _logBuff.serializeFrom(
1529  static_cast<U8>(sizeof(FwEventIdType))
1530  );
1531  FW_ASSERT(
1532  _status == Fw::FW_SERIALIZE_OK,
1533  static_cast<FwAssertArgType>(_status)
1534  );
1535 #endif
1536  _status = _logBuff.serializeFrom(ID);
1537  FW_ASSERT(
1538  _status == Fw::FW_SERIALIZE_OK,
1539  static_cast<FwAssertArgType>(_status)
1540  );
1541 
1542  this->m_Log_OutputPort[0].invoke(
1543  _id,
1544  _logTime,
1546  _logBuff
1547  );
1548  }
1549 
1550  // Emit the event on the text log port
1551 #if FW_ENABLE_TEXT_LOGGING
1552  if (this->m_LogText_OutputPort[0].isConnected()) {
1553 #if FW_OBJECT_NAMES == 1
1554  const char* _formatString =
1555  "(%s) %s: ID filter ID %" PRIu32 " removed.";
1556 #else
1557  const char* _formatString =
1558  "%s: ID filter ID %" PRIu32 " removed.";
1559 #endif
1560 
1561  Fw::TextLogString _logString;
1562  _logString.format(
1563  _formatString,
1564 #if FW_OBJECT_NAMES == 1
1565  this->m_objName.toChar(),
1566 #endif
1567  "ID_FILTER_REMOVED ",
1568  ID
1569  );
1570 
1571  this->m_LogText_OutputPort[0].invoke(
1572  _id,
1573  _logTime,
1575  _logString
1576  );
1577  }
1578 #endif
1579  }
1580 
1583  {
1584  // Get the time
1585  Fw::Time _logTime;
1586  if (this->m_Time_OutputPort[0].isConnected()) {
1587  this->m_Time_OutputPort[0].invoke(_logTime);
1588  }
1589 
1590  FwEventIdType _id = static_cast<FwEventIdType>(0);
1591 
1592  _id = this->getIdBase() + EVENTID_ID_FILTER_NOT_FOUND;
1593 
1594  // Emit the event on the log port
1595  if (this->m_Log_OutputPort[0].isConnected()) {
1596  Fw::LogBuffer _logBuff;
1598 
1599 #if FW_AMPCS_COMPATIBLE
1600  // Serialize the number of arguments
1601  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1602  FW_ASSERT(
1603  _status == Fw::FW_SERIALIZE_OK,
1604  static_cast<FwAssertArgType>(_status)
1605  );
1606 #endif
1607 
1608 #if FW_AMPCS_COMPATIBLE
1609  // Serialize the argument size
1610  _status = _logBuff.serializeFrom(
1611  static_cast<U8>(sizeof(FwEventIdType))
1612  );
1613  FW_ASSERT(
1614  _status == Fw::FW_SERIALIZE_OK,
1615  static_cast<FwAssertArgType>(_status)
1616  );
1617 #endif
1618  _status = _logBuff.serializeFrom(ID);
1619  FW_ASSERT(
1620  _status == Fw::FW_SERIALIZE_OK,
1621  static_cast<FwAssertArgType>(_status)
1622  );
1623 
1624  this->m_Log_OutputPort[0].invoke(
1625  _id,
1626  _logTime,
1628  _logBuff
1629  );
1630  }
1631 
1632  // Emit the event on the text log port
1633 #if FW_ENABLE_TEXT_LOGGING
1634  if (this->m_LogText_OutputPort[0].isConnected()) {
1635 #if FW_OBJECT_NAMES == 1
1636  const char* _formatString =
1637  "(%s) %s: ID filter ID %" PRIu32 " not found.";
1638 #else
1639  const char* _formatString =
1640  "%s: ID filter ID %" PRIu32 " not found.";
1641 #endif
1642 
1643  Fw::TextLogString _logString;
1644  _logString.format(
1645  _formatString,
1646 #if FW_OBJECT_NAMES == 1
1647  this->m_objName.toChar(),
1648 #endif
1649  "ID_FILTER_NOT_FOUND ",
1650  ID
1651  );
1652 
1653  this->m_LogText_OutputPort[0].invoke(
1654  _id,
1655  _logTime,
1657  _logString
1658  );
1659  }
1660 #endif
1661  }
1662 
1663  // ----------------------------------------------------------------------
1664  // Time
1665  // ----------------------------------------------------------------------
1666 
1668  getTime() const
1669  {
1670  if (this->m_Time_OutputPort[0].isConnected()) {
1671  Fw::Time _time;
1672  this->m_Time_OutputPort[0].invoke(_time);
1673  return _time;
1674  }
1675  else {
1676  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1677  }
1678  }
1679 
1680  // ----------------------------------------------------------------------
1681  // Message dispatch functions
1682  // ----------------------------------------------------------------------
1683 
1684  Fw::QueuedComponentBase::MsgDispatchStatus EventManagerComponentBase ::
1685  doDispatch()
1686  {
1687  ComponentIpcSerializableBuffer _msg;
1688  FwQueuePriorityType _priority = 0;
1689 
1690  Os::Queue::Status _msgStatus = this->m_queue.receive(
1691  _msg,
1693  _priority
1694  );
1695  FW_ASSERT(
1696  _msgStatus == Os::Queue::OP_OK,
1697  static_cast<FwAssertArgType>(_msgStatus)
1698  );
1699 
1700  // Reset to beginning of buffer
1701  _msg.resetDeser();
1702 
1703  FwEnumStoreType _desMsg = 0;
1704  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1705  FW_ASSERT(
1706  _deserStatus == Fw::FW_SERIALIZE_OK,
1707  static_cast<FwAssertArgType>(_deserStatus)
1708  );
1709 
1710  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1711 
1712  if (_msgType == EVENTMANAGER_COMPONENT_EXIT) {
1713  return MSG_DISPATCH_EXIT;
1714  }
1715 
1716  FwIndexType portNum = 0;
1717  _deserStatus = _msg.deserializeTo(portNum);
1718  FW_ASSERT(
1719  _deserStatus == Fw::FW_SERIALIZE_OK,
1720  static_cast<FwAssertArgType>(_deserStatus)
1721  );
1722 
1723  switch (_msgType) {
1724  // Handle async input port pingIn
1725  case PINGIN_PING: {
1726  // Deserialize argument key
1727  U32 key;
1728  _deserStatus = _msg.deserializeTo(key);
1729  FW_ASSERT(
1730  _deserStatus == Fw::FW_SERIALIZE_OK,
1731  static_cast<FwAssertArgType>(_deserStatus)
1732  );
1733  // Call handler function
1734  this->pingIn_handler(
1735  portNum,
1736  key
1737  );
1738 
1739  break;
1740  }
1741 
1742  // Handle command SET_ID_FILTER
1743  case CMD_SET_ID_FILTER: {
1744  // Deserialize opcode
1745  FwOpcodeType _opCode = 0;
1746  _deserStatus = _msg.deserializeTo(_opCode);
1747  FW_ASSERT (
1748  _deserStatus == Fw::FW_SERIALIZE_OK,
1749  static_cast<FwAssertArgType>(_deserStatus)
1750  );
1751 
1752  // Deserialize command sequence
1753  U32 _cmdSeq = 0;
1754  _deserStatus = _msg.deserializeTo(_cmdSeq);
1755  FW_ASSERT (
1756  _deserStatus == Fw::FW_SERIALIZE_OK,
1757  static_cast<FwAssertArgType>(_deserStatus)
1758  );
1759 
1760  // Deserialize command argument buffer
1761  Fw::CmdArgBuffer args;
1762  _deserStatus = _msg.deserializeTo(args);
1763  FW_ASSERT (
1764  _deserStatus == Fw::FW_SERIALIZE_OK,
1765  static_cast<FwAssertArgType>(_deserStatus)
1766  );
1767 
1768  // Reset buffer
1769  args.resetDeser();
1770 
1771  // Deserialize argument ID
1772  FwEventIdType ID;
1773  _deserStatus = args.deserializeTo(ID);
1774  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1775  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1776  this->cmdResponse_out(
1777  _opCode,
1778  _cmdSeq,
1780  );
1781  }
1782  // Don't crash the task if bad arguments were passed from the ground
1783  break;
1784  }
1785 
1786  // Deserialize argument idFilterEnabled
1787  Svc::EventManager_Enabled idFilterEnabled;
1788  _deserStatus = args.deserializeTo(idFilterEnabled);
1789  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1790  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1791  this->cmdResponse_out(
1792  _opCode,
1793  _cmdSeq,
1795  );
1796  }
1797  // Don't crash the task if bad arguments were passed from the ground
1798  break;
1799  }
1800 
1801  // Make sure there was no data left over.
1802  // That means the argument buffer size was incorrect.
1803 #if FW_CMD_CHECK_RESIDUAL
1804  if (args.getDeserializeSizeLeft() != 0) {
1805  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1806  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1807  }
1808  // Don't crash the task if bad arguments were passed from the ground
1809  break;
1810  }
1811 #endif
1812 
1813  // Call handler function
1815  _opCode, _cmdSeq,
1816  ID,
1817  idFilterEnabled
1818  );
1819 
1820  break;
1821  }
1822 
1823  // Handle command DUMP_FILTER_STATE
1824  case CMD_DUMP_FILTER_STATE: {
1825  // Deserialize opcode
1826  FwOpcodeType _opCode = 0;
1827  _deserStatus = _msg.deserializeTo(_opCode);
1828  FW_ASSERT (
1829  _deserStatus == Fw::FW_SERIALIZE_OK,
1830  static_cast<FwAssertArgType>(_deserStatus)
1831  );
1832 
1833  // Deserialize command sequence
1834  U32 _cmdSeq = 0;
1835  _deserStatus = _msg.deserializeTo(_cmdSeq);
1836  FW_ASSERT (
1837  _deserStatus == Fw::FW_SERIALIZE_OK,
1838  static_cast<FwAssertArgType>(_deserStatus)
1839  );
1840 
1841  // Deserialize command argument buffer
1842  Fw::CmdArgBuffer args;
1843  _deserStatus = _msg.deserializeTo(args);
1844  FW_ASSERT (
1845  _deserStatus == Fw::FW_SERIALIZE_OK,
1846  static_cast<FwAssertArgType>(_deserStatus)
1847  );
1848 
1849  // Reset buffer
1850  args.resetDeser();
1851 
1852  // Make sure there was no data left over.
1853  // That means the argument buffer size was incorrect.
1854 #if FW_CMD_CHECK_RESIDUAL
1855  if (args.getDeserializeSizeLeft() != 0) {
1856  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1857  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1858  }
1859  // Don't crash the task if bad arguments were passed from the ground
1860  break;
1861  }
1862 #endif
1863 
1864  // Call handler function
1865  this->DUMP_FILTER_STATE_cmdHandler(_opCode, _cmdSeq);
1866 
1867  break;
1868  }
1869 
1870  // Handle internal interface loqQueue
1871  case INT_IF_LOQQUEUE: {
1872  FwEventIdType id;
1873  _deserStatus = _msg.deserializeTo(id);
1874 
1875  // Internal interface should always deserialize
1876  FW_ASSERT(
1877  Fw::FW_SERIALIZE_OK == _deserStatus,
1878  static_cast<FwAssertArgType>(_deserStatus)
1879  );
1880 
1881  Fw::Time timeTag;
1882  _deserStatus = _msg.deserializeTo(timeTag);
1883 
1884  // Internal interface should always deserialize
1885  FW_ASSERT(
1886  Fw::FW_SERIALIZE_OK == _deserStatus,
1887  static_cast<FwAssertArgType>(_deserStatus)
1888  );
1889 
1890  Fw::LogSeverity severity;
1891  _deserStatus = _msg.deserializeTo(severity);
1892 
1893  // Internal interface should always deserialize
1894  FW_ASSERT(
1895  Fw::FW_SERIALIZE_OK == _deserStatus,
1896  static_cast<FwAssertArgType>(_deserStatus)
1897  );
1898 
1899  Fw::LogBuffer args;
1900  _deserStatus = _msg.deserializeTo(args);
1901 
1902  // Internal interface should always deserialize
1903  FW_ASSERT(
1904  Fw::FW_SERIALIZE_OK == _deserStatus,
1905  static_cast<FwAssertArgType>(_deserStatus)
1906  );
1907 
1908  // Make sure there was no data left over.
1909  // That means the buffer size was incorrect.
1910  FW_ASSERT(
1911  _msg.getDeserializeSizeLeft() == 0,
1912  static_cast<FwAssertArgType>(_msg.getDeserializeSizeLeft())
1913  );
1914 
1915  // Call handler function
1917  id,
1918  timeTag,
1919  severity,
1920  args
1921  );
1922 
1923  break;
1924  }
1925 
1926  default:
1927  return MSG_DISPATCH_ERROR;
1928  }
1929 
1930  return MSG_DISPATCH_OK;
1931  }
1932 
1933  // ----------------------------------------------------------------------
1934  // Calls for messages received on special input ports
1935  // ----------------------------------------------------------------------
1936 
1937  void EventManagerComponentBase ::
1938  m_p_CmdDisp_in(
1939  Fw::PassiveComponentBase* callComp,
1940  FwIndexType portNum,
1941  FwOpcodeType opCode,
1942  U32 cmdSeq,
1943  Fw::CmdArgBuffer& args
1944  )
1945  {
1946  FW_ASSERT(callComp);
1947  EventManagerComponentBase* compPtr = static_cast<EventManagerComponentBase*>(callComp);
1948 
1949  const U32 idBase = callComp->getIdBase();
1950  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1951 
1952  // Select base class function based on opcode
1953  switch (opCode - idBase) {
1954  case OPCODE_SET_EVENT_FILTER: {
1955  compPtr->SET_EVENT_FILTER_cmdHandlerBase(
1956  opCode,
1957  cmdSeq,
1958  args
1959  );
1960  break;
1961  }
1962 
1963  case OPCODE_SET_ID_FILTER: {
1964  compPtr->SET_ID_FILTER_cmdHandlerBase(
1965  opCode,
1966  cmdSeq,
1967  args
1968  );
1969  break;
1970  }
1971 
1972  case OPCODE_DUMP_FILTER_STATE: {
1973  compPtr->DUMP_FILTER_STATE_cmdHandlerBase(
1974  opCode,
1975  cmdSeq,
1976  args
1977  );
1978  break;
1979  }
1980  }
1981  }
1982 
1983  // ----------------------------------------------------------------------
1984  // Calls for messages received on typed input ports
1985  // ----------------------------------------------------------------------
1986 
1987  void EventManagerComponentBase ::
1988  m_p_LogRecv_in(
1989  Fw::PassiveComponentBase* callComp,
1990  FwIndexType portNum,
1991  FwEventIdType id,
1992  Fw::Time& timeTag,
1993  const Fw::LogSeverity& severity,
1994  Fw::LogBuffer& args
1995  )
1996  {
1997  FW_ASSERT(callComp);
1998  EventManagerComponentBase* compPtr = static_cast<EventManagerComponentBase*>(callComp);
1999  compPtr->LogRecv_handlerBase(
2000  portNum,
2001  id,
2002  timeTag,
2003  severity,
2004  args
2005  );
2006  }
2007 
2008  void EventManagerComponentBase ::
2009  m_p_pingIn_in(
2010  Fw::PassiveComponentBase* callComp,
2011  FwIndexType portNum,
2012  U32 key
2013  )
2014  {
2015  FW_ASSERT(callComp);
2016  EventManagerComponentBase* compPtr = static_cast<EventManagerComponentBase*>(callComp);
2017  compPtr->pingIn_handlerBase(
2018  portNum,
2019  key
2020  );
2021  }
2022 
2023 }
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void invoke(Fw::ComBuffer &data, U32 context) const
Invoke a port interface.
Definition: ComPortAc.cpp:156
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void init()
Initialization function.
Definition: ComPortAc.cpp:137
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
Enabled and disabled state.
void LogRecv_handlerBase(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Handler base-class function for input port LogRecv.
FwIdType FwOpcodeType
The type of a command opcode.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
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
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
const char * toChar() const
Convert to a C-style char*.
Definition: String.hpp:50
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
static constexpr FwIndexType getNum_CmdReg_OutputPorts()
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
static constexpr FwIndexType getNum_LogRecv_InputPorts()
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
Enum representing a command response.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
void invoke(FwEventIdType Id) const
Invoke a port interface.
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
Os::Queue m_queue
queue object for active component
void init()
Object initializer.
Definition: ObjBase.cpp:24
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
void regCommands()
Register commands with the Command Dispatcher.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
Message will block until space is available.
Definition: Queue.hpp:47
static constexpr FwIndexType getNum_pingIn_InputPorts()
FwIdType FwEventIdType
The type of an event identifier.
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
void init()
Initialization function.
Definition: LogPortAc.cpp:56
void SET_EVENT_FILTER_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void addCallPort(InputFatalEventPort *callPort)
Register an input port.
void log_ACTIVITY_HI_ID_FILTER_ENABLED(FwEventIdType ID) const
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
virtual void SET_ID_FILTER_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_ID_FILTER.
virtual void DUMP_FILTER_STATE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command DUMP_FILTER_STATE.
void init()
Initialization function.
Definition: TimePortAc.cpp:128
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
void log_WARNING_LO_ID_FILTER_LIST_FULL(FwEventIdType ID) const
A less serious but recoverable event.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
static constexpr FwIndexType getNum_FatalAnnounce_OutputPorts()
static constexpr FwIndexType getNum_PktSend_OutputPorts()
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
FwSizeType SizeType
bool isConnected_FatalAnnounce_OutputPort(FwIndexType portNum)
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:54
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
bool isConnected() const
Definition: PortBase.cpp:38
bool isConnected_Time_OutputPort(FwIndexType portNum)
Enum representing event severity.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp: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 addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: LogPortAc.cpp:62
void setPortNum(FwIndexType portNum)
virtual void SET_EVENT_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::EventManager_FilterSeverity filterLevel, Svc::EventManager_Enabled filterEnabled)=0
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
BlockingType
message type
Definition: Queue.hpp:46
void log_WARNING_LO_ID_FILTER_NOT_FOUND(FwEventIdType ID) const
void loqQueue_internalInterfaceInvoke(FwEventIdType id, const Fw::Time &timeTag, const Fw::LogSeverity &severity, const Fw::LogBuffer &args)
Internal interface base-class function for loqQueue.
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
The size of the serial representation.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Important informational events.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
void SET_ID_FILTER_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
virtual void LogRecv_handler(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)=0
Handler for input port LogRecv.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
A message was sent requesting an exit of the loop.
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
message to exit active component task
PlatformIndexType FwIndexType
void DUMP_FILTER_STATE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
virtual void DUMP_FILTER_STATE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void init()
Initialization function.
void incNumMsgDropped()
increment the number of messages dropped
void init()
Initialization function.
Definition: PingPortAc.cpp:56
static constexpr FwIndexType getNum_Time_OutputPorts()
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
virtual void loqQueue_internalInterfaceHandler(FwEventIdType id, const Fw::Time &timeTag, const Fw::LogSeverity &severity, const Fw::LogBuffer &args)=0
Internal interface handler for loqQueue.
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
U8 BYTE
byte type
Definition: BasicTypes.h:56
static constexpr FwIndexType getNum_Log_OutputPorts()
Set filter for reporting events. Events are not stored in component.
void log_ACTIVITY_LO_SEVERITY_FILTER_STATE(Svc::EventManager_FilterSeverity severity, bool enabled) const
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:143
void FatalAnnounce_out(FwIndexType portNum, FwEventIdType Id)
Invoke output port FatalAnnounce.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
void init()
Initialization function.
Implementation of malloc based allocator.
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum)
virtual ~EventManagerComponentBase()
Destroy EventManagerComponentBase object.
void init()
Initialization function.
EventManagerComponentBase(const char *compName="")
Construct EventManagerComponentBase object.
void set_FatalAnnounce_OutputPort(FwIndexType portNum, Svc::InputFatalEventPort *port)
Connect port to FatalAnnounce[portNum].
Fw::InputLogPort * get_LogRecv_InputPort(FwIndexType portNum)
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void log_ACTIVITY_HI_ID_FILTER_REMOVED(FwEventIdType ID) const
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
virtual void SET_ID_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, FwEventIdType ID, Svc::EventManager_Enabled idFilterEnabled)=0