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 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  namespace {
17  enum MsgTypeEnum {
18  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 getCapacity() 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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  // Connection status queries for special output ports
554  // ----------------------------------------------------------------------
555 
556 #if FW_ENABLE_TEXT_LOGGING == 1
557 
558  bool ComLoggerComponentBase ::
559  isConnected_LogText_OutputPort(FwIndexType portNum)
560  {
561  FW_ASSERT(
562  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
563  static_cast<FwAssertArgType>(portNum)
564  );
565 
566  return this->m_LogText_OutputPort[portNum].isConnected();
567  }
568 
569 #endif
570 
573  {
574  FW_ASSERT(
575  (0 <= portNum) && (portNum < this->getNum_cmdRegOut_OutputPorts()),
576  static_cast<FwAssertArgType>(portNum)
577  );
578 
579  return this->m_cmdRegOut_OutputPort[portNum].isConnected();
580  }
581 
584  {
585  FW_ASSERT(
586  (0 <= portNum) && (portNum < this->getNum_cmdResponseOut_OutputPorts()),
587  static_cast<FwAssertArgType>(portNum)
588  );
589 
590  return this->m_cmdResponseOut_OutputPort[portNum].isConnected();
591  }
592 
595  {
596  FW_ASSERT(
597  (0 <= portNum) && (portNum < this->getNum_logOut_OutputPorts()),
598  static_cast<FwAssertArgType>(portNum)
599  );
600 
601  return this->m_logOut_OutputPort[portNum].isConnected();
602  }
603 
606  {
607  FW_ASSERT(
608  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
609  static_cast<FwAssertArgType>(portNum)
610  );
611 
612  return this->m_timeCaller_OutputPort[portNum].isConnected();
613  }
614 
615  // ----------------------------------------------------------------------
616  // Connection status queries for typed output ports
617  // ----------------------------------------------------------------------
618 
621  {
622  FW_ASSERT(
623  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
624  static_cast<FwAssertArgType>(portNum)
625  );
626 
627  return this->m_pingOut_OutputPort[portNum].isConnected();
628  }
629 
630  // ----------------------------------------------------------------------
631  // Port handler base-class functions for typed input ports
632  //
633  // Call these functions directly to bypass the corresponding ports
634  // ----------------------------------------------------------------------
635 
638  FwIndexType portNum,
639  Fw::ComBuffer& data,
640  U32 context
641  )
642  {
643  // Make sure port number is valid
644  FW_ASSERT(
645  (0 <= portNum) && (portNum < this->getNum_comIn_InputPorts()),
646  static_cast<FwAssertArgType>(portNum)
647  );
648 
649  // Call pre-message hook
651  portNum,
652  data,
653  context
654  );
655  ComponentIpcSerializableBuffer msg;
657 
658  // Serialize message ID
659  _status = msg.serializeFrom(
660  static_cast<FwEnumStoreType>(COMIN_COM)
661  );
662  FW_ASSERT(
663  _status == Fw::FW_SERIALIZE_OK,
664  static_cast<FwAssertArgType>(_status)
665  );
666 
667  // Serialize port number
668  _status = msg.serializeFrom(portNum);
669  FW_ASSERT(
670  _status == Fw::FW_SERIALIZE_OK,
671  static_cast<FwAssertArgType>(_status)
672  );
673 
674  // Serialize argument data
675  _status = msg.serializeFrom(data);
676  FW_ASSERT(
677  _status == Fw::FW_SERIALIZE_OK,
678  static_cast<FwAssertArgType>(_status)
679  );
680 
681  // Serialize argument context
682  _status = msg.serializeFrom(context);
683  FW_ASSERT(
684  _status == Fw::FW_SERIALIZE_OK,
685  static_cast<FwAssertArgType>(_status)
686  );
687 
688  // Send message
690  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
691 
692  FW_ASSERT(
693  qStatus == Os::Queue::OP_OK,
694  static_cast<FwAssertArgType>(qStatus)
695  );
696  }
697 
700  FwIndexType portNum,
701  U32 key
702  )
703  {
704  // Make sure port number is valid
705  FW_ASSERT(
706  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
707  static_cast<FwAssertArgType>(portNum)
708  );
709 
710  // Call pre-message hook
712  portNum,
713  key
714  );
715  ComponentIpcSerializableBuffer msg;
717 
718  // Serialize message ID
719  _status = msg.serializeFrom(
720  static_cast<FwEnumStoreType>(PINGIN_PING)
721  );
722  FW_ASSERT(
723  _status == Fw::FW_SERIALIZE_OK,
724  static_cast<FwAssertArgType>(_status)
725  );
726 
727  // Serialize port number
728  _status = msg.serializeFrom(portNum);
729  FW_ASSERT(
730  _status == Fw::FW_SERIALIZE_OK,
731  static_cast<FwAssertArgType>(_status)
732  );
733 
734  // Serialize argument key
735  _status = msg.serializeFrom(key);
736  FW_ASSERT(
737  _status == Fw::FW_SERIALIZE_OK,
738  static_cast<FwAssertArgType>(_status)
739  );
740 
741  // Send message
743  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
744 
745  FW_ASSERT(
746  qStatus == Os::Queue::OP_OK,
747  static_cast<FwAssertArgType>(qStatus)
748  );
749  }
750 
751  // ----------------------------------------------------------------------
752  // Pre-message hooks for typed async input ports
753  //
754  // Each of these functions is invoked just before processing a message
755  // on the corresponding port. By default, they do nothing. You can
756  // override them to provide specific pre-message behavior.
757  // ----------------------------------------------------------------------
758 
761  FwIndexType portNum,
762  Fw::ComBuffer& data,
763  U32 context
764  )
765  {
766  // Default: no-op
767  }
768 
771  FwIndexType portNum,
772  U32 key
773  )
774  {
775  // Default: no-op
776  }
777 
778  // ----------------------------------------------------------------------
779  // Invocation functions for typed output ports
780  // ----------------------------------------------------------------------
781 
784  FwIndexType portNum,
785  U32 key
786  )
787  {
788  FW_ASSERT(
789  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
790  static_cast<FwAssertArgType>(portNum)
791  );
792 
793  FW_ASSERT(
794  this->m_pingOut_OutputPort[portNum].isConnected(),
795  static_cast<FwAssertArgType>(portNum)
796  );
797  this->m_pingOut_OutputPort[portNum].invoke(
798  key
799  );
800  }
801 
802  // ----------------------------------------------------------------------
803  // Command response
804  // ----------------------------------------------------------------------
805 
808  FwOpcodeType opCode,
809  U32 cmdSeq,
810  Fw::CmdResponse response
811  )
812  {
813  FW_ASSERT(this->m_cmdResponseOut_OutputPort[0].isConnected());
814  this->m_cmdResponseOut_OutputPort[0].invoke(opCode, cmdSeq, response);
815  }
816 
817  // ----------------------------------------------------------------------
818  // Command handler base-class functions
819  //
820  // Call these functions directly to bypass the command input port
821  // ----------------------------------------------------------------------
822 
825  FwOpcodeType opCode,
826  U32 cmdSeq,
827  Fw::CmdArgBuffer& args
828  )
829  {
830  // Call pre-message hook
831  this->CloseFile_preMsgHook(opCode,cmdSeq);
832 
833  // Defer deserializing arguments to the message dispatcher
834  // to avoid deserializing and reserializing just for IPC
835  ComponentIpcSerializableBuffer msg;
837 
838  // Serialize for IPC
839  _status = msg.serializeFrom(static_cast<FwEnumStoreType>(CMD_CLOSEFILE));
840  FW_ASSERT (
841  _status == Fw::FW_SERIALIZE_OK,
842  static_cast<FwAssertArgType>(_status)
843  );
844 
845  // Fake port number to make message dequeue work
846  FwIndexType port = 0;
847 
848  _status = msg.serializeFrom(port);
849  FW_ASSERT (
850  _status == Fw::FW_SERIALIZE_OK,
851  static_cast<FwAssertArgType>(_status)
852  );
853 
854  _status = msg.serializeFrom(opCode);
855  FW_ASSERT (
856  _status == Fw::FW_SERIALIZE_OK,
857  static_cast<FwAssertArgType>(_status)
858  );
859 
860  _status = msg.serializeFrom(cmdSeq);
861  FW_ASSERT (
862  _status == Fw::FW_SERIALIZE_OK,
863  static_cast<FwAssertArgType>(_status)
864  );
865 
866  _status = msg.serializeFrom(args);
867  FW_ASSERT (
868  _status == Fw::FW_SERIALIZE_OK,
869  static_cast<FwAssertArgType>(_status)
870  );
871 
872  // Send message
874  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
875 
876  FW_ASSERT(
877  qStatus == Os::Queue::OP_OK,
878  static_cast<FwAssertArgType>(qStatus)
879  );
880  }
881 
882  // ----------------------------------------------------------------------
883  // Pre-message hooks for async commands
884  //
885  // Each of these functions is invoked just before processing the
886  // corresponding command. By default they do nothing. You can
887  // override them to provide specific pre-command behavior.
888  // ----------------------------------------------------------------------
889 
892  FwOpcodeType opCode,
893  U32 cmdSeq
894  )
895  {
896  // Defaults to no-op; can be overridden
897  (void) opCode;
898  (void) cmdSeq;
899  }
900 
901  // ----------------------------------------------------------------------
902  // Event logging functions
903  // ----------------------------------------------------------------------
904 
907  U32 errornum,
908  const Fw::StringBase& file
909  ) const
910  {
911  // Get the time
912  Fw::Time _logTime;
913  if (this->m_timeCaller_OutputPort[0].isConnected()) {
914  this->m_timeCaller_OutputPort[0].invoke(_logTime);
915  }
916 
917  FwEventIdType _id = static_cast<FwEventIdType>(0);
918 
919  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
920 
921  // Emit the event on the log port
922  if (this->m_logOut_OutputPort[0].isConnected()) {
923  Fw::LogBuffer _logBuff;
925 
926 #if FW_AMPCS_COMPATIBLE
927  // Serialize the number of arguments
928  _status = _logBuff.serializeFrom(static_cast<U8>(2));
929  FW_ASSERT(
930  _status == Fw::FW_SERIALIZE_OK,
931  static_cast<FwAssertArgType>(_status)
932  );
933 #endif
934 
935 #if FW_AMPCS_COMPATIBLE
936  // Serialize the argument size
937  _status = _logBuff.serializeFrom(
938  static_cast<U8>(sizeof(U32))
939  );
940  FW_ASSERT(
941  _status == Fw::FW_SERIALIZE_OK,
942  static_cast<FwAssertArgType>(_status)
943  );
944 #endif
945  _status = _logBuff.serializeFrom(errornum);
946  FW_ASSERT(
947  _status == Fw::FW_SERIALIZE_OK,
948  static_cast<FwAssertArgType>(_status)
949  );
950 
951  _status = file.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
952  FW_ASSERT(
953  _status == Fw::FW_SERIALIZE_OK,
954  static_cast<FwAssertArgType>(_status)
955  );
956 
957  this->m_logOut_OutputPort[0].invoke(
958  _id,
959  _logTime,
961  _logBuff
962  );
963  }
964 
965  // Emit the event on the text log port
966 #if FW_ENABLE_TEXT_LOGGING
967  if (this->m_LogText_OutputPort[0].isConnected()) {
968 #if FW_OBJECT_NAMES == 1
969  const char* _formatString =
970  "(%s) %s: Error %" PRIu32 " opening file %s";
971 #else
972  const char* _formatString =
973  "%s: Error %" PRIu32 " opening file %s";
974 #endif
975 
976  Fw::TextLogString _logString;
977  _logString.format(
978  _formatString,
979 #if FW_OBJECT_NAMES == 1
980  this->m_objName.toChar(),
981 #endif
982  "FileOpenError ",
983  errornum,
984  file.toChar()
985  );
986 
987  this->m_LogText_OutputPort[0].invoke(
988  _id,
989  _logTime,
991  _logString
992  );
993  }
994 #endif
995  }
996 
999  U32 errornum,
1000  U32 bytesWritten,
1001  U32 bytesToWrite,
1002  const Fw::StringBase& file
1003  ) const
1004  {
1005  // Get the time
1006  Fw::Time _logTime;
1007  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1008  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1009  }
1010 
1011  FwEventIdType _id = static_cast<FwEventIdType>(0);
1012 
1013  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1014 
1015  // Emit the event on the log port
1016  if (this->m_logOut_OutputPort[0].isConnected()) {
1017  Fw::LogBuffer _logBuff;
1019 
1020 #if FW_AMPCS_COMPATIBLE
1021  // Serialize the number of arguments
1022  _status = _logBuff.serializeFrom(static_cast<U8>(4));
1023  FW_ASSERT(
1024  _status == Fw::FW_SERIALIZE_OK,
1025  static_cast<FwAssertArgType>(_status)
1026  );
1027 #endif
1028 
1029 #if FW_AMPCS_COMPATIBLE
1030  // Serialize the argument size
1031  _status = _logBuff.serializeFrom(
1032  static_cast<U8>(sizeof(U32))
1033  );
1034  FW_ASSERT(
1035  _status == Fw::FW_SERIALIZE_OK,
1036  static_cast<FwAssertArgType>(_status)
1037  );
1038 #endif
1039  _status = _logBuff.serializeFrom(errornum);
1040  FW_ASSERT(
1041  _status == Fw::FW_SERIALIZE_OK,
1042  static_cast<FwAssertArgType>(_status)
1043  );
1044 
1045 #if FW_AMPCS_COMPATIBLE
1046  // Serialize the argument size
1047  _status = _logBuff.serializeFrom(
1048  static_cast<U8>(sizeof(U32))
1049  );
1050  FW_ASSERT(
1051  _status == Fw::FW_SERIALIZE_OK,
1052  static_cast<FwAssertArgType>(_status)
1053  );
1054 #endif
1055  _status = _logBuff.serializeFrom(bytesWritten);
1056  FW_ASSERT(
1057  _status == Fw::FW_SERIALIZE_OK,
1058  static_cast<FwAssertArgType>(_status)
1059  );
1060 
1061 #if FW_AMPCS_COMPATIBLE
1062  // Serialize the argument size
1063  _status = _logBuff.serializeFrom(
1064  static_cast<U8>(sizeof(U32))
1065  );
1066  FW_ASSERT(
1067  _status == Fw::FW_SERIALIZE_OK,
1068  static_cast<FwAssertArgType>(_status)
1069  );
1070 #endif
1071  _status = _logBuff.serializeFrom(bytesToWrite);
1072  FW_ASSERT(
1073  _status == Fw::FW_SERIALIZE_OK,
1074  static_cast<FwAssertArgType>(_status)
1075  );
1076 
1077  _status = file.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1078  FW_ASSERT(
1079  _status == Fw::FW_SERIALIZE_OK,
1080  static_cast<FwAssertArgType>(_status)
1081  );
1082 
1083  this->m_logOut_OutputPort[0].invoke(
1084  _id,
1085  _logTime,
1087  _logBuff
1088  );
1089  }
1090 
1091  // Emit the event on the text log port
1092 #if FW_ENABLE_TEXT_LOGGING
1093  if (this->m_LogText_OutputPort[0].isConnected()) {
1094 #if FW_OBJECT_NAMES == 1
1095  const char* _formatString =
1096  "(%s) %s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1097 #else
1098  const char* _formatString =
1099  "%s: Error %" PRIu32 " while writing %" PRIu32 " of %" PRIu32 " bytes to %s";
1100 #endif
1101 
1102  Fw::TextLogString _logString;
1103  _logString.format(
1104  _formatString,
1105 #if FW_OBJECT_NAMES == 1
1106  this->m_objName.toChar(),
1107 #endif
1108  "FileWriteError ",
1109  errornum,
1110  bytesWritten,
1111  bytesToWrite,
1112  file.toChar()
1113  );
1114 
1115  this->m_LogText_OutputPort[0].invoke(
1116  _id,
1117  _logTime,
1119  _logString
1120  );
1121  }
1122 #endif
1123  }
1124 
1127  const Fw::StringBase& validationFile,
1128  const Fw::StringBase& file,
1129  U32 status
1130  ) const
1131  {
1132  // Get the time
1133  Fw::Time _logTime;
1134  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1135  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1136  }
1137 
1138  FwEventIdType _id = static_cast<FwEventIdType>(0);
1139 
1140  _id = this->getIdBase() + EVENTID_FILEVALIDATIONERROR;
1141 
1142  // Emit the event on the log port
1143  if (this->m_logOut_OutputPort[0].isConnected()) {
1144  Fw::LogBuffer _logBuff;
1146 
1147 #if FW_AMPCS_COMPATIBLE
1148  // Serialize the number of arguments
1149  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1150  FW_ASSERT(
1151  _status == Fw::FW_SERIALIZE_OK,
1152  static_cast<FwAssertArgType>(_status)
1153  );
1154 #endif
1155 
1156  _status = validationFile.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1157  FW_ASSERT(
1158  _status == Fw::FW_SERIALIZE_OK,
1159  static_cast<FwAssertArgType>(_status)
1160  );
1161 
1162  _status = file.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
1163  FW_ASSERT(
1164  _status == Fw::FW_SERIALIZE_OK,
1165  static_cast<FwAssertArgType>(_status)
1166  );
1167 
1168 #if FW_AMPCS_COMPATIBLE
1169  // Serialize the argument size
1170  _status = _logBuff.serializeFrom(
1171  static_cast<U8>(sizeof(U32))
1172  );
1173  FW_ASSERT(
1174  _status == Fw::FW_SERIALIZE_OK,
1175  static_cast<FwAssertArgType>(_status)
1176  );
1177 #endif
1178  _status = _logBuff.serializeFrom(status);
1179  FW_ASSERT(
1180  _status == Fw::FW_SERIALIZE_OK,
1181  static_cast<FwAssertArgType>(_status)
1182  );
1183 
1184  this->m_logOut_OutputPort[0].invoke(
1185  _id,
1186  _logTime,
1188  _logBuff
1189  );
1190  }
1191 
1192  // Emit the event on the text log port
1193 #if FW_ENABLE_TEXT_LOGGING
1194  if (this->m_LogText_OutputPort[0].isConnected()) {
1195 #if FW_OBJECT_NAMES == 1
1196  const char* _formatString =
1197  "(%s) %s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32 ".";
1198 #else
1199  const char* _formatString =
1200  "%s: The ComLogger failed to create a validation file %s for %s with error %" PRIu32 ".";
1201 #endif
1202 
1203  Fw::TextLogString _logString;
1204  _logString.format(
1205  _formatString,
1206 #if FW_OBJECT_NAMES == 1
1207  this->m_objName.toChar(),
1208 #endif
1209  "FileValidationError ",
1210  validationFile.toChar(),
1211  file.toChar(),
1212  status
1213  );
1214 
1215  this->m_LogText_OutputPort[0].invoke(
1216  _id,
1217  _logTime,
1219  _logString
1220  );
1221  }
1222 #endif
1223  }
1224 
1227  {
1228  // Get the time
1229  Fw::Time _logTime;
1230  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1231  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1232  }
1233 
1234  FwEventIdType _id = static_cast<FwEventIdType>(0);
1235 
1236  _id = this->getIdBase() + EVENTID_FILECLOSED;
1237 
1238  // Emit the event on the log port
1239  if (this->m_logOut_OutputPort[0].isConnected()) {
1240  Fw::LogBuffer _logBuff;
1242 
1243 #if FW_AMPCS_COMPATIBLE
1244  // Serialize the number of arguments
1245  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1246  FW_ASSERT(
1247  _status == Fw::FW_SERIALIZE_OK,
1248  static_cast<FwAssertArgType>(_status)
1249  );
1250 #endif
1251 
1252  _status = file.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 240));
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: File %s closed successfully.";
1272 #else
1273  const char* _formatString =
1274  "%s: File %s closed successfully.";
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  "FileClosed ",
1284  file.toChar()
1285  );
1286 
1287  this->m_LogText_OutputPort[0].invoke(
1288  _id,
1289  _logTime,
1291  _logString
1292  );
1293  }
1294 #endif
1295  }
1296 
1299  {
1300  // Check throttle value
1301  if (this->m_FileNotInitializedThrottle >= EVENTID_FILENOTINITIALIZED_THROTTLE) {
1302  return;
1303  }
1304  else {
1305  this->m_FileNotInitializedThrottle++;
1306  }
1307 
1308  // Get the time
1309  Fw::Time _logTime;
1310  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1311  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1312  }
1313 
1314  FwEventIdType _id = static_cast<FwEventIdType>(0);
1315 
1316  _id = this->getIdBase() + EVENTID_FILENOTINITIALIZED;
1317 
1318  // Emit the event on the log port
1319  if (this->m_logOut_OutputPort[0].isConnected()) {
1320  Fw::LogBuffer _logBuff;
1321 
1322 #if FW_AMPCS_COMPATIBLE
1324  // Serialize the number of arguments
1325  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1326  FW_ASSERT(
1327  _status == Fw::FW_SERIALIZE_OK,
1328  static_cast<FwAssertArgType>(_status)
1329  );
1330 #endif
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: Could not open ComLogger file. File not initialized";
1346 #else
1347  const char* _formatString =
1348  "%s: Could not open ComLogger file. File not initialized";
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  "FileNotInitialized "
1358  );
1359 
1360  this->m_LogText_OutputPort[0].invoke(
1361  _id,
1362  _logTime,
1364  _logString
1365  );
1366  }
1367 #endif
1368  }
1369 
1370  // ----------------------------------------------------------------------
1371  // Event throttle reset functions
1372  // ----------------------------------------------------------------------
1373 
1376  {
1377  // Reset throttle counter
1378  this->m_FileNotInitializedThrottle = 0;
1379  }
1380 
1381  // ----------------------------------------------------------------------
1382  // Time
1383  // ----------------------------------------------------------------------
1384 
1386  getTime() const
1387  {
1388  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1389  Fw::Time _time;
1390  this->m_timeCaller_OutputPort[0].invoke(_time);
1391  return _time;
1392  }
1393  else {
1394  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1395  }
1396  }
1397 
1398  // ----------------------------------------------------------------------
1399  // Message dispatch functions
1400  // ----------------------------------------------------------------------
1401 
1402  Fw::QueuedComponentBase::MsgDispatchStatus ComLoggerComponentBase ::
1403  doDispatch()
1404  {
1405  ComponentIpcSerializableBuffer _msg;
1406  FwQueuePriorityType _priority = 0;
1407 
1408  Os::Queue::Status _msgStatus = this->m_queue.receive(
1409  _msg,
1411  _priority
1412  );
1413  FW_ASSERT(
1414  _msgStatus == Os::Queue::OP_OK,
1415  static_cast<FwAssertArgType>(_msgStatus)
1416  );
1417 
1418  // Reset to beginning of buffer
1419  _msg.resetDeser();
1420 
1421  FwEnumStoreType _desMsg = 0;
1422  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1423  FW_ASSERT(
1424  _deserStatus == Fw::FW_SERIALIZE_OK,
1425  static_cast<FwAssertArgType>(_deserStatus)
1426  );
1427 
1428  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1429 
1430  if (_msgType == COMLOGGER_COMPONENT_EXIT) {
1431  return MSG_DISPATCH_EXIT;
1432  }
1433 
1434  FwIndexType portNum = 0;
1435  _deserStatus = _msg.deserializeTo(portNum);
1436  FW_ASSERT(
1437  _deserStatus == Fw::FW_SERIALIZE_OK,
1438  static_cast<FwAssertArgType>(_deserStatus)
1439  );
1440 
1441  switch (_msgType) {
1442  // Handle async input port comIn
1443  case COMIN_COM: {
1444  // Deserialize argument data
1445  Fw::ComBuffer data;
1446  _deserStatus = _msg.deserializeTo(data);
1447  FW_ASSERT(
1448  _deserStatus == Fw::FW_SERIALIZE_OK,
1449  static_cast<FwAssertArgType>(_deserStatus)
1450  );
1451 
1452  // Deserialize argument context
1453  U32 context;
1454  _deserStatus = _msg.deserializeTo(context);
1455  FW_ASSERT(
1456  _deserStatus == Fw::FW_SERIALIZE_OK,
1457  static_cast<FwAssertArgType>(_deserStatus)
1458  );
1459  // Call handler function
1460  this->comIn_handler(
1461  portNum,
1462  data,
1463  context
1464  );
1465 
1466  break;
1467  }
1468 
1469  // Handle async input port pingIn
1470  case PINGIN_PING: {
1471  // Deserialize argument key
1472  U32 key;
1473  _deserStatus = _msg.deserializeTo(key);
1474  FW_ASSERT(
1475  _deserStatus == Fw::FW_SERIALIZE_OK,
1476  static_cast<FwAssertArgType>(_deserStatus)
1477  );
1478  // Call handler function
1479  this->pingIn_handler(
1480  portNum,
1481  key
1482  );
1483 
1484  break;
1485  }
1486 
1487  // Handle command CloseFile
1488  case CMD_CLOSEFILE: {
1489  // Deserialize opcode
1490  FwOpcodeType _opCode = 0;
1491  _deserStatus = _msg.deserializeTo(_opCode);
1492  FW_ASSERT (
1493  _deserStatus == Fw::FW_SERIALIZE_OK,
1494  static_cast<FwAssertArgType>(_deserStatus)
1495  );
1496 
1497  // Deserialize command sequence
1498  U32 _cmdSeq = 0;
1499  _deserStatus = _msg.deserializeTo(_cmdSeq);
1500  FW_ASSERT (
1501  _deserStatus == Fw::FW_SERIALIZE_OK,
1502  static_cast<FwAssertArgType>(_deserStatus)
1503  );
1504 
1505  // Deserialize command argument buffer
1506  Fw::CmdArgBuffer args;
1507  _deserStatus = _msg.deserializeTo(args);
1508  FW_ASSERT (
1509  _deserStatus == Fw::FW_SERIALIZE_OK,
1510  static_cast<FwAssertArgType>(_deserStatus)
1511  );
1512 
1513  // Reset buffer
1514  args.resetDeser();
1515 
1516  // Make sure there was no data left over.
1517  // That means the argument buffer size was incorrect.
1518 #if FW_CMD_CHECK_RESIDUAL
1519  if (args.getDeserializeSizeLeft() != 0) {
1520  if (this->m_cmdResponseOut_OutputPort[0].isConnected()) {
1521  this->cmdResponse_out(_opCode, _cmdSeq, Fw::CmdResponse::FORMAT_ERROR);
1522  }
1523  // Don't crash the task if bad arguments were passed from the ground
1524  break;
1525  }
1526 #endif
1527 
1528  // Call handler function
1529  this->CloseFile_cmdHandler(_opCode, _cmdSeq);
1530 
1531  break;
1532  }
1533 
1534  default:
1535  return MSG_DISPATCH_ERROR;
1536  }
1537 
1538  return MSG_DISPATCH_OK;
1539  }
1540 
1541  // ----------------------------------------------------------------------
1542  // Calls for messages received on special input ports
1543  // ----------------------------------------------------------------------
1544 
1545  void ComLoggerComponentBase ::
1546  m_p_cmdIn_in(
1547  Fw::PassiveComponentBase* callComp,
1548  FwIndexType portNum,
1549  FwOpcodeType opCode,
1550  U32 cmdSeq,
1551  Fw::CmdArgBuffer& args
1552  )
1553  {
1554  FW_ASSERT(callComp);
1555  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1556 
1557  const U32 idBase = callComp->getIdBase();
1558  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1559 
1560  // Select base class function based on opcode
1561  switch (opCode - idBase) {
1562  case OPCODE_CLOSEFILE: {
1563  compPtr->CloseFile_cmdHandlerBase(
1564  opCode,
1565  cmdSeq,
1566  args
1567  );
1568  break;
1569  }
1570  }
1571  }
1572 
1573  // ----------------------------------------------------------------------
1574  // Calls for messages received on typed input ports
1575  // ----------------------------------------------------------------------
1576 
1577  void ComLoggerComponentBase ::
1578  m_p_comIn_in(
1579  Fw::PassiveComponentBase* callComp,
1580  FwIndexType portNum,
1581  Fw::ComBuffer& data,
1582  U32 context
1583  )
1584  {
1585  FW_ASSERT(callComp);
1586  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1587  compPtr->comIn_handlerBase(
1588  portNum,
1589  data,
1590  context
1591  );
1592  }
1593 
1594  void ComLoggerComponentBase ::
1595  m_p_pingIn_in(
1596  Fw::PassiveComponentBase* callComp,
1597  FwIndexType portNum,
1598  U32 key
1599  )
1600  {
1601  FW_ASSERT(callComp);
1602  ComLoggerComponentBase* compPtr = static_cast<ComLoggerComponentBase*>(callComp);
1603  compPtr->pingIn_handlerBase(
1604  portNum,
1605  key
1606  );
1607  }
1608 
1609 }
The ComLogger successfully closed a file on command.
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
ComLoggerComponentBase(const char *compName="")
Construct ComLoggerComponentBase object.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
The ComLogger encountered an error writing the validation file.
FwIdType FwOpcodeType
The type of a command opcode.
Fw::InputCmdPort * get_cmdIn_InputPort(FwIndexType portNum)
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
virtual void comIn_preMsgHook(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Pre-message hook for async input port comIn.
PlatformSizeType FwSizeType
void log_WARNING_LO_FileNotInitialized()
Log event FileNotInitialized.
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:63
I32 FwEnumStoreType
void log_DIAGNOSTIC_FileClosed(const Fw::StringBase &file) const
Status
status returned from the queue send function
Definition: Queue.hpp:30
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
bool isConnected_pingOut_OutputPort(FwIndexType portNum)
The size of the serial representations of the port arguments.
Definition: ComPortAc.hpp:37
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
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
static constexpr FwIndexType getNum_cmdResponseOut_OutputPorts()
static constexpr FwIndexType getNum_pingIn_InputPorts()
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
Enum representing a command response.
No time base has been established (Required)
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.
Os::Queue m_queue
queue object for active component
Software diagnostic events.
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
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:47
void set_cmdRegOut_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to cmdRegOut[portNum].
FwIdType FwEventIdType
The type of an event identifier.
The ComLogger encountered an error writing to a file.
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
void init()
Initialization function.
Definition: TimePortAc.cpp:128
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:92
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)
Forces a close of the currently opened file.
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
Definition: Queue.cpp:46
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
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:38
void set_cmdResponseOut_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to cmdResponseOut[portNum].
static constexpr FwIndexType getNum_logOut_OutputPorts()
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
BlockingType
message type
Definition: Queue.hpp:46
Command failed to deserialize.
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
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].
static constexpr FwIndexType getNum_comIn_InputPorts()
bool isConnected_cmdResponseOut_OutputPort(FwIndexType portNum)
bool isConnected_cmdRegOut_OutputPort(FwIndexType portNum)
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
virtual void comIn_handler(FwIndexType portNum, Fw::ComBuffer &data, U32 context)=0
Handler for input port comIn.
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
RateGroupDivider component implementation.
static constexpr FwIndexType getNum_pingOut_OutputPorts()
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:56
static constexpr FwIndexType getNum_cmdRegOut_OutputPorts()
message to exit active component task
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
Message will return with status when space is unavailable.
Definition: Queue.hpp:48
static constexpr FwIndexType getNum_cmdIn_InputPorts()
Implementation of malloc based allocator.
The ComLogger encountered an error opening a file.
void init()
Initialization function.
virtual void CloseFile_cmdHandler(FwOpcodeType opCode, U32 cmdSeq)=0
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void addCallPort(InputCmdResponsePort *callPort)
Register an input port.
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.