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 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #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 getCapacity() 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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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_FwIndexType "]",
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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  (0 <= portNum) && (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  // Connection status queries for special output ports
503  // ----------------------------------------------------------------------
504 
505 #if FW_ENABLE_TEXT_LOGGING == 1
506 
507  bool FileUplinkComponentBase ::
508  isConnected_LogText_OutputPort(FwIndexType portNum)
509  {
510  FW_ASSERT(
511  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
512  static_cast<FwAssertArgType>(portNum)
513  );
514 
515  return this->m_LogText_OutputPort[portNum].isConnected();
516  }
517 
518 #endif
519 
522  {
523  FW_ASSERT(
524  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
525  static_cast<FwAssertArgType>(portNum)
526  );
527 
528  return this->m_eventOut_OutputPort[portNum].isConnected();
529  }
530 
533  {
534  FW_ASSERT(
535  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
536  static_cast<FwAssertArgType>(portNum)
537  );
538 
539  return this->m_timeCaller_OutputPort[portNum].isConnected();
540  }
541 
544  {
545  FW_ASSERT(
546  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
547  static_cast<FwAssertArgType>(portNum)
548  );
549 
550  return this->m_tlmOut_OutputPort[portNum].isConnected();
551  }
552 
553  // ----------------------------------------------------------------------
554  // Connection status queries for typed output ports
555  // ----------------------------------------------------------------------
556 
559  {
560  FW_ASSERT(
561  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
562  static_cast<FwAssertArgType>(portNum)
563  );
564 
565  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
566  }
567 
570  {
571  FW_ASSERT(
572  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
573  static_cast<FwAssertArgType>(portNum)
574  );
575 
576  return this->m_pingOut_OutputPort[portNum].isConnected();
577  }
578 
579  // ----------------------------------------------------------------------
580  // Port handler base-class functions for typed input ports
581  //
582  // Call these functions directly to bypass the corresponding ports
583  // ----------------------------------------------------------------------
584 
587  FwIndexType portNum,
588  Fw::Buffer& fwBuffer
589  )
590  {
591  // Make sure port number is valid
592  FW_ASSERT(
593  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
594  static_cast<FwAssertArgType>(portNum)
595  );
596 
597  // Call pre-message hook
599  portNum,
600  fwBuffer
601  );
602  ComponentIpcSerializableBuffer msg;
604 
605  // Serialize message ID
606  _status = msg.serializeFrom(
607  static_cast<FwEnumStoreType>(BUFFERSENDIN_BUFFERSEND)
608  );
609  FW_ASSERT(
610  _status == Fw::FW_SERIALIZE_OK,
611  static_cast<FwAssertArgType>(_status)
612  );
613 
614  // Serialize port number
615  _status = msg.serializeFrom(portNum);
616  FW_ASSERT(
617  _status == Fw::FW_SERIALIZE_OK,
618  static_cast<FwAssertArgType>(_status)
619  );
620 
621  // Serialize argument fwBuffer
622  _status = msg.serializeFrom(fwBuffer);
623  FW_ASSERT(
624  _status == Fw::FW_SERIALIZE_OK,
625  static_cast<FwAssertArgType>(_status)
626  );
627 
628  // Send message
630  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
631 
632  FW_ASSERT(
633  qStatus == Os::Queue::OP_OK,
634  static_cast<FwAssertArgType>(qStatus)
635  );
636  }
637 
640  FwIndexType portNum,
641  U32 key
642  )
643  {
644  // Make sure port number is valid
645  FW_ASSERT(
646  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
647  static_cast<FwAssertArgType>(portNum)
648  );
649 
650  // Call pre-message hook
652  portNum,
653  key
654  );
655  ComponentIpcSerializableBuffer msg;
657 
658  // Serialize message ID
659  _status = msg.serializeFrom(
660  static_cast<FwEnumStoreType>(PINGIN_PING)
661  );
662  FW_ASSERT(
663  _status == Fw::FW_SERIALIZE_OK,
664  static_cast<FwAssertArgType>(_status)
665  );
666 
667  // Serialize port number
668  _status = msg.serializeFrom(portNum);
669  FW_ASSERT(
670  _status == Fw::FW_SERIALIZE_OK,
671  static_cast<FwAssertArgType>(_status)
672  );
673 
674  // Serialize argument key
675  _status = msg.serializeFrom(key);
676  FW_ASSERT(
677  _status == Fw::FW_SERIALIZE_OK,
678  static_cast<FwAssertArgType>(_status)
679  );
680 
681  // Send message
683  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
684 
685  FW_ASSERT(
686  qStatus == Os::Queue::OP_OK,
687  static_cast<FwAssertArgType>(qStatus)
688  );
689  }
690 
691  // ----------------------------------------------------------------------
692  // Pre-message hooks for typed async input ports
693  //
694  // Each of these functions is invoked just before processing a message
695  // on the corresponding port. By default, they do nothing. You can
696  // override them to provide specific pre-message behavior.
697  // ----------------------------------------------------------------------
698 
701  FwIndexType portNum,
702  Fw::Buffer& fwBuffer
703  )
704  {
705  // Default: no-op
706  }
707 
710  FwIndexType portNum,
711  U32 key
712  )
713  {
714  // Default: no-op
715  }
716 
717  // ----------------------------------------------------------------------
718  // Invocation functions for typed output ports
719  // ----------------------------------------------------------------------
720 
723  FwIndexType portNum,
724  Fw::Buffer& fwBuffer
725  )
726  {
727  FW_ASSERT(
728  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
729  static_cast<FwAssertArgType>(portNum)
730  );
731 
732  FW_ASSERT(
733  this->m_bufferSendOut_OutputPort[portNum].isConnected(),
734  static_cast<FwAssertArgType>(portNum)
735  );
736  this->m_bufferSendOut_OutputPort[portNum].invoke(
737  fwBuffer
738  );
739  }
740 
743  FwIndexType portNum,
744  U32 key
745  )
746  {
747  FW_ASSERT(
748  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
749  static_cast<FwAssertArgType>(portNum)
750  );
751 
752  FW_ASSERT(
753  this->m_pingOut_OutputPort[portNum].isConnected(),
754  static_cast<FwAssertArgType>(portNum)
755  );
756  this->m_pingOut_OutputPort[portNum].invoke(
757  key
758  );
759  }
760 
761  // ----------------------------------------------------------------------
762  // Event logging functions
763  // ----------------------------------------------------------------------
764 
767  const Fw::StringBase& fileName,
768  U32 computed,
769  U32 read
770  ) const
771  {
772  // Get the time
773  Fw::Time _logTime;
774  if (this->m_timeCaller_OutputPort[0].isConnected()) {
775  this->m_timeCaller_OutputPort[0].invoke(_logTime);
776  }
777 
778  FwEventIdType _id = static_cast<FwEventIdType>(0);
779 
780  _id = this->getIdBase() + EVENTID_BADCHECKSUM;
781 
782  // Emit the event on the log port
783  if (this->m_eventOut_OutputPort[0].isConnected()) {
784  Fw::LogBuffer _logBuff;
786 
787 #if FW_AMPCS_COMPATIBLE
788  // Serialize the number of arguments
789  _status = _logBuff.serializeFrom(static_cast<U8>(3));
790  FW_ASSERT(
791  _status == Fw::FW_SERIALIZE_OK,
792  static_cast<FwAssertArgType>(_status)
793  );
794 #endif
795 
796  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
797  FW_ASSERT(
798  _status == Fw::FW_SERIALIZE_OK,
799  static_cast<FwAssertArgType>(_status)
800  );
801 
802 #if FW_AMPCS_COMPATIBLE
803  // Serialize the argument size
804  _status = _logBuff.serializeFrom(
805  static_cast<U8>(sizeof(U32))
806  );
807  FW_ASSERT(
808  _status == Fw::FW_SERIALIZE_OK,
809  static_cast<FwAssertArgType>(_status)
810  );
811 #endif
812  _status = _logBuff.serializeFrom(computed);
813  FW_ASSERT(
814  _status == Fw::FW_SERIALIZE_OK,
815  static_cast<FwAssertArgType>(_status)
816  );
817 
818 #if FW_AMPCS_COMPATIBLE
819  // Serialize the argument size
820  _status = _logBuff.serializeFrom(
821  static_cast<U8>(sizeof(U32))
822  );
823  FW_ASSERT(
824  _status == Fw::FW_SERIALIZE_OK,
825  static_cast<FwAssertArgType>(_status)
826  );
827 #endif
828  _status = _logBuff.serializeFrom(read);
829  FW_ASSERT(
830  _status == Fw::FW_SERIALIZE_OK,
831  static_cast<FwAssertArgType>(_status)
832  );
833 
834  this->m_eventOut_OutputPort[0].invoke(
835  _id,
836  _logTime,
838  _logBuff
839  );
840  }
841 
842  // Emit the event on the text log port
843 #if FW_ENABLE_TEXT_LOGGING
844  if (this->m_LogText_OutputPort[0].isConnected()) {
845 #if FW_OBJECT_NAMES == 1
846  const char* _formatString =
847  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
848 #else
849  const char* _formatString =
850  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
851 #endif
852 
853  Fw::TextLogString _logString;
854  _logString.format(
855  _formatString,
856 #if FW_OBJECT_NAMES == 1
857  this->m_objName.toChar(),
858 #endif
859  "BadChecksum ",
860  fileName.toChar(),
861  computed,
862  read
863  );
864 
865  this->m_LogText_OutputPort[0].invoke(
866  _id,
867  _logTime,
869  _logString
870  );
871  }
872 #endif
873  }
874 
877  {
878  // Get the time
879  Fw::Time _logTime;
880  if (this->m_timeCaller_OutputPort[0].isConnected()) {
881  this->m_timeCaller_OutputPort[0].invoke(_logTime);
882  }
883 
884  FwEventIdType _id = static_cast<FwEventIdType>(0);
885 
886  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
887 
888  // Emit the event on the log port
889  if (this->m_eventOut_OutputPort[0].isConnected()) {
890  Fw::LogBuffer _logBuff;
892 
893 #if FW_AMPCS_COMPATIBLE
894  // Serialize the number of arguments
895  _status = _logBuff.serializeFrom(static_cast<U8>(1));
896  FW_ASSERT(
897  _status == Fw::FW_SERIALIZE_OK,
898  static_cast<FwAssertArgType>(_status)
899  );
900 #endif
901 
902  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
903  FW_ASSERT(
904  _status == Fw::FW_SERIALIZE_OK,
905  static_cast<FwAssertArgType>(_status)
906  );
907 
908  this->m_eventOut_OutputPort[0].invoke(
909  _id,
910  _logTime,
912  _logBuff
913  );
914  }
915 
916  // Emit the event on the text log port
917 #if FW_ENABLE_TEXT_LOGGING
918  if (this->m_LogText_OutputPort[0].isConnected()) {
919 #if FW_OBJECT_NAMES == 1
920  const char* _formatString =
921  "(%s) %s: Could not open file %s";
922 #else
923  const char* _formatString =
924  "%s: Could not open file %s";
925 #endif
926 
927  Fw::TextLogString _logString;
928  _logString.format(
929  _formatString,
930 #if FW_OBJECT_NAMES == 1
931  this->m_objName.toChar(),
932 #endif
933  "FileOpenError ",
934  fileName.toChar()
935  );
936 
937  this->m_LogText_OutputPort[0].invoke(
938  _id,
939  _logTime,
941  _logString
942  );
943  }
944 #endif
945  }
946 
949  {
950  // Get the time
951  Fw::Time _logTime;
952  if (this->m_timeCaller_OutputPort[0].isConnected()) {
953  this->m_timeCaller_OutputPort[0].invoke(_logTime);
954  }
955 
956  FwEventIdType _id = static_cast<FwEventIdType>(0);
957 
958  _id = this->getIdBase() + EVENTID_FILERECEIVED;
959 
960  // Emit the event on the log port
961  if (this->m_eventOut_OutputPort[0].isConnected()) {
962  Fw::LogBuffer _logBuff;
964 
965 #if FW_AMPCS_COMPATIBLE
966  // Serialize the number of arguments
967  _status = _logBuff.serializeFrom(static_cast<U8>(1));
968  FW_ASSERT(
969  _status == Fw::FW_SERIALIZE_OK,
970  static_cast<FwAssertArgType>(_status)
971  );
972 #endif
973 
974  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
975  FW_ASSERT(
976  _status == Fw::FW_SERIALIZE_OK,
977  static_cast<FwAssertArgType>(_status)
978  );
979 
980  this->m_eventOut_OutputPort[0].invoke(
981  _id,
982  _logTime,
984  _logBuff
985  );
986  }
987 
988  // Emit the event on the text log port
989 #if FW_ENABLE_TEXT_LOGGING
990  if (this->m_LogText_OutputPort[0].isConnected()) {
991 #if FW_OBJECT_NAMES == 1
992  const char* _formatString =
993  "(%s) %s: Received file %s";
994 #else
995  const char* _formatString =
996  "%s: Received file %s";
997 #endif
998 
999  Fw::TextLogString _logString;
1000  _logString.format(
1001  _formatString,
1002 #if FW_OBJECT_NAMES == 1
1003  this->m_objName.toChar(),
1004 #endif
1005  "FileReceived ",
1006  fileName.toChar()
1007  );
1008 
1009  this->m_LogText_OutputPort[0].invoke(
1010  _id,
1011  _logTime,
1013  _logString
1014  );
1015  }
1016 #endif
1017  }
1018 
1021  {
1022  // Check throttle value
1023  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1024  return;
1025  }
1026  else {
1027  this->m_FileWriteErrorThrottle++;
1028  }
1029 
1030  // Get the time
1031  Fw::Time _logTime;
1032  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1033  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1034  }
1035 
1036  FwEventIdType _id = static_cast<FwEventIdType>(0);
1037 
1038  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1039 
1040  // Emit the event on the log port
1041  if (this->m_eventOut_OutputPort[0].isConnected()) {
1042  Fw::LogBuffer _logBuff;
1044 
1045 #if FW_AMPCS_COMPATIBLE
1046  // Serialize the number of arguments
1047  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1048  FW_ASSERT(
1049  _status == Fw::FW_SERIALIZE_OK,
1050  static_cast<FwAssertArgType>(_status)
1051  );
1052 #endif
1053 
1054  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1055  FW_ASSERT(
1056  _status == Fw::FW_SERIALIZE_OK,
1057  static_cast<FwAssertArgType>(_status)
1058  );
1059 
1060  this->m_eventOut_OutputPort[0].invoke(
1061  _id,
1062  _logTime,
1064  _logBuff
1065  );
1066  }
1067 
1068  // Emit the event on the text log port
1069 #if FW_ENABLE_TEXT_LOGGING
1070  if (this->m_LogText_OutputPort[0].isConnected()) {
1071 #if FW_OBJECT_NAMES == 1
1072  const char* _formatString =
1073  "(%s) %s: Could not write to file %s";
1074 #else
1075  const char* _formatString =
1076  "%s: Could not write to file %s";
1077 #endif
1078 
1079  Fw::TextLogString _logString;
1080  _logString.format(
1081  _formatString,
1082 #if FW_OBJECT_NAMES == 1
1083  this->m_objName.toChar(),
1084 #endif
1085  "FileWriteError ",
1086  fileName.toChar()
1087  );
1088 
1089  this->m_LogText_OutputPort[0].invoke(
1090  _id,
1091  _logTime,
1093  _logString
1094  );
1095  }
1096 #endif
1097  }
1098 
1101  FwPacketDescriptorType packetType,
1102  U32 mode
1103  )
1104  {
1105  // Check throttle value
1106  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1107  return;
1108  }
1109  else {
1110  this->m_InvalidReceiveModeThrottle++;
1111  }
1112 
1113  // Get the time
1114  Fw::Time _logTime;
1115  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1116  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1117  }
1118 
1119  FwEventIdType _id = static_cast<FwEventIdType>(0);
1120 
1121  _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1122 
1123  // Emit the event on the log port
1124  if (this->m_eventOut_OutputPort[0].isConnected()) {
1125  Fw::LogBuffer _logBuff;
1127 
1128 #if FW_AMPCS_COMPATIBLE
1129  // Serialize the number of arguments
1130  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1131  FW_ASSERT(
1132  _status == Fw::FW_SERIALIZE_OK,
1133  static_cast<FwAssertArgType>(_status)
1134  );
1135 #endif
1136 
1137 #if FW_AMPCS_COMPATIBLE
1138  // Serialize the argument size
1139  _status = _logBuff.serializeFrom(
1140  static_cast<U8>(sizeof(FwPacketDescriptorType))
1141  );
1142  FW_ASSERT(
1143  _status == Fw::FW_SERIALIZE_OK,
1144  static_cast<FwAssertArgType>(_status)
1145  );
1146 #endif
1147  _status = _logBuff.serializeFrom(packetType);
1148  FW_ASSERT(
1149  _status == Fw::FW_SERIALIZE_OK,
1150  static_cast<FwAssertArgType>(_status)
1151  );
1152 
1153 #if FW_AMPCS_COMPATIBLE
1154  // Serialize the argument size
1155  _status = _logBuff.serializeFrom(
1156  static_cast<U8>(sizeof(U32))
1157  );
1158  FW_ASSERT(
1159  _status == Fw::FW_SERIALIZE_OK,
1160  static_cast<FwAssertArgType>(_status)
1161  );
1162 #endif
1163  _status = _logBuff.serializeFrom(mode);
1164  FW_ASSERT(
1165  _status == Fw::FW_SERIALIZE_OK,
1166  static_cast<FwAssertArgType>(_status)
1167  );
1168 
1169  this->m_eventOut_OutputPort[0].invoke(
1170  _id,
1171  _logTime,
1173  _logBuff
1174  );
1175  }
1176 
1177  // Emit the event on the text log port
1178 #if FW_ENABLE_TEXT_LOGGING
1179  if (this->m_LogText_OutputPort[0].isConnected()) {
1180 #if FW_OBJECT_NAMES == 1
1181  const char* _formatString =
1182  "(%s) %s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1183 #else
1184  const char* _formatString =
1185  "%s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1186 #endif
1187 
1188  Fw::TextLogString _logString;
1189  _logString.format(
1190  _formatString,
1191 #if FW_OBJECT_NAMES == 1
1192  this->m_objName.toChar(),
1193 #endif
1194  "InvalidReceiveMode ",
1195  packetType,
1196  mode
1197  );
1198 
1199  this->m_LogText_OutputPort[0].invoke(
1200  _id,
1201  _logTime,
1203  _logString
1204  );
1205  }
1206 #endif
1207  }
1208 
1211  U32 packetIndex,
1212  const Fw::StringBase& fileName
1213  )
1214  {
1215  // Check throttle value
1216  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1217  return;
1218  }
1219  else {
1220  this->m_PacketOutOfBoundsThrottle++;
1221  }
1222 
1223  // Get the time
1224  Fw::Time _logTime;
1225  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1226  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1227  }
1228 
1229  FwEventIdType _id = static_cast<FwEventIdType>(0);
1230 
1231  _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1232 
1233  // Emit the event on the log port
1234  if (this->m_eventOut_OutputPort[0].isConnected()) {
1235  Fw::LogBuffer _logBuff;
1237 
1238 #if FW_AMPCS_COMPATIBLE
1239  // Serialize the number of arguments
1240  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1241  FW_ASSERT(
1242  _status == Fw::FW_SERIALIZE_OK,
1243  static_cast<FwAssertArgType>(_status)
1244  );
1245 #endif
1246 
1247 #if FW_AMPCS_COMPATIBLE
1248  // Serialize the argument size
1249  _status = _logBuff.serializeFrom(
1250  static_cast<U8>(sizeof(U32))
1251  );
1252  FW_ASSERT(
1253  _status == Fw::FW_SERIALIZE_OK,
1254  static_cast<FwAssertArgType>(_status)
1255  );
1256 #endif
1257  _status = _logBuff.serializeFrom(packetIndex);
1258  FW_ASSERT(
1259  _status == Fw::FW_SERIALIZE_OK,
1260  static_cast<FwAssertArgType>(_status)
1261  );
1262 
1263  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1264  FW_ASSERT(
1265  _status == Fw::FW_SERIALIZE_OK,
1266  static_cast<FwAssertArgType>(_status)
1267  );
1268 
1269  this->m_eventOut_OutputPort[0].invoke(
1270  _id,
1271  _logTime,
1273  _logBuff
1274  );
1275  }
1276 
1277  // Emit the event on the text log port
1278 #if FW_ENABLE_TEXT_LOGGING
1279  if (this->m_LogText_OutputPort[0].isConnected()) {
1280 #if FW_OBJECT_NAMES == 1
1281  const char* _formatString =
1282  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1283 #else
1284  const char* _formatString =
1285  "%s: Packet %" PRIu32 " out of bounds for file %s";
1286 #endif
1287 
1288  Fw::TextLogString _logString;
1289  _logString.format(
1290  _formatString,
1291 #if FW_OBJECT_NAMES == 1
1292  this->m_objName.toChar(),
1293 #endif
1294  "PacketOutOfBounds ",
1295  packetIndex,
1296  fileName.toChar()
1297  );
1298 
1299  this->m_LogText_OutputPort[0].invoke(
1300  _id,
1301  _logTime,
1303  _logString
1304  );
1305  }
1306 #endif
1307  }
1308 
1311  U32 packetIndex,
1312  U32 lastPacketIndex
1313  )
1314  {
1315  // Check throttle value
1316  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1317  return;
1318  }
1319  else {
1320  this->m_PacketOutOfOrderThrottle++;
1321  }
1322 
1323  // Get the time
1324  Fw::Time _logTime;
1325  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1326  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1327  }
1328 
1329  FwEventIdType _id = static_cast<FwEventIdType>(0);
1330 
1331  _id = this->getIdBase() + EVENTID_PACKETOUTOFORDER;
1332 
1333  // Emit the event on the log port
1334  if (this->m_eventOut_OutputPort[0].isConnected()) {
1335  Fw::LogBuffer _logBuff;
1337 
1338 #if FW_AMPCS_COMPATIBLE
1339  // Serialize the number of arguments
1340  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1341  FW_ASSERT(
1342  _status == Fw::FW_SERIALIZE_OK,
1343  static_cast<FwAssertArgType>(_status)
1344  );
1345 #endif
1346 
1347 #if FW_AMPCS_COMPATIBLE
1348  // Serialize the argument size
1349  _status = _logBuff.serializeFrom(
1350  static_cast<U8>(sizeof(U32))
1351  );
1352  FW_ASSERT(
1353  _status == Fw::FW_SERIALIZE_OK,
1354  static_cast<FwAssertArgType>(_status)
1355  );
1356 #endif
1357  _status = _logBuff.serializeFrom(packetIndex);
1358  FW_ASSERT(
1359  _status == Fw::FW_SERIALIZE_OK,
1360  static_cast<FwAssertArgType>(_status)
1361  );
1362 
1363 #if FW_AMPCS_COMPATIBLE
1364  // Serialize the argument size
1365  _status = _logBuff.serializeFrom(
1366  static_cast<U8>(sizeof(U32))
1367  );
1368  FW_ASSERT(
1369  _status == Fw::FW_SERIALIZE_OK,
1370  static_cast<FwAssertArgType>(_status)
1371  );
1372 #endif
1373  _status = _logBuff.serializeFrom(lastPacketIndex);
1374  FW_ASSERT(
1375  _status == Fw::FW_SERIALIZE_OK,
1376  static_cast<FwAssertArgType>(_status)
1377  );
1378 
1379  this->m_eventOut_OutputPort[0].invoke(
1380  _id,
1381  _logTime,
1383  _logBuff
1384  );
1385  }
1386 
1387  // Emit the event on the text log port
1388 #if FW_ENABLE_TEXT_LOGGING
1389  if (this->m_LogText_OutputPort[0].isConnected()) {
1390 #if FW_OBJECT_NAMES == 1
1391  const char* _formatString =
1392  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1393 #else
1394  const char* _formatString =
1395  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1396 #endif
1397 
1398  Fw::TextLogString _logString;
1399  _logString.format(
1400  _formatString,
1401 #if FW_OBJECT_NAMES == 1
1402  this->m_objName.toChar(),
1403 #endif
1404  "PacketOutOfOrder ",
1405  packetIndex,
1406  lastPacketIndex
1407  );
1408 
1409  this->m_LogText_OutputPort[0].invoke(
1410  _id,
1411  _logTime,
1413  _logString
1414  );
1415  }
1416 #endif
1417  }
1418 
1421  {
1422  // Check throttle value
1423  if (this->m_PacketDuplicateThrottle >= EVENTID_PACKETDUPLICATE_THROTTLE) {
1424  return;
1425  }
1426  else {
1427  this->m_PacketDuplicateThrottle++;
1428  }
1429 
1430  // Get the time
1431  Fw::Time _logTime;
1432  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1433  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1434  }
1435 
1436  FwEventIdType _id = static_cast<FwEventIdType>(0);
1437 
1438  _id = this->getIdBase() + EVENTID_PACKETDUPLICATE;
1439 
1440  // Emit the event on the log port
1441  if (this->m_eventOut_OutputPort[0].isConnected()) {
1442  Fw::LogBuffer _logBuff;
1444 
1445 #if FW_AMPCS_COMPATIBLE
1446  // Serialize the number of arguments
1447  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1448  FW_ASSERT(
1449  _status == Fw::FW_SERIALIZE_OK,
1450  static_cast<FwAssertArgType>(_status)
1451  );
1452 #endif
1453 
1454 #if FW_AMPCS_COMPATIBLE
1455  // Serialize the argument size
1456  _status = _logBuff.serializeFrom(
1457  static_cast<U8>(sizeof(U32))
1458  );
1459  FW_ASSERT(
1460  _status == Fw::FW_SERIALIZE_OK,
1461  static_cast<FwAssertArgType>(_status)
1462  );
1463 #endif
1464  _status = _logBuff.serializeFrom(packetIndex);
1465  FW_ASSERT(
1466  _status == Fw::FW_SERIALIZE_OK,
1467  static_cast<FwAssertArgType>(_status)
1468  );
1469 
1470  this->m_eventOut_OutputPort[0].invoke(
1471  _id,
1472  _logTime,
1474  _logBuff
1475  );
1476  }
1477 
1478  // Emit the event on the text log port
1479 #if FW_ENABLE_TEXT_LOGGING
1480  if (this->m_LogText_OutputPort[0].isConnected()) {
1481 #if FW_OBJECT_NAMES == 1
1482  const char* _formatString =
1483  "(%s) %s: Received a duplicate of packet %" PRIu32 "";
1484 #else
1485  const char* _formatString =
1486  "%s: Received a duplicate of packet %" PRIu32 "";
1487 #endif
1488 
1489  Fw::TextLogString _logString;
1490  _logString.format(
1491  _formatString,
1492 #if FW_OBJECT_NAMES == 1
1493  this->m_objName.toChar(),
1494 #endif
1495  "PacketDuplicate ",
1496  packetIndex
1497  );
1498 
1499  this->m_LogText_OutputPort[0].invoke(
1500  _id,
1501  _logTime,
1503  _logString
1504  );
1505  }
1506 #endif
1507  }
1508 
1511  {
1512  // Get the time
1513  Fw::Time _logTime;
1514  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1515  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1516  }
1517 
1518  FwEventIdType _id = static_cast<FwEventIdType>(0);
1519 
1520  _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1521 
1522  // Emit the event on the log port
1523  if (this->m_eventOut_OutputPort[0].isConnected()) {
1524  Fw::LogBuffer _logBuff;
1525 
1526 #if FW_AMPCS_COMPATIBLE
1528  // Serialize the number of arguments
1529  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1530  FW_ASSERT(
1531  _status == Fw::FW_SERIALIZE_OK,
1532  static_cast<FwAssertArgType>(_status)
1533  );
1534 #endif
1535 
1536  this->m_eventOut_OutputPort[0].invoke(
1537  _id,
1538  _logTime,
1540  _logBuff
1541  );
1542  }
1543 
1544  // Emit the event on the text log port
1545 #if FW_ENABLE_TEXT_LOGGING
1546  if (this->m_LogText_OutputPort[0].isConnected()) {
1547 #if FW_OBJECT_NAMES == 1
1548  const char* _formatString =
1549  "(%s) %s: Received CANCEL packet";
1550 #else
1551  const char* _formatString =
1552  "%s: Received CANCEL packet";
1553 #endif
1554 
1555  Fw::TextLogString _logString;
1556  _logString.format(
1557  _formatString,
1558 #if FW_OBJECT_NAMES == 1
1559  this->m_objName.toChar(),
1560 #endif
1561  "UplinkCanceled "
1562  );
1563 
1564  this->m_LogText_OutputPort[0].invoke(
1565  _id,
1566  _logTime,
1568  _logString
1569  );
1570  }
1571 #endif
1572  }
1573 
1576  {
1577  // Get the time
1578  Fw::Time _logTime;
1579  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1580  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1581  }
1582 
1583  FwEventIdType _id = static_cast<FwEventIdType>(0);
1584 
1585  _id = this->getIdBase() + EVENTID_DECODEERROR;
1586 
1587  // Emit the event on the log port
1588  if (this->m_eventOut_OutputPort[0].isConnected()) {
1589  Fw::LogBuffer _logBuff;
1591 
1592 #if FW_AMPCS_COMPATIBLE
1593  // Serialize the number of arguments
1594  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1595  FW_ASSERT(
1596  _status == Fw::FW_SERIALIZE_OK,
1597  static_cast<FwAssertArgType>(_status)
1598  );
1599 #endif
1600 
1601 #if FW_AMPCS_COMPATIBLE
1602  // Serialize the argument size
1603  _status = _logBuff.serializeFrom(
1604  static_cast<U8>(sizeof(I32))
1605  );
1606  FW_ASSERT(
1607  _status == Fw::FW_SERIALIZE_OK,
1608  static_cast<FwAssertArgType>(_status)
1609  );
1610 #endif
1611  _status = _logBuff.serializeFrom(status);
1612  FW_ASSERT(
1613  _status == Fw::FW_SERIALIZE_OK,
1614  static_cast<FwAssertArgType>(_status)
1615  );
1616 
1617  this->m_eventOut_OutputPort[0].invoke(
1618  _id,
1619  _logTime,
1621  _logBuff
1622  );
1623  }
1624 
1625  // Emit the event on the text log port
1626 #if FW_ENABLE_TEXT_LOGGING
1627  if (this->m_LogText_OutputPort[0].isConnected()) {
1628 #if FW_OBJECT_NAMES == 1
1629  const char* _formatString =
1630  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1631 #else
1632  const char* _formatString =
1633  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1634 #endif
1635 
1636  Fw::TextLogString _logString;
1637  _logString.format(
1638  _formatString,
1639 #if FW_OBJECT_NAMES == 1
1640  this->m_objName.toChar(),
1641 #endif
1642  "DecodeError ",
1643  status
1644  );
1645 
1646  this->m_LogText_OutputPort[0].invoke(
1647  _id,
1648  _logTime,
1650  _logString
1651  );
1652  }
1653 #endif
1654  }
1655 
1658  {
1659  // Get the time
1660  Fw::Time _logTime;
1661  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1662  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1663  }
1664 
1665  FwEventIdType _id = static_cast<FwEventIdType>(0);
1666 
1667  _id = this->getIdBase() + EVENTID_INVALIDPACKETRECEIVED;
1668 
1669  // Emit the event on the log port
1670  if (this->m_eventOut_OutputPort[0].isConnected()) {
1671  Fw::LogBuffer _logBuff;
1673 
1674 #if FW_AMPCS_COMPATIBLE
1675  // Serialize the number of arguments
1676  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1677  FW_ASSERT(
1678  _status == Fw::FW_SERIALIZE_OK,
1679  static_cast<FwAssertArgType>(_status)
1680  );
1681 #endif
1682 
1683 #if FW_AMPCS_COMPATIBLE
1684  // Serialize the argument size
1685  _status = _logBuff.serializeFrom(
1686  static_cast<U8>(sizeof(FwPacketDescriptorType))
1687  );
1688  FW_ASSERT(
1689  _status == Fw::FW_SERIALIZE_OK,
1690  static_cast<FwAssertArgType>(_status)
1691  );
1692 #endif
1693  _status = _logBuff.serializeFrom(packetType);
1694  FW_ASSERT(
1695  _status == Fw::FW_SERIALIZE_OK,
1696  static_cast<FwAssertArgType>(_status)
1697  );
1698 
1699  this->m_eventOut_OutputPort[0].invoke(
1700  _id,
1701  _logTime,
1703  _logBuff
1704  );
1705  }
1706 
1707  // Emit the event on the text log port
1708 #if FW_ENABLE_TEXT_LOGGING
1709  if (this->m_LogText_OutputPort[0].isConnected()) {
1710 #if FW_OBJECT_NAMES == 1
1711  const char* _formatString =
1712  "(%s) %s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1713 #else
1714  const char* _formatString =
1715  "%s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1716 #endif
1717 
1718  Fw::TextLogString _logString;
1719  _logString.format(
1720  _formatString,
1721 #if FW_OBJECT_NAMES == 1
1722  this->m_objName.toChar(),
1723 #endif
1724  "InvalidPacketReceived ",
1725  packetType
1726  );
1727 
1728  this->m_LogText_OutputPort[0].invoke(
1729  _id,
1730  _logTime,
1732  _logString
1733  );
1734  }
1735 #endif
1736  }
1737 
1738  // ----------------------------------------------------------------------
1739  // Event throttle reset functions
1740  // ----------------------------------------------------------------------
1741 
1744  {
1745  // Reset throttle counter
1746  this->m_FileWriteErrorThrottle = 0;
1747  }
1748 
1751  {
1752  // Reset throttle counter
1753  this->m_InvalidReceiveModeThrottle = 0;
1754  }
1755 
1758  {
1759  // Reset throttle counter
1760  this->m_PacketOutOfBoundsThrottle = 0;
1761  }
1762 
1765  {
1766  // Reset throttle counter
1767  this->m_PacketOutOfOrderThrottle = 0;
1768  }
1769 
1772  {
1773  // Reset throttle counter
1774  this->m_PacketDuplicateThrottle = 0;
1775  }
1776 
1777  // ----------------------------------------------------------------------
1778  // Telemetry write functions
1779  // ----------------------------------------------------------------------
1780 
1783  U32 arg,
1784  Fw::Time _tlmTime
1785  ) const
1786  {
1787  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1788  if (
1789  this->m_timeCaller_OutputPort[0].isConnected() &&
1790  (_tlmTime == Fw::ZERO_TIME)
1791  ) {
1792  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1793  }
1794 
1795  Fw::TlmBuffer _tlmBuff;
1796  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1797  FW_ASSERT(
1798  _stat == Fw::FW_SERIALIZE_OK,
1799  static_cast<FwAssertArgType>(_stat)
1800  );
1801 
1802  FwChanIdType _id;
1803 
1804  _id = this->getIdBase() + CHANNELID_FILESRECEIVED;
1805 
1806  this->m_tlmOut_OutputPort[0].invoke(
1807  _id,
1808  _tlmTime,
1809  _tlmBuff
1810  );
1811  }
1812  }
1813 
1816  U32 arg,
1817  Fw::Time _tlmTime
1818  ) const
1819  {
1820  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1821  if (
1822  this->m_timeCaller_OutputPort[0].isConnected() &&
1823  (_tlmTime == Fw::ZERO_TIME)
1824  ) {
1825  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1826  }
1827 
1828  Fw::TlmBuffer _tlmBuff;
1829  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1830  FW_ASSERT(
1831  _stat == Fw::FW_SERIALIZE_OK,
1832  static_cast<FwAssertArgType>(_stat)
1833  );
1834 
1835  FwChanIdType _id;
1836 
1837  _id = this->getIdBase() + CHANNELID_PACKETSRECEIVED;
1838 
1839  this->m_tlmOut_OutputPort[0].invoke(
1840  _id,
1841  _tlmTime,
1842  _tlmBuff
1843  );
1844  }
1845  }
1846 
1849  U32 arg,
1850  Fw::Time _tlmTime
1851  ) const
1852  {
1853  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1854  if (
1855  this->m_timeCaller_OutputPort[0].isConnected() &&
1856  (_tlmTime == Fw::ZERO_TIME)
1857  ) {
1858  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1859  }
1860 
1861  Fw::TlmBuffer _tlmBuff;
1862  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1863  FW_ASSERT(
1864  _stat == Fw::FW_SERIALIZE_OK,
1865  static_cast<FwAssertArgType>(_stat)
1866  );
1867 
1868  FwChanIdType _id;
1869 
1870  _id = this->getIdBase() + CHANNELID_WARNINGS;
1871 
1872  this->m_tlmOut_OutputPort[0].invoke(
1873  _id,
1874  _tlmTime,
1875  _tlmBuff
1876  );
1877  }
1878  }
1879 
1880  // ----------------------------------------------------------------------
1881  // Time
1882  // ----------------------------------------------------------------------
1883 
1885  getTime() const
1886  {
1887  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1888  Fw::Time _time;
1889  this->m_timeCaller_OutputPort[0].invoke(_time);
1890  return _time;
1891  }
1892  else {
1893  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1894  }
1895  }
1896 
1897  // ----------------------------------------------------------------------
1898  // Message dispatch functions
1899  // ----------------------------------------------------------------------
1900 
1901  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
1902  doDispatch()
1903  {
1904  ComponentIpcSerializableBuffer _msg;
1905  FwQueuePriorityType _priority = 0;
1906 
1907  Os::Queue::Status _msgStatus = this->m_queue.receive(
1908  _msg,
1910  _priority
1911  );
1912  FW_ASSERT(
1913  _msgStatus == Os::Queue::OP_OK,
1914  static_cast<FwAssertArgType>(_msgStatus)
1915  );
1916 
1917  // Reset to beginning of buffer
1918  _msg.resetDeser();
1919 
1920  FwEnumStoreType _desMsg = 0;
1921  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
1922  FW_ASSERT(
1923  _deserStatus == Fw::FW_SERIALIZE_OK,
1924  static_cast<FwAssertArgType>(_deserStatus)
1925  );
1926 
1927  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
1928 
1929  if (_msgType == FILEUPLINK_COMPONENT_EXIT) {
1930  return MSG_DISPATCH_EXIT;
1931  }
1932 
1933  FwIndexType portNum = 0;
1934  _deserStatus = _msg.deserializeTo(portNum);
1935  FW_ASSERT(
1936  _deserStatus == Fw::FW_SERIALIZE_OK,
1937  static_cast<FwAssertArgType>(_deserStatus)
1938  );
1939 
1940  switch (_msgType) {
1941  // Handle async input port bufferSendIn
1942  case BUFFERSENDIN_BUFFERSEND: {
1943  // Deserialize argument fwBuffer
1944  Fw::Buffer fwBuffer;
1945  _deserStatus = _msg.deserializeTo(fwBuffer);
1946  FW_ASSERT(
1947  _deserStatus == Fw::FW_SERIALIZE_OK,
1948  static_cast<FwAssertArgType>(_deserStatus)
1949  );
1950  // Call handler function
1951  this->bufferSendIn_handler(
1952  portNum,
1953  fwBuffer
1954  );
1955 
1956  break;
1957  }
1958 
1959  // Handle async input port pingIn
1960  case PINGIN_PING: {
1961  // Deserialize argument key
1962  U32 key;
1963  _deserStatus = _msg.deserializeTo(key);
1964  FW_ASSERT(
1965  _deserStatus == Fw::FW_SERIALIZE_OK,
1966  static_cast<FwAssertArgType>(_deserStatus)
1967  );
1968  // Call handler function
1969  this->pingIn_handler(
1970  portNum,
1971  key
1972  );
1973 
1974  break;
1975  }
1976 
1977  default:
1978  return MSG_DISPATCH_ERROR;
1979  }
1980 
1981  return MSG_DISPATCH_OK;
1982  }
1983 
1984  // ----------------------------------------------------------------------
1985  // Calls for messages received on typed input ports
1986  // ----------------------------------------------------------------------
1987 
1988  void FileUplinkComponentBase ::
1989  m_p_bufferSendIn_in(
1990  Fw::PassiveComponentBase* callComp,
1991  FwIndexType portNum,
1992  Fw::Buffer& fwBuffer
1993  )
1994  {
1995  FW_ASSERT(callComp);
1996  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
1997  compPtr->bufferSendIn_handlerBase(
1998  portNum,
1999  fwBuffer
2000  );
2001  }
2002 
2003  void FileUplinkComponentBase ::
2004  m_p_pingIn_in(
2005  Fw::PassiveComponentBase* callComp,
2006  FwIndexType portNum,
2007  U32 key
2008  )
2009  {
2010  FW_ASSERT(callComp);
2011  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
2012  compPtr->pingIn_handlerBase(
2013  portNum,
2014  key
2015  );
2016  }
2017 
2018 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
U16 FwPacketDescriptorType
The width of packet descriptors when they are serialized by the framework.
Operation succeeded.
Definition: Os.hpp:26
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
PlatformSizeType FwSizeType
Status receive(U8 *destination, FwSizeType capacity, BlockingType blockType, FwSizeType &actualSize, FwQueuePriorityType &priority) override
receive a message from the queue through delegate
Definition: Queue.cpp:71
I32 FwEnumStoreType
Status
status returned from the queue send function
Definition: Queue.hpp:30
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void invoke(U32 key) const
Invoke a port interface.
Definition: PingPortAc.cpp:147
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
const Time ZERO_TIME
Definition: Time.cpp:5
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
No time base has been established (Required)
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:24
SerializeStatus
forward declaration for string
Message will block until space is available.
Definition: Queue.hpp:47
FwIdType FwEventIdType
The type of an event identifier.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:26
void init()
Initialization function.
Definition: TimePortAc.cpp:128
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro.
Definition: BasicTypes.h:92
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
message to exit active component task
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
FwIdType FwChanIdType
The type of a telemetry channel identifier.
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
Definition: Queue.cpp:54
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:38
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
BlockingType
message type
Definition: Queue.hpp:46
PlatformQueuePriorityType FwQueuePriorityType
The type of queue priorities used.
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
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
The size of the serial representations of the port arguments.
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void init()
Initialization function.
Definition: PingPortAc.cpp:56
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:56
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:48
Implementation of malloc based allocator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.