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  this->m_PacketDuplicateThrottle = 0;
491  }
492 
495  {
496 
497  }
498 
499  // ----------------------------------------------------------------------
500  // Getters for numbers of typed input ports
501  // ----------------------------------------------------------------------
502 
505  {
506  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendIn_InputPort));
507  }
508 
511  {
512  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
513  }
514 
515  // ----------------------------------------------------------------------
516  // Getters for numbers of special output ports
517  // ----------------------------------------------------------------------
518 
519 #if FW_ENABLE_TEXT_LOGGING == 1
520 
521  FwIndexType FileUplinkComponentBase ::
522  getNum_LogText_OutputPorts() const
523  {
524  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
525  }
526 
527 #endif
528 
531  {
532  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
533  }
534 
537  {
538  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
539  }
540 
543  {
544  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
545  }
546 
547  // ----------------------------------------------------------------------
548  // Getters for numbers of typed output ports
549  // ----------------------------------------------------------------------
550 
553  {
554  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendOut_OutputPort));
555  }
556 
559  {
560  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
561  }
562 
563  // ----------------------------------------------------------------------
564  // Connection status queries for special output ports
565  // ----------------------------------------------------------------------
566 
567 #if FW_ENABLE_TEXT_LOGGING == 1
568 
569  bool FileUplinkComponentBase ::
570  isConnected_LogText_OutputPort(FwIndexType portNum)
571  {
572  FW_ASSERT(
573  portNum < this->getNum_LogText_OutputPorts(),
574  static_cast<FwAssertArgType>(portNum)
575  );
576 
577  return this->m_LogText_OutputPort[portNum].isConnected();
578  }
579 
580 #endif
581 
584  {
585  FW_ASSERT(
586  portNum < this->getNum_eventOut_OutputPorts(),
587  static_cast<FwAssertArgType>(portNum)
588  );
589 
590  return this->m_eventOut_OutputPort[portNum].isConnected();
591  }
592 
595  {
596  FW_ASSERT(
597  portNum < this->getNum_timeCaller_OutputPorts(),
598  static_cast<FwAssertArgType>(portNum)
599  );
600 
601  return this->m_timeCaller_OutputPort[portNum].isConnected();
602  }
603 
606  {
607  FW_ASSERT(
608  portNum < this->getNum_tlmOut_OutputPorts(),
609  static_cast<FwAssertArgType>(portNum)
610  );
611 
612  return this->m_tlmOut_OutputPort[portNum].isConnected();
613  }
614 
615  // ----------------------------------------------------------------------
616  // Connection status queries for typed output ports
617  // ----------------------------------------------------------------------
618 
621  {
622  FW_ASSERT(
623  portNum < this->getNum_bufferSendOut_OutputPorts(),
624  static_cast<FwAssertArgType>(portNum)
625  );
626 
627  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
628  }
629 
632  {
633  FW_ASSERT(
634  portNum < this->getNum_pingOut_OutputPorts(),
635  static_cast<FwAssertArgType>(portNum)
636  );
637 
638  return this->m_pingOut_OutputPort[portNum].isConnected();
639  }
640 
641  // ----------------------------------------------------------------------
642  // Port handler base-class functions for typed input ports
643  //
644  // Call these functions directly to bypass the corresponding ports
645  // ----------------------------------------------------------------------
646 
649  FwIndexType portNum,
650  Fw::Buffer& fwBuffer
651  )
652  {
653  // Make sure port number is valid
654  FW_ASSERT(
655  portNum < this->getNum_bufferSendIn_InputPorts(),
656  static_cast<FwAssertArgType>(portNum)
657  );
658 
659  // Call pre-message hook
661  portNum,
662  fwBuffer
663  );
664  ComponentIpcSerializableBuffer msg;
666 
667  // Serialize message ID
668  _status = msg.serialize(
669  static_cast<FwEnumStoreType>(BUFFERSENDIN_BUFFERSEND)
670  );
671  FW_ASSERT(
672  _status == Fw::FW_SERIALIZE_OK,
673  static_cast<FwAssertArgType>(_status)
674  );
675 
676  // Serialize port number
677  _status = msg.serialize(portNum);
678  FW_ASSERT(
679  _status == Fw::FW_SERIALIZE_OK,
680  static_cast<FwAssertArgType>(_status)
681  );
682 
683  // Serialize argument fwBuffer
684  _status = msg.serialize(fwBuffer);
685  FW_ASSERT(
686  _status == Fw::FW_SERIALIZE_OK,
687  static_cast<FwAssertArgType>(_status)
688  );
689 
690  // Send message
692  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
693 
694  FW_ASSERT(
695  qStatus == Os::Queue::OP_OK,
696  static_cast<FwAssertArgType>(qStatus)
697  );
698  }
699 
702  FwIndexType portNum,
703  U32 key
704  )
705  {
706  // Make sure port number is valid
707  FW_ASSERT(
708  portNum < this->getNum_pingIn_InputPorts(),
709  static_cast<FwAssertArgType>(portNum)
710  );
711 
712  // Call pre-message hook
714  portNum,
715  key
716  );
717  ComponentIpcSerializableBuffer msg;
719 
720  // Serialize message ID
721  _status = msg.serialize(
722  static_cast<FwEnumStoreType>(PINGIN_PING)
723  );
724  FW_ASSERT(
725  _status == Fw::FW_SERIALIZE_OK,
726  static_cast<FwAssertArgType>(_status)
727  );
728 
729  // Serialize port number
730  _status = msg.serialize(portNum);
731  FW_ASSERT(
732  _status == Fw::FW_SERIALIZE_OK,
733  static_cast<FwAssertArgType>(_status)
734  );
735 
736  // Serialize argument key
737  _status = msg.serialize(key);
738  FW_ASSERT(
739  _status == Fw::FW_SERIALIZE_OK,
740  static_cast<FwAssertArgType>(_status)
741  );
742 
743  // Send message
745  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
746 
747  FW_ASSERT(
748  qStatus == Os::Queue::OP_OK,
749  static_cast<FwAssertArgType>(qStatus)
750  );
751  }
752 
753  // ----------------------------------------------------------------------
754  // Pre-message hooks for typed async input ports
755  //
756  // Each of these functions is invoked just before processing a message
757  // on the corresponding port. By default, they do nothing. You can
758  // override them to provide specific pre-message behavior.
759  // ----------------------------------------------------------------------
760 
763  FwIndexType portNum,
764  Fw::Buffer& fwBuffer
765  )
766  {
767  // Default: no-op
768  }
769 
772  FwIndexType portNum,
773  U32 key
774  )
775  {
776  // Default: no-op
777  }
778 
779  // ----------------------------------------------------------------------
780  // Invocation functions for typed output ports
781  // ----------------------------------------------------------------------
782 
785  FwIndexType portNum,
786  Fw::Buffer& fwBuffer
787  )
788  {
789  FW_ASSERT(
790  portNum < this->getNum_bufferSendOut_OutputPorts(),
791  static_cast<FwAssertArgType>(portNum)
792  );
793  this->m_bufferSendOut_OutputPort[portNum].invoke(
794  fwBuffer
795  );
796  }
797 
800  FwIndexType portNum,
801  U32 key
802  )
803  {
804  FW_ASSERT(
805  portNum < this->getNum_pingOut_OutputPorts(),
806  static_cast<FwAssertArgType>(portNum)
807  );
808  this->m_pingOut_OutputPort[portNum].invoke(
809  key
810  );
811  }
812 
813  // ----------------------------------------------------------------------
814  // Event logging functions
815  // ----------------------------------------------------------------------
816 
819  const Fw::StringBase& fileName,
820  U32 computed,
821  U32 read
822  )
823  {
824  // Get the time
825  Fw::Time _logTime;
826  if (this->m_timeCaller_OutputPort[0].isConnected()) {
827  this->m_timeCaller_OutputPort[0].invoke(_logTime);
828  }
829 
830  FwEventIdType _id = static_cast<FwEventIdType>(0);
831 
832  _id = this->getIdBase() + EVENTID_BADCHECKSUM;
833 
834  // Emit the event on the log port
835  if (this->m_eventOut_OutputPort[0].isConnected()) {
836  Fw::LogBuffer _logBuff;
838 
839 #if FW_AMPCS_COMPATIBLE
840  // Serialize the number of arguments
841  _status = _logBuff.serialize(static_cast<U8>(3));
842  FW_ASSERT(
843  _status == Fw::FW_SERIALIZE_OK,
844  static_cast<FwAssertArgType>(_status)
845  );
846 #endif
847 
848  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
849  FW_ASSERT(
850  _status == Fw::FW_SERIALIZE_OK,
851  static_cast<FwAssertArgType>(_status)
852  );
853 
854 #if FW_AMPCS_COMPATIBLE
855  // Serialize the argument size
856  _status = _logBuff.serialize(
857  static_cast<U8>(sizeof(U32))
858  );
859  FW_ASSERT(
860  _status == Fw::FW_SERIALIZE_OK,
861  static_cast<FwAssertArgType>(_status)
862  );
863 #endif
864  _status = _logBuff.serialize(computed);
865  FW_ASSERT(
866  _status == Fw::FW_SERIALIZE_OK,
867  static_cast<FwAssertArgType>(_status)
868  );
869 
870 #if FW_AMPCS_COMPATIBLE
871  // Serialize the argument size
872  _status = _logBuff.serialize(
873  static_cast<U8>(sizeof(U32))
874  );
875  FW_ASSERT(
876  _status == Fw::FW_SERIALIZE_OK,
877  static_cast<FwAssertArgType>(_status)
878  );
879 #endif
880  _status = _logBuff.serialize(read);
881  FW_ASSERT(
882  _status == Fw::FW_SERIALIZE_OK,
883  static_cast<FwAssertArgType>(_status)
884  );
885 
886  this->m_eventOut_OutputPort[0].invoke(
887  _id,
888  _logTime,
890  _logBuff
891  );
892  }
893 
894  // Emit the event on the text log port
895 #if FW_ENABLE_TEXT_LOGGING
896  if (this->m_LogText_OutputPort[0].isConnected()) {
897 #if FW_OBJECT_NAMES == 1
898  const char* _formatString =
899  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
900 #else
901  const char* _formatString =
902  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
903 #endif
904 
905  Fw::TextLogString _logString;
906  _logString.format(
907  _formatString,
908 #if FW_OBJECT_NAMES == 1
909  this->m_objName.toChar(),
910 #endif
911  "BadChecksum ",
912  fileName.toChar(),
913  computed,
914  read
915  );
916 
917  this->m_LogText_OutputPort[0].invoke(
918  _id,
919  _logTime,
921  _logString
922  );
923  }
924 #endif
925  }
926 
929  {
930  // Get the time
931  Fw::Time _logTime;
932  if (this->m_timeCaller_OutputPort[0].isConnected()) {
933  this->m_timeCaller_OutputPort[0].invoke(_logTime);
934  }
935 
936  FwEventIdType _id = static_cast<FwEventIdType>(0);
937 
938  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
939 
940  // Emit the event on the log port
941  if (this->m_eventOut_OutputPort[0].isConnected()) {
942  Fw::LogBuffer _logBuff;
944 
945 #if FW_AMPCS_COMPATIBLE
946  // Serialize the number of arguments
947  _status = _logBuff.serialize(static_cast<U8>(1));
948  FW_ASSERT(
949  _status == Fw::FW_SERIALIZE_OK,
950  static_cast<FwAssertArgType>(_status)
951  );
952 #endif
953 
954  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
955  FW_ASSERT(
956  _status == Fw::FW_SERIALIZE_OK,
957  static_cast<FwAssertArgType>(_status)
958  );
959 
960  this->m_eventOut_OutputPort[0].invoke(
961  _id,
962  _logTime,
964  _logBuff
965  );
966  }
967 
968  // Emit the event on the text log port
969 #if FW_ENABLE_TEXT_LOGGING
970  if (this->m_LogText_OutputPort[0].isConnected()) {
971 #if FW_OBJECT_NAMES == 1
972  const char* _formatString =
973  "(%s) %s: Could not open file %s";
974 #else
975  const char* _formatString =
976  "%s: Could not open file %s";
977 #endif
978 
979  Fw::TextLogString _logString;
980  _logString.format(
981  _formatString,
982 #if FW_OBJECT_NAMES == 1
983  this->m_objName.toChar(),
984 #endif
985  "FileOpenError ",
986  fileName.toChar()
987  );
988 
989  this->m_LogText_OutputPort[0].invoke(
990  _id,
991  _logTime,
993  _logString
994  );
995  }
996 #endif
997  }
998 
1001  {
1002  // Get the time
1003  Fw::Time _logTime;
1004  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1005  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1006  }
1007 
1008  FwEventIdType _id = static_cast<FwEventIdType>(0);
1009 
1010  _id = this->getIdBase() + EVENTID_FILERECEIVED;
1011 
1012  // Emit the event on the log port
1013  if (this->m_eventOut_OutputPort[0].isConnected()) {
1014  Fw::LogBuffer _logBuff;
1016 
1017 #if FW_AMPCS_COMPATIBLE
1018  // Serialize the number of arguments
1019  _status = _logBuff.serialize(static_cast<U8>(1));
1020  FW_ASSERT(
1021  _status == Fw::FW_SERIALIZE_OK,
1022  static_cast<FwAssertArgType>(_status)
1023  );
1024 #endif
1025 
1026  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1027  FW_ASSERT(
1028  _status == Fw::FW_SERIALIZE_OK,
1029  static_cast<FwAssertArgType>(_status)
1030  );
1031 
1032  this->m_eventOut_OutputPort[0].invoke(
1033  _id,
1034  _logTime,
1036  _logBuff
1037  );
1038  }
1039 
1040  // Emit the event on the text log port
1041 #if FW_ENABLE_TEXT_LOGGING
1042  if (this->m_LogText_OutputPort[0].isConnected()) {
1043 #if FW_OBJECT_NAMES == 1
1044  const char* _formatString =
1045  "(%s) %s: Received file %s";
1046 #else
1047  const char* _formatString =
1048  "%s: Received file %s";
1049 #endif
1050 
1051  Fw::TextLogString _logString;
1052  _logString.format(
1053  _formatString,
1054 #if FW_OBJECT_NAMES == 1
1055  this->m_objName.toChar(),
1056 #endif
1057  "FileReceived ",
1058  fileName.toChar()
1059  );
1060 
1061  this->m_LogText_OutputPort[0].invoke(
1062  _id,
1063  _logTime,
1065  _logString
1066  );
1067  }
1068 #endif
1069  }
1070 
1073  {
1074  // Check throttle value
1075  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1076  return;
1077  }
1078  else {
1079  this->m_FileWriteErrorThrottle++;
1080  }
1081 
1082  // Get the time
1083  Fw::Time _logTime;
1084  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1085  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1086  }
1087 
1088  FwEventIdType _id = static_cast<FwEventIdType>(0);
1089 
1090  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1091 
1092  // Emit the event on the log port
1093  if (this->m_eventOut_OutputPort[0].isConnected()) {
1094  Fw::LogBuffer _logBuff;
1096 
1097 #if FW_AMPCS_COMPATIBLE
1098  // Serialize the number of arguments
1099  _status = _logBuff.serialize(static_cast<U8>(1));
1100  FW_ASSERT(
1101  _status == Fw::FW_SERIALIZE_OK,
1102  static_cast<FwAssertArgType>(_status)
1103  );
1104 #endif
1105 
1106  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1107  FW_ASSERT(
1108  _status == Fw::FW_SERIALIZE_OK,
1109  static_cast<FwAssertArgType>(_status)
1110  );
1111 
1112  this->m_eventOut_OutputPort[0].invoke(
1113  _id,
1114  _logTime,
1116  _logBuff
1117  );
1118  }
1119 
1120  // Emit the event on the text log port
1121 #if FW_ENABLE_TEXT_LOGGING
1122  if (this->m_LogText_OutputPort[0].isConnected()) {
1123 #if FW_OBJECT_NAMES == 1
1124  const char* _formatString =
1125  "(%s) %s: Could not write to file %s";
1126 #else
1127  const char* _formatString =
1128  "%s: Could not write to file %s";
1129 #endif
1130 
1131  Fw::TextLogString _logString;
1132  _logString.format(
1133  _formatString,
1134 #if FW_OBJECT_NAMES == 1
1135  this->m_objName.toChar(),
1136 #endif
1137  "FileWriteError ",
1138  fileName.toChar()
1139  );
1140 
1141  this->m_LogText_OutputPort[0].invoke(
1142  _id,
1143  _logTime,
1145  _logString
1146  );
1147  }
1148 #endif
1149  }
1150 
1153  U32 packetType,
1154  U32 mode
1155  )
1156  {
1157  // Check throttle value
1158  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1159  return;
1160  }
1161  else {
1162  this->m_InvalidReceiveModeThrottle++;
1163  }
1164 
1165  // Get the time
1166  Fw::Time _logTime;
1167  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1168  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1169  }
1170 
1171  FwEventIdType _id = static_cast<FwEventIdType>(0);
1172 
1173  _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1174 
1175  // Emit the event on the log port
1176  if (this->m_eventOut_OutputPort[0].isConnected()) {
1177  Fw::LogBuffer _logBuff;
1179 
1180 #if FW_AMPCS_COMPATIBLE
1181  // Serialize the number of arguments
1182  _status = _logBuff.serialize(static_cast<U8>(2));
1183  FW_ASSERT(
1184  _status == Fw::FW_SERIALIZE_OK,
1185  static_cast<FwAssertArgType>(_status)
1186  );
1187 #endif
1188 
1189 #if FW_AMPCS_COMPATIBLE
1190  // Serialize the argument size
1191  _status = _logBuff.serialize(
1192  static_cast<U8>(sizeof(U32))
1193  );
1194  FW_ASSERT(
1195  _status == Fw::FW_SERIALIZE_OK,
1196  static_cast<FwAssertArgType>(_status)
1197  );
1198 #endif
1199  _status = _logBuff.serialize(packetType);
1200  FW_ASSERT(
1201  _status == Fw::FW_SERIALIZE_OK,
1202  static_cast<FwAssertArgType>(_status)
1203  );
1204 
1205 #if FW_AMPCS_COMPATIBLE
1206  // Serialize the argument size
1207  _status = _logBuff.serialize(
1208  static_cast<U8>(sizeof(U32))
1209  );
1210  FW_ASSERT(
1211  _status == Fw::FW_SERIALIZE_OK,
1212  static_cast<FwAssertArgType>(_status)
1213  );
1214 #endif
1215  _status = _logBuff.serialize(mode);
1216  FW_ASSERT(
1217  _status == Fw::FW_SERIALIZE_OK,
1218  static_cast<FwAssertArgType>(_status)
1219  );
1220 
1221  this->m_eventOut_OutputPort[0].invoke(
1222  _id,
1223  _logTime,
1225  _logBuff
1226  );
1227  }
1228 
1229  // Emit the event on the text log port
1230 #if FW_ENABLE_TEXT_LOGGING
1231  if (this->m_LogText_OutputPort[0].isConnected()) {
1232 #if FW_OBJECT_NAMES == 1
1233  const char* _formatString =
1234  "(%s) %s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1235 #else
1236  const char* _formatString =
1237  "%s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1238 #endif
1239 
1240  Fw::TextLogString _logString;
1241  _logString.format(
1242  _formatString,
1243 #if FW_OBJECT_NAMES == 1
1244  this->m_objName.toChar(),
1245 #endif
1246  "InvalidReceiveMode ",
1247  packetType,
1248  mode
1249  );
1250 
1251  this->m_LogText_OutputPort[0].invoke(
1252  _id,
1253  _logTime,
1255  _logString
1256  );
1257  }
1258 #endif
1259  }
1260 
1263  U32 packetIndex,
1264  const Fw::StringBase& fileName
1265  )
1266  {
1267  // Check throttle value
1268  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1269  return;
1270  }
1271  else {
1272  this->m_PacketOutOfBoundsThrottle++;
1273  }
1274 
1275  // Get the time
1276  Fw::Time _logTime;
1277  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1278  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1279  }
1280 
1281  FwEventIdType _id = static_cast<FwEventIdType>(0);
1282 
1283  _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1284 
1285  // Emit the event on the log port
1286  if (this->m_eventOut_OutputPort[0].isConnected()) {
1287  Fw::LogBuffer _logBuff;
1289 
1290 #if FW_AMPCS_COMPATIBLE
1291  // Serialize the number of arguments
1292  _status = _logBuff.serialize(static_cast<U8>(2));
1293  FW_ASSERT(
1294  _status == Fw::FW_SERIALIZE_OK,
1295  static_cast<FwAssertArgType>(_status)
1296  );
1297 #endif
1298 
1299 #if FW_AMPCS_COMPATIBLE
1300  // Serialize the argument size
1301  _status = _logBuff.serialize(
1302  static_cast<U8>(sizeof(U32))
1303  );
1304  FW_ASSERT(
1305  _status == Fw::FW_SERIALIZE_OK,
1306  static_cast<FwAssertArgType>(_status)
1307  );
1308 #endif
1309  _status = _logBuff.serialize(packetIndex);
1310  FW_ASSERT(
1311  _status == Fw::FW_SERIALIZE_OK,
1312  static_cast<FwAssertArgType>(_status)
1313  );
1314 
1315  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1316  FW_ASSERT(
1317  _status == Fw::FW_SERIALIZE_OK,
1318  static_cast<FwAssertArgType>(_status)
1319  );
1320 
1321  this->m_eventOut_OutputPort[0].invoke(
1322  _id,
1323  _logTime,
1325  _logBuff
1326  );
1327  }
1328 
1329  // Emit the event on the text log port
1330 #if FW_ENABLE_TEXT_LOGGING
1331  if (this->m_LogText_OutputPort[0].isConnected()) {
1332 #if FW_OBJECT_NAMES == 1
1333  const char* _formatString =
1334  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1335 #else
1336  const char* _formatString =
1337  "%s: Packet %" PRIu32 " out of bounds for file %s";
1338 #endif
1339 
1340  Fw::TextLogString _logString;
1341  _logString.format(
1342  _formatString,
1343 #if FW_OBJECT_NAMES == 1
1344  this->m_objName.toChar(),
1345 #endif
1346  "PacketOutOfBounds ",
1347  packetIndex,
1348  fileName.toChar()
1349  );
1350 
1351  this->m_LogText_OutputPort[0].invoke(
1352  _id,
1353  _logTime,
1355  _logString
1356  );
1357  }
1358 #endif
1359  }
1360 
1363  U32 packetIndex,
1364  U32 lastPacketIndex
1365  )
1366  {
1367  // Check throttle value
1368  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1369  return;
1370  }
1371  else {
1372  this->m_PacketOutOfOrderThrottle++;
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_PACKETOUTOFORDER;
1384 
1385  // Emit the event on the log port
1386  if (this->m_eventOut_OutputPort[0].isConnected()) {
1387  Fw::LogBuffer _logBuff;
1389 
1390 #if FW_AMPCS_COMPATIBLE
1391  // Serialize the number of arguments
1392  _status = _logBuff.serialize(static_cast<U8>(2));
1393  FW_ASSERT(
1394  _status == Fw::FW_SERIALIZE_OK,
1395  static_cast<FwAssertArgType>(_status)
1396  );
1397 #endif
1398 
1399 #if FW_AMPCS_COMPATIBLE
1400  // Serialize the argument size
1401  _status = _logBuff.serialize(
1402  static_cast<U8>(sizeof(U32))
1403  );
1404  FW_ASSERT(
1405  _status == Fw::FW_SERIALIZE_OK,
1406  static_cast<FwAssertArgType>(_status)
1407  );
1408 #endif
1409  _status = _logBuff.serialize(packetIndex);
1410  FW_ASSERT(
1411  _status == Fw::FW_SERIALIZE_OK,
1412  static_cast<FwAssertArgType>(_status)
1413  );
1414 
1415 #if FW_AMPCS_COMPATIBLE
1416  // Serialize the argument size
1417  _status = _logBuff.serialize(
1418  static_cast<U8>(sizeof(U32))
1419  );
1420  FW_ASSERT(
1421  _status == Fw::FW_SERIALIZE_OK,
1422  static_cast<FwAssertArgType>(_status)
1423  );
1424 #endif
1425  _status = _logBuff.serialize(lastPacketIndex);
1426  FW_ASSERT(
1427  _status == Fw::FW_SERIALIZE_OK,
1428  static_cast<FwAssertArgType>(_status)
1429  );
1430 
1431  this->m_eventOut_OutputPort[0].invoke(
1432  _id,
1433  _logTime,
1435  _logBuff
1436  );
1437  }
1438 
1439  // Emit the event on the text log port
1440 #if FW_ENABLE_TEXT_LOGGING
1441  if (this->m_LogText_OutputPort[0].isConnected()) {
1442 #if FW_OBJECT_NAMES == 1
1443  const char* _formatString =
1444  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1445 #else
1446  const char* _formatString =
1447  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1448 #endif
1449 
1450  Fw::TextLogString _logString;
1451  _logString.format(
1452  _formatString,
1453 #if FW_OBJECT_NAMES == 1
1454  this->m_objName.toChar(),
1455 #endif
1456  "PacketOutOfOrder ",
1457  packetIndex,
1458  lastPacketIndex
1459  );
1460 
1461  this->m_LogText_OutputPort[0].invoke(
1462  _id,
1463  _logTime,
1465  _logString
1466  );
1467  }
1468 #endif
1469  }
1470 
1472  log_WARNING_HI_PacketDuplicate(U32 packetIndex)
1473  {
1474  // Check throttle value
1475  if (this->m_PacketDuplicateThrottle >= EVENTID_PACKETDUPLICATE_THROTTLE) {
1476  return;
1477  }
1478  else {
1479  this->m_PacketDuplicateThrottle++;
1480  }
1481 
1482  // Get the time
1483  Fw::Time _logTime;
1484  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1485  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1486  }
1487 
1488  FwEventIdType _id = static_cast<FwEventIdType>(0);
1489 
1490  _id = this->getIdBase() + EVENTID_PACKETDUPLICATE;
1491 
1492  // Emit the event on the log port
1493  if (this->m_eventOut_OutputPort[0].isConnected()) {
1494  Fw::LogBuffer _logBuff;
1496 
1497 #if FW_AMPCS_COMPATIBLE
1498  // Serialize the number of arguments
1499  _status = _logBuff.serialize(static_cast<U8>(1));
1500  FW_ASSERT(
1501  _status == Fw::FW_SERIALIZE_OK,
1502  static_cast<FwAssertArgType>(_status)
1503  );
1504 #endif
1505 
1506 #if FW_AMPCS_COMPATIBLE
1507  // Serialize the argument size
1508  _status = _logBuff.serialize(
1509  static_cast<U8>(sizeof(U32))
1510  );
1511  FW_ASSERT(
1512  _status == Fw::FW_SERIALIZE_OK,
1513  static_cast<FwAssertArgType>(_status)
1514  );
1515 #endif
1516  _status = _logBuff.serialize(packetIndex);
1517  FW_ASSERT(
1518  _status == Fw::FW_SERIALIZE_OK,
1519  static_cast<FwAssertArgType>(_status)
1520  );
1521 
1522  this->m_eventOut_OutputPort[0].invoke(
1523  _id,
1524  _logTime,
1526  _logBuff
1527  );
1528  }
1529 
1530  // Emit the event on the text log port
1531 #if FW_ENABLE_TEXT_LOGGING
1532  if (this->m_LogText_OutputPort[0].isConnected()) {
1533 #if FW_OBJECT_NAMES == 1
1534  const char* _formatString =
1535  "(%s) %s: Received a duplicate of packet %" PRIu32 "";
1536 #else
1537  const char* _formatString =
1538  "%s: Received a duplicate of packet %" PRIu32 "";
1539 #endif
1540 
1541  Fw::TextLogString _logString;
1542  _logString.format(
1543  _formatString,
1544 #if FW_OBJECT_NAMES == 1
1545  this->m_objName.toChar(),
1546 #endif
1547  "PacketDuplicate ",
1548  packetIndex
1549  );
1550 
1551  this->m_LogText_OutputPort[0].invoke(
1552  _id,
1553  _logTime,
1555  _logString
1556  );
1557  }
1558 #endif
1559  }
1560 
1563  {
1564  // Get the time
1565  Fw::Time _logTime;
1566  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1567  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1568  }
1569 
1570  FwEventIdType _id = static_cast<FwEventIdType>(0);
1571 
1572  _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1573 
1574  // Emit the event on the log port
1575  if (this->m_eventOut_OutputPort[0].isConnected()) {
1576  Fw::LogBuffer _logBuff;
1577 
1578 #if FW_AMPCS_COMPATIBLE
1580  // Serialize the number of arguments
1581  _status = _logBuff.serialize(static_cast<U8>(0));
1582  FW_ASSERT(
1583  _status == Fw::FW_SERIALIZE_OK,
1584  static_cast<FwAssertArgType>(_status)
1585  );
1586 #endif
1587 
1588  this->m_eventOut_OutputPort[0].invoke(
1589  _id,
1590  _logTime,
1592  _logBuff
1593  );
1594  }
1595 
1596  // Emit the event on the text log port
1597 #if FW_ENABLE_TEXT_LOGGING
1598  if (this->m_LogText_OutputPort[0].isConnected()) {
1599 #if FW_OBJECT_NAMES == 1
1600  const char* _formatString =
1601  "(%s) %s: Received CANCEL packet";
1602 #else
1603  const char* _formatString =
1604  "%s: Received CANCEL packet";
1605 #endif
1606 
1607  Fw::TextLogString _logString;
1608  _logString.format(
1609  _formatString,
1610 #if FW_OBJECT_NAMES == 1
1611  this->m_objName.toChar(),
1612 #endif
1613  "UplinkCanceled "
1614  );
1615 
1616  this->m_LogText_OutputPort[0].invoke(
1617  _id,
1618  _logTime,
1620  _logString
1621  );
1622  }
1623 #endif
1624  }
1625 
1627  log_WARNING_HI_DecodeError(I32 status)
1628  {
1629  // Get the time
1630  Fw::Time _logTime;
1631  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1632  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1633  }
1634 
1635  FwEventIdType _id = static_cast<FwEventIdType>(0);
1636 
1637  _id = this->getIdBase() + EVENTID_DECODEERROR;
1638 
1639  // Emit the event on the log port
1640  if (this->m_eventOut_OutputPort[0].isConnected()) {
1641  Fw::LogBuffer _logBuff;
1643 
1644 #if FW_AMPCS_COMPATIBLE
1645  // Serialize the number of arguments
1646  _status = _logBuff.serialize(static_cast<U8>(1));
1647  FW_ASSERT(
1648  _status == Fw::FW_SERIALIZE_OK,
1649  static_cast<FwAssertArgType>(_status)
1650  );
1651 #endif
1652 
1653 #if FW_AMPCS_COMPATIBLE
1654  // Serialize the argument size
1655  _status = _logBuff.serialize(
1656  static_cast<U8>(sizeof(I32))
1657  );
1658  FW_ASSERT(
1659  _status == Fw::FW_SERIALIZE_OK,
1660  static_cast<FwAssertArgType>(_status)
1661  );
1662 #endif
1663  _status = _logBuff.serialize(status);
1664  FW_ASSERT(
1665  _status == Fw::FW_SERIALIZE_OK,
1666  static_cast<FwAssertArgType>(_status)
1667  );
1668 
1669  this->m_eventOut_OutputPort[0].invoke(
1670  _id,
1671  _logTime,
1673  _logBuff
1674  );
1675  }
1676 
1677  // Emit the event on the text log port
1678 #if FW_ENABLE_TEXT_LOGGING
1679  if (this->m_LogText_OutputPort[0].isConnected()) {
1680 #if FW_OBJECT_NAMES == 1
1681  const char* _formatString =
1682  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1683 #else
1684  const char* _formatString =
1685  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1686 #endif
1687 
1688  Fw::TextLogString _logString;
1689  _logString.format(
1690  _formatString,
1691 #if FW_OBJECT_NAMES == 1
1692  this->m_objName.toChar(),
1693 #endif
1694  "DecodeError ",
1695  status
1696  );
1697 
1698  this->m_LogText_OutputPort[0].invoke(
1699  _id,
1700  _logTime,
1702  _logString
1703  );
1704  }
1705 #endif
1706  }
1707 
1708  // ----------------------------------------------------------------------
1709  // Event throttle reset functions
1710  // ----------------------------------------------------------------------
1711 
1714  {
1715  // Reset throttle counter
1716  this->m_FileWriteErrorThrottle = 0;
1717  }
1718 
1721  {
1722  // Reset throttle counter
1723  this->m_InvalidReceiveModeThrottle = 0;
1724  }
1725 
1728  {
1729  // Reset throttle counter
1730  this->m_PacketOutOfBoundsThrottle = 0;
1731  }
1732 
1735  {
1736  // Reset throttle counter
1737  this->m_PacketOutOfOrderThrottle = 0;
1738  }
1739 
1742  {
1743  // Reset throttle counter
1744  this->m_PacketDuplicateThrottle = 0;
1745  }
1746 
1747  // ----------------------------------------------------------------------
1748  // Telemetry write functions
1749  // ----------------------------------------------------------------------
1750 
1753  U32 arg,
1754  Fw::Time _tlmTime
1755  )
1756  {
1757  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1758  if (
1759  this->m_timeCaller_OutputPort[0].isConnected() &&
1760  (_tlmTime == Fw::ZERO_TIME)
1761  ) {
1762  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1763  }
1764 
1765  Fw::TlmBuffer _tlmBuff;
1766  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1767  FW_ASSERT(
1768  _stat == Fw::FW_SERIALIZE_OK,
1769  static_cast<FwAssertArgType>(_stat)
1770  );
1771 
1772  FwChanIdType _id;
1773 
1774  _id = this->getIdBase() + CHANNELID_FILESRECEIVED;
1775 
1776  this->m_tlmOut_OutputPort[0].invoke(
1777  _id,
1778  _tlmTime,
1779  _tlmBuff
1780  );
1781  }
1782  }
1783 
1786  U32 arg,
1787  Fw::Time _tlmTime
1788  )
1789  {
1790  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1791  if (
1792  this->m_timeCaller_OutputPort[0].isConnected() &&
1793  (_tlmTime == Fw::ZERO_TIME)
1794  ) {
1795  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1796  }
1797 
1798  Fw::TlmBuffer _tlmBuff;
1799  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1800  FW_ASSERT(
1801  _stat == Fw::FW_SERIALIZE_OK,
1802  static_cast<FwAssertArgType>(_stat)
1803  );
1804 
1805  FwChanIdType _id;
1806 
1807  _id = this->getIdBase() + CHANNELID_PACKETSRECEIVED;
1808 
1809  this->m_tlmOut_OutputPort[0].invoke(
1810  _id,
1811  _tlmTime,
1812  _tlmBuff
1813  );
1814  }
1815  }
1816 
1819  U32 arg,
1820  Fw::Time _tlmTime
1821  )
1822  {
1823  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1824  if (
1825  this->m_timeCaller_OutputPort[0].isConnected() &&
1826  (_tlmTime == Fw::ZERO_TIME)
1827  ) {
1828  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1829  }
1830 
1831  Fw::TlmBuffer _tlmBuff;
1832  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1833  FW_ASSERT(
1834  _stat == Fw::FW_SERIALIZE_OK,
1835  static_cast<FwAssertArgType>(_stat)
1836  );
1837 
1838  FwChanIdType _id;
1839 
1840  _id = this->getIdBase() + CHANNELID_WARNINGS;
1841 
1842  this->m_tlmOut_OutputPort[0].invoke(
1843  _id,
1844  _tlmTime,
1845  _tlmBuff
1846  );
1847  }
1848  }
1849 
1850  // ----------------------------------------------------------------------
1851  // Time
1852  // ----------------------------------------------------------------------
1853 
1855  getTime()
1856  {
1857  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1858  Fw::Time _time;
1859  this->m_timeCaller_OutputPort[0].invoke(_time);
1860  return _time;
1861  }
1862  else {
1863  return Fw::Time(TB_NONE, 0, 0);
1864  }
1865  }
1866 
1867  // ----------------------------------------------------------------------
1868  // Message dispatch functions
1869  // ----------------------------------------------------------------------
1870 
1871  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
1872  doDispatch()
1873  {
1874  ComponentIpcSerializableBuffer msg;
1875  FwQueuePriorityType priority = 0;
1876 
1877  Os::Queue::Status msgStatus = this->m_queue.receive(
1878  msg,
1880  priority
1881  );
1882  FW_ASSERT(
1883  msgStatus == Os::Queue::OP_OK,
1884  static_cast<FwAssertArgType>(msgStatus)
1885  );
1886 
1887  // Reset to beginning of buffer
1888  msg.resetDeser();
1889 
1890  FwEnumStoreType desMsg = 0;
1891  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1892  FW_ASSERT(
1893  deserStatus == Fw::FW_SERIALIZE_OK,
1894  static_cast<FwAssertArgType>(deserStatus)
1895  );
1896 
1897  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1898 
1899  if (msgType == FILEUPLINK_COMPONENT_EXIT) {
1900  return MSG_DISPATCH_EXIT;
1901  }
1902 
1903  FwIndexType portNum = 0;
1904  deserStatus = msg.deserialize(portNum);
1905  FW_ASSERT(
1906  deserStatus == Fw::FW_SERIALIZE_OK,
1907  static_cast<FwAssertArgType>(deserStatus)
1908  );
1909 
1910  switch (msgType) {
1911  // Handle async input port bufferSendIn
1912  case BUFFERSENDIN_BUFFERSEND: {
1913  // Deserialize argument fwBuffer
1914  Fw::Buffer fwBuffer;
1915  deserStatus = msg.deserialize(fwBuffer);
1916  FW_ASSERT(
1917  deserStatus == Fw::FW_SERIALIZE_OK,
1918  static_cast<FwAssertArgType>(deserStatus)
1919  );
1920  // Call handler function
1921  this->bufferSendIn_handler(
1922  portNum,
1923  fwBuffer
1924  );
1925 
1926  break;
1927  }
1928 
1929  // Handle async input port pingIn
1930  case PINGIN_PING: {
1931  // Deserialize argument key
1932  U32 key;
1933  deserStatus = msg.deserialize(key);
1934  FW_ASSERT(
1935  deserStatus == Fw::FW_SERIALIZE_OK,
1936  static_cast<FwAssertArgType>(deserStatus)
1937  );
1938  // Call handler function
1939  this->pingIn_handler(
1940  portNum,
1941  key
1942  );
1943 
1944  break;
1945  }
1946 
1947  default:
1948  return MSG_DISPATCH_ERROR;
1949  }
1950 
1951  return MSG_DISPATCH_OK;
1952  }
1953 
1954  // ----------------------------------------------------------------------
1955  // Calls for messages received on typed input ports
1956  // ----------------------------------------------------------------------
1957 
1958  void FileUplinkComponentBase ::
1959  m_p_bufferSendIn_in(
1960  Fw::PassiveComponentBase* callComp,
1961  FwIndexType portNum,
1962  Fw::Buffer& fwBuffer
1963  )
1964  {
1965  FW_ASSERT(callComp);
1966  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1967  compPtr->bufferSendIn_handlerBase(
1968  portNum,
1969  fwBuffer
1970  );
1971  }
1972 
1973  void FileUplinkComponentBase ::
1974  m_p_pingIn_in(
1975  Fw::PassiveComponentBase* callComp,
1976  FwIndexType portNum,
1977  U32 key
1978  )
1979  {
1980  FW_ASSERT(callComp);
1981  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1982  compPtr->pingIn_handlerBase(
1983  portNum,
1984  key
1985  );
1986  }
1987 
1988 }
#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