F´ Flight Software - C/C++ Documentation
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  // Offset into data in buffer: Size of message ID and port number
40  DATA_OFFSET = sizeof(FwEnumStoreType) + sizeof(FwIndexType),
41  // Max data size
42  MAX_DATA_SIZE = sizeof(BuffUnion),
43  // Max message size: Size of message id + size of port + max data size
44  SERIALIZATION_SIZE = DATA_OFFSET + MAX_DATA_SIZE
45  };
46 
47  Fw::Serializable::SizeType getBuffCapacity() const {
48  return sizeof(m_buff);
49  }
50 
51  U8* getBuffAddr() {
52  return m_buff;
53  }
54 
55  const U8* getBuffAddr() const {
56  return m_buff;
57  }
58 
59  private:
60  // Should be the max of all the input ports serialized sizes...
61  U8 m_buff[SERIALIZATION_SIZE];
62 
63  };
64  }
65 
66  // ----------------------------------------------------------------------
67  // Component initialization
68  // ----------------------------------------------------------------------
69 
72  FwSizeType queueDepth,
73  FwEnumStoreType instance
74  )
75  {
76  // Initialize base class
78 
79  // Connect input port bufferSendIn
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_bufferSendIn_InputPorts());
83  port++
84  ) {
85  this->m_bufferSendIn_InputPort[port].init();
86  this->m_bufferSendIn_InputPort[port].addCallComp(
87  this,
88  m_p_bufferSendIn_in
89  );
90  this->m_bufferSendIn_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  Fw::ObjectName portName;
94  portName.format(
95  "%s_bufferSendIn_InputPort[%" PRI_PlatformIntType "]",
96  this->m_objName.toChar(),
97  port
98  );
99  this->m_bufferSendIn_InputPort[port].setObjName(portName.toChar());
100 #endif
101  }
102 
103  // Connect input port pingIn
104  for (
105  FwIndexType port = 0;
106  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
107  port++
108  ) {
109  this->m_pingIn_InputPort[port].init();
110  this->m_pingIn_InputPort[port].addCallComp(
111  this,
112  m_p_pingIn_in
113  );
114  this->m_pingIn_InputPort[port].setPortNum(port);
115 
116 #if FW_OBJECT_NAMES == 1
117  Fw::ObjectName portName;
118  portName.format(
119  "%s_pingIn_InputPort[%" PRI_PlatformIntType "]",
120  this->m_objName.toChar(),
121  port
122  );
123  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
124 #endif
125  }
126 
127 #if FW_ENABLE_TEXT_LOGGING == 1
128  // Connect output port LogText
129  for (
130  FwIndexType port = 0;
131  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
132  port++
133  ) {
134  this->m_LogText_OutputPort[port].init();
135 
136 #if FW_OBJECT_NAMES == 1
137  Fw::ObjectName portName;
138  portName.format(
139  "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
140  this->m_objName.toChar(),
141  port
142  );
143  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
144 #endif
145  }
146 #endif
147 
148  // Connect output port eventOut
149  for (
150  FwIndexType port = 0;
151  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
152  port++
153  ) {
154  this->m_eventOut_OutputPort[port].init();
155 
156 #if FW_OBJECT_NAMES == 1
157  Fw::ObjectName portName;
158  portName.format(
159  "%s_eventOut_OutputPort[%" PRI_PlatformIntType "]",
160  this->m_objName.toChar(),
161  port
162  );
163  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
164 #endif
165  }
166 
167  // Connect output port timeCaller
168  for (
169  FwIndexType port = 0;
170  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
171  port++
172  ) {
173  this->m_timeCaller_OutputPort[port].init();
174 
175 #if FW_OBJECT_NAMES == 1
176  Fw::ObjectName portName;
177  portName.format(
178  "%s_timeCaller_OutputPort[%" PRI_PlatformIntType "]",
179  this->m_objName.toChar(),
180  port
181  );
182  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
183 #endif
184  }
185 
186  // Connect output port tlmOut
187  for (
188  FwIndexType port = 0;
189  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
190  port++
191  ) {
192  this->m_tlmOut_OutputPort[port].init();
193 
194 #if FW_OBJECT_NAMES == 1
195  Fw::ObjectName portName;
196  portName.format(
197  "%s_tlmOut_OutputPort[%" PRI_PlatformIntType "]",
198  this->m_objName.toChar(),
199  port
200  );
201  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
202 #endif
203  }
204 
205  // Connect output port bufferSendOut
206  for (
207  FwIndexType port = 0;
208  port < static_cast<FwIndexType>(this->getNum_bufferSendOut_OutputPorts());
209  port++
210  ) {
211  this->m_bufferSendOut_OutputPort[port].init();
212 
213 #if FW_OBJECT_NAMES == 1
214  Fw::ObjectName portName;
215  portName.format(
216  "%s_bufferSendOut_OutputPort[%" PRI_PlatformIntType "]",
217  this->m_objName.toChar(),
218  port
219  );
220  this->m_bufferSendOut_OutputPort[port].setObjName(portName.toChar());
221 #endif
222  }
223 
224  // Connect output port pingOut
225  for (
226  FwIndexType port = 0;
227  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
228  port++
229  ) {
230  this->m_pingOut_OutputPort[port].init();
231 
232 #if FW_OBJECT_NAMES == 1
233  Fw::ObjectName portName;
234  portName.format(
235  "%s_pingOut_OutputPort[%" PRI_PlatformIntType "]",
236  this->m_objName.toChar(),
237  port
238  );
239  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
240 #endif
241  }
242 
243  // Create the queue
244  Os::Queue::Status qStat = this->createQueue(
245  queueDepth,
246  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
247  );
248  FW_ASSERT(
249  Os::Queue::Status::OP_OK == qStat,
250  static_cast<FwAssertArgType>(qStat)
251  );
252  }
253 
254  // ----------------------------------------------------------------------
255  // Getters for typed input ports
256  // ----------------------------------------------------------------------
257 
260  {
261  FW_ASSERT(
262  portNum < this->getNum_bufferSendIn_InputPorts(),
263  static_cast<FwAssertArgType>(portNum)
264  );
265 
266  return &this->m_bufferSendIn_InputPort[portNum];
267  }
268 
271  {
272  FW_ASSERT(
273  portNum < this->getNum_pingIn_InputPorts(),
274  static_cast<FwAssertArgType>(portNum)
275  );
276 
277  return &this->m_pingIn_InputPort[portNum];
278  }
279 
280  // ----------------------------------------------------------------------
281  // Connect input ports to special output ports
282  // ----------------------------------------------------------------------
283 
284 #if FW_ENABLE_TEXT_LOGGING == 1
285 
286  void FileUplinkComponentBase ::
287  set_LogText_OutputPort(
288  FwIndexType portNum,
290  )
291  {
292  FW_ASSERT(
293  portNum < this->getNum_LogText_OutputPorts(),
294  static_cast<FwAssertArgType>(portNum)
295  );
296 
297  this->m_LogText_OutputPort[portNum].addCallPort(port);
298  }
299 
300 #endif
301 
304  FwIndexType portNum,
305  Fw::InputLogPort* port
306  )
307  {
308  FW_ASSERT(
309  portNum < this->getNum_eventOut_OutputPorts(),
310  static_cast<FwAssertArgType>(portNum)
311  );
312 
313  this->m_eventOut_OutputPort[portNum].addCallPort(port);
314  }
315 
318  FwIndexType portNum,
319  Fw::InputTimePort* port
320  )
321  {
322  FW_ASSERT(
323  portNum < this->getNum_timeCaller_OutputPorts(),
324  static_cast<FwAssertArgType>(portNum)
325  );
326 
327  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
328  }
329 
332  FwIndexType portNum,
333  Fw::InputTlmPort* port
334  )
335  {
336  FW_ASSERT(
337  portNum < this->getNum_tlmOut_OutputPorts(),
338  static_cast<FwAssertArgType>(portNum)
339  );
340 
341  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
342  }
343 
344  // ----------------------------------------------------------------------
345  // Connect typed input ports to typed output ports
346  // ----------------------------------------------------------------------
347 
350  FwIndexType portNum,
352  )
353  {
354  FW_ASSERT(
355  portNum < this->getNum_bufferSendOut_OutputPorts(),
356  static_cast<FwAssertArgType>(portNum)
357  );
358 
359  this->m_bufferSendOut_OutputPort[portNum].addCallPort(port);
360  }
361 
364  FwIndexType portNum,
365  Svc::InputPingPort* port
366  )
367  {
368  FW_ASSERT(
369  portNum < this->getNum_pingOut_OutputPorts(),
370  static_cast<FwAssertArgType>(portNum)
371  );
372 
373  this->m_pingOut_OutputPort[portNum].addCallPort(port);
374  }
375 
376 #if FW_PORT_SERIALIZATION
377 
378  // ----------------------------------------------------------------------
379  // Connect serial input ports to special output ports
380  // ----------------------------------------------------------------------
381 
382 #if FW_ENABLE_TEXT_LOGGING == 1
383 
384  void FileUplinkComponentBase ::
385  set_LogText_OutputPort(
386  FwIndexType portNum,
387  Fw::InputSerializePort* port
388  )
389  {
390  FW_ASSERT(
391  portNum < this->getNum_LogText_OutputPorts(),
392  static_cast<FwAssertArgType>(portNum)
393  );
394 
395  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
396  }
397 
398 #endif
399 
402  FwIndexType portNum,
403  Fw::InputSerializePort* port
404  )
405  {
406  FW_ASSERT(
407  portNum < this->getNum_eventOut_OutputPorts(),
408  static_cast<FwAssertArgType>(portNum)
409  );
410 
411  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
412  }
413 
416  FwIndexType portNum,
417  Fw::InputSerializePort* port
418  )
419  {
420  FW_ASSERT(
421  portNum < this->getNum_timeCaller_OutputPorts(),
422  static_cast<FwAssertArgType>(portNum)
423  );
424 
425  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
426  }
427 
430  FwIndexType portNum,
431  Fw::InputSerializePort* port
432  )
433  {
434  FW_ASSERT(
435  portNum < this->getNum_tlmOut_OutputPorts(),
436  static_cast<FwAssertArgType>(portNum)
437  );
438 
439  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
440  }
441 
442 #endif
443 
444 #if FW_PORT_SERIALIZATION
445 
446  // ----------------------------------------------------------------------
447  // Connect serial input ports to typed output ports
448  // ----------------------------------------------------------------------
449 
452  FwIndexType portNum,
453  Fw::InputSerializePort* port
454  )
455  {
456  FW_ASSERT(
457  portNum < this->getNum_bufferSendOut_OutputPorts(),
458  static_cast<FwAssertArgType>(portNum)
459  );
460 
461  this->m_bufferSendOut_OutputPort[portNum].registerSerialPort(port);
462  }
463 
466  FwIndexType portNum,
467  Fw::InputSerializePort* port
468  )
469  {
470  FW_ASSERT(
471  portNum < this->getNum_pingOut_OutputPorts(),
472  static_cast<FwAssertArgType>(portNum)
473  );
474 
475  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
476  }
477 
478 #endif
479 
480  // ----------------------------------------------------------------------
481  // Component construction and destruction
482  // ----------------------------------------------------------------------
483 
485  FileUplinkComponentBase(const char* compName) :
486  Fw::ActiveComponentBase(compName)
487  {
488  this->m_FileWriteErrorThrottle = 0;
489  this->m_InvalidReceiveModeThrottle = 0;
490  this->m_PacketOutOfBoundsThrottle = 0;
491  this->m_PacketOutOfOrderThrottle = 0;
492  this->m_PacketDuplicateThrottle = 0;
493  }
494 
497  {
498 
499  }
500 
501  // ----------------------------------------------------------------------
502  // Getters for numbers of typed input ports
503  // ----------------------------------------------------------------------
504 
507  {
508  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendIn_InputPort));
509  }
510 
513  {
514  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingIn_InputPort));
515  }
516 
517  // ----------------------------------------------------------------------
518  // Getters for numbers of special output ports
519  // ----------------------------------------------------------------------
520 
521 #if FW_ENABLE_TEXT_LOGGING == 1
522 
523  FwIndexType FileUplinkComponentBase ::
524  getNum_LogText_OutputPorts() const
525  {
526  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
527  }
528 
529 #endif
530 
533  {
534  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_eventOut_OutputPort));
535  }
536 
539  {
540  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeCaller_OutputPort));
541  }
542 
545  {
546  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_tlmOut_OutputPort));
547  }
548 
549  // ----------------------------------------------------------------------
550  // Getters for numbers of typed output ports
551  // ----------------------------------------------------------------------
552 
555  {
556  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_bufferSendOut_OutputPort));
557  }
558 
561  {
562  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_pingOut_OutputPort));
563  }
564 
565  // ----------------------------------------------------------------------
566  // Connection status queries for special output ports
567  // ----------------------------------------------------------------------
568 
569 #if FW_ENABLE_TEXT_LOGGING == 1
570 
571  bool FileUplinkComponentBase ::
572  isConnected_LogText_OutputPort(FwIndexType portNum)
573  {
574  FW_ASSERT(
575  portNum < this->getNum_LogText_OutputPorts(),
576  static_cast<FwAssertArgType>(portNum)
577  );
578 
579  return this->m_LogText_OutputPort[portNum].isConnected();
580  }
581 
582 #endif
583 
586  {
587  FW_ASSERT(
588  portNum < this->getNum_eventOut_OutputPorts(),
589  static_cast<FwAssertArgType>(portNum)
590  );
591 
592  return this->m_eventOut_OutputPort[portNum].isConnected();
593  }
594 
597  {
598  FW_ASSERT(
599  portNum < this->getNum_timeCaller_OutputPorts(),
600  static_cast<FwAssertArgType>(portNum)
601  );
602 
603  return this->m_timeCaller_OutputPort[portNum].isConnected();
604  }
605 
608  {
609  FW_ASSERT(
610  portNum < this->getNum_tlmOut_OutputPorts(),
611  static_cast<FwAssertArgType>(portNum)
612  );
613 
614  return this->m_tlmOut_OutputPort[portNum].isConnected();
615  }
616 
617  // ----------------------------------------------------------------------
618  // Connection status queries for typed output ports
619  // ----------------------------------------------------------------------
620 
623  {
624  FW_ASSERT(
625  portNum < this->getNum_bufferSendOut_OutputPorts(),
626  static_cast<FwAssertArgType>(portNum)
627  );
628 
629  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
630  }
631 
634  {
635  FW_ASSERT(
636  portNum < this->getNum_pingOut_OutputPorts(),
637  static_cast<FwAssertArgType>(portNum)
638  );
639 
640  return this->m_pingOut_OutputPort[portNum].isConnected();
641  }
642 
643  // ----------------------------------------------------------------------
644  // Port handler base-class functions for typed input ports
645  //
646  // Call these functions directly to bypass the corresponding ports
647  // ----------------------------------------------------------------------
648 
651  FwIndexType portNum,
652  Fw::Buffer& fwBuffer
653  )
654  {
655  // Make sure port number is valid
656  FW_ASSERT(
657  portNum < this->getNum_bufferSendIn_InputPorts(),
658  static_cast<FwAssertArgType>(portNum)
659  );
660 
661  // Call pre-message hook
663  portNum,
664  fwBuffer
665  );
666  ComponentIpcSerializableBuffer msg;
668 
669  // Serialize message ID
670  _status = msg.serialize(
671  static_cast<FwEnumStoreType>(BUFFERSENDIN_BUFFERSEND)
672  );
673  FW_ASSERT(
674  _status == Fw::FW_SERIALIZE_OK,
675  static_cast<FwAssertArgType>(_status)
676  );
677 
678  // Serialize port number
679  _status = msg.serialize(portNum);
680  FW_ASSERT(
681  _status == Fw::FW_SERIALIZE_OK,
682  static_cast<FwAssertArgType>(_status)
683  );
684 
685  // Serialize argument fwBuffer
686  _status = msg.serialize(fwBuffer);
687  FW_ASSERT(
688  _status == Fw::FW_SERIALIZE_OK,
689  static_cast<FwAssertArgType>(_status)
690  );
691 
692  // Send message
694  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
695 
696  FW_ASSERT(
697  qStatus == Os::Queue::OP_OK,
698  static_cast<FwAssertArgType>(qStatus)
699  );
700  }
701 
704  FwIndexType portNum,
705  U32 key
706  )
707  {
708  // Make sure port number is valid
709  FW_ASSERT(
710  portNum < this->getNum_pingIn_InputPorts(),
711  static_cast<FwAssertArgType>(portNum)
712  );
713 
714  // Call pre-message hook
716  portNum,
717  key
718  );
719  ComponentIpcSerializableBuffer msg;
721 
722  // Serialize message ID
723  _status = msg.serialize(
724  static_cast<FwEnumStoreType>(PINGIN_PING)
725  );
726  FW_ASSERT(
727  _status == Fw::FW_SERIALIZE_OK,
728  static_cast<FwAssertArgType>(_status)
729  );
730 
731  // Serialize port number
732  _status = msg.serialize(portNum);
733  FW_ASSERT(
734  _status == Fw::FW_SERIALIZE_OK,
735  static_cast<FwAssertArgType>(_status)
736  );
737 
738  // Serialize argument key
739  _status = msg.serialize(key);
740  FW_ASSERT(
741  _status == Fw::FW_SERIALIZE_OK,
742  static_cast<FwAssertArgType>(_status)
743  );
744 
745  // Send message
747  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
748 
749  FW_ASSERT(
750  qStatus == Os::Queue::OP_OK,
751  static_cast<FwAssertArgType>(qStatus)
752  );
753  }
754 
755  // ----------------------------------------------------------------------
756  // Pre-message hooks for typed async input ports
757  //
758  // Each of these functions is invoked just before processing a message
759  // on the corresponding port. By default, they do nothing. You can
760  // override them to provide specific pre-message behavior.
761  // ----------------------------------------------------------------------
762 
765  FwIndexType portNum,
766  Fw::Buffer& fwBuffer
767  )
768  {
769  // Default: no-op
770  }
771 
774  FwIndexType portNum,
775  U32 key
776  )
777  {
778  // Default: no-op
779  }
780 
781  // ----------------------------------------------------------------------
782  // Invocation functions for typed output ports
783  // ----------------------------------------------------------------------
784 
787  FwIndexType portNum,
788  Fw::Buffer& fwBuffer
789  )
790  {
791  FW_ASSERT(
792  portNum < this->getNum_bufferSendOut_OutputPorts(),
793  static_cast<FwAssertArgType>(portNum)
794  );
795  this->m_bufferSendOut_OutputPort[portNum].invoke(
796  fwBuffer
797  );
798  }
799 
802  FwIndexType portNum,
803  U32 key
804  )
805  {
806  FW_ASSERT(
807  portNum < this->getNum_pingOut_OutputPorts(),
808  static_cast<FwAssertArgType>(portNum)
809  );
810  this->m_pingOut_OutputPort[portNum].invoke(
811  key
812  );
813  }
814 
815  // ----------------------------------------------------------------------
816  // Event logging functions
817  // ----------------------------------------------------------------------
818 
821  const Fw::StringBase& fileName,
822  U32 computed,
823  U32 read
824  ) const
825  {
826  // Get the time
827  Fw::Time _logTime;
828  if (this->m_timeCaller_OutputPort[0].isConnected()) {
829  this->m_timeCaller_OutputPort[0].invoke(_logTime);
830  }
831 
832  FwEventIdType _id = static_cast<FwEventIdType>(0);
833 
834  _id = this->getIdBase() + EVENTID_BADCHECKSUM;
835 
836  // Emit the event on the log port
837  if (this->m_eventOut_OutputPort[0].isConnected()) {
838  Fw::LogBuffer _logBuff;
840 
841 #if FW_AMPCS_COMPATIBLE
842  // Serialize the number of arguments
843  _status = _logBuff.serialize(static_cast<U8>(3));
844  FW_ASSERT(
845  _status == Fw::FW_SERIALIZE_OK,
846  static_cast<FwAssertArgType>(_status)
847  );
848 #endif
849 
850  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
851  FW_ASSERT(
852  _status == Fw::FW_SERIALIZE_OK,
853  static_cast<FwAssertArgType>(_status)
854  );
855 
856 #if FW_AMPCS_COMPATIBLE
857  // Serialize the argument size
858  _status = _logBuff.serialize(
859  static_cast<U8>(sizeof(U32))
860  );
861  FW_ASSERT(
862  _status == Fw::FW_SERIALIZE_OK,
863  static_cast<FwAssertArgType>(_status)
864  );
865 #endif
866  _status = _logBuff.serialize(computed);
867  FW_ASSERT(
868  _status == Fw::FW_SERIALIZE_OK,
869  static_cast<FwAssertArgType>(_status)
870  );
871 
872 #if FW_AMPCS_COMPATIBLE
873  // Serialize the argument size
874  _status = _logBuff.serialize(
875  static_cast<U8>(sizeof(U32))
876  );
877  FW_ASSERT(
878  _status == Fw::FW_SERIALIZE_OK,
879  static_cast<FwAssertArgType>(_status)
880  );
881 #endif
882  _status = _logBuff.serialize(read);
883  FW_ASSERT(
884  _status == Fw::FW_SERIALIZE_OK,
885  static_cast<FwAssertArgType>(_status)
886  );
887 
888  this->m_eventOut_OutputPort[0].invoke(
889  _id,
890  _logTime,
892  _logBuff
893  );
894  }
895 
896  // Emit the event on the text log port
897 #if FW_ENABLE_TEXT_LOGGING
898  if (this->m_LogText_OutputPort[0].isConnected()) {
899 #if FW_OBJECT_NAMES == 1
900  const char* _formatString =
901  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
902 #else
903  const char* _formatString =
904  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
905 #endif
906 
907  Fw::TextLogString _logString;
908  _logString.format(
909  _formatString,
910 #if FW_OBJECT_NAMES == 1
911  this->m_objName.toChar(),
912 #endif
913  "BadChecksum ",
914  fileName.toChar(),
915  computed,
916  read
917  );
918 
919  this->m_LogText_OutputPort[0].invoke(
920  _id,
921  _logTime,
923  _logString
924  );
925  }
926 #endif
927  }
928 
931  {
932  // Get the time
933  Fw::Time _logTime;
934  if (this->m_timeCaller_OutputPort[0].isConnected()) {
935  this->m_timeCaller_OutputPort[0].invoke(_logTime);
936  }
937 
938  FwEventIdType _id = static_cast<FwEventIdType>(0);
939 
940  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
941 
942  // Emit the event on the log port
943  if (this->m_eventOut_OutputPort[0].isConnected()) {
944  Fw::LogBuffer _logBuff;
946 
947 #if FW_AMPCS_COMPATIBLE
948  // Serialize the number of arguments
949  _status = _logBuff.serialize(static_cast<U8>(1));
950  FW_ASSERT(
951  _status == Fw::FW_SERIALIZE_OK,
952  static_cast<FwAssertArgType>(_status)
953  );
954 #endif
955 
956  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
957  FW_ASSERT(
958  _status == Fw::FW_SERIALIZE_OK,
959  static_cast<FwAssertArgType>(_status)
960  );
961 
962  this->m_eventOut_OutputPort[0].invoke(
963  _id,
964  _logTime,
966  _logBuff
967  );
968  }
969 
970  // Emit the event on the text log port
971 #if FW_ENABLE_TEXT_LOGGING
972  if (this->m_LogText_OutputPort[0].isConnected()) {
973 #if FW_OBJECT_NAMES == 1
974  const char* _formatString =
975  "(%s) %s: Could not open file %s";
976 #else
977  const char* _formatString =
978  "%s: Could not open file %s";
979 #endif
980 
981  Fw::TextLogString _logString;
982  _logString.format(
983  _formatString,
984 #if FW_OBJECT_NAMES == 1
985  this->m_objName.toChar(),
986 #endif
987  "FileOpenError ",
988  fileName.toChar()
989  );
990 
991  this->m_LogText_OutputPort[0].invoke(
992  _id,
993  _logTime,
995  _logString
996  );
997  }
998 #endif
999  }
1000 
1003  {
1004  // Get the time
1005  Fw::Time _logTime;
1006  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1007  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1008  }
1009 
1010  FwEventIdType _id = static_cast<FwEventIdType>(0);
1011 
1012  _id = this->getIdBase() + EVENTID_FILERECEIVED;
1013 
1014  // Emit the event on the log port
1015  if (this->m_eventOut_OutputPort[0].isConnected()) {
1016  Fw::LogBuffer _logBuff;
1018 
1019 #if FW_AMPCS_COMPATIBLE
1020  // Serialize the number of arguments
1021  _status = _logBuff.serialize(static_cast<U8>(1));
1022  FW_ASSERT(
1023  _status == Fw::FW_SERIALIZE_OK,
1024  static_cast<FwAssertArgType>(_status)
1025  );
1026 #endif
1027 
1028  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1029  FW_ASSERT(
1030  _status == Fw::FW_SERIALIZE_OK,
1031  static_cast<FwAssertArgType>(_status)
1032  );
1033 
1034  this->m_eventOut_OutputPort[0].invoke(
1035  _id,
1036  _logTime,
1038  _logBuff
1039  );
1040  }
1041 
1042  // Emit the event on the text log port
1043 #if FW_ENABLE_TEXT_LOGGING
1044  if (this->m_LogText_OutputPort[0].isConnected()) {
1045 #if FW_OBJECT_NAMES == 1
1046  const char* _formatString =
1047  "(%s) %s: Received file %s";
1048 #else
1049  const char* _formatString =
1050  "%s: Received file %s";
1051 #endif
1052 
1053  Fw::TextLogString _logString;
1054  _logString.format(
1055  _formatString,
1056 #if FW_OBJECT_NAMES == 1
1057  this->m_objName.toChar(),
1058 #endif
1059  "FileReceived ",
1060  fileName.toChar()
1061  );
1062 
1063  this->m_LogText_OutputPort[0].invoke(
1064  _id,
1065  _logTime,
1067  _logString
1068  );
1069  }
1070 #endif
1071  }
1072 
1075  {
1076  // Check throttle value
1077  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1078  return;
1079  }
1080  else {
1081  this->m_FileWriteErrorThrottle++;
1082  }
1083 
1084  // Get the time
1085  Fw::Time _logTime;
1086  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1087  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1088  }
1089 
1090  FwEventIdType _id = static_cast<FwEventIdType>(0);
1091 
1092  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1093 
1094  // Emit the event on the log port
1095  if (this->m_eventOut_OutputPort[0].isConnected()) {
1096  Fw::LogBuffer _logBuff;
1098 
1099 #if FW_AMPCS_COMPATIBLE
1100  // Serialize the number of arguments
1101  _status = _logBuff.serialize(static_cast<U8>(1));
1102  FW_ASSERT(
1103  _status == Fw::FW_SERIALIZE_OK,
1104  static_cast<FwAssertArgType>(_status)
1105  );
1106 #endif
1107 
1108  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1109  FW_ASSERT(
1110  _status == Fw::FW_SERIALIZE_OK,
1111  static_cast<FwAssertArgType>(_status)
1112  );
1113 
1114  this->m_eventOut_OutputPort[0].invoke(
1115  _id,
1116  _logTime,
1118  _logBuff
1119  );
1120  }
1121 
1122  // Emit the event on the text log port
1123 #if FW_ENABLE_TEXT_LOGGING
1124  if (this->m_LogText_OutputPort[0].isConnected()) {
1125 #if FW_OBJECT_NAMES == 1
1126  const char* _formatString =
1127  "(%s) %s: Could not write to file %s";
1128 #else
1129  const char* _formatString =
1130  "%s: Could not write to file %s";
1131 #endif
1132 
1133  Fw::TextLogString _logString;
1134  _logString.format(
1135  _formatString,
1136 #if FW_OBJECT_NAMES == 1
1137  this->m_objName.toChar(),
1138 #endif
1139  "FileWriteError ",
1140  fileName.toChar()
1141  );
1142 
1143  this->m_LogText_OutputPort[0].invoke(
1144  _id,
1145  _logTime,
1147  _logString
1148  );
1149  }
1150 #endif
1151  }
1152 
1155  U32 packetType,
1156  U32 mode
1157  )
1158  {
1159  // Check throttle value
1160  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1161  return;
1162  }
1163  else {
1164  this->m_InvalidReceiveModeThrottle++;
1165  }
1166 
1167  // Get the time
1168  Fw::Time _logTime;
1169  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1170  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1171  }
1172 
1173  FwEventIdType _id = static_cast<FwEventIdType>(0);
1174 
1175  _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1176 
1177  // Emit the event on the log port
1178  if (this->m_eventOut_OutputPort[0].isConnected()) {
1179  Fw::LogBuffer _logBuff;
1181 
1182 #if FW_AMPCS_COMPATIBLE
1183  // Serialize the number of arguments
1184  _status = _logBuff.serialize(static_cast<U8>(2));
1185  FW_ASSERT(
1186  _status == Fw::FW_SERIALIZE_OK,
1187  static_cast<FwAssertArgType>(_status)
1188  );
1189 #endif
1190 
1191 #if FW_AMPCS_COMPATIBLE
1192  // Serialize the argument size
1193  _status = _logBuff.serialize(
1194  static_cast<U8>(sizeof(U32))
1195  );
1196  FW_ASSERT(
1197  _status == Fw::FW_SERIALIZE_OK,
1198  static_cast<FwAssertArgType>(_status)
1199  );
1200 #endif
1201  _status = _logBuff.serialize(packetType);
1202  FW_ASSERT(
1203  _status == Fw::FW_SERIALIZE_OK,
1204  static_cast<FwAssertArgType>(_status)
1205  );
1206 
1207 #if FW_AMPCS_COMPATIBLE
1208  // Serialize the argument size
1209  _status = _logBuff.serialize(
1210  static_cast<U8>(sizeof(U32))
1211  );
1212  FW_ASSERT(
1213  _status == Fw::FW_SERIALIZE_OK,
1214  static_cast<FwAssertArgType>(_status)
1215  );
1216 #endif
1217  _status = _logBuff.serialize(mode);
1218  FW_ASSERT(
1219  _status == Fw::FW_SERIALIZE_OK,
1220  static_cast<FwAssertArgType>(_status)
1221  );
1222 
1223  this->m_eventOut_OutputPort[0].invoke(
1224  _id,
1225  _logTime,
1227  _logBuff
1228  );
1229  }
1230 
1231  // Emit the event on the text log port
1232 #if FW_ENABLE_TEXT_LOGGING
1233  if (this->m_LogText_OutputPort[0].isConnected()) {
1234 #if FW_OBJECT_NAMES == 1
1235  const char* _formatString =
1236  "(%s) %s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1237 #else
1238  const char* _formatString =
1239  "%s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1240 #endif
1241 
1242  Fw::TextLogString _logString;
1243  _logString.format(
1244  _formatString,
1245 #if FW_OBJECT_NAMES == 1
1246  this->m_objName.toChar(),
1247 #endif
1248  "InvalidReceiveMode ",
1249  packetType,
1250  mode
1251  );
1252 
1253  this->m_LogText_OutputPort[0].invoke(
1254  _id,
1255  _logTime,
1257  _logString
1258  );
1259  }
1260 #endif
1261  }
1262 
1265  U32 packetIndex,
1266  const Fw::StringBase& fileName
1267  )
1268  {
1269  // Check throttle value
1270  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1271  return;
1272  }
1273  else {
1274  this->m_PacketOutOfBoundsThrottle++;
1275  }
1276 
1277  // Get the time
1278  Fw::Time _logTime;
1279  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1280  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1281  }
1282 
1283  FwEventIdType _id = static_cast<FwEventIdType>(0);
1284 
1285  _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1286 
1287  // Emit the event on the log port
1288  if (this->m_eventOut_OutputPort[0].isConnected()) {
1289  Fw::LogBuffer _logBuff;
1291 
1292 #if FW_AMPCS_COMPATIBLE
1293  // Serialize the number of arguments
1294  _status = _logBuff.serialize(static_cast<U8>(2));
1295  FW_ASSERT(
1296  _status == Fw::FW_SERIALIZE_OK,
1297  static_cast<FwAssertArgType>(_status)
1298  );
1299 #endif
1300 
1301 #if FW_AMPCS_COMPATIBLE
1302  // Serialize the argument size
1303  _status = _logBuff.serialize(
1304  static_cast<U8>(sizeof(U32))
1305  );
1306  FW_ASSERT(
1307  _status == Fw::FW_SERIALIZE_OK,
1308  static_cast<FwAssertArgType>(_status)
1309  );
1310 #endif
1311  _status = _logBuff.serialize(packetIndex);
1312  FW_ASSERT(
1313  _status == Fw::FW_SERIALIZE_OK,
1314  static_cast<FwAssertArgType>(_status)
1315  );
1316 
1317  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1318  FW_ASSERT(
1319  _status == Fw::FW_SERIALIZE_OK,
1320  static_cast<FwAssertArgType>(_status)
1321  );
1322 
1323  this->m_eventOut_OutputPort[0].invoke(
1324  _id,
1325  _logTime,
1327  _logBuff
1328  );
1329  }
1330 
1331  // Emit the event on the text log port
1332 #if FW_ENABLE_TEXT_LOGGING
1333  if (this->m_LogText_OutputPort[0].isConnected()) {
1334 #if FW_OBJECT_NAMES == 1
1335  const char* _formatString =
1336  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1337 #else
1338  const char* _formatString =
1339  "%s: Packet %" PRIu32 " out of bounds for file %s";
1340 #endif
1341 
1342  Fw::TextLogString _logString;
1343  _logString.format(
1344  _formatString,
1345 #if FW_OBJECT_NAMES == 1
1346  this->m_objName.toChar(),
1347 #endif
1348  "PacketOutOfBounds ",
1349  packetIndex,
1350  fileName.toChar()
1351  );
1352 
1353  this->m_LogText_OutputPort[0].invoke(
1354  _id,
1355  _logTime,
1357  _logString
1358  );
1359  }
1360 #endif
1361  }
1362 
1365  U32 packetIndex,
1366  U32 lastPacketIndex
1367  )
1368  {
1369  // Check throttle value
1370  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1371  return;
1372  }
1373  else {
1374  this->m_PacketOutOfOrderThrottle++;
1375  }
1376 
1377  // Get the time
1378  Fw::Time _logTime;
1379  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1380  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1381  }
1382 
1383  FwEventIdType _id = static_cast<FwEventIdType>(0);
1384 
1385  _id = this->getIdBase() + EVENTID_PACKETOUTOFORDER;
1386 
1387  // Emit the event on the log port
1388  if (this->m_eventOut_OutputPort[0].isConnected()) {
1389  Fw::LogBuffer _logBuff;
1391 
1392 #if FW_AMPCS_COMPATIBLE
1393  // Serialize the number of arguments
1394  _status = _logBuff.serialize(static_cast<U8>(2));
1395  FW_ASSERT(
1396  _status == Fw::FW_SERIALIZE_OK,
1397  static_cast<FwAssertArgType>(_status)
1398  );
1399 #endif
1400 
1401 #if FW_AMPCS_COMPATIBLE
1402  // Serialize the argument size
1403  _status = _logBuff.serialize(
1404  static_cast<U8>(sizeof(U32))
1405  );
1406  FW_ASSERT(
1407  _status == Fw::FW_SERIALIZE_OK,
1408  static_cast<FwAssertArgType>(_status)
1409  );
1410 #endif
1411  _status = _logBuff.serialize(packetIndex);
1412  FW_ASSERT(
1413  _status == Fw::FW_SERIALIZE_OK,
1414  static_cast<FwAssertArgType>(_status)
1415  );
1416 
1417 #if FW_AMPCS_COMPATIBLE
1418  // Serialize the argument size
1419  _status = _logBuff.serialize(
1420  static_cast<U8>(sizeof(U32))
1421  );
1422  FW_ASSERT(
1423  _status == Fw::FW_SERIALIZE_OK,
1424  static_cast<FwAssertArgType>(_status)
1425  );
1426 #endif
1427  _status = _logBuff.serialize(lastPacketIndex);
1428  FW_ASSERT(
1429  _status == Fw::FW_SERIALIZE_OK,
1430  static_cast<FwAssertArgType>(_status)
1431  );
1432 
1433  this->m_eventOut_OutputPort[0].invoke(
1434  _id,
1435  _logTime,
1437  _logBuff
1438  );
1439  }
1440 
1441  // Emit the event on the text log port
1442 #if FW_ENABLE_TEXT_LOGGING
1443  if (this->m_LogText_OutputPort[0].isConnected()) {
1444 #if FW_OBJECT_NAMES == 1
1445  const char* _formatString =
1446  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1447 #else
1448  const char* _formatString =
1449  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1450 #endif
1451 
1452  Fw::TextLogString _logString;
1453  _logString.format(
1454  _formatString,
1455 #if FW_OBJECT_NAMES == 1
1456  this->m_objName.toChar(),
1457 #endif
1458  "PacketOutOfOrder ",
1459  packetIndex,
1460  lastPacketIndex
1461  );
1462 
1463  this->m_LogText_OutputPort[0].invoke(
1464  _id,
1465  _logTime,
1467  _logString
1468  );
1469  }
1470 #endif
1471  }
1472 
1475  {
1476  // Check throttle value
1477  if (this->m_PacketDuplicateThrottle >= EVENTID_PACKETDUPLICATE_THROTTLE) {
1478  return;
1479  }
1480  else {
1481  this->m_PacketDuplicateThrottle++;
1482  }
1483 
1484  // Get the time
1485  Fw::Time _logTime;
1486  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1487  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1488  }
1489 
1490  FwEventIdType _id = static_cast<FwEventIdType>(0);
1491 
1492  _id = this->getIdBase() + EVENTID_PACKETDUPLICATE;
1493 
1494  // Emit the event on the log port
1495  if (this->m_eventOut_OutputPort[0].isConnected()) {
1496  Fw::LogBuffer _logBuff;
1498 
1499 #if FW_AMPCS_COMPATIBLE
1500  // Serialize the number of arguments
1501  _status = _logBuff.serialize(static_cast<U8>(1));
1502  FW_ASSERT(
1503  _status == Fw::FW_SERIALIZE_OK,
1504  static_cast<FwAssertArgType>(_status)
1505  );
1506 #endif
1507 
1508 #if FW_AMPCS_COMPATIBLE
1509  // Serialize the argument size
1510  _status = _logBuff.serialize(
1511  static_cast<U8>(sizeof(U32))
1512  );
1513  FW_ASSERT(
1514  _status == Fw::FW_SERIALIZE_OK,
1515  static_cast<FwAssertArgType>(_status)
1516  );
1517 #endif
1518  _status = _logBuff.serialize(packetIndex);
1519  FW_ASSERT(
1520  _status == Fw::FW_SERIALIZE_OK,
1521  static_cast<FwAssertArgType>(_status)
1522  );
1523 
1524  this->m_eventOut_OutputPort[0].invoke(
1525  _id,
1526  _logTime,
1528  _logBuff
1529  );
1530  }
1531 
1532  // Emit the event on the text log port
1533 #if FW_ENABLE_TEXT_LOGGING
1534  if (this->m_LogText_OutputPort[0].isConnected()) {
1535 #if FW_OBJECT_NAMES == 1
1536  const char* _formatString =
1537  "(%s) %s: Received a duplicate of packet %" PRIu32 "";
1538 #else
1539  const char* _formatString =
1540  "%s: Received a duplicate of packet %" PRIu32 "";
1541 #endif
1542 
1543  Fw::TextLogString _logString;
1544  _logString.format(
1545  _formatString,
1546 #if FW_OBJECT_NAMES == 1
1547  this->m_objName.toChar(),
1548 #endif
1549  "PacketDuplicate ",
1550  packetIndex
1551  );
1552 
1553  this->m_LogText_OutputPort[0].invoke(
1554  _id,
1555  _logTime,
1557  _logString
1558  );
1559  }
1560 #endif
1561  }
1562 
1565  {
1566  // Get the time
1567  Fw::Time _logTime;
1568  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1569  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1570  }
1571 
1572  FwEventIdType _id = static_cast<FwEventIdType>(0);
1573 
1574  _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1575 
1576  // Emit the event on the log port
1577  if (this->m_eventOut_OutputPort[0].isConnected()) {
1578  Fw::LogBuffer _logBuff;
1579 
1580 #if FW_AMPCS_COMPATIBLE
1582  // Serialize the number of arguments
1583  _status = _logBuff.serialize(static_cast<U8>(0));
1584  FW_ASSERT(
1585  _status == Fw::FW_SERIALIZE_OK,
1586  static_cast<FwAssertArgType>(_status)
1587  );
1588 #endif
1589 
1590  this->m_eventOut_OutputPort[0].invoke(
1591  _id,
1592  _logTime,
1594  _logBuff
1595  );
1596  }
1597 
1598  // Emit the event on the text log port
1599 #if FW_ENABLE_TEXT_LOGGING
1600  if (this->m_LogText_OutputPort[0].isConnected()) {
1601 #if FW_OBJECT_NAMES == 1
1602  const char* _formatString =
1603  "(%s) %s: Received CANCEL packet";
1604 #else
1605  const char* _formatString =
1606  "%s: Received CANCEL packet";
1607 #endif
1608 
1609  Fw::TextLogString _logString;
1610  _logString.format(
1611  _formatString,
1612 #if FW_OBJECT_NAMES == 1
1613  this->m_objName.toChar(),
1614 #endif
1615  "UplinkCanceled "
1616  );
1617 
1618  this->m_LogText_OutputPort[0].invoke(
1619  _id,
1620  _logTime,
1622  _logString
1623  );
1624  }
1625 #endif
1626  }
1627 
1630  {
1631  // Get the time
1632  Fw::Time _logTime;
1633  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1634  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1635  }
1636 
1637  FwEventIdType _id = static_cast<FwEventIdType>(0);
1638 
1639  _id = this->getIdBase() + EVENTID_DECODEERROR;
1640 
1641  // Emit the event on the log port
1642  if (this->m_eventOut_OutputPort[0].isConnected()) {
1643  Fw::LogBuffer _logBuff;
1645 
1646 #if FW_AMPCS_COMPATIBLE
1647  // Serialize the number of arguments
1648  _status = _logBuff.serialize(static_cast<U8>(1));
1649  FW_ASSERT(
1650  _status == Fw::FW_SERIALIZE_OK,
1651  static_cast<FwAssertArgType>(_status)
1652  );
1653 #endif
1654 
1655 #if FW_AMPCS_COMPATIBLE
1656  // Serialize the argument size
1657  _status = _logBuff.serialize(
1658  static_cast<U8>(sizeof(I32))
1659  );
1660  FW_ASSERT(
1661  _status == Fw::FW_SERIALIZE_OK,
1662  static_cast<FwAssertArgType>(_status)
1663  );
1664 #endif
1665  _status = _logBuff.serialize(status);
1666  FW_ASSERT(
1667  _status == Fw::FW_SERIALIZE_OK,
1668  static_cast<FwAssertArgType>(_status)
1669  );
1670 
1671  this->m_eventOut_OutputPort[0].invoke(
1672  _id,
1673  _logTime,
1675  _logBuff
1676  );
1677  }
1678 
1679  // Emit the event on the text log port
1680 #if FW_ENABLE_TEXT_LOGGING
1681  if (this->m_LogText_OutputPort[0].isConnected()) {
1682 #if FW_OBJECT_NAMES == 1
1683  const char* _formatString =
1684  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1685 #else
1686  const char* _formatString =
1687  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1688 #endif
1689 
1690  Fw::TextLogString _logString;
1691  _logString.format(
1692  _formatString,
1693 #if FW_OBJECT_NAMES == 1
1694  this->m_objName.toChar(),
1695 #endif
1696  "DecodeError ",
1697  status
1698  );
1699 
1700  this->m_LogText_OutputPort[0].invoke(
1701  _id,
1702  _logTime,
1704  _logString
1705  );
1706  }
1707 #endif
1708  }
1709 
1710  // ----------------------------------------------------------------------
1711  // Event throttle reset functions
1712  // ----------------------------------------------------------------------
1713 
1716  {
1717  // Reset throttle counter
1718  this->m_FileWriteErrorThrottle = 0;
1719  }
1720 
1723  {
1724  // Reset throttle counter
1725  this->m_InvalidReceiveModeThrottle = 0;
1726  }
1727 
1730  {
1731  // Reset throttle counter
1732  this->m_PacketOutOfBoundsThrottle = 0;
1733  }
1734 
1737  {
1738  // Reset throttle counter
1739  this->m_PacketOutOfOrderThrottle = 0;
1740  }
1741 
1744  {
1745  // Reset throttle counter
1746  this->m_PacketDuplicateThrottle = 0;
1747  }
1748 
1749  // ----------------------------------------------------------------------
1750  // Telemetry write functions
1751  // ----------------------------------------------------------------------
1752 
1755  U32 arg,
1756  Fw::Time _tlmTime
1757  ) const
1758  {
1759  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1760  if (
1761  this->m_timeCaller_OutputPort[0].isConnected() &&
1762  (_tlmTime == Fw::ZERO_TIME)
1763  ) {
1764  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1765  }
1766 
1767  Fw::TlmBuffer _tlmBuff;
1768  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1769  FW_ASSERT(
1770  _stat == Fw::FW_SERIALIZE_OK,
1771  static_cast<FwAssertArgType>(_stat)
1772  );
1773 
1774  FwChanIdType _id;
1775 
1776  _id = this->getIdBase() + CHANNELID_FILESRECEIVED;
1777 
1778  this->m_tlmOut_OutputPort[0].invoke(
1779  _id,
1780  _tlmTime,
1781  _tlmBuff
1782  );
1783  }
1784  }
1785 
1788  U32 arg,
1789  Fw::Time _tlmTime
1790  ) const
1791  {
1792  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1793  if (
1794  this->m_timeCaller_OutputPort[0].isConnected() &&
1795  (_tlmTime == Fw::ZERO_TIME)
1796  ) {
1797  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1798  }
1799 
1800  Fw::TlmBuffer _tlmBuff;
1801  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1802  FW_ASSERT(
1803  _stat == Fw::FW_SERIALIZE_OK,
1804  static_cast<FwAssertArgType>(_stat)
1805  );
1806 
1807  FwChanIdType _id;
1808 
1809  _id = this->getIdBase() + CHANNELID_PACKETSRECEIVED;
1810 
1811  this->m_tlmOut_OutputPort[0].invoke(
1812  _id,
1813  _tlmTime,
1814  _tlmBuff
1815  );
1816  }
1817  }
1818 
1821  U32 arg,
1822  Fw::Time _tlmTime
1823  ) const
1824  {
1825  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1826  if (
1827  this->m_timeCaller_OutputPort[0].isConnected() &&
1828  (_tlmTime == Fw::ZERO_TIME)
1829  ) {
1830  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1831  }
1832 
1833  Fw::TlmBuffer _tlmBuff;
1834  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1835  FW_ASSERT(
1836  _stat == Fw::FW_SERIALIZE_OK,
1837  static_cast<FwAssertArgType>(_stat)
1838  );
1839 
1840  FwChanIdType _id;
1841 
1842  _id = this->getIdBase() + CHANNELID_WARNINGS;
1843 
1844  this->m_tlmOut_OutputPort[0].invoke(
1845  _id,
1846  _tlmTime,
1847  _tlmBuff
1848  );
1849  }
1850  }
1851 
1852  // ----------------------------------------------------------------------
1853  // Time
1854  // ----------------------------------------------------------------------
1855 
1858  {
1859  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1860  Fw::Time _time;
1861  this->m_timeCaller_OutputPort[0].invoke(_time);
1862  return _time;
1863  }
1864  else {
1865  return Fw::Time(TB_NONE, 0, 0);
1866  }
1867  }
1868 
1869  // ----------------------------------------------------------------------
1870  // Message dispatch functions
1871  // ----------------------------------------------------------------------
1872 
1873  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
1874  doDispatch()
1875  {
1876  ComponentIpcSerializableBuffer msg;
1877  FwQueuePriorityType priority = 0;
1878 
1879  Os::Queue::Status msgStatus = this->m_queue.receive(
1880  msg,
1882  priority
1883  );
1884  FW_ASSERT(
1885  msgStatus == Os::Queue::OP_OK,
1886  static_cast<FwAssertArgType>(msgStatus)
1887  );
1888 
1889  // Reset to beginning of buffer
1890  msg.resetDeser();
1891 
1892  FwEnumStoreType desMsg = 0;
1893  Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
1894  FW_ASSERT(
1895  deserStatus == Fw::FW_SERIALIZE_OK,
1896  static_cast<FwAssertArgType>(deserStatus)
1897  );
1898 
1899  MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
1900 
1901  if (msgType == FILEUPLINK_COMPONENT_EXIT) {
1902  return MSG_DISPATCH_EXIT;
1903  }
1904 
1905  FwIndexType portNum = 0;
1906  deserStatus = msg.deserialize(portNum);
1907  FW_ASSERT(
1908  deserStatus == Fw::FW_SERIALIZE_OK,
1909  static_cast<FwAssertArgType>(deserStatus)
1910  );
1911 
1912  switch (msgType) {
1913  // Handle async input port bufferSendIn
1914  case BUFFERSENDIN_BUFFERSEND: {
1915  // Deserialize argument fwBuffer
1916  Fw::Buffer fwBuffer;
1917  deserStatus = msg.deserialize(fwBuffer);
1918  FW_ASSERT(
1919  deserStatus == Fw::FW_SERIALIZE_OK,
1920  static_cast<FwAssertArgType>(deserStatus)
1921  );
1922  // Call handler function
1923  this->bufferSendIn_handler(
1924  portNum,
1925  fwBuffer
1926  );
1927 
1928  break;
1929  }
1930 
1931  // Handle async input port pingIn
1932  case PINGIN_PING: {
1933  // Deserialize argument key
1934  U32 key;
1935  deserStatus = msg.deserialize(key);
1936  FW_ASSERT(
1937  deserStatus == Fw::FW_SERIALIZE_OK,
1938  static_cast<FwAssertArgType>(deserStatus)
1939  );
1940  // Call handler function
1941  this->pingIn_handler(
1942  portNum,
1943  key
1944  );
1945 
1946  break;
1947  }
1948 
1949  default:
1950  return MSG_DISPATCH_ERROR;
1951  }
1952 
1953  return MSG_DISPATCH_OK;
1954  }
1955 
1956  // ----------------------------------------------------------------------
1957  // Calls for messages received on typed input ports
1958  // ----------------------------------------------------------------------
1959 
1960  void FileUplinkComponentBase ::
1961  m_p_bufferSendIn_in(
1962  Fw::PassiveComponentBase* callComp,
1963  FwIndexType portNum,
1964  Fw::Buffer& fwBuffer
1965  )
1966  {
1967  FW_ASSERT(callComp);
1968  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1969  compPtr->bufferSendIn_handlerBase(
1970  portNum,
1971  fwBuffer
1972  );
1973  }
1974 
1975  void FileUplinkComponentBase ::
1976  m_p_pingIn_in(
1977  Fw::PassiveComponentBase* callComp,
1978  FwIndexType portNum,
1979  U32 key
1980  )
1981  {
1982  FW_ASSERT(callComp);
1983  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1984  compPtr->pingIn_handlerBase(
1985  portNum,
1986  key
1987  );
1988  }
1989 
1990 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
Definition: Time.hpp:9
Operation succeeded.
Definition: Os.hpp:26
NATIVE_UINT_TYPE SizeType
Status
status returned from the queue send function
Definition: Queue.hpp:30
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
const Time ZERO_TIME
Definition: Time.cpp:5
I32 FwEnumStoreType
Definition: FpConfig.h:64
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Object initializer.
Definition: ObjBase.cpp:26
SerializeStatus
forward declaration for string
Message will block until space is available.
Definition: Queue.hpp:46
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void setPortNum(NATIVE_INT_TYPE portNum)
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:72
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port interface.
void init()
Initialization function.
Definition: PingPortAc.cpp:128
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
The size of the serial representations of the port arguments.
const char * toChar() const
Definition: ObjectName.hpp:50
No time base has been established.
Definition: FpConfig.h:70
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
A serious but recoverable event.
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:42
U32 FwEventIdType
Definition: FpConfig.h:103
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void init()
Initialization function.
Definition: LogPortAc.cpp:151
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
BlockingType
message type
Definition: Queue.hpp:45
#define PRI_PlatformIntType
Important informational events.
void init()
Initialization function.
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port interface.
Definition: LogPortAc.cpp:170
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
message to exit active component task
A message was sent requesting an exit of the loop.
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void init()
Initialization function.
Definition: PingPortAc.cpp:56
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:31
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const
serialization function
Definition: StringBase.cpp:142
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
Message will return with status when space is unavailable.
Definition: Queue.hpp:47
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:148
#define FW_ASSERT(...)
Definition: Assert.hpp:14
#define FW_LOG_STRING_MAX_SIZE
Max size of log string parameter type.
Definition: FpConfig.h:319
virtual const CHAR * toChar() const =0
U32 FwChanIdType
Definition: FpConfig.h:95