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 
796  FW_ASSERT(
797  this->m_bufferSendOut_OutputPort[portNum].isConnected(),
798  static_cast<FwAssertArgType>(portNum)
799  );
800  this->m_bufferSendOut_OutputPort[portNum].invoke(
801  fwBuffer
802  );
803  }
804 
807  FwIndexType portNum,
808  U32 key
809  )
810  {
811  FW_ASSERT(
812  portNum < this->getNum_pingOut_OutputPorts(),
813  static_cast<FwAssertArgType>(portNum)
814  );
815 
816  FW_ASSERT(
817  this->m_pingOut_OutputPort[portNum].isConnected(),
818  static_cast<FwAssertArgType>(portNum)
819  );
820  this->m_pingOut_OutputPort[portNum].invoke(
821  key
822  );
823  }
824 
825  // ----------------------------------------------------------------------
826  // Event logging functions
827  // ----------------------------------------------------------------------
828 
831  const Fw::StringBase& fileName,
832  U32 computed,
833  U32 read
834  ) const
835  {
836  // Get the time
837  Fw::Time _logTime;
838  if (this->m_timeCaller_OutputPort[0].isConnected()) {
839  this->m_timeCaller_OutputPort[0].invoke(_logTime);
840  }
841 
842  FwEventIdType _id = static_cast<FwEventIdType>(0);
843 
844  _id = this->getIdBase() + EVENTID_BADCHECKSUM;
845 
846  // Emit the event on the log port
847  if (this->m_eventOut_OutputPort[0].isConnected()) {
848  Fw::LogBuffer _logBuff;
850 
851 #if FW_AMPCS_COMPATIBLE
852  // Serialize the number of arguments
853  _status = _logBuff.serialize(static_cast<U8>(3));
854  FW_ASSERT(
855  _status == Fw::FW_SERIALIZE_OK,
856  static_cast<FwAssertArgType>(_status)
857  );
858 #endif
859 
860  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
861  FW_ASSERT(
862  _status == Fw::FW_SERIALIZE_OK,
863  static_cast<FwAssertArgType>(_status)
864  );
865 
866 #if FW_AMPCS_COMPATIBLE
867  // Serialize the argument size
868  _status = _logBuff.serialize(
869  static_cast<U8>(sizeof(U32))
870  );
871  FW_ASSERT(
872  _status == Fw::FW_SERIALIZE_OK,
873  static_cast<FwAssertArgType>(_status)
874  );
875 #endif
876  _status = _logBuff.serialize(computed);
877  FW_ASSERT(
878  _status == Fw::FW_SERIALIZE_OK,
879  static_cast<FwAssertArgType>(_status)
880  );
881 
882 #if FW_AMPCS_COMPATIBLE
883  // Serialize the argument size
884  _status = _logBuff.serialize(
885  static_cast<U8>(sizeof(U32))
886  );
887  FW_ASSERT(
888  _status == Fw::FW_SERIALIZE_OK,
889  static_cast<FwAssertArgType>(_status)
890  );
891 #endif
892  _status = _logBuff.serialize(read);
893  FW_ASSERT(
894  _status == Fw::FW_SERIALIZE_OK,
895  static_cast<FwAssertArgType>(_status)
896  );
897 
898  this->m_eventOut_OutputPort[0].invoke(
899  _id,
900  _logTime,
902  _logBuff
903  );
904  }
905 
906  // Emit the event on the text log port
907 #if FW_ENABLE_TEXT_LOGGING
908  if (this->m_LogText_OutputPort[0].isConnected()) {
909 #if FW_OBJECT_NAMES == 1
910  const char* _formatString =
911  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
912 #else
913  const char* _formatString =
914  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
915 #endif
916 
917  Fw::TextLogString _logString;
918  _logString.format(
919  _formatString,
920 #if FW_OBJECT_NAMES == 1
921  this->m_objName.toChar(),
922 #endif
923  "BadChecksum ",
924  fileName.toChar(),
925  computed,
926  read
927  );
928 
929  this->m_LogText_OutputPort[0].invoke(
930  _id,
931  _logTime,
933  _logString
934  );
935  }
936 #endif
937  }
938 
941  {
942  // Get the time
943  Fw::Time _logTime;
944  if (this->m_timeCaller_OutputPort[0].isConnected()) {
945  this->m_timeCaller_OutputPort[0].invoke(_logTime);
946  }
947 
948  FwEventIdType _id = static_cast<FwEventIdType>(0);
949 
950  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
951 
952  // Emit the event on the log port
953  if (this->m_eventOut_OutputPort[0].isConnected()) {
954  Fw::LogBuffer _logBuff;
956 
957 #if FW_AMPCS_COMPATIBLE
958  // Serialize the number of arguments
959  _status = _logBuff.serialize(static_cast<U8>(1));
960  FW_ASSERT(
961  _status == Fw::FW_SERIALIZE_OK,
962  static_cast<FwAssertArgType>(_status)
963  );
964 #endif
965 
966  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
967  FW_ASSERT(
968  _status == Fw::FW_SERIALIZE_OK,
969  static_cast<FwAssertArgType>(_status)
970  );
971 
972  this->m_eventOut_OutputPort[0].invoke(
973  _id,
974  _logTime,
976  _logBuff
977  );
978  }
979 
980  // Emit the event on the text log port
981 #if FW_ENABLE_TEXT_LOGGING
982  if (this->m_LogText_OutputPort[0].isConnected()) {
983 #if FW_OBJECT_NAMES == 1
984  const char* _formatString =
985  "(%s) %s: Could not open file %s";
986 #else
987  const char* _formatString =
988  "%s: Could not open file %s";
989 #endif
990 
991  Fw::TextLogString _logString;
992  _logString.format(
993  _formatString,
994 #if FW_OBJECT_NAMES == 1
995  this->m_objName.toChar(),
996 #endif
997  "FileOpenError ",
998  fileName.toChar()
999  );
1000 
1001  this->m_LogText_OutputPort[0].invoke(
1002  _id,
1003  _logTime,
1005  _logString
1006  );
1007  }
1008 #endif
1009  }
1010 
1013  {
1014  // Get the time
1015  Fw::Time _logTime;
1016  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1017  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1018  }
1019 
1020  FwEventIdType _id = static_cast<FwEventIdType>(0);
1021 
1022  _id = this->getIdBase() + EVENTID_FILERECEIVED;
1023 
1024  // Emit the event on the log port
1025  if (this->m_eventOut_OutputPort[0].isConnected()) {
1026  Fw::LogBuffer _logBuff;
1028 
1029 #if FW_AMPCS_COMPATIBLE
1030  // Serialize the number of arguments
1031  _status = _logBuff.serialize(static_cast<U8>(1));
1032  FW_ASSERT(
1033  _status == Fw::FW_SERIALIZE_OK,
1034  static_cast<FwAssertArgType>(_status)
1035  );
1036 #endif
1037 
1038  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1039  FW_ASSERT(
1040  _status == Fw::FW_SERIALIZE_OK,
1041  static_cast<FwAssertArgType>(_status)
1042  );
1043 
1044  this->m_eventOut_OutputPort[0].invoke(
1045  _id,
1046  _logTime,
1048  _logBuff
1049  );
1050  }
1051 
1052  // Emit the event on the text log port
1053 #if FW_ENABLE_TEXT_LOGGING
1054  if (this->m_LogText_OutputPort[0].isConnected()) {
1055 #if FW_OBJECT_NAMES == 1
1056  const char* _formatString =
1057  "(%s) %s: Received file %s";
1058 #else
1059  const char* _formatString =
1060  "%s: Received file %s";
1061 #endif
1062 
1063  Fw::TextLogString _logString;
1064  _logString.format(
1065  _formatString,
1066 #if FW_OBJECT_NAMES == 1
1067  this->m_objName.toChar(),
1068 #endif
1069  "FileReceived ",
1070  fileName.toChar()
1071  );
1072 
1073  this->m_LogText_OutputPort[0].invoke(
1074  _id,
1075  _logTime,
1077  _logString
1078  );
1079  }
1080 #endif
1081  }
1082 
1085  {
1086  // Check throttle value
1087  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1088  return;
1089  }
1090  else {
1091  this->m_FileWriteErrorThrottle++;
1092  }
1093 
1094  // Get the time
1095  Fw::Time _logTime;
1096  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1097  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1098  }
1099 
1100  FwEventIdType _id = static_cast<FwEventIdType>(0);
1101 
1102  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1103 
1104  // Emit the event on the log port
1105  if (this->m_eventOut_OutputPort[0].isConnected()) {
1106  Fw::LogBuffer _logBuff;
1108 
1109 #if FW_AMPCS_COMPATIBLE
1110  // Serialize the number of arguments
1111  _status = _logBuff.serialize(static_cast<U8>(1));
1112  FW_ASSERT(
1113  _status == Fw::FW_SERIALIZE_OK,
1114  static_cast<FwAssertArgType>(_status)
1115  );
1116 #endif
1117 
1118  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1119  FW_ASSERT(
1120  _status == Fw::FW_SERIALIZE_OK,
1121  static_cast<FwAssertArgType>(_status)
1122  );
1123 
1124  this->m_eventOut_OutputPort[0].invoke(
1125  _id,
1126  _logTime,
1128  _logBuff
1129  );
1130  }
1131 
1132  // Emit the event on the text log port
1133 #if FW_ENABLE_TEXT_LOGGING
1134  if (this->m_LogText_OutputPort[0].isConnected()) {
1135 #if FW_OBJECT_NAMES == 1
1136  const char* _formatString =
1137  "(%s) %s: Could not write to file %s";
1138 #else
1139  const char* _formatString =
1140  "%s: Could not write to file %s";
1141 #endif
1142 
1143  Fw::TextLogString _logString;
1144  _logString.format(
1145  _formatString,
1146 #if FW_OBJECT_NAMES == 1
1147  this->m_objName.toChar(),
1148 #endif
1149  "FileWriteError ",
1150  fileName.toChar()
1151  );
1152 
1153  this->m_LogText_OutputPort[0].invoke(
1154  _id,
1155  _logTime,
1157  _logString
1158  );
1159  }
1160 #endif
1161  }
1162 
1165  U32 packetType,
1166  U32 mode
1167  )
1168  {
1169  // Check throttle value
1170  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1171  return;
1172  }
1173  else {
1174  this->m_InvalidReceiveModeThrottle++;
1175  }
1176 
1177  // Get the time
1178  Fw::Time _logTime;
1179  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1180  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1181  }
1182 
1183  FwEventIdType _id = static_cast<FwEventIdType>(0);
1184 
1185  _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1186 
1187  // Emit the event on the log port
1188  if (this->m_eventOut_OutputPort[0].isConnected()) {
1189  Fw::LogBuffer _logBuff;
1191 
1192 #if FW_AMPCS_COMPATIBLE
1193  // Serialize the number of arguments
1194  _status = _logBuff.serialize(static_cast<U8>(2));
1195  FW_ASSERT(
1196  _status == Fw::FW_SERIALIZE_OK,
1197  static_cast<FwAssertArgType>(_status)
1198  );
1199 #endif
1200 
1201 #if FW_AMPCS_COMPATIBLE
1202  // Serialize the argument size
1203  _status = _logBuff.serialize(
1204  static_cast<U8>(sizeof(U32))
1205  );
1206  FW_ASSERT(
1207  _status == Fw::FW_SERIALIZE_OK,
1208  static_cast<FwAssertArgType>(_status)
1209  );
1210 #endif
1211  _status = _logBuff.serialize(packetType);
1212  FW_ASSERT(
1213  _status == Fw::FW_SERIALIZE_OK,
1214  static_cast<FwAssertArgType>(_status)
1215  );
1216 
1217 #if FW_AMPCS_COMPATIBLE
1218  // Serialize the argument size
1219  _status = _logBuff.serialize(
1220  static_cast<U8>(sizeof(U32))
1221  );
1222  FW_ASSERT(
1223  _status == Fw::FW_SERIALIZE_OK,
1224  static_cast<FwAssertArgType>(_status)
1225  );
1226 #endif
1227  _status = _logBuff.serialize(mode);
1228  FW_ASSERT(
1229  _status == Fw::FW_SERIALIZE_OK,
1230  static_cast<FwAssertArgType>(_status)
1231  );
1232 
1233  this->m_eventOut_OutputPort[0].invoke(
1234  _id,
1235  _logTime,
1237  _logBuff
1238  );
1239  }
1240 
1241  // Emit the event on the text log port
1242 #if FW_ENABLE_TEXT_LOGGING
1243  if (this->m_LogText_OutputPort[0].isConnected()) {
1244 #if FW_OBJECT_NAMES == 1
1245  const char* _formatString =
1246  "(%s) %s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1247 #else
1248  const char* _formatString =
1249  "%s: Packet type %" PRIu32 " received in mode %" PRIu32 "";
1250 #endif
1251 
1252  Fw::TextLogString _logString;
1253  _logString.format(
1254  _formatString,
1255 #if FW_OBJECT_NAMES == 1
1256  this->m_objName.toChar(),
1257 #endif
1258  "InvalidReceiveMode ",
1259  packetType,
1260  mode
1261  );
1262 
1263  this->m_LogText_OutputPort[0].invoke(
1264  _id,
1265  _logTime,
1267  _logString
1268  );
1269  }
1270 #endif
1271  }
1272 
1275  U32 packetIndex,
1276  const Fw::StringBase& fileName
1277  )
1278  {
1279  // Check throttle value
1280  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1281  return;
1282  }
1283  else {
1284  this->m_PacketOutOfBoundsThrottle++;
1285  }
1286 
1287  // Get the time
1288  Fw::Time _logTime;
1289  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1290  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1291  }
1292 
1293  FwEventIdType _id = static_cast<FwEventIdType>(0);
1294 
1295  _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1296 
1297  // Emit the event on the log port
1298  if (this->m_eventOut_OutputPort[0].isConnected()) {
1299  Fw::LogBuffer _logBuff;
1301 
1302 #if FW_AMPCS_COMPATIBLE
1303  // Serialize the number of arguments
1304  _status = _logBuff.serialize(static_cast<U8>(2));
1305  FW_ASSERT(
1306  _status == Fw::FW_SERIALIZE_OK,
1307  static_cast<FwAssertArgType>(_status)
1308  );
1309 #endif
1310 
1311 #if FW_AMPCS_COMPATIBLE
1312  // Serialize the argument size
1313  _status = _logBuff.serialize(
1314  static_cast<U8>(sizeof(U32))
1315  );
1316  FW_ASSERT(
1317  _status == Fw::FW_SERIALIZE_OK,
1318  static_cast<FwAssertArgType>(_status)
1319  );
1320 #endif
1321  _status = _logBuff.serialize(packetIndex);
1322  FW_ASSERT(
1323  _status == Fw::FW_SERIALIZE_OK,
1324  static_cast<FwAssertArgType>(_status)
1325  );
1326 
1327  _status = fileName.serialize(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1328  FW_ASSERT(
1329  _status == Fw::FW_SERIALIZE_OK,
1330  static_cast<FwAssertArgType>(_status)
1331  );
1332 
1333  this->m_eventOut_OutputPort[0].invoke(
1334  _id,
1335  _logTime,
1337  _logBuff
1338  );
1339  }
1340 
1341  // Emit the event on the text log port
1342 #if FW_ENABLE_TEXT_LOGGING
1343  if (this->m_LogText_OutputPort[0].isConnected()) {
1344 #if FW_OBJECT_NAMES == 1
1345  const char* _formatString =
1346  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1347 #else
1348  const char* _formatString =
1349  "%s: Packet %" PRIu32 " out of bounds for file %s";
1350 #endif
1351 
1352  Fw::TextLogString _logString;
1353  _logString.format(
1354  _formatString,
1355 #if FW_OBJECT_NAMES == 1
1356  this->m_objName.toChar(),
1357 #endif
1358  "PacketOutOfBounds ",
1359  packetIndex,
1360  fileName.toChar()
1361  );
1362 
1363  this->m_LogText_OutputPort[0].invoke(
1364  _id,
1365  _logTime,
1367  _logString
1368  );
1369  }
1370 #endif
1371  }
1372 
1375  U32 packetIndex,
1376  U32 lastPacketIndex
1377  )
1378  {
1379  // Check throttle value
1380  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1381  return;
1382  }
1383  else {
1384  this->m_PacketOutOfOrderThrottle++;
1385  }
1386 
1387  // Get the time
1388  Fw::Time _logTime;
1389  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1390  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1391  }
1392 
1393  FwEventIdType _id = static_cast<FwEventIdType>(0);
1394 
1395  _id = this->getIdBase() + EVENTID_PACKETOUTOFORDER;
1396 
1397  // Emit the event on the log port
1398  if (this->m_eventOut_OutputPort[0].isConnected()) {
1399  Fw::LogBuffer _logBuff;
1401 
1402 #if FW_AMPCS_COMPATIBLE
1403  // Serialize the number of arguments
1404  _status = _logBuff.serialize(static_cast<U8>(2));
1405  FW_ASSERT(
1406  _status == Fw::FW_SERIALIZE_OK,
1407  static_cast<FwAssertArgType>(_status)
1408  );
1409 #endif
1410 
1411 #if FW_AMPCS_COMPATIBLE
1412  // Serialize the argument size
1413  _status = _logBuff.serialize(
1414  static_cast<U8>(sizeof(U32))
1415  );
1416  FW_ASSERT(
1417  _status == Fw::FW_SERIALIZE_OK,
1418  static_cast<FwAssertArgType>(_status)
1419  );
1420 #endif
1421  _status = _logBuff.serialize(packetIndex);
1422  FW_ASSERT(
1423  _status == Fw::FW_SERIALIZE_OK,
1424  static_cast<FwAssertArgType>(_status)
1425  );
1426 
1427 #if FW_AMPCS_COMPATIBLE
1428  // Serialize the argument size
1429  _status = _logBuff.serialize(
1430  static_cast<U8>(sizeof(U32))
1431  );
1432  FW_ASSERT(
1433  _status == Fw::FW_SERIALIZE_OK,
1434  static_cast<FwAssertArgType>(_status)
1435  );
1436 #endif
1437  _status = _logBuff.serialize(lastPacketIndex);
1438  FW_ASSERT(
1439  _status == Fw::FW_SERIALIZE_OK,
1440  static_cast<FwAssertArgType>(_status)
1441  );
1442 
1443  this->m_eventOut_OutputPort[0].invoke(
1444  _id,
1445  _logTime,
1447  _logBuff
1448  );
1449  }
1450 
1451  // Emit the event on the text log port
1452 #if FW_ENABLE_TEXT_LOGGING
1453  if (this->m_LogText_OutputPort[0].isConnected()) {
1454 #if FW_OBJECT_NAMES == 1
1455  const char* _formatString =
1456  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1457 #else
1458  const char* _formatString =
1459  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1460 #endif
1461 
1462  Fw::TextLogString _logString;
1463  _logString.format(
1464  _formatString,
1465 #if FW_OBJECT_NAMES == 1
1466  this->m_objName.toChar(),
1467 #endif
1468  "PacketOutOfOrder ",
1469  packetIndex,
1470  lastPacketIndex
1471  );
1472 
1473  this->m_LogText_OutputPort[0].invoke(
1474  _id,
1475  _logTime,
1477  _logString
1478  );
1479  }
1480 #endif
1481  }
1482 
1485  {
1486  // Check throttle value
1487  if (this->m_PacketDuplicateThrottle >= EVENTID_PACKETDUPLICATE_THROTTLE) {
1488  return;
1489  }
1490  else {
1491  this->m_PacketDuplicateThrottle++;
1492  }
1493 
1494  // Get the time
1495  Fw::Time _logTime;
1496  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1497  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1498  }
1499 
1500  FwEventIdType _id = static_cast<FwEventIdType>(0);
1501 
1502  _id = this->getIdBase() + EVENTID_PACKETDUPLICATE;
1503 
1504  // Emit the event on the log port
1505  if (this->m_eventOut_OutputPort[0].isConnected()) {
1506  Fw::LogBuffer _logBuff;
1508 
1509 #if FW_AMPCS_COMPATIBLE
1510  // Serialize the number of arguments
1511  _status = _logBuff.serialize(static_cast<U8>(1));
1512  FW_ASSERT(
1513  _status == Fw::FW_SERIALIZE_OK,
1514  static_cast<FwAssertArgType>(_status)
1515  );
1516 #endif
1517 
1518 #if FW_AMPCS_COMPATIBLE
1519  // Serialize the argument size
1520  _status = _logBuff.serialize(
1521  static_cast<U8>(sizeof(U32))
1522  );
1523  FW_ASSERT(
1524  _status == Fw::FW_SERIALIZE_OK,
1525  static_cast<FwAssertArgType>(_status)
1526  );
1527 #endif
1528  _status = _logBuff.serialize(packetIndex);
1529  FW_ASSERT(
1530  _status == Fw::FW_SERIALIZE_OK,
1531  static_cast<FwAssertArgType>(_status)
1532  );
1533 
1534  this->m_eventOut_OutputPort[0].invoke(
1535  _id,
1536  _logTime,
1538  _logBuff
1539  );
1540  }
1541 
1542  // Emit the event on the text log port
1543 #if FW_ENABLE_TEXT_LOGGING
1544  if (this->m_LogText_OutputPort[0].isConnected()) {
1545 #if FW_OBJECT_NAMES == 1
1546  const char* _formatString =
1547  "(%s) %s: Received a duplicate of packet %" PRIu32 "";
1548 #else
1549  const char* _formatString =
1550  "%s: Received a duplicate of packet %" PRIu32 "";
1551 #endif
1552 
1553  Fw::TextLogString _logString;
1554  _logString.format(
1555  _formatString,
1556 #if FW_OBJECT_NAMES == 1
1557  this->m_objName.toChar(),
1558 #endif
1559  "PacketDuplicate ",
1560  packetIndex
1561  );
1562 
1563  this->m_LogText_OutputPort[0].invoke(
1564  _id,
1565  _logTime,
1567  _logString
1568  );
1569  }
1570 #endif
1571  }
1572 
1575  {
1576  // Get the time
1577  Fw::Time _logTime;
1578  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1579  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1580  }
1581 
1582  FwEventIdType _id = static_cast<FwEventIdType>(0);
1583 
1584  _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1585 
1586  // Emit the event on the log port
1587  if (this->m_eventOut_OutputPort[0].isConnected()) {
1588  Fw::LogBuffer _logBuff;
1589 
1590 #if FW_AMPCS_COMPATIBLE
1592  // Serialize the number of arguments
1593  _status = _logBuff.serialize(static_cast<U8>(0));
1594  FW_ASSERT(
1595  _status == Fw::FW_SERIALIZE_OK,
1596  static_cast<FwAssertArgType>(_status)
1597  );
1598 #endif
1599 
1600  this->m_eventOut_OutputPort[0].invoke(
1601  _id,
1602  _logTime,
1604  _logBuff
1605  );
1606  }
1607 
1608  // Emit the event on the text log port
1609 #if FW_ENABLE_TEXT_LOGGING
1610  if (this->m_LogText_OutputPort[0].isConnected()) {
1611 #if FW_OBJECT_NAMES == 1
1612  const char* _formatString =
1613  "(%s) %s: Received CANCEL packet";
1614 #else
1615  const char* _formatString =
1616  "%s: Received CANCEL packet";
1617 #endif
1618 
1619  Fw::TextLogString _logString;
1620  _logString.format(
1621  _formatString,
1622 #if FW_OBJECT_NAMES == 1
1623  this->m_objName.toChar(),
1624 #endif
1625  "UplinkCanceled "
1626  );
1627 
1628  this->m_LogText_OutputPort[0].invoke(
1629  _id,
1630  _logTime,
1632  _logString
1633  );
1634  }
1635 #endif
1636  }
1637 
1640  {
1641  // Get the time
1642  Fw::Time _logTime;
1643  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1644  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1645  }
1646 
1647  FwEventIdType _id = static_cast<FwEventIdType>(0);
1648 
1649  _id = this->getIdBase() + EVENTID_DECODEERROR;
1650 
1651  // Emit the event on the log port
1652  if (this->m_eventOut_OutputPort[0].isConnected()) {
1653  Fw::LogBuffer _logBuff;
1655 
1656 #if FW_AMPCS_COMPATIBLE
1657  // Serialize the number of arguments
1658  _status = _logBuff.serialize(static_cast<U8>(1));
1659  FW_ASSERT(
1660  _status == Fw::FW_SERIALIZE_OK,
1661  static_cast<FwAssertArgType>(_status)
1662  );
1663 #endif
1664 
1665 #if FW_AMPCS_COMPATIBLE
1666  // Serialize the argument size
1667  _status = _logBuff.serialize(
1668  static_cast<U8>(sizeof(I32))
1669  );
1670  FW_ASSERT(
1671  _status == Fw::FW_SERIALIZE_OK,
1672  static_cast<FwAssertArgType>(_status)
1673  );
1674 #endif
1675  _status = _logBuff.serialize(status);
1676  FW_ASSERT(
1677  _status == Fw::FW_SERIALIZE_OK,
1678  static_cast<FwAssertArgType>(_status)
1679  );
1680 
1681  this->m_eventOut_OutputPort[0].invoke(
1682  _id,
1683  _logTime,
1685  _logBuff
1686  );
1687  }
1688 
1689  // Emit the event on the text log port
1690 #if FW_ENABLE_TEXT_LOGGING
1691  if (this->m_LogText_OutputPort[0].isConnected()) {
1692 #if FW_OBJECT_NAMES == 1
1693  const char* _formatString =
1694  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1695 #else
1696  const char* _formatString =
1697  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1698 #endif
1699 
1700  Fw::TextLogString _logString;
1701  _logString.format(
1702  _formatString,
1703 #if FW_OBJECT_NAMES == 1
1704  this->m_objName.toChar(),
1705 #endif
1706  "DecodeError ",
1707  status
1708  );
1709 
1710  this->m_LogText_OutputPort[0].invoke(
1711  _id,
1712  _logTime,
1714  _logString
1715  );
1716  }
1717 #endif
1718  }
1719 
1720  // ----------------------------------------------------------------------
1721  // Event throttle reset functions
1722  // ----------------------------------------------------------------------
1723 
1726  {
1727  // Reset throttle counter
1728  this->m_FileWriteErrorThrottle = 0;
1729  }
1730 
1733  {
1734  // Reset throttle counter
1735  this->m_InvalidReceiveModeThrottle = 0;
1736  }
1737 
1740  {
1741  // Reset throttle counter
1742  this->m_PacketOutOfBoundsThrottle = 0;
1743  }
1744 
1747  {
1748  // Reset throttle counter
1749  this->m_PacketOutOfOrderThrottle = 0;
1750  }
1751 
1754  {
1755  // Reset throttle counter
1756  this->m_PacketDuplicateThrottle = 0;
1757  }
1758 
1759  // ----------------------------------------------------------------------
1760  // Telemetry write functions
1761  // ----------------------------------------------------------------------
1762 
1765  U32 arg,
1766  Fw::Time _tlmTime
1767  ) const
1768  {
1769  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1770  if (
1771  this->m_timeCaller_OutputPort[0].isConnected() &&
1772  (_tlmTime == Fw::ZERO_TIME)
1773  ) {
1774  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1775  }
1776 
1777  Fw::TlmBuffer _tlmBuff;
1778  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1779  FW_ASSERT(
1780  _stat == Fw::FW_SERIALIZE_OK,
1781  static_cast<FwAssertArgType>(_stat)
1782  );
1783 
1784  FwChanIdType _id;
1785 
1786  _id = this->getIdBase() + CHANNELID_FILESRECEIVED;
1787 
1788  this->m_tlmOut_OutputPort[0].invoke(
1789  _id,
1790  _tlmTime,
1791  _tlmBuff
1792  );
1793  }
1794  }
1795 
1798  U32 arg,
1799  Fw::Time _tlmTime
1800  ) const
1801  {
1802  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1803  if (
1804  this->m_timeCaller_OutputPort[0].isConnected() &&
1805  (_tlmTime == Fw::ZERO_TIME)
1806  ) {
1807  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1808  }
1809 
1810  Fw::TlmBuffer _tlmBuff;
1811  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1812  FW_ASSERT(
1813  _stat == Fw::FW_SERIALIZE_OK,
1814  static_cast<FwAssertArgType>(_stat)
1815  );
1816 
1817  FwChanIdType _id;
1818 
1819  _id = this->getIdBase() + CHANNELID_PACKETSRECEIVED;
1820 
1821  this->m_tlmOut_OutputPort[0].invoke(
1822  _id,
1823  _tlmTime,
1824  _tlmBuff
1825  );
1826  }
1827  }
1828 
1831  U32 arg,
1832  Fw::Time _tlmTime
1833  ) const
1834  {
1835  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1836  if (
1837  this->m_timeCaller_OutputPort[0].isConnected() &&
1838  (_tlmTime == Fw::ZERO_TIME)
1839  ) {
1840  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1841  }
1842 
1843  Fw::TlmBuffer _tlmBuff;
1844  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1845  FW_ASSERT(
1846  _stat == Fw::FW_SERIALIZE_OK,
1847  static_cast<FwAssertArgType>(_stat)
1848  );
1849 
1850  FwChanIdType _id;
1851 
1852  _id = this->getIdBase() + CHANNELID_WARNINGS;
1853 
1854  this->m_tlmOut_OutputPort[0].invoke(
1855  _id,
1856  _tlmTime,
1857  _tlmBuff
1858  );
1859  }
1860  }
1861 
1862  // ----------------------------------------------------------------------
1863  // Time
1864  // ----------------------------------------------------------------------
1865 
1868  {
1869  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1870  Fw::Time _time;
1871  this->m_timeCaller_OutputPort[0].invoke(_time);
1872  return _time;
1873  }
1874  else {
1875  return Fw::Time(TB_NONE, 0, 0);
1876  }
1877  }
1878 
1879  // ----------------------------------------------------------------------
1880  // Message dispatch functions
1881  // ----------------------------------------------------------------------
1882 
1883  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
1884  doDispatch()
1885  {
1886  ComponentIpcSerializableBuffer _msg;
1887  FwQueuePriorityType _priority = 0;
1888 
1889  Os::Queue::Status _msgStatus = this->m_queue.receive(
1890  _msg,
1892  _priority
1893  );
1894  FW_ASSERT(
1895  _msgStatus == Os::Queue::OP_OK,
1896  static_cast<FwAssertArgType>(_msgStatus)
1897  );
1898 
1899  // Reset to beginning of buffer
1900  _msg.resetDeser();
1901 
1902  FwEnumStoreType _desMsg = 0;
1903  Fw::SerializeStatus _deserStatus = _msg.deserialize(_desMsg);
1904  FW_ASSERT(
1905  _deserStatus == Fw::FW_SERIALIZE_OK,
1906  static_cast<FwAssertArgType>(_deserStatus)
1907  );
1908 
1909  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1910 
1911  if (_msgType == FILEUPLINK_COMPONENT_EXIT) {
1912  return MSG_DISPATCH_EXIT;
1913  }
1914 
1915  FwIndexType portNum = 0;
1916  _deserStatus = _msg.deserialize(portNum);
1917  FW_ASSERT(
1918  _deserStatus == Fw::FW_SERIALIZE_OK,
1919  static_cast<FwAssertArgType>(_deserStatus)
1920  );
1921 
1922  switch (_msgType) {
1923  // Handle async input port bufferSendIn
1924  case BUFFERSENDIN_BUFFERSEND: {
1925  // Deserialize argument fwBuffer
1926  Fw::Buffer fwBuffer;
1927  _deserStatus = _msg.deserialize(fwBuffer);
1928  FW_ASSERT(
1929  _deserStatus == Fw::FW_SERIALIZE_OK,
1930  static_cast<FwAssertArgType>(_deserStatus)
1931  );
1932  // Call handler function
1933  this->bufferSendIn_handler(
1934  portNum,
1935  fwBuffer
1936  );
1937 
1938  break;
1939  }
1940 
1941  // Handle async input port pingIn
1942  case PINGIN_PING: {
1943  // Deserialize argument key
1944  U32 key;
1945  _deserStatus = _msg.deserialize(key);
1946  FW_ASSERT(
1947  _deserStatus == Fw::FW_SERIALIZE_OK,
1948  static_cast<FwAssertArgType>(_deserStatus)
1949  );
1950  // Call handler function
1951  this->pingIn_handler(
1952  portNum,
1953  key
1954  );
1955 
1956  break;
1957  }
1958 
1959  default:
1960  return MSG_DISPATCH_ERROR;
1961  }
1962 
1963  return MSG_DISPATCH_OK;
1964  }
1965 
1966  // ----------------------------------------------------------------------
1967  // Calls for messages received on typed input ports
1968  // ----------------------------------------------------------------------
1969 
1970  void FileUplinkComponentBase ::
1971  m_p_bufferSendIn_in(
1972  Fw::PassiveComponentBase* callComp,
1973  FwIndexType portNum,
1974  Fw::Buffer& fwBuffer
1975  )
1976  {
1977  FW_ASSERT(callComp);
1978  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1979  compPtr->bufferSendIn_handlerBase(
1980  portNum,
1981  fwBuffer
1982  );
1983  }
1984 
1985  void FileUplinkComponentBase ::
1986  m_p_pingIn_in(
1987  Fw::PassiveComponentBase* callComp,
1988  FwIndexType portNum,
1989  U32 key
1990  )
1991  {
1992  FW_ASSERT(callComp);
1993  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1994  compPtr->pingIn_handlerBase(
1995  portNum,
1996  key
1997  );
1998  }
1999 
2000 }
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
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
message to exit active component task
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:87
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.
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
FwSizeType SizeType
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
Status send(const U8 *buffer, FwSizeType size, FwQueuePriorityType priority, BlockingType blockType) override
send a message into the queue through delegate
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
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:32
BlockingType
message type
Definition: Queue.hpp:45
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
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:85
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void init()
Initialization function.
Definition: PingPortAc.cpp:56
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:35
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