F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ComLoggerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComLoggerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ComLogger 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  COMLOGGER_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  COMIN_COM,
20  PINGIN_PING,
21  CMD_CLOSEFILE,
22  };
23 
24  // Get the max size by constructing a union of the async input, command, and
25  // internal port serialization sizes
26  union BuffUnion {
30  };
31 
32  // Define a message buffer class large enough to handle all the
33  // asynchronous inputs to the component
34  class ComponentIpcSerializableBuffer :
36  {
37 
38  public:
39 
40  enum {
41  // Offset into data in buffer: Size of message ID and port number
42  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
43  // Max data size
44  MAX_DATA_SIZE = sizeof(BuffUnion),
45  // Max message size: Size of message id + size of port + max data size
46  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
47  };
48 
49  Fw::Serializable::SizeType getBuffCapacity() const {
50  return sizeof(m_buff);
51  }
52 
53  U8* getBuffAddr() {
54  return m_buff;
55  }
56 
57  const U8* getBuffAddr() const {
58  return m_buff;
59  }
60 
61  private:
62  // Should be the max of all the input ports serialized sizes...
63  U8 m_buff[SERIALIZATION_SIZE];
64 
65  };
66  }
67 
68  // ----------------------------------------------------------------------
69  // Component initialization
70  // ----------------------------------------------------------------------
71 
74  FwSizeType queueDepth,
75  FwEnumStoreType instance
76  )
77  {
78  // Initialize base class
80 
81  // Connect input port cmdIn
82  for (
83  FwIndexType port = 0;
84  port < static_cast<FwIndexType>(this->getNum_cmdIn_InputPorts());
85  port++
86  ) {
87  this->m_cmdIn_InputPort[port].init();
88  this->m_cmdIn_InputPort[port].addCallComp(
89  this,
90  m_p_cmdIn_in
91  );
92  this->m_cmdIn_InputPort[port].setPortNum(port);
93 
94 #if FW_OBJECT_NAMES == 1
95  Fw::ObjectName portName;
96  portName.format(
97  "%s_cmdIn_InputPort[%" PRI_PlatformIntType "]",
98  this->m_objName.toChar(),
99  port
100  );
101  this->m_cmdIn_InputPort[port].setObjName(portName.toChar());
102 #endif
103  }
104 
105  // Connect input port comIn
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_comIn_InputPorts());
109  port++
110  ) {
111  this->m_comIn_InputPort[port].init();
112  this->m_comIn_InputPort[port].addCallComp(
113  this,
114  m_p_comIn_in
115  );
116  this->m_comIn_InputPort[port].setPortNum(port);
117 
118 #if FW_OBJECT_NAMES == 1
119  Fw::ObjectName portName;
120  portName.format(
121  "%s_comIn_InputPort[%" PRI_PlatformIntType "]",
122  this->m_objName.toChar(),
123  port
124  );
125  this->m_comIn_InputPort[port].setObjName(portName.toChar());
126 #endif
127  }
128 
129  // Connect input port pingIn
130  for (
131  FwIndexType port = 0;
132  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
133  port++
134  ) {
135  this->m_pingIn_InputPort[port].init();
136  this->m_pingIn_InputPort[port].addCallComp(
137  this,
138  m_p_pingIn_in
139  );
140  this->m_pingIn_InputPort[port].setPortNum(port);
141 
142 #if FW_OBJECT_NAMES == 1
143  Fw::ObjectName portName;
144  portName.format(
145  "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
146  this->m_objName.toChar(),
147  port
148  );
149  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
150 #endif
151  }
152 
153 #if FW_ENABLE_TEXT_LOGGING == 1
154  // Connect output port LogText
155  for (
156  FwIndexType port = 0;
157  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
158  port++
159  ) {
160  this->m_LogText_OutputPort[port].init();
161 
162 #if FW_OBJECT_NAMES == 1
163  Fw::ObjectName portName;
164  portName.format(
165  "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
166  this->m_objName.toChar(),
167  port
168  );
169  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
170 #endif
171  }
172 #endif
173 
174  // Connect output port cmdRegOut
175  for (
176  FwIndexType port = 0;
177  port < static_cast<FwIndexType>(this->getNum_cmdRegOut_OutputPorts());
178  port++
179  ) {
180  this->m_cmdRegOut_OutputPort[port].init();
181 
182 #if FW_OBJECT_NAMES == 1
183  Fw::ObjectName portName;
184  portName.format(
185  "%s_cmdRegOut_OutputPort[%" PRI_PlatformIntType "]",
186  this->m_objName.toChar(),
187  port
188  );
189  this->m_cmdRegOut_OutputPort[port].setObjName(portName.toChar());
190 #endif
191  }
192 
193  // Connect output port cmdResponseOut
194  for (
195  FwIndexType port = 0;
196  port < static_cast<FwIndexType>(this->getNum_cmdResponseOut_OutputPorts());
197  port++
198  ) {
199  this->m_cmdResponseOut_OutputPort[port].init();
200 
201 #if FW_OBJECT_NAMES == 1
202  Fw::ObjectName portName;
203  portName.format(
204  "%s_cmdResponseOut_OutputPort[%" PRI_PlatformIntType "]",
205  this->m_objName.toChar(),
206  port
207  );
208  this->m_cmdResponseOut_OutputPort[port].setObjName(portName.toChar());
209 #endif
210  }
211 
212  // Connect output port logOut
213  for (
214  FwIndexType port = 0;
215  port < static_cast<FwIndexType>(this->getNum_logOut_OutputPorts());
216  port++
217  ) {
218  this->m_logOut_OutputPort[port].init();
219 
220 #if FW_OBJECT_NAMES == 1
221  Fw::ObjectName portName;
222  portName.format(
223  "%s_logOut_OutputPort[%" PRI_PlatformIntType "]",
224  this->m_objName.toChar(),
225  port
226  );
227  this->m_logOut_OutputPort[port].setObjName(portName.toChar());
228 #endif
229  }
230 
231  // Connect output port timeCaller
232  for (
233  FwIndexType port = 0;
234  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
235  port++
236  ) {
237  this->m_timeCaller_OutputPort[port].init();
238 
239 #if FW_OBJECT_NAMES == 1
240  Fw::ObjectName portName;
241  portName.format(
242  "%s_timeCaller_OutputPort[%" PRI_PlatformIntType "]",
243  this->m_objName.toChar(),
244  port
245  );
246  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
247 #endif
248  }
249 
250  // Connect output port pingOut
251  for (
252  FwIndexType port = 0;
253  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
254  port++
255  ) {
256  this->m_pingOut_OutputPort[port].init();
257 
258 #if FW_OBJECT_NAMES == 1
259  Fw::ObjectName portName;
260  portName.format(
261  "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
262  this->m_objName.toChar(),
263  port
264  );
265  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
266 #endif
267  }
268 
269  // Create the queue
270  Os::Queue::Status qStat = this->createQueue(
271  queueDepth,
272  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
273  );
274  FW_ASSERT(
275  Os::Queue::Status::OP_OK == qStat,
276  static_cast<FwAssertArgType>(qStat)
277  );
278  }
279 
280  // ----------------------------------------------------------------------
281  // Getters for special input ports
282  // ----------------------------------------------------------------------
283 
286  {
287  FW_ASSERT(
288  portNum < this->getNum_cmdIn_InputPorts(),
289  static_cast<FwAssertArgType>(portNum)
290  );
291 
292  return &this->m_cmdIn_InputPort[portNum];
293  }
294 
295  // ----------------------------------------------------------------------
296  // Getters for typed input ports
297  // ----------------------------------------------------------------------
298 
301  {
302  FW_ASSERT(
303  portNum < this->getNum_comIn_InputPorts(),
304  static_cast<FwAssertArgType>(portNum)
305  );
306 
307  return &this->m_comIn_InputPort[portNum];
308  }
309 
312  {
313  FW_ASSERT(
314  portNum < this->getNum_pingIn_InputPorts(),
315  static_cast<FwAssertArgType>(portNum)
316  );
317 
318  return &this->m_pingIn_InputPort[portNum];
319  }
320 
321  // ----------------------------------------------------------------------
322  // Connect input ports to special output ports
323  // ----------------------------------------------------------------------
324 
325 #if FW_ENABLE_TEXT_LOGGING == 1
326 
327  void ComLoggerComponentBase ::
328  set_LogText_OutputPort(
329  FwIndexType portNum,
331  )
332  {
333  FW_ASSERT(
334  portNum < this->getNum_LogText_OutputPorts(),
335  static_cast<FwAssertArgType>(portNum)
336  );
337 
338  this->m_LogText_OutputPort[portNum].addCallPort(port);
339  }
340 
341 #endif
342 
345  FwIndexType portNum,
346  Fw::InputCmdRegPort* port
347  )
348  {
349  FW_ASSERT(
350  portNum < this->getNum_cmdRegOut_OutputPorts(),
351  static_cast<FwAssertArgType>(portNum)
352  );
353 
354  this->m_cmdRegOut_OutputPort[portNum].addCallPort(port);
355  }
356 
359  FwIndexType portNum,
361  )
362  {
363  FW_ASSERT(
364  portNum < this->getNum_cmdResponseOut_OutputPorts(),
365  static_cast<FwAssertArgType>(portNum)
366  );
367 
368  this->m_cmdResponseOut_OutputPort[portNum].addCallPort(port);
369  }
370 
373  FwIndexType portNum,
374  Fw::InputLogPort* port
375  )
376  {
377  FW_ASSERT(
378  portNum < this->getNum_logOut_OutputPorts(),
379  static_cast<FwAssertArgType>(portNum)
380  );
381 
382  this->m_logOut_OutputPort[portNum].addCallPort(port);
383  }
384 
387  FwIndexType portNum,
388  Fw::InputTimePort* port
389  )
390  {
391  FW_ASSERT(
392  portNum < this->getNum_timeCaller_OutputPorts(),
393  static_cast<FwAssertArgType>(portNum)
394  );
395 
396  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
397  }
398 
399  // ----------------------------------------------------------------------
400  // Connect typed input ports to typed output ports
401  // ----------------------------------------------------------------------
402 
405  FwIndexType portNum,
406  Svc::InputPingPort* port
407  )
408  {
409  FW_ASSERT(
410  portNum < this->getNum_pingOut_OutputPorts(),
411  static_cast<FwAssertArgType>(portNum)
412  );
413 
414  this->m_pingOut_OutputPort[portNum].addCallPort(port);
415  }
416 
417 #if FW_PORT_SERIALIZATION
418 
419  // ----------------------------------------------------------------------
420  // Connect serial input ports to special output ports
421  // ----------------------------------------------------------------------
422 
423 #if FW_ENABLE_TEXT_LOGGING == 1
424 
425  void ComLoggerComponentBase ::
426  set_LogText_OutputPort(
427  FwIndexType portNum,
428  Fw::InputSerializePort* port
429  )
430  {
431  FW_ASSERT(
432  portNum < this->getNum_LogText_OutputPorts(),
433  static_cast<FwAssertArgType>(portNum)
434  );
435 
436  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
437  }
438 
439 #endif
440 
443  FwIndexType portNum,
444  Fw::InputSerializePort* port
445  )
446  {
447  FW_ASSERT(
448  portNum < this->getNum_cmdRegOut_OutputPorts(),
449  static_cast<FwAssertArgType>(portNum)
450  );
451 
452  this->m_cmdRegOut_OutputPort[portNum].registerSerialPort(port);
453  }
454 
457  FwIndexType portNum,
458  Fw::InputSerializePort* port
459  )
460  {
461  FW_ASSERT(
462  portNum < this->getNum_cmdResponseOut_OutputPorts(),
463  static_cast<FwAssertArgType>(portNum)
464  );
465 
466  this->m_cmdResponseOut_OutputPort[portNum].registerSerialPort(port);
467  }
468 
471  FwIndexType portNum,
472  Fw::InputSerializePort* port
473  )
474  {
475  FW_ASSERT(
476  portNum < this->getNum_logOut_OutputPorts(),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_logOut_OutputPort[portNum].registerSerialPort(port);
481  }
482 
485  FwIndexType portNum,
486  Fw::InputSerializePort* port
487  )
488  {
489  FW_ASSERT(
490  portNum < this->getNum_timeCaller_OutputPorts(),
491  static_cast<FwAssertArgType>(portNum)
492  );
493 
494  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
495  }
496 
497 #endif
498 
499 #if FW_PORT_SERIALIZATION
500 
501  // ----------------------------------------------------------------------
502  // Connect serial input ports to typed output ports
503  // ----------------------------------------------------------------------
504 
507  FwIndexType portNum,
508  Fw::InputSerializePort* port
509  )
510  {
511  FW_ASSERT(
512  portNum < this->getNum_pingOut_OutputPorts(),
513  static_cast<FwAssertArgType>(portNum)
514  );
515 
516  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
517  }
518 
519 #endif
520 
521  // ----------------------------------------------------------------------
522  // Command registration
523  // ----------------------------------------------------------------------
524 
527  {
528  FW_ASSERT(this->m_cmdRegOut_OutputPort[0].isConnected());
529 
530  this->m_cmdRegOut_OutputPort[0].invoke(
531  this->getIdBase() + OPCODE_CLOSEFILE
532  );
533  }
534 
535  // ----------------------------------------------------------------------
536  // Component construction and destruction
537  // ----------------------------------------------------------------------
538 
540  ComLoggerComponentBase(const char* compName) :
541  Fw::ActiveComponentBase(compName)
542  {
543  this->m_FileNotInitializedThrottle = 0;
544  }
545 
548  {
549 
550  }
551 
552  // ----------------------------------------------------------------------
553  // Getters for numbers of special input ports
554  // ----------------------------------------------------------------------
555 
558  {
559  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdIn_InputPort));
560  }
561 
562  // ----------------------------------------------------------------------
563  // Getters for numbers of typed input ports
564  // ----------------------------------------------------------------------
565 
568  {
569  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_comIn_InputPort));
570  }
571 
574  {
575  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
576  }
577 
578  // ----------------------------------------------------------------------
579  // Getters for numbers of special output ports
580  // ----------------------------------------------------------------------
581 
582 #if FW_ENABLE_TEXT_LOGGING == 1
583 
584  FwIndexType ComLoggerComponentBase ::
585  getNum_LogText_OutputPorts() const
586  {
587  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
588  }
589 
590 #endif
591 
594  {
595  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdRegOut_OutputPort));
596  }
597 
600  {
601  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_cmdResponseOut_OutputPort));
602  }
603 
606  {
607  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_logOut_OutputPort));
608  }
609 
612  {
613  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
614  }
615 
616  // ----------------------------------------------------------------------
617  // Getters for numbers of typed output ports
618  // ----------------------------------------------------------------------
619 
622  {
623  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
624  }
625 
626  // ----------------------------------------------------------------------
627  // Connection status queries for special output ports
628  // ----------------------------------------------------------------------
629 
630 #if FW_ENABLE_TEXT_LOGGING == 1
631 
632  bool ComLoggerComponentBase ::
633  isConnected_LogText_OutputPort(FwIndexType portNum)
634  {
635  FW_ASSERT(
636  portNum < this->getNum_LogText_OutputPorts(),
637  static_cast<FwAssertArgType>(portNum)
638  );
639 
640  return this->m_LogText_OutputPort[portNum].isConnected();
641  }
642 
643 #endif
644 
647  {
648  FW_ASSERT(
649  portNum < this->getNum_cmdRegOut_OutputPorts(),
650  static_cast<FwAssertArgType>(portNum)
651  );
652 
653  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
654  }
655 
658  {
659  FW_ASSERT(
660  portNum < this->getNum_cmdResponseOut_OutputPorts(),
661  static_cast<FwAssertArgType>(portNum)
662  );
663 
664  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
665  }
666 
669  {
670  FW_ASSERT(
671  portNum < this->getNum_logOut_OutputPorts(),
672  static_cast<FwAssertArgType>(portNum)
673  );
674 
675  return this->m_logOut_OutputPort[portNum].isConnected();
676  }
677 
680  {
681  FW_ASSERT(
682  portNum < this->getNum_timeCaller_OutputPorts(),
683  static_cast<FwAssertArgType>(portNum)
684  );
685 
686  return this->m_timeCaller_OutputPort[portNum].isConnected();
687  }
688 
689  // ----------------------------------------------------------------------
690  // Connection status queries for typed output ports
691  // ----------------------------------------------------------------------
692 
695  {
696  FW_ASSERT(
697  portNum < this->getNum_pingOut_OutputPorts(),
698  static_cast<FwAssertArgType>(portNum)
699  );
700 
701  return this->m_pingOut_OutputPort[portNum].isConnected();
702  }
703 
704  // ----------------------------------------------------------------------
705  // Port handler base-class functions for typed input ports
706  //
707  // Call these functions directly to bypass the corresponding ports
708  // ----------------------------------------------------------------------
709 
712  FwIndexType portNum,
713  Fw::ComBuffer& data,
714  U32 context
715  )
716  {
717  // Make sure port number is valid
718  FW_ASSERT(
719  portNum < this->getNum_comIn_InputPorts(),
720  static_cast<FwAssertArgType>(portNum)
721  );
722 
723  // Call pre-message hook
725  portNum,
726  data,
727  context
728  );
729  ComponentIpcSerializableBuffer msg;
731 
732  // Serialize message ID
733  _status = msg.serialize(
734  static_cast<FwEnumStoreType>(COMIN_COM)
735  );
736  FW_ASSERT(
737  _status == Fw::FW_SERIALIZE_OK,
738  static_cast<FwAssertArgType>(_status)
739  );
740 
741  // Serialize port number
742  _status = msg.serialize(portNum);
743  FW_ASSERT(
744  _status == Fw::FW_SERIALIZE_OK,
745  static_cast<FwAssertArgType>(_status)
746  );
747 
748  // Serialize argument data
749  _status = msg.serialize(data);
750  FW_ASSERT(
751  _status == Fw::FW_SERIALIZE_OK,
752  static_cast<FwAssertArgType>(_status)
753  );
754 
755  // Serialize argument context
756  _status = msg.serialize(context);
757  FW_ASSERT(
758  _status == Fw::FW_SERIALIZE_OK,
759  static_cast<FwAssertArgType>(_status)
760  );
761 
762  // Send message
764  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
765 
766  FW_ASSERT(
767  qStatus == Os::Queue::OP_OK,
768  static_cast<FwAssertArgType>(qStatus)
769  );
770  }
771 
774  FwIndexType portNum,
775  U32 key
776  )
777  {
778  // Make sure port number is valid
779  FW_ASSERT(
780  portNum < this->getNum_pingIn_InputPorts(),
781  static_cast<FwAssertArgType>(portNum)
782  );
783 
784  // Call pre-message hook
786  portNum,
787  key
788  );
789  ComponentIpcSerializableBuffer msg;
791 
792  // Serialize message ID
793  _status = msg.serialize(
794  static_cast<FwEnumStoreType>(PINGIN_PING)
795  );
796  FW_ASSERT(
797  _status == Fw::FW_SERIALIZE_OK,
798  static_cast<FwAssertArgType>(_status)
799  );
800 
801  // Serialize port number
802  _status = msg.serialize(portNum);
803  FW_ASSERT(
804  _status == Fw::FW_SERIALIZE_OK,
805  static_cast<FwAssertArgType>(_status)
806  );
807 
808  // Serialize argument key
809  _status = msg.serialize(key);
810  FW_ASSERT(
811  _status == Fw::FW_SERIALIZE_OK,
812  static_cast<FwAssertArgType>(_status)
813  );
814 
815  // Send message
817  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
818 
819  FW_ASSERT(
820  qStatus == Os::Queue::OP_OK,
821  static_cast<FwAssertArgType>(qStatus)
822  );
823  }
824 
825  // ----------------------------------------------------------------------
826  // Pre-message hooks for typed async input ports
827  //
828  // Each of these functions is invoked just before processing a message
829  // on the corresponding port. By default, they do nothing. You can
830  // override them to provide specific pre-message behavior.
831  // ----------------------------------------------------------------------
832 
835  FwIndexType portNum,
836  Fw::ComBuffer& data,
837  U32 context
838  )
839  {
840  // Default: no-op
841  }
842 
845  FwIndexType portNum,
846  U32 key
847  )
848  {
849  // Default: no-op
850  }
851 
852  // ----------------------------------------------------------------------
853  // Invocation functions for typed output ports
854  // ----------------------------------------------------------------------
855 
858  FwIndexType portNum,
859  U32 key
860  )
861  {
862  FW_ASSERT(
863  portNum < this->getNum_pingOut_OutputPorts(),
864  static_cast<FwAssertArgType>(portNum)
865  );
866  this->m_pingOut_OutputPort[portNum].invoke(
867  key
868  );
869  }
870 
871  // ----------------------------------------------------------------------
872  // Command response
873  // ----------------------------------------------------------------------
874 
877  FwOpcodeType opCode,
878  U32 cmdSeq,
879  Fw::CmdResponse response
880  )
881  {
882  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
883  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
884  }
885 
886  // ----------------------------------------------------------------------
887  // Command handler base-class functions
888  //
889  // Call these functions directly to bypass the command input port
890  // ----------------------------------------------------------------------
891 
894  FwOpcodeType opCode,
895  U32 cmdSeq,
896  Fw::CmdArgBuffer& args
897  )
898  {
899  // Call pre-message hook
900  this->CloseFile_preMsgHook(opCode,cmdSeq);
901 
902  // Defer deserializing arguments to the message dispatcher
903  // to avoid deserializing and reserializing just for IPC
904  ComponentIpcSerializableBuffer msg;
906 
907  // Serialize for IPC
908  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CLOSEFILE));
909  FW_ASSERT (
910  _status == Fw::FW_SERIALIZE_OK,
911  static_cast<FwAssertArgType>(_status)
912  );
913 
914  // Fake port number to make message dequeue work
915  FwIndexType port = 0;
916 
917  _status = msg.serialize(port);
918  FW_ASSERT (
919  _status == Fw::FW_SERIALIZE_OK,
920  static_cast<FwAssertArgType>(_status)
921  );
922 
923  _status = msg.serialize(opCode);
924  FW_ASSERT (
925  _status == Fw::FW_SERIALIZE_OK,
926  static_cast<FwAssertArgType>(_status)
927  );
928 
929  _status = msg.serialize(cmdSeq);
930  FW_ASSERT (
931  _status == Fw::FW_SERIALIZE_OK,
932  static_cast<FwAssertArgType>(_status)
933  );
934 
935  _status = msg.serialize(args);
936  FW_ASSERT (
937  _status == Fw::FW_SERIALIZE_OK,
938  static_cast<FwAssertArgType>(_status)
939  );
940 
941  // Send message
943  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
944 
945  FW_ASSERT(
946  qStatus == Os::Queue::OP_OK,
947  static_cast<FwAssertArgType>(qStatus)
948  );
949  }
950 
951  // ----------------------------------------------------------------------
952  // Pre-message hooks for async commands
953  //
954  // Each of these functions is invoked just before processing the
955  // corresponding command. By default they do nothing. You can
956  // override them to provide specific pre-command behavior.
957  // ----------------------------------------------------------------------
958 
961  FwOpcodeType opCode,
962  U32 cmdSeq
963  )
964  {
965  // Defaults to no-op; can be overridden
966  (void) opCode;
967  (void) cmdSeq;
968  }
969 
970  // ----------------------------------------------------------------------
971  // Event logging functions
972  // ----------------------------------------------------------------------
973 
976  U32 errornum,
977  const Fw::StringBase& file
978  ) const
979  {
980  // Get the time
981  Fw::Time _logTime;
982  if (this->m_timeCaller_OutputPort[0].isConnected()) {
983  this->m_timeCaller_OutputPort[0].invoke(_logTime);
984  }
985 
986  FwEventIdType _id = static_cast<FwEventIdType>(0);
987 
988  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
989 
990  // Emit the event on the log port
991  if (this->m_logOut_OutputPort[0].isConnected()) {
992  Fw::LogBuffer _logBuff;
994 
995 #if FW_AMPCS_COMPATIBLE
996  // Serialize the number of arguments
997  _status = _logBuff.serialize(static_cast<U8>(2));
998  FW_ASSERT(
999  _status == Fw::FW_SERIALIZE_OK,
1000  static_cast<FwAssertArgType>(_status)
1001  );
1002 #endif
1003 
1004 #if FW_AMPCS_COMPATIBLE
1005  // Serialize the argument size
1006  _status = _logBuff.serialize(
1007  static_cast<U8>(sizeof(U32))
1008  );
1009  FW_ASSERT(
1010  _status == Fw::FW_SERIALIZE_OK,
1011  static_cast<FwAssertArgType>(_status)
1012  );
1013 #endif
1014  _status = _logBuff.serialize(errornum);
1015  FW_ASSERT(
1016  _status == Fw::FW_SERIALIZE_OK,
1017  static_cast<FwAssertArgType>(_status)
1018  );
1019 
1020  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1021  FW_ASSERT(
1022  _status == Fw::FW_SERIALIZE_OK,
1023  static_cast<FwAssertArgType>(_status)
1024  );
1025 
1026  this->m_logOut_OutputPort[0].invoke(
1027  _id,
1028  _logTime,
1030  _logBuff
1031  );
1032  }
1033 
1034  // Emit the event on the text log port
1035 #if FW_ENABLE_TEXT_LOGGING
1036  if (this->m_LogText_OutputPort[0].isConnected()) {
1037 #if FW_OBJECT_NAMES == 1
1038  const char* _formatString =
1039  "(%s) %s: Error %" PRIu32 " opening file %s";
1040 #else
1041  const char* _formatString =
1042  "%s: Error %" PRIu32 " opening file %s";
1043 #endif
1044 
1045  Fw::TextLogString _logString;
1046  _logString.format(
1047  _formatString,
1048 #if FW_OBJECT_NAMES == 1
1049  this->m_objName.toChar(),
1050 #endif
1051  "FileOpenError ",
1052  errornum,
1053  file.toChar()
1054  );
1055 
1056  this->m_LogText_OutputPort[0].invoke(
1057  _id,
1058  _logTime,
1060  _logString
1061  );
1062  }
1063 #endif
1064  }
1065 
1068  U32 errornum,
1069  U32 bytesWritten,
1070  U32 bytesToWrite,
1071  const Fw::StringBase& file
1072  ) const
1073  {
1074  // Get the time
1075  Fw::Time _logTime;
1076  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1077  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1078  }
1079 
1080  FwEventIdType _id = static_cast<FwEventIdType>(0);
1081 
1082  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1083 
1084  // Emit the event on the log port
1085  if (this->m_logOut_OutputPort[0].isConnected()) {
1086  Fw::LogBuffer _logBuff;
1088 
1089 #if FW_AMPCS_COMPATIBLE
1090  // Serialize the number of arguments
1091  _status = _logBuff.serialize(static_cast<U8>(4));
1092  FW_ASSERT(
1093  _status == Fw::FW_SERIALIZE_OK,
1094  static_cast<FwAssertArgType>(_status)
1095  );
1096 #endif
1097 
1098 #if FW_AMPCS_COMPATIBLE
1099  // Serialize the argument size
1100  _status = _logBuff.serialize(
1101  static_cast<U8>(sizeof(U32))
1102  );
1103  FW_ASSERT(
1104  _status == Fw::FW_SERIALIZE_OK,
1105  static_cast<FwAssertArgType>(_status)
1106  );
1107 #endif
1108  _status = _logBuff.serialize(errornum);
1109  FW_ASSERT(
1110  _status == Fw::FW_SERIALIZE_OK,
1111  static_cast<FwAssertArgType>(_status)
1112  );
1113 
1114 #if FW_AMPCS_COMPATIBLE
1115  // Serialize the argument size
1116  _status = _logBuff.serialize(
1117  static_cast<U8>(sizeof(U32))
1118  );
1119  FW_ASSERT(
1120  _status == Fw::FW_SERIALIZE_OK,
1121  static_cast<FwAssertArgType>(_status)
1122  );
1123 #endif
1124  _status = _logBuff.serialize(bytesWritten);
1125  FW_ASSERT(
1126  _status == Fw::FW_SERIALIZE_OK,
1127  static_cast<FwAssertArgType>(_status)
1128  );
1129 
1130 #if FW_AMPCS_COMPATIBLE
1131  // Serialize the argument size
1132  _status = _logBuff.serialize(
1133  static_cast<U8>(sizeof(U32))
1134  );
1135  FW_ASSERT(
1136  _status == Fw::FW_SERIALIZE_OK,
1137  static_cast<FwAssertArgType>(_status)
1138  );
1139 #endif
1140  _status = _logBuff.serialize(bytesToWrite);
1141  FW_ASSERT(
1142  _status == Fw::FW_SERIALIZE_OK,
1143  static_cast<FwAssertArgType>(_status)
1144  );
1145 
1146  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1147  FW_ASSERT(
1148  _status == Fw::FW_SERIALIZE_OK,
1149  static_cast<FwAssertArgType>(_status)
1150  );
1151 
1152  this->m_logOut_OutputPort[0].invoke(
1153  _id,
1154  _logTime,
1156  _logBuff
1157  );
1158  }
1159 
1160  // Emit the event on the text log port
1161 #if FW_ENABLE_TEXT_LOGGING
1162  if (this->m_LogText_OutputPort[0].isConnected()) {
1163 #if FW_OBJECT_NAMES == 1
1164  const char* _formatString =
1165  "(%s) %s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1166 #else
1167  const char* _formatString =
1168  "%s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1169 #endif
1170 
1171  Fw::TextLogString _logString;
1172  _logString.format(
1173  _formatString,
1174 #if FW_OBJECT_NAMES == 1
1175  this->m_objName.toChar(),
1176 #endif
1177  "FileWriteError ",
1178  errornum,
1179  bytesWritten,
1180  bytesToWrite,
1181  file.toChar()
1182  );
1183 
1184  this->m_LogText_OutputPort[0].invoke(
1185  _id,
1186  _logTime,
1188  _logString
1189  );
1190  }
1191 #endif
1192  }
1193 
1196  const Fw::StringBase& validationFile,
1197  const Fw::StringBase& file,
1198  U32 status
1199  ) const
1200  {
1201  // Get the time
1202  Fw::Time _logTime;
1203  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1204  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1205  }
1206 
1207  FwEventIdType _id = static_cast<FwEventIdType>(0);
1208 
1209  _id = this->getIdBase() + EVENTID_FILEVALIDATIONERROR;
1210 
1211  // Emit the event on the log port
1212  if (this->m_logOut_OutputPort[0].isConnected()) {
1213  Fw::LogBuffer _logBuff;
1215 
1216 #if FW_AMPCS_COMPATIBLE
1217  // Serialize the number of arguments
1218  _status = _logBuff.serialize(static_cast<U8>(3));
1219  FW_ASSERT(
1220  _status == Fw::FW_SERIALIZE_OK,
1221  static_cast<FwAssertArgType>(_status)
1222  );
1223 #endif
1224 
1225  _status = validationFile.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1226  FW_ASSERT(
1227  _status == Fw::FW_SERIALIZE_OK,
1228  static_cast<FwAssertArgType>(_status)
1229  );
1230 
1231  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1232  FW_ASSERT(
1233  _status == Fw::FW_SERIALIZE_OK,
1234  static_cast<FwAssertArgType>(_status)
1235  );
1236 
1237 #if FW_AMPCS_COMPATIBLE
1238  // Serialize the argument size
1239  _status = _logBuff.serialize(
1240  static_cast<U8>(sizeof(U32))
1241  );
1242  FW_ASSERT(
1243  _status == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_status)
1245  );
1246 #endif
1247  _status = _logBuff.serialize(status);
1248  FW_ASSERT(
1249  _status == Fw::FW_SERIALIZE_OK,
1250  static_cast<FwAssertArgType>(_status)
1251  );
1252 
1253  this->m_logOut_OutputPort[0].invoke(
1254  _id,
1255  _logTime,
1257  _logBuff
1258  );
1259  }
1260 
1261  // Emit the event on the text log port
1262 #if FW_ENABLE_TEXT_LOGGING
1263  if (this->m_LogText_OutputPort[0].isConnected()) {
1264 #if FW_OBJECT_NAMES == 1
1265  const char* _formatString =
1266  "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32 ".";
1267 #else
1268  const char* _formatString =
1269  "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32 ".";
1270 #endif
1271 
1272  Fw::TextLogString _logString;
1273  _logString.format(
1274  _formatString,
1275 #if FW_OBJECT_NAMES == 1
1276  this->m_objName.toChar(),
1277 #endif
1278  "FileValidationError ",
1279  validationFile.toChar(),
1280  file.toChar(),
1281  status
1282  );
1283 
1284  this->m_LogText_OutputPort[0].invoke(
1285  _id,
1286  _logTime,
1288  _logString
1289  );
1290  }
1291 #endif
1292  }
1293 
1296  {
1297  // Get the time
1298  Fw::Time _logTime;
1299  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1300  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1301  }
1302 
1303  FwEventIdType _id = static_cast<FwEventIdType>(0);
1304 
1305  _id = this->getIdBase() + EVENTID_FILECLOSED;
1306 
1307  // Emit the event on the log port
1308  if (this->m_logOut_OutputPort[0].isConnected()) {
1309  Fw::LogBuffer _logBuff;
1311 
1312 #if FW_AMPCS_COMPATIBLE
1313  // Serialize the number of arguments
1314  _status = _logBuff.serialize(static_cast<U8>(1));
1315  FW_ASSERT(
1316  _status == Fw::FW_SERIALIZE_OK,
1317  static_cast<FwAssertArgType>(_status)
1318  );
1319 #endif
1320 
1321  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1322  FW_ASSERT(
1323  _status == Fw::FW_SERIALIZE_OK,
1324  static_cast<FwAssertArgType>(_status)
1325  );
1326 
1327  this->m_logOut_OutputPort[0].invoke(
1328  _id,
1329  _logTime,
1331  _logBuff
1332  );
1333  }
1334 
1335  // Emit the event on the text log port
1336 #if FW_ENABLE_TEXT_LOGGING
1337  if (this->m_LogText_OutputPort[0].isConnected()) {
1338 #if FW_OBJECT_NAMES == 1
1339  const char* _formatString =
1340  "(%s) %s: File %s closed successfully.";
1341 #else
1342  const char* _formatString =
1343  "%s: File %s closed successfully.";
1344 #endif
1345 
1346  Fw::TextLogString _logString;
1347  _logString.format(
1348  _formatString,
1349 #if FW_OBJECT_NAMES == 1
1350  this->m_objName.toChar(),
1351 #endif
1352  "FileClosed ",
1353  file.toChar()
1354  );
1355 
1356  this->m_LogText_OutputPort[0].invoke(
1357  _id,
1358  _logTime,
1360  _logString
1361  );
1362  }
1363 #endif
1364  }
1365 
1368  {
1369  // Check throttle value
1370  if (this->m_FileNotInitializedThrottle >= EVENTID_FILENOTINITIALIZED_THROTTLE) {
1371  return;
1372  }
1373  else {
1374  this->m_FileNotInitializedThrottle++;
1375  }
1376 
1377  // Get the time
1378  Fw::Time _logTime;
1379  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1380  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1381  }
1382 
1383  FwEventIdType _id = static_cast<FwEventIdType>(0);
1384 
1385  _id = this->getIdBase() + EVENTID_FILENOTINITIALIZED;
1386 
1387  // Emit the event on the log port
1388  if (this->m_logOut_OutputPort[0].isConnected()) {
1389  Fw::LogBuffer _logBuff;
1390 
1391 #if FW_AMPCS_COMPATIBLE
1393  // Serialize the number of arguments
1394  _status = _logBuff.serialize(static_cast<U8>(0));
1395  FW_ASSERT(
1396  _status == Fw::FW_SERIALIZE_OK,
1397  static_cast<FwAssertArgType>(_status)
1398  );
1399 #endif
1400 
1401  this->m_logOut_OutputPort[0].invoke(
1402  _id,
1403  _logTime,
1405  _logBuff
1406  );
1407  }
1408 
1409  // Emit the event on the text log port
1410 #if FW_ENABLE_TEXT_LOGGING
1411  if (this->m_LogText_OutputPort[0].isConnected()) {
1412 #if FW_OBJECT_NAMES == 1
1413  const char* _formatString =
1414  "(%s) %s: Could not open ComLogger file. File not initialized";
1415 #else
1416  const char* _formatString =
1417  "%s: Could not open ComLogger file. File not initialized";
1418 #endif
1419 
1420  Fw::TextLogString _logString;
1421  _logString.format(
1422  _formatString,
1423 #if FW_OBJECT_NAMES == 1
1424  this->m_objName.toChar(),
1425 #endif
1426  "FileNotInitialized "
1427  );
1428 
1429  this->m_LogText_OutputPort[0].invoke(
1430  _id,
1431  _logTime,
1433  _logString
1434  );
1435  }
1436 #endif
1437  }
1438 
1439  // ----------------------------------------------------------------------
1440  // Event throttle reset functions
1441  // ----------------------------------------------------------------------
1442 
1445  {
1446  // Reset throttle counter
1447  this->m_FileNotInitializedThrottle = 0;
1448  }
1449 
1450  // ----------------------------------------------------------------------
1451  // Time
1452  // ----------------------------------------------------------------------
1453 
1456  {
1457  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1458  Fw::Time _time;
1459  this->m_timeCaller_OutputPort[0].invoke(_time);
1460  return _time;
1461  }
1462  else {
1463  return Fw::Time(TB_NONE, 0, 0);
1464  }
1465  }
1466 
1467  // ----------------------------------------------------------------------
1468  // Message dispatch functions
1469  // ----------------------------------------------------------------------
1470 
1471  Fw::QueuedComponentBase::MsgDispatchStatus ComLoggerComponentBase ::
1472  doDispatch()
1473  {
1474  ComponentIpcSerializableBuffer msg;
1475  FwQueuePriorityType priority = 0;
1476 
1477  Os::Queue::Status msgStatus = this->m_queue.receive(
1478  msg,
1480  priority
1481  );
1482  FW_ASSERT(
1483  msgStatus == Os::Queue::OP_OK,
1484  static_cast<FwAssertArgType>(msgStatus)
1485  );
1486 
1487  // Reset to beginning of buffer
1488  msg.resetDeser();
1489 
1490  FwEnumStoreType desMsg = 0;
1491  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1492  FW_ASSERT(
1493  deserStatus == Fw::FW_SERIALIZE_OK,
1494  static_cast<FwAssertArgType>(deserStatus)
1495  );
1496 
1497  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1498 
1499  if (msgType == COMLOGGER_COMPONENT_EXIT) {
1500  return MSG_DISPATCH_EXIT;
1501  }
1502 
1503  FwIndexType portNum = 0;
1504  deserStatus = msg.deserialize(portNum);
1505  FW_ASSERT(
1506  deserStatus == Fw::FW_SERIALIZE_OK,
1507  static_cast<FwAssertArgType>(deserStatus)
1508  );
1509 
1510  switch (msgType) {
1511  // Handle async input port comIn
1512  case COMIN_COM: {
1513  // Deserialize argument data
1514  Fw::ComBuffer data;
1515  deserStatus = msg.deserialize(data);
1516  FW_ASSERT(
1517  deserStatus == Fw::FW_SERIALIZE_OK,
1518  static_cast<FwAssertArgType>(deserStatus)
1519  );
1520 
1521  // Deserialize argument context
1522  U32 context;
1523  deserStatus = msg.deserialize(context);
1524  FW_ASSERT(
1525  deserStatus == Fw::FW_SERIALIZE_OK,
1526  static_cast<FwAssertArgType>(deserStatus)
1527  );
1528  // Call handler function
1529  this->comIn_handler(
1530  portNum,
1531  data,
1532  context
1533  );
1534 
1535  break;
1536  }
1537 
1538  // Handle async input port pingIn
1539  case PINGIN_PING: {
1540  // Deserialize argument key
1541  U32 key;
1542  deserStatus = msg.deserialize(key);
1543  FW_ASSERT(
1544  deserStatus == Fw::FW_SERIALIZE_OK,
1545  static_cast<FwAssertArgType>(deserStatus)
1546  );
1547  // Call handler function
1548  this->pingIn_handler(
1549  portNum,
1550  key
1551  );
1552 
1553  break;
1554  }
1555 
1556  // Handle command CloseFile
1557  case CMD_CLOSEFILE: {
1558  // Deserialize opcode
1559  FwOpcodeType opCode = 0;
1560  deserStatus = msg.deserialize(opCode);
1561  FW_ASSERT (
1562  deserStatus == Fw::FW_SERIALIZE_OK,
1563  static_cast<FwAssertArgType>(deserStatus)
1564  );
1565 
1566  // Deserialize command sequence
1567  U32 cmdSeq = 0;
1568  deserStatus = msg.deserialize(cmdSeq);
1569  FW_ASSERT (
1570  deserStatus == Fw::FW_SERIALIZE_OK,
1571  static_cast<FwAssertArgType>(deserStatus)
1572  );
1573 
1574  // Deserialize command argument buffer
1575  Fw::CmdArgBuffer args;
1576  deserStatus = msg.deserialize(args);
1577  FW_ASSERT (
1578  deserStatus == Fw::FW_SERIALIZE_OK,
1579  static_cast<FwAssertArgType>(deserStatus)
1580  );
1581 
1582  // Reset buffer
1583  args.resetDeser();
1584 
1585  // Make sure there was no data left over.
1586  // That means the argument buffer size was incorrect.
1587 #if FW_CMD_CHECK_RESIDUAL
1588  if (args.getBuffLeft() != 0) {
1589  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1590  this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1591  }
1592  // Don't crash the task if bad arguments were passed from the ground
1593  break;
1594  }
1595 #endif
1596 
1597  // Call handler function
1598  this->CloseFile_cmdHandler(opCode, cmdSeq);
1599 
1600  break;
1601  }
1602 
1603  default:
1604  return MSG_DISPATCH_ERROR;
1605  }
1606 
1607  return MSG_DISPATCH_OK;
1608  }
1609 
1610  // ----------------------------------------------------------------------
1611  // Calls for messages received on special input ports
1612  // ----------------------------------------------------------------------
1613 
1614  void ComLoggerComponentBase ::
1615  m_p_cmdIn_in(
1616  Fw::PassiveComponentBase* callComp,
1617  FwIndexType portNum,
1618  FwOpcodeType opCode,
1619  U32 cmdSeq,
1620  Fw::CmdArgBuffer& args
1621  )
1622  {
1623  FW_ASSERT(callComp);
1624  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1625 
1626  const U32 idBase = callComp->getIdBase();
1627  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1628 
1629  // Select base class function based on opcode
1630  switch (opCode - idBase) {
1631  case OPCODE_CLOSEFILE: {
1632  compPtr->CloseFile_cmdHandlerBase(
1633  opCode,
1634  cmdSeq,
1635  args
1636  );
1637  break;
1638  }
1639  }
1640  }
1641 
1642  // ----------------------------------------------------------------------
1643  // Calls for messages received on typed input ports
1644  // ----------------------------------------------------------------------
1645 
1646  void ComLoggerComponentBase ::
1647  m_p_comIn_in(
1648  Fw::PassiveComponentBase* callComp,
1649  FwIndexType portNum,
1650  Fw::ComBuffer& data,
1651  U32 context
1652  )
1653  {
1654  FW_ASSERT(callComp);
1655  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1656  compPtr->comIn_handlerBase(
1657  portNum,
1658  data,
1659  context
1660  );
1661  }
1662 
1663  void ComLoggerComponentBase ::
1664  m_p_pingIn_in(
1665  Fw::PassiveComponentBase* callComp,
1666  FwIndexType portNum,
1667  U32 key
1668  )
1669  {
1670  FW_ASSERT(callComp);
1671  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1672  compPtr->pingIn_handlerBase(
1673  portNum,
1674  key
1675  );
1676  }
1677 
1678 }
Serialization/Deserialization operation was successful.
void set_pingOut_OutputPort(FwIndexType portNum, Svc::InputPingPort *port)
Connect port to pingOut[portNum].
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
Forces a close of the currently opened file.
Definition: Time.hpp:9
ComLoggerComponentBase(const char *compName="")
Construct ComLoggerComponentBase object.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
Operation succeeded.
Definition: Os.hpp:26
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
void log_WARNING_LO_FileNotInitialized()
Log event FileNotInitialized.
void log_DIAGNOSTIC_FileClosed(const Fw::StringBase &file) const
NATIVE_UINT_TYPE SizeType
Status
status returned from the queue send function
Definition: Queue.hpp:30
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
virtual void pingIn_handler(FwIndexType portNum, U32 key)=0
Handler for input port pingIn.
Svc::InputPingPort * get_pingIn_InputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
The ComLogger encountered an error opening a file.
FwIndexType getNum_cmdResponseOut_OutputPorts() const
I32 FwEnumStoreType
Definition: FpConfig.h:64
Enum representing a command response.
void regCommands()
Register commands with the Command Dispatcher.
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
Os::Queue m_queue
queue object for active component
Software diagnostic events.
void init()
Object initializer.
Definition: ObjBase.cpp:26
void init()
Initialization function.
Definition: ComPortAc.cpp:56
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
Message will block until space is available.
Definition: Queue.hpp:46
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
The ComLogger encountered an error writing to a file.
FwIndexType getNum_pingOut_OutputPorts() const
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
The ComLogger successfully closed a file on command.
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void setPortNum(NATIVE_INT_TYPE portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ComPortAc.cpp:62
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
virtual void CloseFile_preMsgHook(FwOpcodeType opCode, U32 cmdSeq)
Pre-message hook for command CloseFile.
void log_WARNING_HI_FileOpenError(U32 errornum, const Fw::StringBase &file) const
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:72
A less serious but recoverable event.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
void log_WARNING_LO_FileNotInitialized_ThrottleClear()
Reset throttle value for FileNotInitialized.
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
void CloseFile_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
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
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
FwIndexType getNum_pingIn_InputPorts() const
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
void resetDeser()
reset deserialization to beginning
Fw::InputComPort * get_comIn_InputPort(FwIndexType portNum)
void log_WARNING_HI_FileWriteError(U32 errornum, U32 bytesWritten, U32 bytesToWrite, const Fw::StringBase &file) const
virtual ~ComLoggerComponentBase()
Destroy ComLoggerComponentBase object.
A serious but recoverable event.
virtual void pingIn_preMsgHook(FwIndexType portNum, U32 key)
Pre-message hook for async input port pingIn.
bool isConnected() const
Definition: PortBase.cpp:42
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
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
FwIndexType getNum_cmdIn_InputPorts() const
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
BlockingType
message type
Definition: Queue.hpp:45
#define PRI_PlatformIntType
Command failed to deserialize.
FwIndexType getNum_comIn_InputPorts() const
void log_WARNING_LO_FileValidationError(const Fw::StringBase &validationFile, const Fw::StringBase &file, U32 status) const
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
void pingIn_handlerBase(FwIndexType portNum, U32 key)
Handler base-class function for input port pingIn.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
message to exit active component task
A message was sent requesting an exit of the loop.
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
FwIndexType getNum_timeCaller_OutputPorts() const
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
FwIndexType getNum_logOut_OutputPorts() const
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void init()
Initialization function.
void comIn_handlerBase(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Handler base-class function for input port comIn.
void init()
Initialization function.
Definition: PingPortAc.cpp:56
FwIndexType getNum_cmdRegOut_OutputPorts() const
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:31
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Definition: StringBase.cpp:142
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
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
void init()
Initialization function.
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
#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
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:319
virtual const CHAR * toChar() const =0
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
The size of the serial representations of the port arguments.
Definition: ComPortAc.hpp:37
The ComLogger encountered an error writing the validation file.