F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActiveLoggerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ActiveLoggerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ActiveLogger component base class
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  ACTIVELOGGER_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 getBuffCapacity() 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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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  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  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  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  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  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  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 ActiveLoggerComponentBase ::
415  set_LogText_OutputPort(
416  FwIndexType portNum,
418  )
419  {
420  FW_ASSERT(
421  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  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  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  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  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  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  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  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 ActiveLoggerComponentBase ::
541  set_LogText_OutputPort(
542  FwIndexType portNum,
543  Fw::InputSerializePort* port
544  )
545  {
546  FW_ASSERT(
547  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  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  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  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  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  ActiveLoggerComponentBase(const char* compName) :
650  Fw::ActiveComponentBase(compName)
651  {
652 
653  }
654 
657  {
658 
659  }
660 
661  // ----------------------------------------------------------------------
662  // Getters for numbers of special input ports
663  // ----------------------------------------------------------------------
664 
667  {
668  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdDisp_InputPort));
669  }
670 
671  // ----------------------------------------------------------------------
672  // Getters for numbers of typed input ports
673  // ----------------------------------------------------------------------
674 
677  {
678  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogRecv_InputPort));
679  }
680 
683  {
684  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
685  }
686 
687  // ----------------------------------------------------------------------
688  // Getters for numbers of special output ports
689  // ----------------------------------------------------------------------
690 
693  {
694  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdReg_OutputPort));
695  }
696 
699  {
700  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdStatus_OutputPort));
701  }
702 
705  {
706  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
707  }
708 
709 #if FW_ENABLE_TEXT_LOGGING == 1
710 
711  FwIndexType ActiveLoggerComponentBase ::
712  getNum_LogText_OutputPorts() const
713  {
714  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
715  }
716 
717 #endif
718 
721  {
722  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
723  }
724 
725  // ----------------------------------------------------------------------
726  // Getters for numbers of typed output ports
727  // ----------------------------------------------------------------------
728 
731  {
732  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_FatalAnnounce_OutputPort));
733  }
734 
737  {
738  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_PktSend_OutputPort));
739  }
740 
743  {
744  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
745  }
746 
747  // ----------------------------------------------------------------------
748  // Connection status queries for special output ports
749  // ----------------------------------------------------------------------
750 
753  {
754  FW_ASSERT(
755  portNum < this->getNum_CmdReg_OutputPorts(),
756  static_cast<FwAssertArgType>(portNum)
757  );
758 
759  return this->m_CmdReg_OutputPort[portNum].isConnected();
760  }
761 
764  {
765  FW_ASSERT(
766  portNum < this->getNum_CmdStatus_OutputPorts(),
767  static_cast<FwAssertArgType>(portNum)
768  );
769 
770  return this->m_CmdStatus_OutputPort[portNum].isConnected();
771  }
772 
775  {
776  FW_ASSERT(
777  portNum < this->getNum_Log_OutputPorts(),
778  static_cast<FwAssertArgType>(portNum)
779  );
780 
781  return this->m_Log_OutputPort[portNum].isConnected();
782  }
783 
784 #if FW_ENABLE_TEXT_LOGGING == 1
785 
786  bool ActiveLoggerComponentBase ::
787  isConnected_LogText_OutputPort(FwIndexType portNum)
788  {
789  FW_ASSERT(
790  portNum < this->getNum_LogText_OutputPorts(),
791  static_cast<FwAssertArgType>(portNum)
792  );
793 
794  return this->m_LogText_OutputPort[portNum].isConnected();
795  }
796 
797 #endif
798 
801  {
802  FW_ASSERT(
803  portNum < this->getNum_Time_OutputPorts(),
804  static_cast<FwAssertArgType>(portNum)
805  );
806 
807  return this->m_Time_OutputPort[portNum].isConnected();
808  }
809 
810  // ----------------------------------------------------------------------
811  // Connection status queries for typed output ports
812  // ----------------------------------------------------------------------
813 
816  {
817  FW_ASSERT(
818  portNum < this->getNum_FatalAnnounce_OutputPorts(),
819  static_cast<FwAssertArgType>(portNum)
820  );
821 
822  return this->m_FatalAnnounce_OutputPort[portNum].isConnected();
823  }
824 
827  {
828  FW_ASSERT(
829  portNum < this->getNum_PktSend_OutputPorts(),
830  static_cast<FwAssertArgType>(portNum)
831  );
832 
833  return this->m_PktSend_OutputPort[portNum].isConnected();
834  }
835 
838  {
839  FW_ASSERT(
840  portNum < this->getNum_pingOut_OutputPorts(),
841  static_cast<FwAssertArgType>(portNum)
842  );
843 
844  return this->m_pingOut_OutputPort[portNum].isConnected();
845  }
846 
847  // ----------------------------------------------------------------------
848  // Port handler base-class functions for typed input ports
849  //
850  // Call these functions directly to bypass the corresponding ports
851  // ----------------------------------------------------------------------
852 
855  FwIndexType portNum,
856  FwEventIdType id,
857  Fw::Time& timeTag,
858  const Fw::LogSeverity& severity,
859  Fw::LogBuffer& args
860  )
861  {
862  // Make sure port number is valid
863  FW_ASSERT(
864  portNum < this->getNum_LogRecv_InputPorts(),
865  static_cast<FwAssertArgType>(portNum)
866  );
867 
868  // Call handler function
869  this->LogRecv_handler(
870  portNum,
871  id,
872  timeTag,
873  severity,
874  args
875  );
876  }
877 
880  FwIndexType portNum,
881  U32 key
882  )
883  {
884  // Make sure port number is valid
885  FW_ASSERT(
886  portNum < this->getNum_pingIn_InputPorts(),
887  static_cast<FwAssertArgType>(portNum)
888  );
889 
890  // Call pre-message hook
892  portNum,
893  key
894  );
895  ComponentIpcSerializableBuffer msg;
897 
898  // Serialize message ID
899  _status = msg.serialize(
900  static_cast<FwEnumStoreType>(PINGIN_PING)
901  );
902  FW_ASSERT(
903  _status == Fw::FW_SERIALIZE_OK,
904  static_cast<FwAssertArgType>(_status)
905  );
906 
907  // Serialize port number
908  _status = msg.serialize(portNum);
909  FW_ASSERT(
910  _status == Fw::FW_SERIALIZE_OK,
911  static_cast<FwAssertArgType>(_status)
912  );
913 
914  // Serialize argument key
915  _status = msg.serialize(key);
916  FW_ASSERT(
917  _status == Fw::FW_SERIALIZE_OK,
918  static_cast<FwAssertArgType>(_status)
919  );
920 
921  // Send message
923  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
924 
925  FW_ASSERT(
926  qStatus == Os::Queue::OP_OK,
927  static_cast<FwAssertArgType>(qStatus)
928  );
929  }
930 
931  // ----------------------------------------------------------------------
932  // Pre-message hooks for typed async input ports
933  //
934  // Each of these functions is invoked just before processing a message
935  // on the corresponding port. By default, they do nothing. You can
936  // override them to provide specific pre-message behavior.
937  // ----------------------------------------------------------------------
938 
941  FwIndexType portNum,
942  U32 key
943  )
944  {
945  // Default: no-op
946  }
947 
948  // ----------------------------------------------------------------------
949  // Invocation functions for typed output ports
950  // ----------------------------------------------------------------------
951 
954  FwIndexType portNum,
955  FwEventIdType Id
956  )
957  {
958  FW_ASSERT(
959  portNum < this->getNum_FatalAnnounce_OutputPorts(),
960  static_cast<FwAssertArgType>(portNum)
961  );
962 
963  FW_ASSERT(
964  this->m_FatalAnnounce_OutputPort[portNum].isConnected(),
965  static_cast<FwAssertArgType>(portNum)
966  );
967  this->m_FatalAnnounce_OutputPort[portNum].invoke(
968  Id
969  );
970  }
971 
974  FwIndexType portNum,
975  Fw::ComBuffer& data,
976  U32 context
977  )
978  {
979  FW_ASSERT(
980  portNum < this->getNum_PktSend_OutputPorts(),
981  static_cast<FwAssertArgType>(portNum)
982  );
983 
984  FW_ASSERT(
985  this->m_PktSend_OutputPort[portNum].isConnected(),
986  static_cast<FwAssertArgType>(portNum)
987  );
988  this->m_PktSend_OutputPort[portNum].invoke(
989  data,
990  context
991  );
992  }
993 
996  FwIndexType portNum,
997  U32 key
998  )
999  {
1000  FW_ASSERT(
1001  portNum < this->getNum_pingOut_OutputPorts(),
1002  static_cast<FwAssertArgType>(portNum)
1003  );
1004 
1005  FW_ASSERT(
1006  this->m_pingOut_OutputPort[portNum].isConnected(),
1007  static_cast<FwAssertArgType>(portNum)
1008  );
1009  this->m_pingOut_OutputPort[portNum].invoke(
1010  key
1011  );
1012  }
1013 
1014  // ----------------------------------------------------------------------
1015  // Internal interface base-class functions
1016  // ----------------------------------------------------------------------
1017 
1020  FwEventIdType id,
1021  const Fw::Time& timeTag,
1022  const Fw::LogSeverity& severity,
1023  const Fw::LogBuffer& args
1024  )
1025  {
1026  ComponentIpcSerializableBuffer msg;
1028 
1029  // Serialize the message ID
1030  _status = msg.serialize(static_cast<FwEnumStoreType>(INT_IF_LOQQUEUE));
1031  FW_ASSERT (
1032  _status == Fw::FW_SERIALIZE_OK,
1033  static_cast<FwAssertArgType>(_status)
1034  );
1035 
1036  // Fake port number to make message dequeue work
1037  _status = msg.serialize(static_cast<FwIndexType>(0));
1038  FW_ASSERT (
1039  _status == Fw::FW_SERIALIZE_OK,
1040  static_cast<FwAssertArgType>(_status)
1041  );
1042 
1043  _status = msg.serialize(id);
1044  FW_ASSERT(
1045  _status == Fw::FW_SERIALIZE_OK,
1046  static_cast<FwAssertArgType>(_status)
1047  );
1048 
1049  _status = msg.serialize(timeTag);
1050  FW_ASSERT(
1051  _status == Fw::FW_SERIALIZE_OK,
1052  static_cast<FwAssertArgType>(_status)
1053  );
1054 
1055  _status = msg.serialize(severity);
1056  FW_ASSERT(
1057  _status == Fw::FW_SERIALIZE_OK,
1058  static_cast<FwAssertArgType>(_status)
1059  );
1060 
1061  _status = msg.serialize(args);
1062  FW_ASSERT(
1063  _status == Fw::FW_SERIALIZE_OK,
1064  static_cast<FwAssertArgType>(_status)
1065  );
1066 
1067  // Send message
1069  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1070 
1071  if (qStatus == Os::Queue::Status::FULL) {
1072  this->incNumMsgDropped();
1073  return;
1074  }
1075 
1076  FW_ASSERT(
1077  qStatus == Os::Queue::OP_OK,
1078  static_cast<FwAssertArgType>(qStatus)
1079  );
1080  }
1081 
1082  // ----------------------------------------------------------------------
1083  // Command response
1084  // ----------------------------------------------------------------------
1085 
1088  FwOpcodeType opCode,
1089  U32 cmdSeq,
1090  Fw::CmdResponse response
1091  )
1092  {
1093  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
1094  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
1095  }
1096 
1097  // ----------------------------------------------------------------------
1098  // Command handler base-class functions
1099  //
1100  // Call these functions directly to bypass the command input port
1101  // ----------------------------------------------------------------------
1102 
1105  FwOpcodeType opCode,
1106  U32 cmdSeq,
1107  Fw::CmdArgBuffer& args
1108  )
1109  {
1110  // Deserialize the arguments
1112 
1113  // Reset the buffer
1114  args.resetDeser();
1115 
1117  _status = args.deserialize(filterLevel);
1118  if (_status != Fw::FW_SERIALIZE_OK) {
1119  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1120  this->m_CmdStatus_OutputPort[0].invoke(
1121  opCode,
1122  cmdSeq,
1124  );
1125  }
1126  return;
1127  }
1128 
1129  Svc::ActiveLogger_Enabled filterEnabled;
1130  _status = args.deserialize(filterEnabled);
1131  if (_status != Fw::FW_SERIALIZE_OK) {
1132  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1133  this->m_CmdStatus_OutputPort[0].invoke(
1134  opCode,
1135  cmdSeq,
1137  );
1138  }
1139  return;
1140  }
1141 
1142 #if FW_CMD_CHECK_RESIDUAL
1143  // Make sure there was no data left over.
1144  // That means the argument buffer size was incorrect.
1145  if (args.getBuffLeft() != 0) {
1146  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1147  this->m_CmdStatus_OutputPort[0].invoke(
1148  opCode,
1149  cmdSeq,
1151  );
1152  }
1153  return;
1154  }
1155 #endif
1156 
1158  opCode, cmdSeq,
1159  filterLevel,
1160  filterEnabled
1161  );
1162  }
1163 
1166  FwOpcodeType opCode,
1167  U32 cmdSeq,
1168  Fw::CmdArgBuffer& args
1169  )
1170  {
1171  // Call pre-message hook
1172  this->SET_ID_FILTER_preMsgHook(opCode,cmdSeq);
1173 
1174  // Defer deserializing arguments to the message dispatcher
1175  // to avoid deserializing and reserializing just for IPC
1176  ComponentIpcSerializableBuffer msg;
1178 
1179  // Serialize for IPC
1180  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_SET_ID_FILTER));
1181  FW_ASSERT (
1182  _status == Fw::FW_SERIALIZE_OK,
1183  static_cast<FwAssertArgType>(_status)
1184  );
1185 
1186  // Fake port number to make message dequeue work
1187  FwIndexType port = 0;
1188 
1189  _status = msg.serialize(port);
1190  FW_ASSERT (
1191  _status == Fw::FW_SERIALIZE_OK,
1192  static_cast<FwAssertArgType>(_status)
1193  );
1194 
1195  _status = msg.serialize(opCode);
1196  FW_ASSERT (
1197  _status == Fw::FW_SERIALIZE_OK,
1198  static_cast<FwAssertArgType>(_status)
1199  );
1200 
1201  _status = msg.serialize(cmdSeq);
1202  FW_ASSERT (
1203  _status == Fw::FW_SERIALIZE_OK,
1204  static_cast<FwAssertArgType>(_status)
1205  );
1206 
1207  _status = msg.serialize(args);
1208  FW_ASSERT (
1209  _status == Fw::FW_SERIALIZE_OK,
1210  static_cast<FwAssertArgType>(_status)
1211  );
1212 
1213  // Send message
1215  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1216 
1217  FW_ASSERT(
1218  qStatus == Os::Queue::OP_OK,
1219  static_cast<FwAssertArgType>(qStatus)
1220  );
1221  }
1222 
1225  FwOpcodeType opCode,
1226  U32 cmdSeq,
1227  Fw::CmdArgBuffer& args
1228  )
1229  {
1230  // Call pre-message hook
1231  this->DUMP_FILTER_STATE_preMsgHook(opCode,cmdSeq);
1232 
1233  // Defer deserializing arguments to the message dispatcher
1234  // to avoid deserializing and reserializing just for IPC
1235  ComponentIpcSerializableBuffer msg;
1237 
1238  // Serialize for IPC
1239  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_DUMP_FILTER_STATE));
1240  FW_ASSERT (
1241  _status == Fw::FW_SERIALIZE_OK,
1242  static_cast<FwAssertArgType>(_status)
1243  );
1244 
1245  // Fake port number to make message dequeue work
1246  FwIndexType port = 0;
1247 
1248  _status = msg.serialize(port);
1249  FW_ASSERT (
1250  _status == Fw::FW_SERIALIZE_OK,
1251  static_cast<FwAssertArgType>(_status)
1252  );
1253 
1254  _status = msg.serialize(opCode);
1255  FW_ASSERT (
1256  _status == Fw::FW_SERIALIZE_OK,
1257  static_cast<FwAssertArgType>(_status)
1258  );
1259 
1260  _status = msg.serialize(cmdSeq);
1261  FW_ASSERT (
1262  _status == Fw::FW_SERIALIZE_OK,
1263  static_cast<FwAssertArgType>(_status)
1264  );
1265 
1266  _status = msg.serialize(args);
1267  FW_ASSERT (
1268  _status == Fw::FW_SERIALIZE_OK,
1269  static_cast<FwAssertArgType>(_status)
1270  );
1271 
1272  // Send message
1274  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
1275 
1276  FW_ASSERT(
1277  qStatus == Os::Queue::OP_OK,
1278  static_cast<FwAssertArgType>(qStatus)
1279  );
1280  }
1281 
1282  // ----------------------------------------------------------------------
1283  // Pre-message hooks for async commands
1284  //
1285  // Each of these functions is invoked just before processing the
1286  // corresponding command. By default they do nothing. You can
1287  // override them to provide specific pre-command behavior.
1288  // ----------------------------------------------------------------------
1289 
1292  FwOpcodeType opCode,
1293  U32 cmdSeq
1294  )
1295  {
1296  // Defaults to no-op; can be overridden
1297  (void) opCode;
1298  (void) cmdSeq;
1299  }
1300 
1303  FwOpcodeType opCode,
1304  U32 cmdSeq
1305  )
1306  {
1307  // Defaults to no-op; can be overridden
1308  (void) opCode;
1309  (void) cmdSeq;
1310  }
1311 
1312  // ----------------------------------------------------------------------
1313  // Event logging functions
1314  // ----------------------------------------------------------------------
1315 
1319  bool enabled
1320  ) const
1321  {
1322  // Get the time
1323  Fw::Time _logTime;
1324  if (this->m_Time_OutputPort[0].isConnected()) {
1325  this->m_Time_OutputPort[0].invoke(_logTime);
1326  }
1327 
1328  FwEventIdType _id = static_cast<FwEventIdType>(0);
1329 
1330  _id = this->getIdBase() + EVENTID_SEVERITY_FILTER_STATE;
1331 
1332  // Emit the event on the log port
1333  if (this->m_Log_OutputPort[0].isConnected()) {
1334  Fw::LogBuffer _logBuff;
1336 
1337 #if FW_AMPCS_COMPATIBLE
1338  // Serialize the number of arguments
1339  _status = _logBuff.serialize(static_cast<U8>(2));
1340  FW_ASSERT(
1341  _status == Fw::FW_SERIALIZE_OK,
1342  static_cast<FwAssertArgType>(_status)
1343  );
1344 #endif
1345 
1346 #if FW_AMPCS_COMPATIBLE
1347  // Serialize the argument size
1348  _status = _logBuff.serialize(
1350  );
1351  FW_ASSERT(
1352  _status == Fw::FW_SERIALIZE_OK,
1353  static_cast<FwAssertArgType>(_status)
1354  );
1355 #endif
1356  _status = _logBuff.serialize(severity);
1357  FW_ASSERT(
1358  _status == Fw::FW_SERIALIZE_OK,
1359  static_cast<FwAssertArgType>(_status)
1360  );
1361 
1362 #if FW_AMPCS_COMPATIBLE
1363  // Serialize the argument size
1364  _status = _logBuff.serialize(
1365  static_cast<U8>(sizeof(U8))
1366  );
1367  FW_ASSERT(
1368  _status == Fw::FW_SERIALIZE_OK,
1369  static_cast<FwAssertArgType>(_status)
1370  );
1371 #endif
1372  _status = _logBuff.serialize(enabled);
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: %s filter state. %d";
1392 #else
1393  const char* _formatString =
1394  "%s: %s filter state. %d";
1395 #endif
1396 
1397  Fw::String severityStr;
1398  severity.toString(severityStr);
1399 
1400  Fw::TextLogString _logString;
1401  _logString.format(
1402  _formatString,
1403 #if FW_OBJECT_NAMES == 1
1404  this->m_objName.toChar(),
1405 #endif
1406  "SEVERITY_FILTER_STATE ",
1407  severityStr.toChar(),
1408  enabled
1409  );
1410 
1411  this->m_LogText_OutputPort[0].invoke(
1412  _id,
1413  _logTime,
1415  _logString
1416  );
1417  }
1418 #endif
1419  }
1420 
1423  {
1424  // Get the time
1425  Fw::Time _logTime;
1426  if (this->m_Time_OutputPort[0].isConnected()) {
1427  this->m_Time_OutputPort[0].invoke(_logTime);
1428  }
1429 
1430  FwEventIdType _id = static_cast<FwEventIdType>(0);
1431 
1432  _id = this->getIdBase() + EVENTID_ID_FILTER_ENABLED;
1433 
1434  // Emit the event on the log port
1435  if (this->m_Log_OutputPort[0].isConnected()) {
1436  Fw::LogBuffer _logBuff;
1438 
1439 #if FW_AMPCS_COMPATIBLE
1440  // Serialize the number of arguments
1441  _status = _logBuff.serialize(static_cast<U8>(1));
1442  FW_ASSERT(
1443  _status == Fw::FW_SERIALIZE_OK,
1444  static_cast<FwAssertArgType>(_status)
1445  );
1446 #endif
1447 
1448 #if FW_AMPCS_COMPATIBLE
1449  // Serialize the argument size
1450  _status = _logBuff.serialize(
1451  static_cast<U8>(sizeof(U32))
1452  );
1453  FW_ASSERT(
1454  _status == Fw::FW_SERIALIZE_OK,
1455  static_cast<FwAssertArgType>(_status)
1456  );
1457 #endif
1458  _status = _logBuff.serialize(ID);
1459  FW_ASSERT(
1460  _status == Fw::FW_SERIALIZE_OK,
1461  static_cast<FwAssertArgType>(_status)
1462  );
1463 
1464  this->m_Log_OutputPort[0].invoke(
1465  _id,
1466  _logTime,
1468  _logBuff
1469  );
1470  }
1471 
1472  // Emit the event on the text log port
1473 #if FW_ENABLE_TEXT_LOGGING
1474  if (this->m_LogText_OutputPort[0].isConnected()) {
1475 #if FW_OBJECT_NAMES == 1
1476  const char* _formatString =
1477  "(%s) %s: ID %" PRIu32 " is filtered.";
1478 #else
1479  const char* _formatString =
1480  "%s: ID %" PRIu32 " is filtered.";
1481 #endif
1482 
1483  Fw::TextLogString _logString;
1484  _logString.format(
1485  _formatString,
1486 #if FW_OBJECT_NAMES == 1
1487  this->m_objName.toChar(),
1488 #endif
1489  "ID_FILTER_ENABLED ",
1490  ID
1491  );
1492 
1493  this->m_LogText_OutputPort[0].invoke(
1494  _id,
1495  _logTime,
1497  _logString
1498  );
1499  }
1500 #endif
1501  }
1502 
1505  {
1506  // Get the time
1507  Fw::Time _logTime;
1508  if (this->m_Time_OutputPort[0].isConnected()) {
1509  this->m_Time_OutputPort[0].invoke(_logTime);
1510  }
1511 
1512  FwEventIdType _id = static_cast<FwEventIdType>(0);
1513 
1514  _id = this->getIdBase() + EVENTID_ID_FILTER_LIST_FULL;
1515 
1516  // Emit the event on the log port
1517  if (this->m_Log_OutputPort[0].isConnected()) {
1518  Fw::LogBuffer _logBuff;
1520 
1521 #if FW_AMPCS_COMPATIBLE
1522  // Serialize the number of arguments
1523  _status = _logBuff.serialize(static_cast<U8>(1));
1524  FW_ASSERT(
1525  _status == Fw::FW_SERIALIZE_OK,
1526  static_cast<FwAssertArgType>(_status)
1527  );
1528 #endif
1529 
1530 #if FW_AMPCS_COMPATIBLE
1531  // Serialize the argument size
1532  _status = _logBuff.serialize(
1533  static_cast<U8>(sizeof(U32))
1534  );
1535  FW_ASSERT(
1536  _status == Fw::FW_SERIALIZE_OK,
1537  static_cast<FwAssertArgType>(_status)
1538  );
1539 #endif
1540  _status = _logBuff.serialize(ID);
1541  FW_ASSERT(
1542  _status == Fw::FW_SERIALIZE_OK,
1543  static_cast<FwAssertArgType>(_status)
1544  );
1545 
1546  this->m_Log_OutputPort[0].invoke(
1547  _id,
1548  _logTime,
1550  _logBuff
1551  );
1552  }
1553 
1554  // Emit the event on the text log port
1555 #if FW_ENABLE_TEXT_LOGGING
1556  if (this->m_LogText_OutputPort[0].isConnected()) {
1557 #if FW_OBJECT_NAMES == 1
1558  const char* _formatString =
1559  "(%s) %s: ID filter list is full. Cannot filter %" PRIu32 " .";
1560 #else
1561  const char* _formatString =
1562  "%s: ID filter list is full. Cannot filter %" PRIu32 " .";
1563 #endif
1564 
1565  Fw::TextLogString _logString;
1566  _logString.format(
1567  _formatString,
1568 #if FW_OBJECT_NAMES == 1
1569  this->m_objName.toChar(),
1570 #endif
1571  "ID_FILTER_LIST_FULL ",
1572  ID
1573  );
1574 
1575  this->m_LogText_OutputPort[0].invoke(
1576  _id,
1577  _logTime,
1579  _logString
1580  );
1581  }
1582 #endif
1583  }
1584 
1587  {
1588  // Get the time
1589  Fw::Time _logTime;
1590  if (this->m_Time_OutputPort[0].isConnected()) {
1591  this->m_Time_OutputPort[0].invoke(_logTime);
1592  }
1593 
1594  FwEventIdType _id = static_cast<FwEventIdType>(0);
1595 
1596  _id = this->getIdBase() + EVENTID_ID_FILTER_REMOVED;
1597 
1598  // Emit the event on the log port
1599  if (this->m_Log_OutputPort[0].isConnected()) {
1600  Fw::LogBuffer _logBuff;
1602 
1603 #if FW_AMPCS_COMPATIBLE
1604  // Serialize the number of arguments
1605  _status = _logBuff.serialize(static_cast<U8>(1));
1606  FW_ASSERT(
1607  _status == Fw::FW_SERIALIZE_OK,
1608  static_cast<FwAssertArgType>(_status)
1609  );
1610 #endif
1611 
1612 #if FW_AMPCS_COMPATIBLE
1613  // Serialize the argument size
1614  _status = _logBuff.serialize(
1615  static_cast<U8>(sizeof(U32))
1616  );
1617  FW_ASSERT(
1618  _status == Fw::FW_SERIALIZE_OK,
1619  static_cast<FwAssertArgType>(_status)
1620  );
1621 #endif
1622  _status = _logBuff.serialize(ID);
1623  FW_ASSERT(
1624  _status == Fw::FW_SERIALIZE_OK,
1625  static_cast<FwAssertArgType>(_status)
1626  );
1627 
1628  this->m_Log_OutputPort[0].invoke(
1629  _id,
1630  _logTime,
1632  _logBuff
1633  );
1634  }
1635 
1636  // Emit the event on the text log port
1637 #if FW_ENABLE_TEXT_LOGGING
1638  if (this->m_LogText_OutputPort[0].isConnected()) {
1639 #if FW_OBJECT_NAMES == 1
1640  const char* _formatString =
1641  "(%s) %s: ID filter ID %" PRIu32 " removed.";
1642 #else
1643  const char* _formatString =
1644  "%s: ID filter ID %" PRIu32 " removed.";
1645 #endif
1646 
1647  Fw::TextLogString _logString;
1648  _logString.format(
1649  _formatString,
1650 #if FW_OBJECT_NAMES == 1
1651  this->m_objName.toChar(),
1652 #endif
1653  "ID_FILTER_REMOVED ",
1654  ID
1655  );
1656 
1657  this->m_LogText_OutputPort[0].invoke(
1658  _id,
1659  _logTime,
1661  _logString
1662  );
1663  }
1664 #endif
1665  }
1666 
1669  {
1670  // Get the time
1671  Fw::Time _logTime;
1672  if (this->m_Time_OutputPort[0].isConnected()) {
1673  this->m_Time_OutputPort[0].invoke(_logTime);
1674  }
1675 
1676  FwEventIdType _id = static_cast<FwEventIdType>(0);
1677 
1678  _id = this->getIdBase() + EVENTID_ID_FILTER_NOT_FOUND;
1679 
1680  // Emit the event on the log port
1681  if (this->m_Log_OutputPort[0].isConnected()) {
1682  Fw::LogBuffer _logBuff;
1684 
1685 #if FW_AMPCS_COMPATIBLE
1686  // Serialize the number of arguments
1687  _status = _logBuff.serialize(static_cast<U8>(1));
1688  FW_ASSERT(
1689  _status == Fw::FW_SERIALIZE_OK,
1690  static_cast<FwAssertArgType>(_status)
1691  );
1692 #endif
1693 
1694 #if FW_AMPCS_COMPATIBLE
1695  // Serialize the argument size
1696  _status = _logBuff.serialize(
1697  static_cast<U8>(sizeof(U32))
1698  );
1699  FW_ASSERT(
1700  _status == Fw::FW_SERIALIZE_OK,
1701  static_cast<FwAssertArgType>(_status)
1702  );
1703 #endif
1704  _status = _logBuff.serialize(ID);
1705  FW_ASSERT(
1706  _status == Fw::FW_SERIALIZE_OK,
1707  static_cast<FwAssertArgType>(_status)
1708  );
1709 
1710  this->m_Log_OutputPort[0].invoke(
1711  _id,
1712  _logTime,
1714  _logBuff
1715  );
1716  }
1717 
1718  // Emit the event on the text log port
1719 #if FW_ENABLE_TEXT_LOGGING
1720  if (this->m_LogText_OutputPort[0].isConnected()) {
1721 #if FW_OBJECT_NAMES == 1
1722  const char* _formatString =
1723  "(%s) %s: ID filter ID %" PRIu32 " not found.";
1724 #else
1725  const char* _formatString =
1726  "%s: ID filter ID %" PRIu32 " not found.";
1727 #endif
1728 
1729  Fw::TextLogString _logString;
1730  _logString.format(
1731  _formatString,
1732 #if FW_OBJECT_NAMES == 1
1733  this->m_objName.toChar(),
1734 #endif
1735  "ID_FILTER_NOT_FOUND ",
1736  ID
1737  );
1738 
1739  this->m_LogText_OutputPort[0].invoke(
1740  _id,
1741  _logTime,
1743  _logString
1744  );
1745  }
1746 #endif
1747  }
1748 
1749  // ----------------------------------------------------------------------
1750  // Time
1751  // ----------------------------------------------------------------------
1752 
1755  {
1756  if (this->m_Time_OutputPort[0].isConnected()) {
1757  Fw::Time _time;
1758  this->m_Time_OutputPort[0].invoke(_time);
1759  return _time;
1760  }
1761  else {
1762  return Fw::Time(TB_NONE, 0, 0);
1763  }
1764  }
1765 
1766  // ----------------------------------------------------------------------
1767  // Message dispatch functions
1768  // ----------------------------------------------------------------------
1769 
1770  Fw::QueuedComponentBase::MsgDispatchStatus ActiveLoggerComponentBase ::
1771  doDispatch()
1772  {
1773  ComponentIpcSerializableBuffer _msg;
1774  FwQueuePriorityType _priority = 0;
1775 
1776  Os::Queue::Status _msgStatus = this->m_queue.receive(
1777  _msg,
1779  _priority
1780  );
1781  FW_ASSERT(
1782  _msgStatus == Os::Queue::OP_OK,
1783  static_cast<FwAssertArgType>(_msgStatus)
1784  );
1785 
1786  // Reset to beginning of buffer
1787  _msg.resetDeser();
1788 
1789  FwEnumStoreType _desMsg = 0;
1790  Fw::SerializeStatus _deserStatus = _msg.deserialize(_desMsg);
1791  FW_ASSERT(
1792  _deserStatus == Fw::FW_SERIALIZE_OK,
1793  static_cast<FwAssertArgType>(_deserStatus)
1794  );
1795 
1796  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1797 
1798  if (_msgType == ACTIVELOGGER_COMPONENT_EXIT) {
1799  return MSG_DISPATCH_EXIT;
1800  }
1801 
1802  FwIndexType portNum = 0;
1803  _deserStatus = _msg.deserialize(portNum);
1804  FW_ASSERT(
1805  _deserStatus == Fw::FW_SERIALIZE_OK,
1806  static_cast<FwAssertArgType>(_deserStatus)
1807  );
1808 
1809  switch (_msgType) {
1810  // Handle async input port pingIn
1811  case PINGIN_PING: {
1812  // Deserialize argument key
1813  U32 key;
1814  _deserStatus = _msg.deserialize(key);
1815  FW_ASSERT(
1816  _deserStatus == Fw::FW_SERIALIZE_OK,
1817  static_cast<FwAssertArgType>(_deserStatus)
1818  );
1819  // Call handler function
1820  this->pingIn_handler(
1821  portNum,
1822  key
1823  );
1824 
1825  break;
1826  }
1827 
1828  // Handle command SET_ID_FILTER
1829  case CMD_SET_ID_FILTER: {
1830  // Deserialize opcode
1831  FwOpcodeType _opCode = 0;
1832  _deserStatus = _msg.deserialize(_opCode);
1833  FW_ASSERT (
1834  _deserStatus == Fw::FW_SERIALIZE_OK,
1835  static_cast<FwAssertArgType>(_deserStatus)
1836  );
1837 
1838  // Deserialize command sequence
1839  U32 _cmdSeq = 0;
1840  _deserStatus = _msg.deserialize(_cmdSeq);
1841  FW_ASSERT (
1842  _deserStatus == Fw::FW_SERIALIZE_OK,
1843  static_cast<FwAssertArgType>(_deserStatus)
1844  );
1845 
1846  // Deserialize command argument buffer
1847  Fw::CmdArgBuffer args;
1848  _deserStatus = _msg.deserialize(args);
1849  FW_ASSERT (
1850  _deserStatus == Fw::FW_SERIALIZE_OK,
1851  static_cast<FwAssertArgType>(_deserStatus)
1852  );
1853 
1854  // Reset buffer
1855  args.resetDeser();
1856 
1857  // Deserialize argument ID
1858  U32 ID;
1859  _deserStatus = args.deserialize(ID);
1860  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1861  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1862  this->cmdResponse_out(
1863  _opCode,
1864  _cmdSeq,
1866  );
1867  }
1868  // Don't crash the task if bad arguments were passed from the ground
1869  break;
1870  }
1871 
1872  // Deserialize argument idFilterEnabled
1873  Svc::ActiveLogger_Enabled idFilterEnabled;
1874  _deserStatus = args.deserialize(idFilterEnabled);
1875  if (_deserStatus != Fw::FW_SERIALIZE_OK) {
1876  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1877  this->cmdResponse_out(
1878  _opCode,
1879  _cmdSeq,
1881  );
1882  }
1883  // Don't crash the task if bad arguments were passed from the ground
1884  break;
1885  }
1886 
1887  // Make sure there was no data left over.
1888  // That means the argument buffer size was incorrect.
1889 #if FW_CMD_CHECK_RESIDUAL
1890  if (args.getBuffLeft() != 0) {
1891  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1892  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1893  }
1894  // Don't crash the task if bad arguments were passed from the ground
1895  break;
1896  }
1897 #endif
1898 
1899  // Call handler function
1901  _opCode, _cmdSeq,
1902  ID,
1903  idFilterEnabled
1904  );
1905 
1906  break;
1907  }
1908 
1909  // Handle command DUMP_FILTER_STATE
1910  case CMD_DUMP_FILTER_STATE: {
1911  // Deserialize opcode
1912  FwOpcodeType _opCode = 0;
1913  _deserStatus = _msg.deserialize(_opCode);
1914  FW_ASSERT (
1915  _deserStatus == Fw::FW_SERIALIZE_OK,
1916  static_cast<FwAssertArgType>(_deserStatus)
1917  );
1918 
1919  // Deserialize command sequence
1920  U32 _cmdSeq = 0;
1921  _deserStatus = _msg.deserialize(_cmdSeq);
1922  FW_ASSERT (
1923  _deserStatus == Fw::FW_SERIALIZE_OK,
1924  static_cast<FwAssertArgType>(_deserStatus)
1925  );
1926 
1927  // Deserialize command argument buffer
1928  Fw::CmdArgBuffer args;
1929  _deserStatus = _msg.deserialize(args);
1930  FW_ASSERT (
1931  _deserStatus == Fw::FW_SERIALIZE_OK,
1932  static_cast<FwAssertArgType>(_deserStatus)
1933  );
1934 
1935  // Reset buffer
1936  args.resetDeser();
1937 
1938  // Make sure there was no data left over.
1939  // That means the argument buffer size was incorrect.
1940 #if FW_CMD_CHECK_RESIDUAL
1941  if (args.getBuffLeft() != 0) {
1942  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
1943  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1944  }
1945  // Don't crash the task if bad arguments were passed from the ground
1946  break;
1947  }
1948 #endif
1949 
1950  // Call handler function
1951  this->DUMP_FILTER_STATE_cmdHandler(_opCode, _cmdSeq);
1952 
1953  break;
1954  }
1955 
1956  // Handle internal interface loqQueue
1957  case INT_IF_LOQQUEUE: {
1958  FwEventIdType id;
1959  _deserStatus = _msg.deserialize(id);
1960 
1961  // Internal interface should always deserialize
1962  FW_ASSERT(
1963  Fw::FW_SERIALIZE_OK == _deserStatus,
1964  static_cast<FwAssertArgType>(_deserStatus)
1965  );
1966 
1967  Fw::Time timeTag;
1968  _deserStatus = _msg.deserialize(timeTag);
1969 
1970  // Internal interface should always deserialize
1971  FW_ASSERT(
1972  Fw::FW_SERIALIZE_OK == _deserStatus,
1973  static_cast<FwAssertArgType>(_deserStatus)
1974  );
1975 
1976  Fw::LogSeverity severity;
1977  _deserStatus = _msg.deserialize(severity);
1978 
1979  // Internal interface should always deserialize
1980  FW_ASSERT(
1981  Fw::FW_SERIALIZE_OK == _deserStatus,
1982  static_cast<FwAssertArgType>(_deserStatus)
1983  );
1984 
1985  Fw::LogBuffer args;
1986  _deserStatus = _msg.deserialize(args);
1987 
1988  // Internal interface should always deserialize
1989  FW_ASSERT(
1990  Fw::FW_SERIALIZE_OK == _deserStatus,
1991  static_cast<FwAssertArgType>(_deserStatus)
1992  );
1993 
1994  // Make sure there was no data left over.
1995  // That means the buffer size was incorrect.
1996  FW_ASSERT(
1997  _msg.getBuffLeft() == 0,
1998  static_cast<FwAssertArgType>(_msg.getBuffLeft())
1999  );
2000 
2001  // Call handler function
2003  id,
2004  timeTag,
2005  severity,
2006  args
2007  );
2008 
2009  break;
2010  }
2011 
2012  default:
2013  return MSG_DISPATCH_ERROR;
2014  }
2015 
2016  return MSG_DISPATCH_OK;
2017  }
2018 
2019  // ----------------------------------------------------------------------
2020  // Calls for messages received on special input ports
2021  // ----------------------------------------------------------------------
2022 
2023  void ActiveLoggerComponentBase ::
2024  m_p_CmdDisp_in(
2025  Fw::PassiveComponentBase* callComp,
2026  FwIndexType portNum,
2027  FwOpcodeType opCode,
2028  U32 cmdSeq,
2029  Fw::CmdArgBuffer& args
2030  )
2031  {
2032  FW_ASSERT(callComp);
2033  ActiveLoggerComponentBase* compPtr = static_cast<ActiveLoggerComponentBase*>(callComp);
2034 
2035  const U32 idBase = callComp->getIdBase();
2036  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
2037 
2038  // Select base class function based on opcode
2039  switch (opCode - idBase) {
2040  case OPCODE_SET_EVENT_FILTER: {
2041  compPtr->SET_EVENT_FILTER_cmdHandlerBase(
2042  opCode,
2043  cmdSeq,
2044  args
2045  );
2046  break;
2047  }
2048 
2049  case OPCODE_SET_ID_FILTER: {
2050  compPtr->SET_ID_FILTER_cmdHandlerBase(
2051  opCode,
2052  cmdSeq,
2053  args
2054  );
2055  break;
2056  }
2057 
2058  case OPCODE_DUMP_FILTER_STATE: {
2059  compPtr->DUMP_FILTER_STATE_cmdHandlerBase(
2060  opCode,
2061  cmdSeq,
2062  args
2063  );
2064  break;
2065  }
2066  }
2067  }
2068 
2069  // ----------------------------------------------------------------------
2070  // Calls for messages received on typed input ports
2071  // ----------------------------------------------------------------------
2072 
2073  void ActiveLoggerComponentBase ::
2074  m_p_LogRecv_in(
2075  Fw::PassiveComponentBase* callComp,
2076  FwIndexType portNum,
2077  FwEventIdType id,
2078  Fw::Time& timeTag,
2079  const Fw::LogSeverity& severity,
2080  Fw::LogBuffer& args
2081  )
2082  {
2083  FW_ASSERT(callComp);
2084  ActiveLoggerComponentBase* compPtr = static_cast<ActiveLoggerComponentBase*>(callComp);
2085  compPtr->LogRecv_handlerBase(
2086  portNum,
2087  id,
2088  timeTag,
2089  severity,
2090  args
2091  );
2092  }
2093 
2094  void ActiveLoggerComponentBase ::
2095  m_p_pingIn_in(
2096  Fw::PassiveComponentBase* callComp,
2097  FwIndexType portNum,
2098  U32 key
2099  )
2100  {
2101  FW_ASSERT(callComp);
2102  ActiveLoggerComponentBase* compPtr = static_cast<ActiveLoggerComponentBase*>(callComp);
2103  compPtr->pingIn_handlerBase(
2104  portNum,
2105  key
2106  );
2107  }
2108 
2109 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
void invoke(Fw::ComBuffer &data, U32 context) const
Invoke a port interface.
Definition: ComPortAc.cpp:156
Definition: Time.hpp:9
void init()
Initialization function.
Definition: ComPortAc.cpp:137
Operation succeeded.
Definition: Os.hpp:26
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
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.
Status
status returned from the queue send function
Definition: Queue.hpp:30
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
Definition: String.hpp:50
void FatalAnnounce_out(FwIndexType portNum, FwEventIdType Id)
Invoke output port FatalAnnounce.
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
virtual ~ActiveLoggerComponentBase()
Destroy ActiveLoggerComponentBase object.
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
void set_PktSend_OutputPort(FwIndexType portNum, Fw::InputComPort *port)
Connect port to PktSend[portNum].
void SET_EVENT_FILTER_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void DUMP_FILTER_STATE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void loqQueue_internalInterfaceInvoke(FwEventIdType id, const Fw::Time &timeTag, const Fw::LogSeverity &severity, const Fw::LogBuffer &args)
Internal interface base-class function for loqQueue.
The size of the serial representation.
FwIndexType getNum_FatalAnnounce_OutputPorts() const
I32 FwEnumStoreType
Definition: FpConfig.h:64
Enum representing a command response.
void invoke(FwEventIdType Id) const
Invoke a port interface.
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
bool isConnected_Log_OutputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
Os::Queue m_queue
queue object for active component
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void init()
Object initializer.
Definition: ObjBase.cpp:26
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
Message will block until space is available.
Definition: Queue.hpp:46
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
void init()
Initialization function.
Definition: LogPortAc.cpp:56
void addCallPort(InputFatalEventPort *callPort)
Register an input port.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
message to exit active component task
Less important informational events.
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
A less serious but recoverable event.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
ActiveLoggerComponentBase(const char *compName="")
Construct ActiveLoggerComponentBase object.
bool isConnected_CmdReg_OutputPort(FwIndexType portNum)
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
virtual void loqQueue_internalInterfaceHandler(FwEventIdType id, const Fw::Time &timeTag, const Fw::LogSeverity &severity, const Fw::LogBuffer &args)=0
Internal interface handler for loqQueue.
U32 FwOpcodeType
Definition: FpConfig.h:91
const char * toChar() const
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
No time base has been established.
Definition: FpConfig.h:70
FwSizeType SizeType
virtual void SET_EVENT_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::ActiveLogger_FilterSeverity filterLevel, Svc::ActiveLogger_Enabled filterEnabled)=0
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
void log_ACTIVITY_LO_SEVERITY_FILTER_STATE(Svc::ActiveLogger_FilterSeverity severity, bool enabled) const
void resetDeser()
reset deserialization to beginning
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
bool isConnected() const
Definition: PortBase.cpp:42
void set_FatalAnnounce_OutputPort(FwIndexType portNum, Svc::InputFatalEventPort *port)
Connect port to FatalAnnounce[portNum].
Enum representing event severity.
virtual void LogRecv_handler(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)=0
Handler for input port LogRecv.
U32 FwEventIdType
Definition: FpConfig.h:103
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
Fw::InputLogPort * get_LogRecv_InputPort(FwIndexType portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: LogPortAc.cpp:62
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:32
BlockingType
message type
Definition: Queue.hpp:45
Command failed to deserialize.
virtual void DUMP_FILTER_STATE_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command DUMP_FILTER_STATE.
Important informational events.
virtual void SET_ID_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, U32 ID, Svc::ActiveLogger_Enabled idFilterEnabled)=0
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_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
A message was sent requesting an exit of the loop.
void SET_ID_FILTER_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:85
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void init()
Initialization function.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void incNumMsgDropped()
increment the number of messages dropped
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: PingPortAc.cpp:56
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:35
bool isConnected_Time_OutputPort(FwIndexType portNum)
void addCallPort(InputComPort *callPort)
Register an input port.
Definition: ComPortAc.cpp:143
Enabled and disabled state.
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:47
virtual void SET_ID_FILTER_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command SET_ID_FILTER.
void init()
Initialization function.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
void regCommands()
Register commands with the Command Dispatcher.
bool isConnected_FatalAnnounce_OutputPort(FwIndexType portNum)
Set filter for reporting events. Events are not stored in component.
void init()
Initialization function.
bool isConnected_PktSend_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:148
#define FW_ASSERT(...)
Definition: Assert.hpp:14
virtual void DUMP_FILTER_STATE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.