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 
867  FW_ASSERT(
868  this->m_pingOut_OutputPort[portNum].isConnected(),
869  static_cast<FwAssertArgType>(portNum)
870  );
871  this->m_pingOut_OutputPort[portNum].invoke(
872  key
873  );
874  }
875 
876  // ----------------------------------------------------------------------
877  // Command response
878  // ----------------------------------------------------------------------
879 
882  FwOpcodeType opCode,
883  U32 cmdSeq,
884  Fw::CmdResponse response
885  )
886  {
887  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
888  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
889  }
890 
891  // ----------------------------------------------------------------------
892  // Command handler base-class functions
893  //
894  // Call these functions directly to bypass the command input port
895  // ----------------------------------------------------------------------
896 
899  FwOpcodeType opCode,
900  U32 cmdSeq,
901  Fw::CmdArgBuffer& args
902  )
903  {
904  // Call pre-message hook
905  this->CloseFile_preMsgHook(opCode,cmdSeq);
906 
907  // Defer deserializing arguments to the message dispatcher
908  // to avoid deserializing and reserializing just for IPC
909  ComponentIpcSerializableBuffer msg;
911 
912  // Serialize for IPC
913  _status = msg.serialize(static_cast<FwEnumStoreType>(CMD_CLOSEFILE));
914  FW_ASSERT (
915  _status == Fw::FW_SERIALIZE_OK,
916  static_cast<FwAssertArgType>(_status)
917  );
918 
919  // Fake port number to make message dequeue work
920  FwIndexType port = 0;
921 
922  _status = msg.serialize(port);
923  FW_ASSERT (
924  _status == Fw::FW_SERIALIZE_OK,
925  static_cast<FwAssertArgType>(_status)
926  );
927 
928  _status = msg.serialize(opCode);
929  FW_ASSERT (
930  _status == Fw::FW_SERIALIZE_OK,
931  static_cast<FwAssertArgType>(_status)
932  );
933 
934  _status = msg.serialize(cmdSeq);
935  FW_ASSERT (
936  _status == Fw::FW_SERIALIZE_OK,
937  static_cast<FwAssertArgType>(_status)
938  );
939 
940  _status = msg.serialize(args);
941  FW_ASSERT (
942  _status == Fw::FW_SERIALIZE_OK,
943  static_cast<FwAssertArgType>(_status)
944  );
945 
946  // Send message
948  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
949 
950  FW_ASSERT(
951  qStatus == Os::Queue::OP_OK,
952  static_cast<FwAssertArgType>(qStatus)
953  );
954  }
955 
956  // ----------------------------------------------------------------------
957  // Pre-message hooks for async commands
958  //
959  // Each of these functions is invoked just before processing the
960  // corresponding command. By default they do nothing. You can
961  // override them to provide specific pre-command behavior.
962  // ----------------------------------------------------------------------
963 
966  FwOpcodeType opCode,
967  U32 cmdSeq
968  )
969  {
970  // Defaults to no-op; can be overridden
971  (void) opCode;
972  (void) cmdSeq;
973  }
974 
975  // ----------------------------------------------------------------------
976  // Event logging functions
977  // ----------------------------------------------------------------------
978 
981  U32 errornum,
982  const Fw::StringBase& file
983  ) const
984  {
985  // Get the time
986  Fw::Time _logTime;
987  if (this->m_timeCaller_OutputPort[0].isConnected()) {
988  this->m_timeCaller_OutputPort[0].invoke(_logTime);
989  }
990 
991  FwEventIdType _id = static_cast<FwEventIdType>(0);
992 
993  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
994 
995  // Emit the event on the log port
996  if (this->m_logOut_OutputPort[0].isConnected()) {
997  Fw::LogBuffer _logBuff;
999 
1000 #if FW_AMPCS_COMPATIBLE
1001  // Serialize the number of arguments
1002  _status = _logBuff.serialize(static_cast<U8>(2));
1003  FW_ASSERT(
1004  _status == Fw::FW_SERIALIZE_OK,
1005  static_cast<FwAssertArgType>(_status)
1006  );
1007 #endif
1008 
1009 #if FW_AMPCS_COMPATIBLE
1010  // Serialize the argument size
1011  _status = _logBuff.serialize(
1012  static_cast<U8>(sizeof(U32))
1013  );
1014  FW_ASSERT(
1015  _status == Fw::FW_SERIALIZE_OK,
1016  static_cast<FwAssertArgType>(_status)
1017  );
1018 #endif
1019  _status = _logBuff.serialize(errornum);
1020  FW_ASSERT(
1021  _status == Fw::FW_SERIALIZE_OK,
1022  static_cast<FwAssertArgType>(_status)
1023  );
1024 
1025  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1026  FW_ASSERT(
1027  _status == Fw::FW_SERIALIZE_OK,
1028  static_cast<FwAssertArgType>(_status)
1029  );
1030 
1031  this->m_logOut_OutputPort[0].invoke(
1032  _id,
1033  _logTime,
1035  _logBuff
1036  );
1037  }
1038 
1039  // Emit the event on the text log port
1040 #if FW_ENABLE_TEXT_LOGGING
1041  if (this->m_LogText_OutputPort[0].isConnected()) {
1042 #if FW_OBJECT_NAMES == 1
1043  const char* _formatString =
1044  "(%s) %s: Error %" PRIu32 " opening file %s";
1045 #else
1046  const char* _formatString =
1047  "%s: Error %" PRIu32 " opening file %s";
1048 #endif
1049 
1050  Fw::TextLogString _logString;
1051  _logString.format(
1052  _formatString,
1053 #if FW_OBJECT_NAMES == 1
1054  this->m_objName.toChar(),
1055 #endif
1056  "FileOpenError ",
1057  errornum,
1058  file.toChar()
1059  );
1060 
1061  this->m_LogText_OutputPort[0].invoke(
1062  _id,
1063  _logTime,
1065  _logString
1066  );
1067  }
1068 #endif
1069  }
1070 
1073  U32 errornum,
1074  U32 bytesWritten,
1075  U32 bytesToWrite,
1076  const Fw::StringBase& file
1077  ) const
1078  {
1079  // Get the time
1080  Fw::Time _logTime;
1081  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1082  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1083  }
1084 
1085  FwEventIdType _id = static_cast<FwEventIdType>(0);
1086 
1087  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1088 
1089  // Emit the event on the log port
1090  if (this->m_logOut_OutputPort[0].isConnected()) {
1091  Fw::LogBuffer _logBuff;
1093 
1094 #if FW_AMPCS_COMPATIBLE
1095  // Serialize the number of arguments
1096  _status = _logBuff.serialize(static_cast<U8>(4));
1097  FW_ASSERT(
1098  _status == Fw::FW_SERIALIZE_OK,
1099  static_cast<FwAssertArgType>(_status)
1100  );
1101 #endif
1102 
1103 #if FW_AMPCS_COMPATIBLE
1104  // Serialize the argument size
1105  _status = _logBuff.serialize(
1106  static_cast<U8>(sizeof(U32))
1107  );
1108  FW_ASSERT(
1109  _status == Fw::FW_SERIALIZE_OK,
1110  static_cast<FwAssertArgType>(_status)
1111  );
1112 #endif
1113  _status = _logBuff.serialize(errornum);
1114  FW_ASSERT(
1115  _status == Fw::FW_SERIALIZE_OK,
1116  static_cast<FwAssertArgType>(_status)
1117  );
1118 
1119 #if FW_AMPCS_COMPATIBLE
1120  // Serialize the argument size
1121  _status = _logBuff.serialize(
1122  static_cast<U8>(sizeof(U32))
1123  );
1124  FW_ASSERT(
1125  _status == Fw::FW_SERIALIZE_OK,
1126  static_cast<FwAssertArgType>(_status)
1127  );
1128 #endif
1129  _status = _logBuff.serialize(bytesWritten);
1130  FW_ASSERT(
1131  _status == Fw::FW_SERIALIZE_OK,
1132  static_cast<FwAssertArgType>(_status)
1133  );
1134 
1135 #if FW_AMPCS_COMPATIBLE
1136  // Serialize the argument size
1137  _status = _logBuff.serialize(
1138  static_cast<U8>(sizeof(U32))
1139  );
1140  FW_ASSERT(
1141  _status == Fw::FW_SERIALIZE_OK,
1142  static_cast<FwAssertArgType>(_status)
1143  );
1144 #endif
1145  _status = _logBuff.serialize(bytesToWrite);
1146  FW_ASSERT(
1147  _status == Fw::FW_SERIALIZE_OK,
1148  static_cast<FwAssertArgType>(_status)
1149  );
1150 
1151  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1152  FW_ASSERT(
1153  _status == Fw::FW_SERIALIZE_OK,
1154  static_cast<FwAssertArgType>(_status)
1155  );
1156 
1157  this->m_logOut_OutputPort[0].invoke(
1158  _id,
1159  _logTime,
1161  _logBuff
1162  );
1163  }
1164 
1165  // Emit the event on the text log port
1166 #if FW_ENABLE_TEXT_LOGGING
1167  if (this->m_LogText_OutputPort[0].isConnected()) {
1168 #if FW_OBJECT_NAMES == 1
1169  const char* _formatString =
1170  "(%s) %s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1171 #else
1172  const char* _formatString =
1173  "%s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1174 #endif
1175 
1176  Fw::TextLogString _logString;
1177  _logString.format(
1178  _formatString,
1179 #if FW_OBJECT_NAMES == 1
1180  this->m_objName.toChar(),
1181 #endif
1182  "FileWriteError ",
1183  errornum,
1184  bytesWritten,
1185  bytesToWrite,
1186  file.toChar()
1187  );
1188 
1189  this->m_LogText_OutputPort[0].invoke(
1190  _id,
1191  _logTime,
1193  _logString
1194  );
1195  }
1196 #endif
1197  }
1198 
1201  const Fw::StringBase& validationFile,
1202  const Fw::StringBase& file,
1203  U32 status
1204  ) const
1205  {
1206  // Get the time
1207  Fw::Time _logTime;
1208  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1209  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1210  }
1211 
1212  FwEventIdType _id = static_cast<FwEventIdType>(0);
1213 
1214  _id = this->getIdBase() + EVENTID_FILEVALIDATIONERROR;
1215 
1216  // Emit the event on the log port
1217  if (this->m_logOut_OutputPort[0].isConnected()) {
1218  Fw::LogBuffer _logBuff;
1220 
1221 #if FW_AMPCS_COMPATIBLE
1222  // Serialize the number of arguments
1223  _status = _logBuff.serialize(static_cast<U8>(3));
1224  FW_ASSERT(
1225  _status == Fw::FW_SERIALIZE_OK,
1226  static_cast<FwAssertArgType>(_status)
1227  );
1228 #endif
1229 
1230  _status = validationFile.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1231  FW_ASSERT(
1232  _status == Fw::FW_SERIALIZE_OK,
1233  static_cast<FwAssertArgType>(_status)
1234  );
1235 
1236  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1237  FW_ASSERT(
1238  _status == Fw::FW_SERIALIZE_OK,
1239  static_cast<FwAssertArgType>(_status)
1240  );
1241 
1242 #if FW_AMPCS_COMPATIBLE
1243  // Serialize the argument size
1244  _status = _logBuff.serialize(
1245  static_cast<U8>(sizeof(U32))
1246  );
1247  FW_ASSERT(
1248  _status == Fw::FW_SERIALIZE_OK,
1249  static_cast<FwAssertArgType>(_status)
1250  );
1251 #endif
1252  _status = _logBuff.serialize(status);
1253  FW_ASSERT(
1254  _status == Fw::FW_SERIALIZE_OK,
1255  static_cast<FwAssertArgType>(_status)
1256  );
1257 
1258  this->m_logOut_OutputPort[0].invoke(
1259  _id,
1260  _logTime,
1262  _logBuff
1263  );
1264  }
1265 
1266  // Emit the event on the text log port
1267 #if FW_ENABLE_TEXT_LOGGING
1268  if (this->m_LogText_OutputPort[0].isConnected()) {
1269 #if FW_OBJECT_NAMES == 1
1270  const char* _formatString =
1271  "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32 ".";
1272 #else
1273  const char* _formatString =
1274  "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32 ".";
1275 #endif
1276 
1277  Fw::TextLogString _logString;
1278  _logString.format(
1279  _formatString,
1280 #if FW_OBJECT_NAMES == 1
1281  this->m_objName.toChar(),
1282 #endif
1283  "FileValidationError ",
1284  validationFile.toChar(),
1285  file.toChar(),
1286  status
1287  );
1288 
1289  this->m_LogText_OutputPort[0].invoke(
1290  _id,
1291  _logTime,
1293  _logString
1294  );
1295  }
1296 #endif
1297  }
1298 
1301  {
1302  // Get the time
1303  Fw::Time _logTime;
1304  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1305  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1306  }
1307 
1308  FwEventIdType _id = static_cast<FwEventIdType>(0);
1309 
1310  _id = this->getIdBase() + EVENTID_FILECLOSED;
1311 
1312  // Emit the event on the log port
1313  if (this->m_logOut_OutputPort[0].isConnected()) {
1314  Fw::LogBuffer _logBuff;
1316 
1317 #if FW_AMPCS_COMPATIBLE
1318  // Serialize the number of arguments
1319  _status = _logBuff.serialize(static_cast<U8>(1));
1320  FW_ASSERT(
1321  _status == Fw::FW_SERIALIZE_OK,
1322  static_cast<FwAssertArgType>(_status)
1323  );
1324 #endif
1325 
1326  _status = file.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1327  FW_ASSERT(
1328  _status == Fw::FW_SERIALIZE_OK,
1329  static_cast<FwAssertArgType>(_status)
1330  );
1331 
1332  this->m_logOut_OutputPort[0].invoke(
1333  _id,
1334  _logTime,
1336  _logBuff
1337  );
1338  }
1339 
1340  // Emit the event on the text log port
1341 #if FW_ENABLE_TEXT_LOGGING
1342  if (this->m_LogText_OutputPort[0].isConnected()) {
1343 #if FW_OBJECT_NAMES == 1
1344  const char* _formatString =
1345  "(%s) %s: File %s closed successfully.";
1346 #else
1347  const char* _formatString =
1348  "%s: File %s closed successfully.";
1349 #endif
1350 
1351  Fw::TextLogString _logString;
1352  _logString.format(
1353  _formatString,
1354 #if FW_OBJECT_NAMES == 1
1355  this->m_objName.toChar(),
1356 #endif
1357  "FileClosed ",
1358  file.toChar()
1359  );
1360 
1361  this->m_LogText_OutputPort[0].invoke(
1362  _id,
1363  _logTime,
1365  _logString
1366  );
1367  }
1368 #endif
1369  }
1370 
1373  {
1374  // Check throttle value
1375  if (this->m_FileNotInitializedThrottle >= EVENTID_FILENOTINITIALIZED_THROTTLE) {
1376  return;
1377  }
1378  else {
1379  this->m_FileNotInitializedThrottle++;
1380  }
1381 
1382  // Get the time
1383  Fw::Time _logTime;
1384  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1385  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1386  }
1387 
1388  FwEventIdType _id = static_cast<FwEventIdType>(0);
1389 
1390  _id = this->getIdBase() + EVENTID_FILENOTINITIALIZED;
1391 
1392  // Emit the event on the log port
1393  if (this->m_logOut_OutputPort[0].isConnected()) {
1394  Fw::LogBuffer _logBuff;
1395 
1396 #if FW_AMPCS_COMPATIBLE
1398  // Serialize the number of arguments
1399  _status = _logBuff.serialize(static_cast<U8>(0));
1400  FW_ASSERT(
1401  _status == Fw::FW_SERIALIZE_OK,
1402  static_cast<FwAssertArgType>(_status)
1403  );
1404 #endif
1405 
1406  this->m_logOut_OutputPort[0].invoke(
1407  _id,
1408  _logTime,
1410  _logBuff
1411  );
1412  }
1413 
1414  // Emit the event on the text log port
1415 #if FW_ENABLE_TEXT_LOGGING
1416  if (this->m_LogText_OutputPort[0].isConnected()) {
1417 #if FW_OBJECT_NAMES == 1
1418  const char* _formatString =
1419  "(%s) %s: Could not open ComLogger file. File not initialized";
1420 #else
1421  const char* _formatString =
1422  "%s: Could not open ComLogger file. File not initialized";
1423 #endif
1424 
1425  Fw::TextLogString _logString;
1426  _logString.format(
1427  _formatString,
1428 #if FW_OBJECT_NAMES == 1
1429  this->m_objName.toChar(),
1430 #endif
1431  "FileNotInitialized "
1432  );
1433 
1434  this->m_LogText_OutputPort[0].invoke(
1435  _id,
1436  _logTime,
1438  _logString
1439  );
1440  }
1441 #endif
1442  }
1443 
1444  // ----------------------------------------------------------------------
1445  // Event throttle reset functions
1446  // ----------------------------------------------------------------------
1447 
1450  {
1451  // Reset throttle counter
1452  this->m_FileNotInitializedThrottle = 0;
1453  }
1454 
1455  // ----------------------------------------------------------------------
1456  // Time
1457  // ----------------------------------------------------------------------
1458 
1461  {
1462  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1463  Fw::Time _time;
1464  this->m_timeCaller_OutputPort[0].invoke(_time);
1465  return _time;
1466  }
1467  else {
1468  return Fw::Time(TB_NONE, 0, 0);
1469  }
1470  }
1471 
1472  // ----------------------------------------------------------------------
1473  // Message dispatch functions
1474  // ----------------------------------------------------------------------
1475 
1476  Fw::QueuedComponentBase::MsgDispatchStatus ComLoggerComponentBase ::
1477  doDispatch()
1478  {
1479  ComponentIpcSerializableBuffer _msg;
1480  FwQueuePriorityType _priority = 0;
1481 
1482  Os::Queue::Status _msgStatus = this->m_queue.receive(
1483  _msg,
1485  _priority
1486  );
1487  FW_ASSERT(
1488  _msgStatus == Os::Queue::OP_OK,
1489  static_cast<FwAssertArgType>(_msgStatus)
1490  );
1491 
1492  // Reset to beginning of buffer
1493  _msg.resetDeser();
1494 
1495  FwEnumStoreType _desMsg = 0;
1496  Fw::SerializeStatus _deserStatus = _msg.deserialize(_desMsg);
1497  FW_ASSERT(
1498  _deserStatus == Fw::FW_SERIALIZE_OK,
1499  static_cast<FwAssertArgType>(_deserStatus)
1500  );
1501 
1502  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1503 
1504  if (_msgType == COMLOGGER_COMPONENT_EXIT) {
1505  return MSG_DISPATCH_EXIT;
1506  }
1507 
1508  FwIndexType portNum = 0;
1509  _deserStatus = _msg.deserialize(portNum);
1510  FW_ASSERT(
1511  _deserStatus == Fw::FW_SERIALIZE_OK,
1512  static_cast<FwAssertArgType>(_deserStatus)
1513  );
1514 
1515  switch (_msgType) {
1516  // Handle async input port comIn
1517  case COMIN_COM: {
1518  // Deserialize argument data
1519  Fw::ComBuffer data;
1520  _deserStatus = _msg.deserialize(data);
1521  FW_ASSERT(
1522  _deserStatus == Fw::FW_SERIALIZE_OK,
1523  static_cast<FwAssertArgType>(_deserStatus)
1524  );
1525 
1526  // Deserialize argument context
1527  U32 context;
1528  _deserStatus = _msg.deserialize(context);
1529  FW_ASSERT(
1530  _deserStatus == Fw::FW_SERIALIZE_OK,
1531  static_cast<FwAssertArgType>(_deserStatus)
1532  );
1533  // Call handler function
1534  this->comIn_handler(
1535  portNum,
1536  data,
1537  context
1538  );
1539 
1540  break;
1541  }
1542 
1543  // Handle async input port pingIn
1544  case PINGIN_PING: {
1545  // Deserialize argument key
1546  U32 key;
1547  _deserStatus = _msg.deserialize(key);
1548  FW_ASSERT(
1549  _deserStatus == Fw::FW_SERIALIZE_OK,
1550  static_cast<FwAssertArgType>(_deserStatus)
1551  );
1552  // Call handler function
1553  this->pingIn_handler(
1554  portNum,
1555  key
1556  );
1557 
1558  break;
1559  }
1560 
1561  // Handle command CloseFile
1562  case CMD_CLOSEFILE: {
1563  // Deserialize opcode
1564  FwOpcodeType _opCode = 0;
1565  _deserStatus = _msg.deserialize(_opCode);
1566  FW_ASSERT (
1567  _deserStatus == Fw::FW_SERIALIZE_OK,
1568  static_cast<FwAssertArgType>(_deserStatus)
1569  );
1570 
1571  // Deserialize command sequence
1572  U32 _cmdSeq = 0;
1573  _deserStatus = _msg.deserialize(_cmdSeq);
1574  FW_ASSERT (
1575  _deserStatus == Fw::FW_SERIALIZE_OK,
1576  static_cast<FwAssertArgType>(_deserStatus)
1577  );
1578 
1579  // Deserialize command argument buffer
1580  Fw::CmdArgBuffer args;
1581  _deserStatus = _msg.deserialize(args);
1582  FW_ASSERT (
1583  _deserStatus == Fw::FW_SERIALIZE_OK,
1584  static_cast<FwAssertArgType>(_deserStatus)
1585  );
1586 
1587  // Reset buffer
1588  args.resetDeser();
1589 
1590  // Make sure there was no data left over.
1591  // That means the argument buffer size was incorrect.
1592 #if FW_CMD_CHECK_RESIDUAL
1593  if (args.getBuffLeft() != 0) {
1594  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1595  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1596  }
1597  // Don't crash the task if bad arguments were passed from the ground
1598  break;
1599  }
1600 #endif
1601 
1602  // Call handler function
1603  this->CloseFile_cmdHandler(_opCode, _cmdSeq);
1604 
1605  break;
1606  }
1607 
1608  default:
1609  return MSG_DISPATCH_ERROR;
1610  }
1611 
1612  return MSG_DISPATCH_OK;
1613  }
1614 
1615  // ----------------------------------------------------------------------
1616  // Calls for messages received on special input ports
1617  // ----------------------------------------------------------------------
1618 
1619  void ComLoggerComponentBase ::
1620  m_p_cmdIn_in(
1621  Fw::PassiveComponentBase* callComp,
1622  FwIndexType portNum,
1623  FwOpcodeType opCode,
1624  U32 cmdSeq,
1625  Fw::CmdArgBuffer& args
1626  )
1627  {
1628  FW_ASSERT(callComp);
1629  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1630 
1631  const U32 idBase = callComp->getIdBase();
1632  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1633 
1634  // Select base class function based on opcode
1635  switch (opCode - idBase) {
1636  case OPCODE_CLOSEFILE: {
1637  compPtr->CloseFile_cmdHandlerBase(
1638  opCode,
1639  cmdSeq,
1640  args
1641  );
1642  break;
1643  }
1644  }
1645  }
1646 
1647  // ----------------------------------------------------------------------
1648  // Calls for messages received on typed input ports
1649  // ----------------------------------------------------------------------
1650 
1651  void ComLoggerComponentBase ::
1652  m_p_comIn_in(
1653  Fw::PassiveComponentBase* callComp,
1654  FwIndexType portNum,
1655  Fw::ComBuffer& data,
1656  U32 context
1657  )
1658  {
1659  FW_ASSERT(callComp);
1660  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1661  compPtr->comIn_handlerBase(
1662  portNum,
1663  data,
1664  context
1665  );
1666  }
1667 
1668  void ComLoggerComponentBase ::
1669  m_p_pingIn_in(
1670  Fw::PassiveComponentBase* callComp,
1671  FwIndexType portNum,
1672  U32 key
1673  )
1674  {
1675  FW_ASSERT(callComp);
1676  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1677  compPtr->pingIn_handlerBase(
1678  portNum,
1679  key
1680  );
1681  }
1682 
1683 }
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
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
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 successfully closed a file on command.
FwIndexType getNum_cmdResponseOut_OutputPorts() const
The ComLogger encountered an error opening a file.
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
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:37
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
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)
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
void init()
Initialization function.
Definition: TimePortAc.cpp:128
Forces a close of the currently opened file.
message to exit active component task
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:87
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.
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
FwSizeType SizeType
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
void setPortNum(FwIndexType portNum)
FwIndexType getNum_cmdIn_InputPorts() const
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:32
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
BlockingType
message type
Definition: Queue.hpp:45
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)
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:85
FwIndexType getNum_logOut_OutputPorts() const
The size of the serial representations of the port arguments.
Definition: ComPortAc.hpp:37
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
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:35
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.
The ComLogger encountered an error writing the validation file.
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.