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