F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
FileUplinkComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileUplinkComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FileUplink 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  FILEUPLINK_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
19  BUFFERSENDIN_BUFFERSEND,
20  PINGIN_PING,
21  };
22 
23  // Get the max size by constructing a union of the async input, command, and
24  // internal port serialization sizes
25  union BuffUnion {
26  BYTE bufferSendInPortSize[Fw::InputBufferSendPort::SERIALIZED_SIZE];
28  };
29 
30  // Define a message buffer class large enough to handle all the
31  // asynchronous inputs to the component
32  class ComponentIpcSerializableBuffer :
34  {
35 
36  public:
37 
38  enum {
39  // Max. message size = size of data + message id + port
40  SERIALIZATION_SIZE =
41  sizeof(BuffUnion) +
42  sizeof(FwEnumStoreType) +
43  sizeof(FwIndexType)
44  };
45 
46  Fw::Serializable::SizeType getBuffCapacity() const {
47  return sizeof(m_buff);
48  }
49 
50  U8* getBuffAddr() {
51  return m_buff;
52  }
53 
54  const U8* getBuffAddr() const {
55  return m_buff;
56  }
57 
58  private:
59  // Should be the max of all the input ports serialized sizes...
60  U8 m_buff[SERIALIZATION_SIZE];
61 
62  };
63  }
64 
65  // ----------------------------------------------------------------------
66  // Component initialization
67  // ----------------------------------------------------------------------
68 
70  init(
71  FwSizeType queueDepth,
72  FwEnumStoreType instance
73  )
74  {
75  // Initialize base class
77 
78  // Connect input port bufferSendIn
79  for (
80  FwIndexType port = 0;
81  port < static_cast<FwIndexType>(this->getNum_bufferSendIn_InputPorts());
82  port++
83  ) {
84  this->m_bufferSendIn_InputPort[port].init();
85  this->m_bufferSendIn_InputPort[port].addCallComp(
86  this,
87  m_p_bufferSendIn_in
88  );
89  this->m_bufferSendIn_InputPort[port].setPortNum(port);
90 
91 #if FW_OBJECT_NAMES == 1
92  Fw::ObjectName portName;
93  portName.format(
94  "%s_bufferSendIn_InputPort[%" PRI_PlatformIntType "]",
95  this->m_objName.toChar(),
96  port
97  );
98  this->m_bufferSendIn_InputPort[port].setObjName(portName.toChar());
99 #endif
100  }
101 
102  // Connect input port pingIn
103  for (
104  FwIndexType port = 0;
105  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
106  port++
107  ) {
108  this->m_pingIn_InputPort[port].init();
109  this->m_pingIn_InputPort[port].addCallComp(
110  this,
111  m_p_pingIn_in
112  );
113  this->m_pingIn_InputPort[port].setPortNum(port);
114 
115 #if FW_OBJECT_NAMES == 1
116  Fw::ObjectName portName;
117  portName.format(
118  "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
119  this->m_objName.toChar(),
120  port
121  );
122  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
123 #endif
124  }
125 
126 #if FW_ENABLE_TEXT_LOGGING == 1
127  // Connect output port LogText
128  for (
129  FwIndexType port = 0;
130  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
131  port++
132  ) {
133  this->m_LogText_OutputPort[port].init();
134 
135 #if FW_OBJECT_NAMES == 1
136  Fw::ObjectName portName;
137  portName.format(
138  "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
139  this->m_objName.toChar(),
140  port
141  );
142  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
143 #endif
144  }
145 #endif
146 
147  // Connect output port eventOut
148  for (
149  FwIndexType port = 0;
150  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
151  port++
152  ) {
153  this->m_eventOut_OutputPort[port].init();
154 
155 #if FW_OBJECT_NAMES == 1
156  Fw::ObjectName portName;
157  portName.format(
158  "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]",
159  this->m_objName.toChar(),
160  port
161  );
162  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
163 #endif
164  }
165 
166  // Connect output port timeCaller
167  for (
168  FwIndexType port = 0;
169  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
170  port++
171  ) {
172  this->m_timeCaller_OutputPort[port].init();
173 
174 #if FW_OBJECT_NAMES == 1
175  Fw::ObjectName portName;
176  portName.format(
177  "%s_timeCaller_OutputPort[%" PRI_PlatformIntType "]",
178  this->m_objName.toChar(),
179  port
180  );
181  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
182 #endif
183  }
184 
185  // Connect output port tlmOut
186  for (
187  FwIndexType port = 0;
188  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
189  port++
190  ) {
191  this->m_tlmOut_OutputPort[port].init();
192 
193 #if FW_OBJECT_NAMES == 1
194  Fw::ObjectName portName;
195  portName.format(
196  "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
197  this->m_objName.toChar(),
198  port
199  );
200  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
201 #endif
202  }
203 
204  // Connect output port bufferSendOut
205  for (
206  FwIndexType port = 0;
207  port < static_cast<FwIndexType>(this->getNum_bufferSendOut_OutputPorts());
208  port++
209  ) {
210  this->m_bufferSendOut_OutputPort[port].init();
211 
212 #if FW_OBJECT_NAMES == 1
213  Fw::ObjectName portName;
214  portName.format(
215  "%s_bufferSendOut_OutputPort[%" PRI_PlatformIntType "]",
216  this->m_objName.toChar(),
217  port
218  );
219  this->m_bufferSendOut_OutputPort[port].setObjName(portName.toChar());
220 #endif
221  }
222 
223  // Connect output port pingOut
224  for (
225  FwIndexType port = 0;
226  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
227  port++
228  ) {
229  this->m_pingOut_OutputPort[port].init();
230 
231 #if FW_OBJECT_NAMES == 1
232  Fw::ObjectName portName;
233  portName.format(
234  "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
235  this->m_objName.toChar(),
236  port
237  );
238  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
239 #endif
240  }
241 
242  Os::Queue::Status qStat = this->createQueue(
243  queueDepth,
244  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
245  );
246  FW_ASSERT(
247  Os::Queue::Status::OP_OK == qStat,
248  static_cast<FwAssertArgType>(qStat)
249  );
250  }
251 
252  // ----------------------------------------------------------------------
253  // Getters for typed input ports
254  // ----------------------------------------------------------------------
255 
258  {
259  FW_ASSERT(
260  portNum < this->getNum_bufferSendIn_InputPorts(),
261  static_cast<FwAssertArgType>(portNum)
262  );
263 
264  return &this->m_bufferSendIn_InputPort[portNum];
265  }
266 
269  {
270  FW_ASSERT(
271  portNum < this->getNum_pingIn_InputPorts(),
272  static_cast<FwAssertArgType>(portNum)
273  );
274 
275  return &this->m_pingIn_InputPort[portNum];
276  }
277 
278  // ----------------------------------------------------------------------
279  // Connect input ports to special output ports
280  // ----------------------------------------------------------------------
281 
282 #if FW_ENABLE_TEXT_LOGGING == 1
283 
284  void FileUplinkComponentBase ::
285  set_LogText_OutputPort(
286  FwIndexType portNum,
288  )
289  {
290  FW_ASSERT(
291  portNum < this->getNum_LogText_OutputPorts(),
292  static_cast<FwAssertArgType>(portNum)
293  );
294 
295  this->m_LogText_OutputPort[portNum].addCallPort(port);
296  }
297 
298 #endif
299 
302  FwIndexType portNum,
303  Fw::InputLogPort* port
304  )
305  {
306  FW_ASSERT(
307  portNum < this->getNum_eventOut_OutputPorts(),
308  static_cast<FwAssertArgType>(portNum)
309  );
310 
311  this->m_eventOut_OutputPort[portNum].addCallPort(port);
312  }
313 
316  FwIndexType portNum,
317  Fw::InputTimePort* port
318  )
319  {
320  FW_ASSERT(
321  portNum < this->getNum_timeCaller_OutputPorts(),
322  static_cast<FwAssertArgType>(portNum)
323  );
324 
325  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
326  }
327 
330  FwIndexType portNum,
331  Fw::InputTlmPort* port
332  )
333  {
334  FW_ASSERT(
335  portNum < this->getNum_tlmOut_OutputPorts(),
336  static_cast<FwAssertArgType>(portNum)
337  );
338 
339  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
340  }
341 
342  // ----------------------------------------------------------------------
343  // Connect typed input ports to typed output ports
344  // ----------------------------------------------------------------------
345 
348  FwIndexType portNum,
350  )
351  {
352  FW_ASSERT(
353  portNum < this->getNum_bufferSendOut_OutputPorts(),
354  static_cast<FwAssertArgType>(portNum)
355  );
356 
357  this->m_bufferSendOut_OutputPort[portNum].addCallPort(port);
358  }
359 
362  FwIndexType portNum,
363  Svc::InputPingPort* port
364  )
365  {
366  FW_ASSERT(
367  portNum < this->getNum_pingOut_OutputPorts(),
368  static_cast<FwAssertArgType>(portNum)
369  );
370 
371  this->m_pingOut_OutputPort[portNum].addCallPort(port);
372  }
373 
374 #if FW_PORT_SERIALIZATION
375 
376  // ----------------------------------------------------------------------
377  // Connect serial input ports to special output ports
378  // ----------------------------------------------------------------------
379 
380 #if FW_ENABLE_TEXT_LOGGING == 1
381 
382  void FileUplinkComponentBase ::
383  set_LogText_OutputPort(
384  FwIndexType portNum,
385  Fw::InputSerializePort* port
386  )
387  {
388  FW_ASSERT(
389  portNum < this->getNum_LogText_OutputPorts(),
390  static_cast<FwAssertArgType>(portNum)
391  );
392 
393  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
394  }
395 
396 #endif
397 
400  FwIndexType portNum,
401  Fw::InputSerializePort* port
402  )
403  {
404  FW_ASSERT(
405  portNum < this->getNum_eventOut_OutputPorts(),
406  static_cast<FwAssertArgType>(portNum)
407  );
408 
409  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
410  }
411 
414  FwIndexType portNum,
415  Fw::InputSerializePort* port
416  )
417  {
418  FW_ASSERT(
419  portNum < this->getNum_timeCaller_OutputPorts(),
420  static_cast<FwAssertArgType>(portNum)
421  );
422 
423  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
424  }
425 
428  FwIndexType portNum,
429  Fw::InputSerializePort* port
430  )
431  {
432  FW_ASSERT(
433  portNum < this->getNum_tlmOut_OutputPorts(),
434  static_cast<FwAssertArgType>(portNum)
435  );
436 
437  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
438  }
439 
440 #endif
441 
442 #if FW_PORT_SERIALIZATION
443 
444  // ----------------------------------------------------------------------
445  // Connect serial input ports to typed output ports
446  // ----------------------------------------------------------------------
447 
450  FwIndexType portNum,
451  Fw::InputSerializePort* port
452  )
453  {
454  FW_ASSERT(
455  portNum < this->getNum_bufferSendOut_OutputPorts(),
456  static_cast<FwAssertArgType>(portNum)
457  );
458 
459  this->m_bufferSendOut_OutputPort[portNum].registerSerialPort(port);
460  }
461 
464  FwIndexType portNum,
465  Fw::InputSerializePort* port
466  )
467  {
468  FW_ASSERT(
469  portNum < this->getNum_pingOut_OutputPorts(),
470  static_cast<FwAssertArgType>(portNum)
471  );
472 
473  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
474  }
475 
476 #endif
477 
478  // ----------------------------------------------------------------------
479  // Component construction and destruction
480  // ----------------------------------------------------------------------
481 
483  FileUplinkComponentBase(const char* compName) :
484  Fw::ActiveComponentBase(compName)
485  {
486  this->m_FileWriteErrorThrottle = 0;
487  this->m_InvalidReceiveModeThrottle = 0;
488  this->m_PacketOutOfBoundsThrottle = 0;
489  this->m_PacketOutOfOrderThrottle = 0;
490  }
491 
494  {
495 
496  }
497 
498  // ----------------------------------------------------------------------
499  // Getters for numbers of typed input ports
500  // ----------------------------------------------------------------------
501 
504  {
505  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendIn_InputPort));
506  }
507 
510  {
511  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
512  }
513 
514  // ----------------------------------------------------------------------
515  // Getters for numbers of special output ports
516  // ----------------------------------------------------------------------
517 
518 #if FW_ENABLE_TEXT_LOGGING == 1
519 
520  FwIndexType FileUplinkComponentBase ::
521  getNum_LogText_OutputPorts() const
522  {
523  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
524  }
525 
526 #endif
527 
530  {
531  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
532  }
533 
536  {
537  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
538  }
539 
542  {
543  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
544  }
545 
546  // ----------------------------------------------------------------------
547  // Getters for numbers of typed output ports
548  // ----------------------------------------------------------------------
549 
552  {
553  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendOut_OutputPort));
554  }
555 
558  {
559  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
560  }
561 
562  // ----------------------------------------------------------------------
563  // Connection status queries for special output ports
564  // ----------------------------------------------------------------------
565 
566 #if FW_ENABLE_TEXT_LOGGING == 1
567 
568  bool FileUplinkComponentBase ::
569  isConnected_LogText_OutputPort(FwIndexType portNum)
570  {
571  FW_ASSERT(
572  portNum < this->getNum_LogText_OutputPorts(),
573  static_cast<FwAssertArgType>(portNum)
574  );
575 
576  return this->m_LogText_OutputPort[portNum].isConnected();
577  }
578 
579 #endif
580 
583  {
584  FW_ASSERT(
585  portNum < this->getNum_eventOut_OutputPorts(),
586  static_cast<FwAssertArgType>(portNum)
587  );
588 
589  return this->m_eventOut_OutputPort[portNum].isConnected();
590  }
591 
594  {
595  FW_ASSERT(
596  portNum < this->getNum_timeCaller_OutputPorts(),
597  static_cast<FwAssertArgType>(portNum)
598  );
599 
600  return this->m_timeCaller_OutputPort[portNum].isConnected();
601  }
602 
605  {
606  FW_ASSERT(
607  portNum < this->getNum_tlmOut_OutputPorts(),
608  static_cast<FwAssertArgType>(portNum)
609  );
610 
611  return this->m_tlmOut_OutputPort[portNum].isConnected();
612  }
613 
614  // ----------------------------------------------------------------------
615  // Connection status queries for typed output ports
616  // ----------------------------------------------------------------------
617 
620  {
621  FW_ASSERT(
622  portNum < this->getNum_bufferSendOut_OutputPorts(),
623  static_cast<FwAssertArgType>(portNum)
624  );
625 
626  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
627  }
628 
631  {
632  FW_ASSERT(
633  portNum < this->getNum_pingOut_OutputPorts(),
634  static_cast<FwAssertArgType>(portNum)
635  );
636 
637  return this->m_pingOut_OutputPort[portNum].isConnected();
638  }
639 
640  // ----------------------------------------------------------------------
641  // Port handler base-class functions for typed input ports
642  //
643  // Call these functions directly to bypass the corresponding ports
644  // ----------------------------------------------------------------------
645 
648  FwIndexType portNum,
649  Fw::Buffer& fwBuffer
650  )
651  {
652  // Make sure port number is valid
653  FW_ASSERT(
654  portNum < this->getNum_bufferSendIn_InputPorts(),
655  static_cast<FwAssertArgType>(portNum)
656  );
657 
658  // Call pre-message hook
660  portNum,
661  fwBuffer
662  );
663  ComponentIpcSerializableBuffer msg;
665 
666  // Serialize message ID
667  _status = msg.serialize(
668  static_cast<FwEnumStoreType>(BUFFERSENDIN_BUFFERSEND)
669  );
670  FW_ASSERT(
671  _status == Fw::FW_SERIALIZE_OK,
672  static_cast<FwAssertArgType>(_status)
673  );
674 
675  // Serialize port number
676  _status = msg.serialize(portNum);
677  FW_ASSERT(
678  _status == Fw::FW_SERIALIZE_OK,
679  static_cast<FwAssertArgType>(_status)
680  );
681 
682  // Serialize argument fwBuffer
683  _status = msg.serialize(fwBuffer);
684  FW_ASSERT(
685  _status == Fw::FW_SERIALIZE_OK,
686  static_cast<FwAssertArgType>(_status)
687  );
688 
689  // Send message
691  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
692 
693  FW_ASSERT(
694  qStatus == Os::Queue::OP_OK,
695  static_cast<FwAssertArgType>(qStatus)
696  );
697  }
698 
701  FwIndexType portNum,
702  U32 key
703  )
704  {
705  // Make sure port number is valid
706  FW_ASSERT(
707  portNum < this->getNum_pingIn_InputPorts(),
708  static_cast<FwAssertArgType>(portNum)
709  );
710 
711  // Call pre-message hook
713  portNum,
714  key
715  );
716  ComponentIpcSerializableBuffer msg;
718 
719  // Serialize message ID
720  _status = msg.serialize(
721  static_cast<FwEnumStoreType>(PINGIN_PING)
722  );
723  FW_ASSERT(
724  _status == Fw::FW_SERIALIZE_OK,
725  static_cast<FwAssertArgType>(_status)
726  );
727 
728  // Serialize port number
729  _status = msg.serialize(portNum);
730  FW_ASSERT(
731  _status == Fw::FW_SERIALIZE_OK,
732  static_cast<FwAssertArgType>(_status)
733  );
734 
735  // Serialize argument key
736  _status = msg.serialize(key);
737  FW_ASSERT(
738  _status == Fw::FW_SERIALIZE_OK,
739  static_cast<FwAssertArgType>(_status)
740  );
741 
742  // Send message
744  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
745 
746  FW_ASSERT(
747  qStatus == Os::Queue::OP_OK,
748  static_cast<FwAssertArgType>(qStatus)
749  );
750  }
751 
752  // ----------------------------------------------------------------------
753  // Pre-message hooks for typed async input ports
754  //
755  // Each of these functions is invoked just before processing a message
756  // on the corresponding port. By default, they do nothing. You can
757  // override them to provide specific pre-message behavior.
758  // ----------------------------------------------------------------------
759 
762  FwIndexType portNum,
763  Fw::Buffer& fwBuffer
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  Fw::Buffer& fwBuffer
786  )
787  {
788  FW_ASSERT(
789  portNum < this->getNum_bufferSendOut_OutputPorts(),
790  static_cast<FwAssertArgType>(portNum)
791  );
792  this->m_bufferSendOut_OutputPort[portNum].invoke(
793  fwBuffer
794  );
795  }
796 
799  FwIndexType portNum,
800  U32 key
801  )
802  {
803  FW_ASSERT(
804  portNum < this->getNum_pingOut_OutputPorts(),
805  static_cast<FwAssertArgType>(portNum)
806  );
807  this->m_pingOut_OutputPort[portNum].invoke(
808  key
809  );
810  }
811 
812  // ----------------------------------------------------------------------
813  // Event logging functions
814  // ----------------------------------------------------------------------
815 
818  const Fw::StringBase& fileName,
819  U32 computed,
820  U32 read
821  )
822  {
823  // Get the time
824  Fw::Time _logTime;
825  if (this->m_timeCaller_OutputPort[0].isConnected()) {
826  this->m_timeCaller_OutputPort[0].invoke(_logTime);
827  }
828 
829  FwEventIdType _id = static_cast<FwEventIdType>(0);
830 
831  _id = this->getIdBase() + EVENTID_BADCHECKSUM;
832 
833  // Emit the event on the log port
834  if (this->m_eventOut_OutputPort[0].isConnected()) {
835  Fw::LogBuffer _logBuff;
837 
838 #if FW_AMPCS_COMPATIBLE
839  // Serialize the number of arguments
840  _status = _logBuff.serialize(static_cast<U8>(3));
841  FW_ASSERT(
842  _status == Fw::FW_SERIALIZE_OK,
843  static_cast<FwAssertArgType>(_status)
844  );
845 #endif
846 
847  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
848  FW_ASSERT(
849  _status == Fw::FW_SERIALIZE_OK,
850  static_cast<FwAssertArgType>(_status)
851  );
852 
853 #if FW_AMPCS_COMPATIBLE
854  // Serialize the argument size
855  _status = _logBuff.serialize(
856  static_cast<U8>(sizeof(U32))
857  );
858  FW_ASSERT(
859  _status == Fw::FW_SERIALIZE_OK,
860  static_cast<FwAssertArgType>(_status)
861  );
862 #endif
863  _status = _logBuff.serialize(computed);
864  FW_ASSERT(
865  _status == Fw::FW_SERIALIZE_OK,
866  static_cast<FwAssertArgType>(_status)
867  );
868 
869 #if FW_AMPCS_COMPATIBLE
870  // Serialize the argument size
871  _status = _logBuff.serialize(
872  static_cast<U8>(sizeof(U32))
873  );
874  FW_ASSERT(
875  _status == Fw::FW_SERIALIZE_OK,
876  static_cast<FwAssertArgType>(_status)
877  );
878 #endif
879  _status = _logBuff.serialize(read);
880  FW_ASSERT(
881  _status == Fw::FW_SERIALIZE_OK,
882  static_cast<FwAssertArgType>(_status)
883  );
884 
885  this->m_eventOut_OutputPort[0].invoke(
886  _id,
887  _logTime,
889  _logBuff
890  );
891  }
892 
893  // Emit the event on the text log port
894 #if FW_ENABLE_TEXT_LOGGING
895  if (this->m_LogText_OutputPort[0].isConnected()) {
896 #if FW_OBJECT_NAMES == 1
897  const char* _formatString =
898  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
899 #else
900  const char* _formatString =
901  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
902 #endif
903 
904  Fw::TextLogString _logString;
905  _logString.format(
906  _formatString,
907 #if FW_OBJECT_NAMES == 1
908  this->m_objName.toChar(),
909 #endif
910  "BadChecksum ",
911  fileName.toChar(),
912  computed,
913  read
914  );
915 
916  this->m_LogText_OutputPort[0].invoke(
917  _id,
918  _logTime,
920  _logString
921  );
922  }
923 #endif
924  }
925 
928  {
929  // Get the time
930  Fw::Time _logTime;
931  if (this->m_timeCaller_OutputPort[0].isConnected()) {
932  this->m_timeCaller_OutputPort[0].invoke(_logTime);
933  }
934 
935  FwEventIdType _id = static_cast<FwEventIdType>(0);
936 
937  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
938 
939  // Emit the event on the log port
940  if (this->m_eventOut_OutputPort[0].isConnected()) {
941  Fw::LogBuffer _logBuff;
943 
944 #if FW_AMPCS_COMPATIBLE
945  // Serialize the number of arguments
946  _status = _logBuff.serialize(static_cast<U8>(1));
947  FW_ASSERT(
948  _status == Fw::FW_SERIALIZE_OK,
949  static_cast<FwAssertArgType>(_status)
950  );
951 #endif
952 
953  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
954  FW_ASSERT(
955  _status == Fw::FW_SERIALIZE_OK,
956  static_cast<FwAssertArgType>(_status)
957  );
958 
959  this->m_eventOut_OutputPort[0].invoke(
960  _id,
961  _logTime,
963  _logBuff
964  );
965  }
966 
967  // Emit the event on the text log port
968 #if FW_ENABLE_TEXT_LOGGING
969  if (this->m_LogText_OutputPort[0].isConnected()) {
970 #if FW_OBJECT_NAMES == 1
971  const char* _formatString =
972  "(%s) %s: Could not open file %s";
973 #else
974  const char* _formatString =
975  "%s: Could not open file %s";
976 #endif
977 
978  Fw::TextLogString _logString;
979  _logString.format(
980  _formatString,
981 #if FW_OBJECT_NAMES == 1
982  this->m_objName.toChar(),
983 #endif
984  "FileOpenError ",
985  fileName.toChar()
986  );
987 
988  this->m_LogText_OutputPort[0].invoke(
989  _id,
990  _logTime,
992  _logString
993  );
994  }
995 #endif
996  }
997 
1000  {
1001  // Get the time
1002  Fw::Time _logTime;
1003  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1004  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1005  }
1006 
1007  FwEventIdType _id = static_cast<FwEventIdType>(0);
1008 
1009  _id = this->getIdBase() + EVENTID_FILERECEIVED;
1010 
1011  // Emit the event on the log port
1012  if (this->m_eventOut_OutputPort[0].isConnected()) {
1013  Fw::LogBuffer _logBuff;
1015 
1016 #if FW_AMPCS_COMPATIBLE
1017  // Serialize the number of arguments
1018  _status = _logBuff.serialize(static_cast<U8>(1));
1019  FW_ASSERT(
1020  _status == Fw::FW_SERIALIZE_OK,
1021  static_cast<FwAssertArgType>(_status)
1022  );
1023 #endif
1024 
1025  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1026  FW_ASSERT(
1027  _status == Fw::FW_SERIALIZE_OK,
1028  static_cast<FwAssertArgType>(_status)
1029  );
1030 
1031  this->m_eventOut_OutputPort[0].invoke(
1032  _id,
1033  _logTime,
1035  _logBuff
1036  );
1037  }
1038 
1039  // Emit the event on the text log port
1040 #if FW_ENABLE_TEXT_LOGGING
1041  if (this->m_LogText_OutputPort[0].isConnected()) {
1042 #if FW_OBJECT_NAMES == 1
1043  const char* _formatString =
1044  "(%s) %s: Received file %s";
1045 #else
1046  const char* _formatString =
1047  "%s: Received file %s";
1048 #endif
1049 
1050  Fw::TextLogString _logString;
1051  _logString.format(
1052  _formatString,
1053 #if FW_OBJECT_NAMES == 1
1054  this->m_objName.toChar(),
1055 #endif
1056  "FileReceived ",
1057  fileName.toChar()
1058  );
1059 
1060  this->m_LogText_OutputPort[0].invoke(
1061  _id,
1062  _logTime,
1064  _logString
1065  );
1066  }
1067 #endif
1068  }
1069 
1072  {
1073  // Check throttle value
1074  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1075  return;
1076  }
1077  else {
1078  this->m_FileWriteErrorThrottle++;
1079  }
1080 
1081  // Get the time
1082  Fw::Time _logTime;
1083  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1084  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1085  }
1086 
1087  FwEventIdType _id = static_cast<FwEventIdType>(0);
1088 
1089  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1090 
1091  // Emit the event on the log port
1092  if (this->m_eventOut_OutputPort[0].isConnected()) {
1093  Fw::LogBuffer _logBuff;
1095 
1096 #if FW_AMPCS_COMPATIBLE
1097  // Serialize the number of arguments
1098  _status = _logBuff.serialize(static_cast<U8>(1));
1099  FW_ASSERT(
1100  _status == Fw::FW_SERIALIZE_OK,
1101  static_cast<FwAssertArgType>(_status)
1102  );
1103 #endif
1104 
1105  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1106  FW_ASSERT(
1107  _status == Fw::FW_SERIALIZE_OK,
1108  static_cast<FwAssertArgType>(_status)
1109  );
1110 
1111  this->m_eventOut_OutputPort[0].invoke(
1112  _id,
1113  _logTime,
1115  _logBuff
1116  );
1117  }
1118 
1119  // Emit the event on the text log port
1120 #if FW_ENABLE_TEXT_LOGGING
1121  if (this->m_LogText_OutputPort[0].isConnected()) {
1122 #if FW_OBJECT_NAMES == 1
1123  const char* _formatString =
1124  "(%s) %s: Could not write to file %s";
1125 #else
1126  const char* _formatString =
1127  "%s: Could not write to file %s";
1128 #endif
1129 
1130  Fw::TextLogString _logString;
1131  _logString.format(
1132  _formatString,
1133 #if FW_OBJECT_NAMES == 1
1134  this->m_objName.toChar(),
1135 #endif
1136  "FileWriteError ",
1137  fileName.toChar()
1138  );
1139 
1140  this->m_LogText_OutputPort[0].invoke(
1141  _id,
1142  _logTime,
1144  _logString
1145  );
1146  }
1147 #endif
1148  }
1149 
1152  U32 packetType,
1153  U32 mode
1154  )
1155  {
1156  // Check throttle value
1157  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1158  return;
1159  }
1160  else {
1161  this->m_InvalidReceiveModeThrottle++;
1162  }
1163 
1164  // Get the time
1165  Fw::Time _logTime;
1166  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1167  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1168  }
1169 
1170  FwEventIdType _id = static_cast<FwEventIdType>(0);
1171 
1172  _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1173 
1174  // Emit the event on the log port
1175  if (this->m_eventOut_OutputPort[0].isConnected()) {
1176  Fw::LogBuffer _logBuff;
1178 
1179 #if FW_AMPCS_COMPATIBLE
1180  // Serialize the number of arguments
1181  _status = _logBuff.serialize(static_cast<U8>(2));
1182  FW_ASSERT(
1183  _status == Fw::FW_SERIALIZE_OK,
1184  static_cast<FwAssertArgType>(_status)
1185  );
1186 #endif
1187 
1188 #if FW_AMPCS_COMPATIBLE
1189  // Serialize the argument size
1190  _status = _logBuff.serialize(
1191  static_cast<U8>(sizeof(U32))
1192  );
1193  FW_ASSERT(
1194  _status == Fw::FW_SERIALIZE_OK,
1195  static_cast<FwAssertArgType>(_status)
1196  );
1197 #endif
1198  _status = _logBuff.serialize(packetType);
1199  FW_ASSERT(
1200  _status == Fw::FW_SERIALIZE_OK,
1201  static_cast<FwAssertArgType>(_status)
1202  );
1203 
1204 #if FW_AMPCS_COMPATIBLE
1205  // Serialize the argument size
1206  _status = _logBuff.serialize(
1207  static_cast<U8>(sizeof(U32))
1208  );
1209  FW_ASSERT(
1210  _status == Fw::FW_SERIALIZE_OK,
1211  static_cast<FwAssertArgType>(_status)
1212  );
1213 #endif
1214  _status = _logBuff.serialize(mode);
1215  FW_ASSERT(
1216  _status == Fw::FW_SERIALIZE_OK,
1217  static_cast<FwAssertArgType>(_status)
1218  );
1219 
1220  this->m_eventOut_OutputPort[0].invoke(
1221  _id,
1222  _logTime,
1224  _logBuff
1225  );
1226  }
1227 
1228  // Emit the event on the text log port
1229 #if FW_ENABLE_TEXT_LOGGING
1230  if (this->m_LogText_OutputPort[0].isConnected()) {
1231 #if FW_OBJECT_NAMES == 1
1232  const char* _formatString =
1233  "(%s) %s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1234 #else
1235  const char* _formatString =
1236  "%s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1237 #endif
1238 
1239  Fw::TextLogString _logString;
1240  _logString.format(
1241  _formatString,
1242 #if FW_OBJECT_NAMES == 1
1243  this->m_objName.toChar(),
1244 #endif
1245  "InvalidReceiveMode ",
1246  packetType,
1247  mode
1248  );
1249 
1250  this->m_LogText_OutputPort[0].invoke(
1251  _id,
1252  _logTime,
1254  _logString
1255  );
1256  }
1257 #endif
1258  }
1259 
1262  U32 packetIndex,
1263  const Fw::StringBase& fileName
1264  )
1265  {
1266  // Check throttle value
1267  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1268  return;
1269  }
1270  else {
1271  this->m_PacketOutOfBoundsThrottle++;
1272  }
1273 
1274  // Get the time
1275  Fw::Time _logTime;
1276  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1277  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1278  }
1279 
1280  FwEventIdType _id = static_cast<FwEventIdType>(0);
1281 
1282  _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1283 
1284  // Emit the event on the log port
1285  if (this->m_eventOut_OutputPort[0].isConnected()) {
1286  Fw::LogBuffer _logBuff;
1288 
1289 #if FW_AMPCS_COMPATIBLE
1290  // Serialize the number of arguments
1291  _status = _logBuff.serialize(static_cast<U8>(2));
1292  FW_ASSERT(
1293  _status == Fw::FW_SERIALIZE_OK,
1294  static_cast<FwAssertArgType>(_status)
1295  );
1296 #endif
1297 
1298 #if FW_AMPCS_COMPATIBLE
1299  // Serialize the argument size
1300  _status = _logBuff.serialize(
1301  static_cast<U8>(sizeof(U32))
1302  );
1303  FW_ASSERT(
1304  _status == Fw::FW_SERIALIZE_OK,
1305  static_cast<FwAssertArgType>(_status)
1306  );
1307 #endif
1308  _status = _logBuff.serialize(packetIndex);
1309  FW_ASSERT(
1310  _status == Fw::FW_SERIALIZE_OK,
1311  static_cast<FwAssertArgType>(_status)
1312  );
1313 
1314  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1315  FW_ASSERT(
1316  _status == Fw::FW_SERIALIZE_OK,
1317  static_cast<FwAssertArgType>(_status)
1318  );
1319 
1320  this->m_eventOut_OutputPort[0].invoke(
1321  _id,
1322  _logTime,
1324  _logBuff
1325  );
1326  }
1327 
1328  // Emit the event on the text log port
1329 #if FW_ENABLE_TEXT_LOGGING
1330  if (this->m_LogText_OutputPort[0].isConnected()) {
1331 #if FW_OBJECT_NAMES == 1
1332  const char* _formatString =
1333  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1334 #else
1335  const char* _formatString =
1336  "%s: Packet %" PRIu32 " out of bounds for file %s";
1337 #endif
1338 
1339  Fw::TextLogString _logString;
1340  _logString.format(
1341  _formatString,
1342 #if FW_OBJECT_NAMES == 1
1343  this->m_objName.toChar(),
1344 #endif
1345  "PacketOutOfBounds ",
1346  packetIndex,
1347  fileName.toChar()
1348  );
1349 
1350  this->m_LogText_OutputPort[0].invoke(
1351  _id,
1352  _logTime,
1354  _logString
1355  );
1356  }
1357 #endif
1358  }
1359 
1362  U32 packetIndex,
1363  U32 lastPacketIndex
1364  )
1365  {
1366  // Check throttle value
1367  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1368  return;
1369  }
1370  else {
1371  this->m_PacketOutOfOrderThrottle++;
1372  }
1373 
1374  // Get the time
1375  Fw::Time _logTime;
1376  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1377  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1378  }
1379 
1380  FwEventIdType _id = static_cast<FwEventIdType>(0);
1381 
1382  _id = this->getIdBase() + EVENTID_PACKETOUTOFORDER;
1383 
1384  // Emit the event on the log port
1385  if (this->m_eventOut_OutputPort[0].isConnected()) {
1386  Fw::LogBuffer _logBuff;
1388 
1389 #if FW_AMPCS_COMPATIBLE
1390  // Serialize the number of arguments
1391  _status = _logBuff.serialize(static_cast<U8>(2));
1392  FW_ASSERT(
1393  _status == Fw::FW_SERIALIZE_OK,
1394  static_cast<FwAssertArgType>(_status)
1395  );
1396 #endif
1397 
1398 #if FW_AMPCS_COMPATIBLE
1399  // Serialize the argument size
1400  _status = _logBuff.serialize(
1401  static_cast<U8>(sizeof(U32))
1402  );
1403  FW_ASSERT(
1404  _status == Fw::FW_SERIALIZE_OK,
1405  static_cast<FwAssertArgType>(_status)
1406  );
1407 #endif
1408  _status = _logBuff.serialize(packetIndex);
1409  FW_ASSERT(
1410  _status == Fw::FW_SERIALIZE_OK,
1411  static_cast<FwAssertArgType>(_status)
1412  );
1413 
1414 #if FW_AMPCS_COMPATIBLE
1415  // Serialize the argument size
1416  _status = _logBuff.serialize(
1417  static_cast<U8>(sizeof(U32))
1418  );
1419  FW_ASSERT(
1420  _status == Fw::FW_SERIALIZE_OK,
1421  static_cast<FwAssertArgType>(_status)
1422  );
1423 #endif
1424  _status = _logBuff.serialize(lastPacketIndex);
1425  FW_ASSERT(
1426  _status == Fw::FW_SERIALIZE_OK,
1427  static_cast<FwAssertArgType>(_status)
1428  );
1429 
1430  this->m_eventOut_OutputPort[0].invoke(
1431  _id,
1432  _logTime,
1434  _logBuff
1435  );
1436  }
1437 
1438  // Emit the event on the text log port
1439 #if FW_ENABLE_TEXT_LOGGING
1440  if (this->m_LogText_OutputPort[0].isConnected()) {
1441 #if FW_OBJECT_NAMES == 1
1442  const char* _formatString =
1443  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1444 #else
1445  const char* _formatString =
1446  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1447 #endif
1448 
1449  Fw::TextLogString _logString;
1450  _logString.format(
1451  _formatString,
1452 #if FW_OBJECT_NAMES == 1
1453  this->m_objName.toChar(),
1454 #endif
1455  "PacketOutOfOrder ",
1456  packetIndex,
1457  lastPacketIndex
1458  );
1459 
1460  this->m_LogText_OutputPort[0].invoke(
1461  _id,
1462  _logTime,
1464  _logString
1465  );
1466  }
1467 #endif
1468  }
1469 
1472  {
1473  // Get the time
1474  Fw::Time _logTime;
1475  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1476  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1477  }
1478 
1479  FwEventIdType _id = static_cast<FwEventIdType>(0);
1480 
1481  _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1482 
1483  // Emit the event on the log port
1484  if (this->m_eventOut_OutputPort[0].isConnected()) {
1485  Fw::LogBuffer _logBuff;
1486 
1487 #if FW_AMPCS_COMPATIBLE
1489  // Serialize the number of arguments
1490  _status = _logBuff.serialize(static_cast<U8>(0));
1491  FW_ASSERT(
1492  _status == Fw::FW_SERIALIZE_OK,
1493  static_cast<FwAssertArgType>(_status)
1494  );
1495 #endif
1496 
1497  this->m_eventOut_OutputPort[0].invoke(
1498  _id,
1499  _logTime,
1501  _logBuff
1502  );
1503  }
1504 
1505  // Emit the event on the text log port
1506 #if FW_ENABLE_TEXT_LOGGING
1507  if (this->m_LogText_OutputPort[0].isConnected()) {
1508 #if FW_OBJECT_NAMES == 1
1509  const char* _formatString =
1510  "(%s) %s: Received CANCEL packet";
1511 #else
1512  const char* _formatString =
1513  "%s: Received CANCEL packet";
1514 #endif
1515 
1516  Fw::TextLogString _logString;
1517  _logString.format(
1518  _formatString,
1519 #if FW_OBJECT_NAMES == 1
1520  this->m_objName.toChar(),
1521 #endif
1522  "UplinkCanceled "
1523  );
1524 
1525  this->m_LogText_OutputPort[0].invoke(
1526  _id,
1527  _logTime,
1529  _logString
1530  );
1531  }
1532 #endif
1533  }
1534 
1536  log_WARNING_HI_DecodeError(I32 status)
1537  {
1538  // Get the time
1539  Fw::Time _logTime;
1540  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1541  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1542  }
1543 
1544  FwEventIdType _id = static_cast<FwEventIdType>(0);
1545 
1546  _id = this->getIdBase() + EVENTID_DECODEERROR;
1547 
1548  // Emit the event on the log port
1549  if (this->m_eventOut_OutputPort[0].isConnected()) {
1550  Fw::LogBuffer _logBuff;
1552 
1553 #if FW_AMPCS_COMPATIBLE
1554  // Serialize the number of arguments
1555  _status = _logBuff.serialize(static_cast<U8>(1));
1556  FW_ASSERT(
1557  _status == Fw::FW_SERIALIZE_OK,
1558  static_cast<FwAssertArgType>(_status)
1559  );
1560 #endif
1561 
1562 #if FW_AMPCS_COMPATIBLE
1563  // Serialize the argument size
1564  _status = _logBuff.serialize(
1565  static_cast<U8>(sizeof(I32))
1566  );
1567  FW_ASSERT(
1568  _status == Fw::FW_SERIALIZE_OK,
1569  static_cast<FwAssertArgType>(_status)
1570  );
1571 #endif
1572  _status = _logBuff.serialize(status);
1573  FW_ASSERT(
1574  _status == Fw::FW_SERIALIZE_OK,
1575  static_cast<FwAssertArgType>(_status)
1576  );
1577 
1578  this->m_eventOut_OutputPort[0].invoke(
1579  _id,
1580  _logTime,
1582  _logBuff
1583  );
1584  }
1585 
1586  // Emit the event on the text log port
1587 #if FW_ENABLE_TEXT_LOGGING
1588  if (this->m_LogText_OutputPort[0].isConnected()) {
1589 #if FW_OBJECT_NAMES == 1
1590  const char* _formatString =
1591  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1592 #else
1593  const char* _formatString =
1594  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1595 #endif
1596 
1597  Fw::TextLogString _logString;
1598  _logString.format(
1599  _formatString,
1600 #if FW_OBJECT_NAMES == 1
1601  this->m_objName.toChar(),
1602 #endif
1603  "DecodeError ",
1604  status
1605  );
1606 
1607  this->m_LogText_OutputPort[0].invoke(
1608  _id,
1609  _logTime,
1611  _logString
1612  );
1613  }
1614 #endif
1615  }
1616 
1617  // ----------------------------------------------------------------------
1618  // Event throttle reset functions
1619  // ----------------------------------------------------------------------
1620 
1623  {
1624  // Reset throttle counter
1625  this->m_FileWriteErrorThrottle = 0;
1626  }
1627 
1630  {
1631  // Reset throttle counter
1632  this->m_InvalidReceiveModeThrottle = 0;
1633  }
1634 
1637  {
1638  // Reset throttle counter
1639  this->m_PacketOutOfBoundsThrottle = 0;
1640  }
1641 
1644  {
1645  // Reset throttle counter
1646  this->m_PacketOutOfOrderThrottle = 0;
1647  }
1648 
1649  // ----------------------------------------------------------------------
1650  // Telemetry write functions
1651  // ----------------------------------------------------------------------
1652 
1655  U32 arg,
1656  Fw::Time _tlmTime
1657  )
1658  {
1659  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1660  if (
1661  this->m_timeCaller_OutputPort[0].isConnected() &&
1662  (_tlmTime == Fw::ZERO_TIME)
1663  ) {
1664  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1665  }
1666 
1667  Fw::TlmBuffer _tlmBuff;
1668  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1669  FW_ASSERT(
1670  _stat == Fw::FW_SERIALIZE_OK,
1671  static_cast<FwAssertArgType>(_stat)
1672  );
1673 
1674  FwChanIdType _id;
1675 
1676  _id = this->getIdBase() + CHANNELID_FILESRECEIVED;
1677 
1678  this->m_tlmOut_OutputPort[0].invoke(
1679  _id,
1680  _tlmTime,
1681  _tlmBuff
1682  );
1683  }
1684  }
1685 
1688  U32 arg,
1689  Fw::Time _tlmTime
1690  )
1691  {
1692  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1693  if (
1694  this->m_timeCaller_OutputPort[0].isConnected() &&
1695  (_tlmTime == Fw::ZERO_TIME)
1696  ) {
1697  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1698  }
1699 
1700  Fw::TlmBuffer _tlmBuff;
1701  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1702  FW_ASSERT(
1703  _stat == Fw::FW_SERIALIZE_OK,
1704  static_cast<FwAssertArgType>(_stat)
1705  );
1706 
1707  FwChanIdType _id;
1708 
1709  _id = this->getIdBase() + CHANNELID_PACKETSRECEIVED;
1710 
1711  this->m_tlmOut_OutputPort[0].invoke(
1712  _id,
1713  _tlmTime,
1714  _tlmBuff
1715  );
1716  }
1717  }
1718 
1721  U32 arg,
1722  Fw::Time _tlmTime
1723  )
1724  {
1725  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1726  if (
1727  this->m_timeCaller_OutputPort[0].isConnected() &&
1728  (_tlmTime == Fw::ZERO_TIME)
1729  ) {
1730  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1731  }
1732 
1733  Fw::TlmBuffer _tlmBuff;
1734  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1735  FW_ASSERT(
1736  _stat == Fw::FW_SERIALIZE_OK,
1737  static_cast<FwAssertArgType>(_stat)
1738  );
1739 
1740  FwChanIdType _id;
1741 
1742  _id = this->getIdBase() + CHANNELID_WARNINGS;
1743 
1744  this->m_tlmOut_OutputPort[0].invoke(
1745  _id,
1746  _tlmTime,
1747  _tlmBuff
1748  );
1749  }
1750  }
1751 
1752  // ----------------------------------------------------------------------
1753  // Time
1754  // ----------------------------------------------------------------------
1755 
1757  getTime()
1758  {
1759  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1760  Fw::Time _time;
1761  this->m_timeCaller_OutputPort[0].invoke(_time);
1762  return _time;
1763  }
1764  else {
1765  return Fw::Time(TB_NONE, 0, 0);
1766  }
1767  }
1768 
1769  // ----------------------------------------------------------------------
1770  // Message dispatch functions
1771  // ----------------------------------------------------------------------
1772 
1773  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
1774  doDispatch()
1775  {
1776  ComponentIpcSerializableBuffer msg;
1777  FwQueuePriorityType priority = 0;
1778 
1779  Os::Queue::Status msgStatus = this->m_queue.receive(
1780  msg,
1782  priority
1783  );
1784  FW_ASSERT(
1785  msgStatus == Os::Queue::OP_OK,
1786  static_cast<FwAssertArgType>(msgStatus)
1787  );
1788 
1789  // Reset to beginning of buffer
1790  msg.resetDeser();
1791 
1792  FwEnumStoreType desMsg = 0;
1793  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1794  FW_ASSERT(
1795  deserStatus == Fw::FW_SERIALIZE_OK,
1796  static_cast<FwAssertArgType>(deserStatus)
1797  );
1798 
1799  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1800 
1801  if (msgType == FILEUPLINK_COMPONENT_EXIT) {
1802  return MSG_DISPATCH_EXIT;
1803  }
1804 
1805  FwIndexType portNum = 0;
1806  deserStatus = msg.deserialize(portNum);
1807  FW_ASSERT(
1808  deserStatus == Fw::FW_SERIALIZE_OK,
1809  static_cast<FwAssertArgType>(deserStatus)
1810  );
1811 
1812  switch (msgType) {
1813  // Handle async input port bufferSendIn
1814  case BUFFERSENDIN_BUFFERSEND: {
1815  // Deserialize argument fwBuffer
1816  Fw::Buffer fwBuffer;
1817  deserStatus = msg.deserialize(fwBuffer);
1818  FW_ASSERT(
1819  deserStatus == Fw::FW_SERIALIZE_OK,
1820  static_cast<FwAssertArgType>(deserStatus)
1821  );
1822  // Call handler function
1823  this->bufferSendIn_handler(
1824  portNum,
1825  fwBuffer
1826  );
1827 
1828  break;
1829  }
1830 
1831  // Handle async input port pingIn
1832  case PINGIN_PING: {
1833  // Deserialize argument key
1834  U32 key;
1835  deserStatus = msg.deserialize(key);
1836  FW_ASSERT(
1837  deserStatus == Fw::FW_SERIALIZE_OK,
1838  static_cast<FwAssertArgType>(deserStatus)
1839  );
1840  // Call handler function
1841  this->pingIn_handler(
1842  portNum,
1843  key
1844  );
1845 
1846  break;
1847  }
1848 
1849  default:
1850  return MSG_DISPATCH_ERROR;
1851  }
1852 
1853  return MSG_DISPATCH_OK;
1854  }
1855 
1856  // ----------------------------------------------------------------------
1857  // Calls for messages received on typed input ports
1858  // ----------------------------------------------------------------------
1859 
1860  void FileUplinkComponentBase ::
1861  m_p_bufferSendIn_in(
1862  Fw::PassiveComponentBase* callComp,
1863  FwIndexType portNum,
1864  Fw::Buffer& fwBuffer
1865  )
1866  {
1867  FW_ASSERT(callComp);
1868  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1869  compPtr->bufferSendIn_handlerBase(
1870  portNum,
1871  fwBuffer
1872  );
1873  }
1874 
1875  void FileUplinkComponentBase ::
1876  m_p_pingIn_in(
1877  Fw::PassiveComponentBase* callComp,
1878  FwIndexType portNum,
1879  U32 key
1880  )
1881  {
1882  FW_ASSERT(callComp);
1883  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1884  compPtr->pingIn_handlerBase(
1885  portNum,
1886  key
1887  );
1888  }
1889 
1890 }
#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 FwChanIdType
Definition: FpConfig.h:95
U32 FwEventIdType
Definition: FpConfig.h:103
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
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Definition: Buffer.cpp:134
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
void init()
Initialization function.
void setPortNum(NATIVE_INT_TYPE portNum)
@ WARNING_HI
A serious but recoverable event.
@ ACTIVITY_HI
Important informational events.
void init()
Object initializer.
Definition: ObjBase.cpp:27
const char * toChar() const
Definition: ObjectName.hpp:50
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Buffer &fwBuffer)
Invoke a port interface.
void init()
Initialization function.
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
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke a port interface.
Definition: TlmPortAc.cpp:163
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
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
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.
const Time ZERO_TIME
Definition: Time.cpp:5
@ OP_OK
Operation succeeded.
Definition: Os.hpp:26