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