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 fileAnnounce
225  for (
226  FwIndexType port = 0;
227  port < static_cast<FwIndexType>(this->getNum_fileAnnounce_OutputPorts());
228  port++
229  ) {
230  this->m_fileAnnounce_OutputPort[port].init();
231 
232 #if FW_OBJECT_NAMES == 1
233  Fw::ObjectName portName;
234  portName.format(
235  "%s_fileAnnounce_OutputPort[%" PRI_FwIndexType "]",
236  this->m_objName.toChar(),
237  port
238  );
239  this->m_fileAnnounce_OutputPort[port].setObjName(portName.toChar());
240 #endif
241  }
242 
243  // Connect output port pingOut
244  for (
245  FwIndexType port = 0;
246  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
247  port++
248  ) {
249  this->m_pingOut_OutputPort[port].init();
250 
251 #if FW_OBJECT_NAMES == 1
252  Fw::ObjectName portName;
253  portName.format(
254  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
255  this->m_objName.toChar(),
256  port
257  );
258  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
259 #endif
260  }
261 
262  // Create the queue
263  Os::Queue::Status qStat = this->createQueue(
264  queueDepth,
265  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
266  );
267  FW_ASSERT(
268  Os::Queue::Status::OP_OK == qStat,
269  static_cast<FwAssertArgType>(qStat)
270  );
271  }
272 
273  // ----------------------------------------------------------------------
274  // Getters for typed input ports
275  // ----------------------------------------------------------------------
276 
279  {
280  FW_ASSERT(
281  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
282  static_cast<FwAssertArgType>(portNum)
283  );
284 
285  return &this->m_bufferSendIn_InputPort[portNum];
286  }
287 
290  {
291  FW_ASSERT(
292  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
293  static_cast<FwAssertArgType>(portNum)
294  );
295 
296  return &this->m_pingIn_InputPort[portNum];
297  }
298 
299  // ----------------------------------------------------------------------
300  // Connect input ports to special output ports
301  // ----------------------------------------------------------------------
302 
303 #if FW_ENABLE_TEXT_LOGGING == 1
304 
305  void FileUplinkComponentBase ::
306  set_LogText_OutputPort(
307  FwIndexType portNum,
309  )
310  {
311  FW_ASSERT(
312  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
313  static_cast<FwAssertArgType>(portNum)
314  );
315 
316  this->m_LogText_OutputPort[portNum].addCallPort(port);
317  }
318 
319 #endif
320 
323  FwIndexType portNum,
324  Fw::InputLogPort* port
325  )
326  {
327  FW_ASSERT(
328  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
329  static_cast<FwAssertArgType>(portNum)
330  );
331 
332  this->m_eventOut_OutputPort[portNum].addCallPort(port);
333  }
334 
337  FwIndexType portNum,
338  Fw::InputTimePort* port
339  )
340  {
341  FW_ASSERT(
342  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
343  static_cast<FwAssertArgType>(portNum)
344  );
345 
346  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
347  }
348 
351  FwIndexType portNum,
352  Fw::InputTlmPort* port
353  )
354  {
355  FW_ASSERT(
356  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
357  static_cast<FwAssertArgType>(portNum)
358  );
359 
360  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
361  }
362 
363  // ----------------------------------------------------------------------
364  // Connect typed input ports to typed output ports
365  // ----------------------------------------------------------------------
366 
369  FwIndexType portNum,
371  )
372  {
373  FW_ASSERT(
374  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
375  static_cast<FwAssertArgType>(portNum)
376  );
377 
378  this->m_bufferSendOut_OutputPort[portNum].addCallPort(port);
379  }
380 
383  FwIndexType portNum,
385  )
386  {
387  FW_ASSERT(
388  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
389  static_cast<FwAssertArgType>(portNum)
390  );
391 
392  this->m_fileAnnounce_OutputPort[portNum].addCallPort(port);
393  }
394 
397  FwIndexType portNum,
398  Svc::InputPingPort* port
399  )
400  {
401  FW_ASSERT(
402  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
403  static_cast<FwAssertArgType>(portNum)
404  );
405 
406  this->m_pingOut_OutputPort[portNum].addCallPort(port);
407  }
408 
409 #if FW_PORT_SERIALIZATION
410 
411  // ----------------------------------------------------------------------
412  // Connect serial input ports to special output ports
413  // ----------------------------------------------------------------------
414 
415 #if FW_ENABLE_TEXT_LOGGING == 1
416 
417  void FileUplinkComponentBase ::
418  set_LogText_OutputPort(
419  FwIndexType portNum,
420  Fw::InputSerializePort* port
421  )
422  {
423  FW_ASSERT(
424  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
425  static_cast<FwAssertArgType>(portNum)
426  );
427 
428  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
429  }
430 
431 #endif
432 
435  FwIndexType portNum,
436  Fw::InputSerializePort* port
437  )
438  {
439  FW_ASSERT(
440  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
441  static_cast<FwAssertArgType>(portNum)
442  );
443 
444  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
445  }
446 
449  FwIndexType portNum,
450  Fw::InputSerializePort* port
451  )
452  {
453  FW_ASSERT(
454  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
455  static_cast<FwAssertArgType>(portNum)
456  );
457 
458  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
459  }
460 
463  FwIndexType portNum,
464  Fw::InputSerializePort* port
465  )
466  {
467  FW_ASSERT(
468  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
469  static_cast<FwAssertArgType>(portNum)
470  );
471 
472  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
473  }
474 
475 #endif
476 
477 #if FW_PORT_SERIALIZATION
478 
479  // ----------------------------------------------------------------------
480  // Connect serial input ports to typed output ports
481  // ----------------------------------------------------------------------
482 
485  FwIndexType portNum,
486  Fw::InputSerializePort* port
487  )
488  {
489  FW_ASSERT(
490  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
491  static_cast<FwAssertArgType>(portNum)
492  );
493 
494  this->m_bufferSendOut_OutputPort[portNum].registerSerialPort(port);
495  }
496 
499  FwIndexType portNum,
500  Fw::InputSerializePort* port
501  )
502  {
503  FW_ASSERT(
504  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
505  static_cast<FwAssertArgType>(portNum)
506  );
507 
508  this->m_fileAnnounce_OutputPort[portNum].registerSerialPort(port);
509  }
510 
513  FwIndexType portNum,
514  Fw::InputSerializePort* port
515  )
516  {
517  FW_ASSERT(
518  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
519  static_cast<FwAssertArgType>(portNum)
520  );
521 
522  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
523  }
524 
525 #endif
526 
527  // ----------------------------------------------------------------------
528  // Component construction and destruction
529  // ----------------------------------------------------------------------
530 
532  FileUplinkComponentBase(const char* compName) :
533  Fw::ActiveComponentBase(compName)
534  {
535  this->m_FileWriteErrorThrottle = 0;
536  this->m_InvalidReceiveModeThrottle = 0;
537  this->m_PacketOutOfBoundsThrottle = 0;
538  this->m_PacketOutOfOrderThrottle = 0;
539  this->m_PacketDuplicateThrottle = 0;
540  }
541 
544  {
545 
546  }
547 
548  // ----------------------------------------------------------------------
549  // Connection status queries for special output ports
550  // ----------------------------------------------------------------------
551 
552 #if FW_ENABLE_TEXT_LOGGING == 1
553 
554  bool FileUplinkComponentBase ::
555  isConnected_LogText_OutputPort(FwIndexType portNum)
556  {
557  FW_ASSERT(
558  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
559  static_cast<FwAssertArgType>(portNum)
560  );
561 
562  return this->m_LogText_OutputPort[portNum].isConnected();
563  }
564 
565 #endif
566 
569  {
570  FW_ASSERT(
571  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
572  static_cast<FwAssertArgType>(portNum)
573  );
574 
575  return this->m_eventOut_OutputPort[portNum].isConnected();
576  }
577 
580  {
581  FW_ASSERT(
582  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
583  static_cast<FwAssertArgType>(portNum)
584  );
585 
586  return this->m_timeCaller_OutputPort[portNum].isConnected();
587  }
588 
591  {
592  FW_ASSERT(
593  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
594  static_cast<FwAssertArgType>(portNum)
595  );
596 
597  return this->m_tlmOut_OutputPort[portNum].isConnected();
598  }
599 
600  // ----------------------------------------------------------------------
601  // Connection status queries for typed output ports
602  // ----------------------------------------------------------------------
603 
606  {
607  FW_ASSERT(
608  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
609  static_cast<FwAssertArgType>(portNum)
610  );
611 
612  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
613  }
614 
617  {
618  FW_ASSERT(
619  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
620  static_cast<FwAssertArgType>(portNum)
621  );
622 
623  return this->m_fileAnnounce_OutputPort[portNum].isConnected();
624  }
625 
628  {
629  FW_ASSERT(
630  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
631  static_cast<FwAssertArgType>(portNum)
632  );
633 
634  return this->m_pingOut_OutputPort[portNum].isConnected();
635  }
636 
637  // ----------------------------------------------------------------------
638  // Port handler base-class functions for typed input ports
639  //
640  // Call these functions directly to bypass the corresponding ports
641  // ----------------------------------------------------------------------
642 
645  FwIndexType portNum,
646  Fw::Buffer& fwBuffer
647  )
648  {
649  // Make sure port number is valid
650  FW_ASSERT(
651  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
652  static_cast<FwAssertArgType>(portNum)
653  );
654 
655  // Call pre-message hook
657  portNum,
658  fwBuffer
659  );
660  ComponentIpcSerializableBuffer msg;
662 
663  // Serialize message ID
664  _status = msg.serializeFrom(
665  static_cast<FwEnumStoreType>(BUFFERSENDIN_BUFFERSEND)
666  );
667  FW_ASSERT(
668  _status == Fw::FW_SERIALIZE_OK,
669  static_cast<FwAssertArgType>(_status)
670  );
671 
672  // Serialize port number
673  _status = msg.serializeFrom(portNum);
674  FW_ASSERT(
675  _status == Fw::FW_SERIALIZE_OK,
676  static_cast<FwAssertArgType>(_status)
677  );
678 
679  // Serialize argument fwBuffer
680  _status = msg.serializeFrom(fwBuffer);
681  FW_ASSERT(
682  _status == Fw::FW_SERIALIZE_OK,
683  static_cast<FwAssertArgType>(_status)
684  );
685 
686  // Send message
688  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
689 
690  FW_ASSERT(
691  qStatus == Os::Queue::OP_OK,
692  static_cast<FwAssertArgType>(qStatus)
693  );
694  }
695 
698  FwIndexType portNum,
699  U32 key
700  )
701  {
702  // Make sure port number is valid
703  FW_ASSERT(
704  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
705  static_cast<FwAssertArgType>(portNum)
706  );
707 
708  // Call pre-message hook
710  portNum,
711  key
712  );
713  ComponentIpcSerializableBuffer msg;
715 
716  // Serialize message ID
717  _status = msg.serializeFrom(
718  static_cast<FwEnumStoreType>(PINGIN_PING)
719  );
720  FW_ASSERT(
721  _status == Fw::FW_SERIALIZE_OK,
722  static_cast<FwAssertArgType>(_status)
723  );
724 
725  // Serialize port number
726  _status = msg.serializeFrom(portNum);
727  FW_ASSERT(
728  _status == Fw::FW_SERIALIZE_OK,
729  static_cast<FwAssertArgType>(_status)
730  );
731 
732  // Serialize argument key
733  _status = msg.serializeFrom(key);
734  FW_ASSERT(
735  _status == Fw::FW_SERIALIZE_OK,
736  static_cast<FwAssertArgType>(_status)
737  );
738 
739  // Send message
741  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
742 
743  FW_ASSERT(
744  qStatus == Os::Queue::OP_OK,
745  static_cast<FwAssertArgType>(qStatus)
746  );
747  }
748 
749  // ----------------------------------------------------------------------
750  // Pre-message hooks for typed async input ports
751  //
752  // Each of these functions is invoked just before processing a message
753  // on the corresponding port. By default, they do nothing. You can
754  // override them to provide specific pre-message behavior.
755  // ----------------------------------------------------------------------
756 
759  FwIndexType portNum,
760  Fw::Buffer& fwBuffer
761  )
762  {
763  // Default: no-op
764  }
765 
768  FwIndexType portNum,
769  U32 key
770  )
771  {
772  // Default: no-op
773  }
774 
775  // ----------------------------------------------------------------------
776  // Invocation functions for typed output ports
777  // ----------------------------------------------------------------------
778 
781  FwIndexType portNum,
782  Fw::Buffer& fwBuffer
783  )
784  {
785  FW_ASSERT(
786  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
787  static_cast<FwAssertArgType>(portNum)
788  );
789 
790  FW_ASSERT(
791  this->m_bufferSendOut_OutputPort[portNum].isConnected(),
792  static_cast<FwAssertArgType>(portNum)
793  );
794  this->m_bufferSendOut_OutputPort[portNum].invoke(
795  fwBuffer
796  );
797  }
798 
801  FwIndexType portNum,
802  Fw::StringBase& file_name
803  )
804  {
805  FW_ASSERT(
806  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
807  static_cast<FwAssertArgType>(portNum)
808  );
809 
810  FW_ASSERT(
811  this->m_fileAnnounce_OutputPort[portNum].isConnected(),
812  static_cast<FwAssertArgType>(portNum)
813  );
814  this->m_fileAnnounce_OutputPort[portNum].invoke(
815  file_name
816  );
817  }
818 
821  FwIndexType portNum,
822  U32 key
823  )
824  {
825  FW_ASSERT(
826  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
827  static_cast<FwAssertArgType>(portNum)
828  );
829 
830  FW_ASSERT(
831  this->m_pingOut_OutputPort[portNum].isConnected(),
832  static_cast<FwAssertArgType>(portNum)
833  );
834  this->m_pingOut_OutputPort[portNum].invoke(
835  key
836  );
837  }
838 
839  // ----------------------------------------------------------------------
840  // Event logging functions
841  // ----------------------------------------------------------------------
842 
845  const Fw::StringBase& fileName,
846  U32 computed,
847  U32 read
848  ) const
849  {
850  // Get the time
851  Fw::Time _logTime;
852  if (this->m_timeCaller_OutputPort[0].isConnected()) {
853  this->m_timeCaller_OutputPort[0].invoke(_logTime);
854  }
855 
856  FwEventIdType _id = static_cast<FwEventIdType>(0);
857 
858  _id = this->getIdBase() + EVENTID_BADCHECKSUM;
859 
860  // Emit the event on the log port
861  if (this->m_eventOut_OutputPort[0].isConnected()) {
862  Fw::LogBuffer _logBuff;
864 
865 #if FW_AMPCS_COMPATIBLE
866  // Serialize the number of arguments
867  _status = _logBuff.serializeFrom(static_cast<U8>(3));
868  FW_ASSERT(
869  _status == Fw::FW_SERIALIZE_OK,
870  static_cast<FwAssertArgType>(_status)
871  );
872 #endif
873 
874  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
875  FW_ASSERT(
876  _status == Fw::FW_SERIALIZE_OK,
877  static_cast<FwAssertArgType>(_status)
878  );
879 
880 #if FW_AMPCS_COMPATIBLE
881  // Serialize the argument size
882  _status = _logBuff.serializeFrom(
883  static_cast<U8>(sizeof(U32))
884  );
885  FW_ASSERT(
886  _status == Fw::FW_SERIALIZE_OK,
887  static_cast<FwAssertArgType>(_status)
888  );
889 #endif
890  _status = _logBuff.serializeFrom(computed);
891  FW_ASSERT(
892  _status == Fw::FW_SERIALIZE_OK,
893  static_cast<FwAssertArgType>(_status)
894  );
895 
896 #if FW_AMPCS_COMPATIBLE
897  // Serialize the argument size
898  _status = _logBuff.serializeFrom(
899  static_cast<U8>(sizeof(U32))
900  );
901  FW_ASSERT(
902  _status == Fw::FW_SERIALIZE_OK,
903  static_cast<FwAssertArgType>(_status)
904  );
905 #endif
906  _status = _logBuff.serializeFrom(read);
907  FW_ASSERT(
908  _status == Fw::FW_SERIALIZE_OK,
909  static_cast<FwAssertArgType>(_status)
910  );
911 
912  this->m_eventOut_OutputPort[0].invoke(
913  _id,
914  _logTime,
916  _logBuff
917  );
918  }
919 
920  // Emit the event on the text log port
921 #if FW_ENABLE_TEXT_LOGGING
922  if (this->m_LogText_OutputPort[0].isConnected()) {
923 #if FW_OBJECT_NAMES == 1
924  const char* _formatString =
925  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
926 #else
927  const char* _formatString =
928  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
929 #endif
930 
931  Fw::TextLogString _logString;
932  _logString.format(
933  _formatString,
934 #if FW_OBJECT_NAMES == 1
935  this->m_objName.toChar(),
936 #endif
937  "BadChecksum ",
938  fileName.toChar(),
939  computed,
940  read
941  );
942 
943  this->m_LogText_OutputPort[0].invoke(
944  _id,
945  _logTime,
947  _logString
948  );
949  }
950 #endif
951  }
952 
955  {
956  // Get the time
957  Fw::Time _logTime;
958  if (this->m_timeCaller_OutputPort[0].isConnected()) {
959  this->m_timeCaller_OutputPort[0].invoke(_logTime);
960  }
961 
962  FwEventIdType _id = static_cast<FwEventIdType>(0);
963 
964  _id = this->getIdBase() + EVENTID_FILEOPENERROR;
965 
966  // Emit the event on the log port
967  if (this->m_eventOut_OutputPort[0].isConnected()) {
968  Fw::LogBuffer _logBuff;
970 
971 #if FW_AMPCS_COMPATIBLE
972  // Serialize the number of arguments
973  _status = _logBuff.serializeFrom(static_cast<U8>(1));
974  FW_ASSERT(
975  _status == Fw::FW_SERIALIZE_OK,
976  static_cast<FwAssertArgType>(_status)
977  );
978 #endif
979 
980  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
981  FW_ASSERT(
982  _status == Fw::FW_SERIALIZE_OK,
983  static_cast<FwAssertArgType>(_status)
984  );
985 
986  this->m_eventOut_OutputPort[0].invoke(
987  _id,
988  _logTime,
990  _logBuff
991  );
992  }
993 
994  // Emit the event on the text log port
995 #if FW_ENABLE_TEXT_LOGGING
996  if (this->m_LogText_OutputPort[0].isConnected()) {
997 #if FW_OBJECT_NAMES == 1
998  const char* _formatString =
999  "(%s) %s: Could not open file %s";
1000 #else
1001  const char* _formatString =
1002  "%s: Could not open file %s";
1003 #endif
1004 
1005  Fw::TextLogString _logString;
1006  _logString.format(
1007  _formatString,
1008 #if FW_OBJECT_NAMES == 1
1009  this->m_objName.toChar(),
1010 #endif
1011  "FileOpenError ",
1012  fileName.toChar()
1013  );
1014 
1015  this->m_LogText_OutputPort[0].invoke(
1016  _id,
1017  _logTime,
1019  _logString
1020  );
1021  }
1022 #endif
1023  }
1024 
1027  {
1028  // Get the time
1029  Fw::Time _logTime;
1030  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1031  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1032  }
1033 
1034  FwEventIdType _id = static_cast<FwEventIdType>(0);
1035 
1036  _id = this->getIdBase() + EVENTID_FILERECEIVED;
1037 
1038  // Emit the event on the log port
1039  if (this->m_eventOut_OutputPort[0].isConnected()) {
1040  Fw::LogBuffer _logBuff;
1042 
1043 #if FW_AMPCS_COMPATIBLE
1044  // Serialize the number of arguments
1045  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1046  FW_ASSERT(
1047  _status == Fw::FW_SERIALIZE_OK,
1048  static_cast<FwAssertArgType>(_status)
1049  );
1050 #endif
1051 
1052  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1053  FW_ASSERT(
1054  _status == Fw::FW_SERIALIZE_OK,
1055  static_cast<FwAssertArgType>(_status)
1056  );
1057 
1058  this->m_eventOut_OutputPort[0].invoke(
1059  _id,
1060  _logTime,
1062  _logBuff
1063  );
1064  }
1065 
1066  // Emit the event on the text log port
1067 #if FW_ENABLE_TEXT_LOGGING
1068  if (this->m_LogText_OutputPort[0].isConnected()) {
1069 #if FW_OBJECT_NAMES == 1
1070  const char* _formatString =
1071  "(%s) %s: Received file %s";
1072 #else
1073  const char* _formatString =
1074  "%s: Received file %s";
1075 #endif
1076 
1077  Fw::TextLogString _logString;
1078  _logString.format(
1079  _formatString,
1080 #if FW_OBJECT_NAMES == 1
1081  this->m_objName.toChar(),
1082 #endif
1083  "FileReceived ",
1084  fileName.toChar()
1085  );
1086 
1087  this->m_LogText_OutputPort[0].invoke(
1088  _id,
1089  _logTime,
1091  _logString
1092  );
1093  }
1094 #endif
1095  }
1096 
1099  {
1100  // Check throttle value
1101  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1102  return;
1103  }
1104  else {
1105  this->m_FileWriteErrorThrottle++;
1106  }
1107 
1108  // Get the time
1109  Fw::Time _logTime;
1110  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1111  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1112  }
1113 
1114  FwEventIdType _id = static_cast<FwEventIdType>(0);
1115 
1116  _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1117 
1118  // Emit the event on the log port
1119  if (this->m_eventOut_OutputPort[0].isConnected()) {
1120  Fw::LogBuffer _logBuff;
1122 
1123 #if FW_AMPCS_COMPATIBLE
1124  // Serialize the number of arguments
1125  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1126  FW_ASSERT(
1127  _status == Fw::FW_SERIALIZE_OK,
1128  static_cast<FwAssertArgType>(_status)
1129  );
1130 #endif
1131 
1132  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1133  FW_ASSERT(
1134  _status == Fw::FW_SERIALIZE_OK,
1135  static_cast<FwAssertArgType>(_status)
1136  );
1137 
1138  this->m_eventOut_OutputPort[0].invoke(
1139  _id,
1140  _logTime,
1142  _logBuff
1143  );
1144  }
1145 
1146  // Emit the event on the text log port
1147 #if FW_ENABLE_TEXT_LOGGING
1148  if (this->m_LogText_OutputPort[0].isConnected()) {
1149 #if FW_OBJECT_NAMES == 1
1150  const char* _formatString =
1151  "(%s) %s: Could not write to file %s";
1152 #else
1153  const char* _formatString =
1154  "%s: Could not write to file %s";
1155 #endif
1156 
1157  Fw::TextLogString _logString;
1158  _logString.format(
1159  _formatString,
1160 #if FW_OBJECT_NAMES == 1
1161  this->m_objName.toChar(),
1162 #endif
1163  "FileWriteError ",
1164  fileName.toChar()
1165  );
1166 
1167  this->m_LogText_OutputPort[0].invoke(
1168  _id,
1169  _logTime,
1171  _logString
1172  );
1173  }
1174 #endif
1175  }
1176 
1179  FwPacketDescriptorType packetType,
1180  U32 mode
1181  )
1182  {
1183  // Check throttle value
1184  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1185  return;
1186  }
1187  else {
1188  this->m_InvalidReceiveModeThrottle++;
1189  }
1190 
1191  // Get the time
1192  Fw::Time _logTime;
1193  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1194  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1195  }
1196 
1197  FwEventIdType _id = static_cast<FwEventIdType>(0);
1198 
1199  _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1200 
1201  // Emit the event on the log port
1202  if (this->m_eventOut_OutputPort[0].isConnected()) {
1203  Fw::LogBuffer _logBuff;
1205 
1206 #if FW_AMPCS_COMPATIBLE
1207  // Serialize the number of arguments
1208  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1209  FW_ASSERT(
1210  _status == Fw::FW_SERIALIZE_OK,
1211  static_cast<FwAssertArgType>(_status)
1212  );
1213 #endif
1214 
1215 #if FW_AMPCS_COMPATIBLE
1216  // Serialize the argument size
1217  _status = _logBuff.serializeFrom(
1218  static_cast<U8>(sizeof(FwPacketDescriptorType))
1219  );
1220  FW_ASSERT(
1221  _status == Fw::FW_SERIALIZE_OK,
1222  static_cast<FwAssertArgType>(_status)
1223  );
1224 #endif
1225  _status = _logBuff.serializeFrom(packetType);
1226  FW_ASSERT(
1227  _status == Fw::FW_SERIALIZE_OK,
1228  static_cast<FwAssertArgType>(_status)
1229  );
1230 
1231 #if FW_AMPCS_COMPATIBLE
1232  // Serialize the argument size
1233  _status = _logBuff.serializeFrom(
1234  static_cast<U8>(sizeof(U32))
1235  );
1236  FW_ASSERT(
1237  _status == Fw::FW_SERIALIZE_OK,
1238  static_cast<FwAssertArgType>(_status)
1239  );
1240 #endif
1241  _status = _logBuff.serializeFrom(mode);
1242  FW_ASSERT(
1243  _status == Fw::FW_SERIALIZE_OK,
1244  static_cast<FwAssertArgType>(_status)
1245  );
1246 
1247  this->m_eventOut_OutputPort[0].invoke(
1248  _id,
1249  _logTime,
1251  _logBuff
1252  );
1253  }
1254 
1255  // Emit the event on the text log port
1256 #if FW_ENABLE_TEXT_LOGGING
1257  if (this->m_LogText_OutputPort[0].isConnected()) {
1258 #if FW_OBJECT_NAMES == 1
1259  const char* _formatString =
1260  "(%s) %s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1261 #else
1262  const char* _formatString =
1263  "%s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1264 #endif
1265 
1266  Fw::TextLogString _logString;
1267  _logString.format(
1268  _formatString,
1269 #if FW_OBJECT_NAMES == 1
1270  this->m_objName.toChar(),
1271 #endif
1272  "InvalidReceiveMode ",
1273  packetType,
1274  mode
1275  );
1276 
1277  this->m_LogText_OutputPort[0].invoke(
1278  _id,
1279  _logTime,
1281  _logString
1282  );
1283  }
1284 #endif
1285  }
1286 
1289  U32 packetIndex,
1290  const Fw::StringBase& fileName
1291  )
1292  {
1293  // Check throttle value
1294  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1295  return;
1296  }
1297  else {
1298  this->m_PacketOutOfBoundsThrottle++;
1299  }
1300 
1301  // Get the time
1302  Fw::Time _logTime;
1303  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1304  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1305  }
1306 
1307  FwEventIdType _id = static_cast<FwEventIdType>(0);
1308 
1309  _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1310 
1311  // Emit the event on the log port
1312  if (this->m_eventOut_OutputPort[0].isConnected()) {
1313  Fw::LogBuffer _logBuff;
1315 
1316 #if FW_AMPCS_COMPATIBLE
1317  // Serialize the number of arguments
1318  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1319  FW_ASSERT(
1320  _status == Fw::FW_SERIALIZE_OK,
1321  static_cast<FwAssertArgType>(_status)
1322  );
1323 #endif
1324 
1325 #if FW_AMPCS_COMPATIBLE
1326  // Serialize the argument size
1327  _status = _logBuff.serializeFrom(
1328  static_cast<U8>(sizeof(U32))
1329  );
1330  FW_ASSERT(
1331  _status == Fw::FW_SERIALIZE_OK,
1332  static_cast<FwAssertArgType>(_status)
1333  );
1334 #endif
1335  _status = _logBuff.serializeFrom(packetIndex);
1336  FW_ASSERT(
1337  _status == Fw::FW_SERIALIZE_OK,
1338  static_cast<FwAssertArgType>(_status)
1339  );
1340 
1341  _status = fileName.serializeTo(_logBuff, FW_MIN(FW_LOG_STRING_MAX_SIZE, 40));
1342  FW_ASSERT(
1343  _status == Fw::FW_SERIALIZE_OK,
1344  static_cast<FwAssertArgType>(_status)
1345  );
1346 
1347  this->m_eventOut_OutputPort[0].invoke(
1348  _id,
1349  _logTime,
1351  _logBuff
1352  );
1353  }
1354 
1355  // Emit the event on the text log port
1356 #if FW_ENABLE_TEXT_LOGGING
1357  if (this->m_LogText_OutputPort[0].isConnected()) {
1358 #if FW_OBJECT_NAMES == 1
1359  const char* _formatString =
1360  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1361 #else
1362  const char* _formatString =
1363  "%s: Packet %" PRIu32 " out of bounds for file %s";
1364 #endif
1365 
1366  Fw::TextLogString _logString;
1367  _logString.format(
1368  _formatString,
1369 #if FW_OBJECT_NAMES == 1
1370  this->m_objName.toChar(),
1371 #endif
1372  "PacketOutOfBounds ",
1373  packetIndex,
1374  fileName.toChar()
1375  );
1376 
1377  this->m_LogText_OutputPort[0].invoke(
1378  _id,
1379  _logTime,
1381  _logString
1382  );
1383  }
1384 #endif
1385  }
1386 
1389  U32 packetIndex,
1390  U32 lastPacketIndex
1391  )
1392  {
1393  // Check throttle value
1394  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1395  return;
1396  }
1397  else {
1398  this->m_PacketOutOfOrderThrottle++;
1399  }
1400 
1401  // Get the time
1402  Fw::Time _logTime;
1403  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1404  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1405  }
1406 
1407  FwEventIdType _id = static_cast<FwEventIdType>(0);
1408 
1409  _id = this->getIdBase() + EVENTID_PACKETOUTOFORDER;
1410 
1411  // Emit the event on the log port
1412  if (this->m_eventOut_OutputPort[0].isConnected()) {
1413  Fw::LogBuffer _logBuff;
1415 
1416 #if FW_AMPCS_COMPATIBLE
1417  // Serialize the number of arguments
1418  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1419  FW_ASSERT(
1420  _status == Fw::FW_SERIALIZE_OK,
1421  static_cast<FwAssertArgType>(_status)
1422  );
1423 #endif
1424 
1425 #if FW_AMPCS_COMPATIBLE
1426  // Serialize the argument size
1427  _status = _logBuff.serializeFrom(
1428  static_cast<U8>(sizeof(U32))
1429  );
1430  FW_ASSERT(
1431  _status == Fw::FW_SERIALIZE_OK,
1432  static_cast<FwAssertArgType>(_status)
1433  );
1434 #endif
1435  _status = _logBuff.serializeFrom(packetIndex);
1436  FW_ASSERT(
1437  _status == Fw::FW_SERIALIZE_OK,
1438  static_cast<FwAssertArgType>(_status)
1439  );
1440 
1441 #if FW_AMPCS_COMPATIBLE
1442  // Serialize the argument size
1443  _status = _logBuff.serializeFrom(
1444  static_cast<U8>(sizeof(U32))
1445  );
1446  FW_ASSERT(
1447  _status == Fw::FW_SERIALIZE_OK,
1448  static_cast<FwAssertArgType>(_status)
1449  );
1450 #endif
1451  _status = _logBuff.serializeFrom(lastPacketIndex);
1452  FW_ASSERT(
1453  _status == Fw::FW_SERIALIZE_OK,
1454  static_cast<FwAssertArgType>(_status)
1455  );
1456 
1457  this->m_eventOut_OutputPort[0].invoke(
1458  _id,
1459  _logTime,
1461  _logBuff
1462  );
1463  }
1464 
1465  // Emit the event on the text log port
1466 #if FW_ENABLE_TEXT_LOGGING
1467  if (this->m_LogText_OutputPort[0].isConnected()) {
1468 #if FW_OBJECT_NAMES == 1
1469  const char* _formatString =
1470  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1471 #else
1472  const char* _formatString =
1473  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1474 #endif
1475 
1476  Fw::TextLogString _logString;
1477  _logString.format(
1478  _formatString,
1479 #if FW_OBJECT_NAMES == 1
1480  this->m_objName.toChar(),
1481 #endif
1482  "PacketOutOfOrder ",
1483  packetIndex,
1484  lastPacketIndex
1485  );
1486 
1487  this->m_LogText_OutputPort[0].invoke(
1488  _id,
1489  _logTime,
1491  _logString
1492  );
1493  }
1494 #endif
1495  }
1496 
1499  {
1500  // Check throttle value
1501  if (this->m_PacketDuplicateThrottle >= EVENTID_PACKETDUPLICATE_THROTTLE) {
1502  return;
1503  }
1504  else {
1505  this->m_PacketDuplicateThrottle++;
1506  }
1507 
1508  // Get the time
1509  Fw::Time _logTime;
1510  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1511  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1512  }
1513 
1514  FwEventIdType _id = static_cast<FwEventIdType>(0);
1515 
1516  _id = this->getIdBase() + EVENTID_PACKETDUPLICATE;
1517 
1518  // Emit the event on the log port
1519  if (this->m_eventOut_OutputPort[0].isConnected()) {
1520  Fw::LogBuffer _logBuff;
1522 
1523 #if FW_AMPCS_COMPATIBLE
1524  // Serialize the number of arguments
1525  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1526  FW_ASSERT(
1527  _status == Fw::FW_SERIALIZE_OK,
1528  static_cast<FwAssertArgType>(_status)
1529  );
1530 #endif
1531 
1532 #if FW_AMPCS_COMPATIBLE
1533  // Serialize the argument size
1534  _status = _logBuff.serializeFrom(
1535  static_cast<U8>(sizeof(U32))
1536  );
1537  FW_ASSERT(
1538  _status == Fw::FW_SERIALIZE_OK,
1539  static_cast<FwAssertArgType>(_status)
1540  );
1541 #endif
1542  _status = _logBuff.serializeFrom(packetIndex);
1543  FW_ASSERT(
1544  _status == Fw::FW_SERIALIZE_OK,
1545  static_cast<FwAssertArgType>(_status)
1546  );
1547 
1548  this->m_eventOut_OutputPort[0].invoke(
1549  _id,
1550  _logTime,
1552  _logBuff
1553  );
1554  }
1555 
1556  // Emit the event on the text log port
1557 #if FW_ENABLE_TEXT_LOGGING
1558  if (this->m_LogText_OutputPort[0].isConnected()) {
1559 #if FW_OBJECT_NAMES == 1
1560  const char* _formatString =
1561  "(%s) %s: Received a duplicate of packet %" PRIu32 "";
1562 #else
1563  const char* _formatString =
1564  "%s: Received a duplicate of packet %" PRIu32 "";
1565 #endif
1566 
1567  Fw::TextLogString _logString;
1568  _logString.format(
1569  _formatString,
1570 #if FW_OBJECT_NAMES == 1
1571  this->m_objName.toChar(),
1572 #endif
1573  "PacketDuplicate ",
1574  packetIndex
1575  );
1576 
1577  this->m_LogText_OutputPort[0].invoke(
1578  _id,
1579  _logTime,
1581  _logString
1582  );
1583  }
1584 #endif
1585  }
1586 
1589  {
1590  // Get the time
1591  Fw::Time _logTime;
1592  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1593  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1594  }
1595 
1596  FwEventIdType _id = static_cast<FwEventIdType>(0);
1597 
1598  _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1599 
1600  // Emit the event on the log port
1601  if (this->m_eventOut_OutputPort[0].isConnected()) {
1602  Fw::LogBuffer _logBuff;
1603 
1604 #if FW_AMPCS_COMPATIBLE
1606  // Serialize the number of arguments
1607  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1608  FW_ASSERT(
1609  _status == Fw::FW_SERIALIZE_OK,
1610  static_cast<FwAssertArgType>(_status)
1611  );
1612 #endif
1613 
1614  this->m_eventOut_OutputPort[0].invoke(
1615  _id,
1616  _logTime,
1618  _logBuff
1619  );
1620  }
1621 
1622  // Emit the event on the text log port
1623 #if FW_ENABLE_TEXT_LOGGING
1624  if (this->m_LogText_OutputPort[0].isConnected()) {
1625 #if FW_OBJECT_NAMES == 1
1626  const char* _formatString =
1627  "(%s) %s: Received CANCEL packet";
1628 #else
1629  const char* _formatString =
1630  "%s: Received CANCEL packet";
1631 #endif
1632 
1633  Fw::TextLogString _logString;
1634  _logString.format(
1635  _formatString,
1636 #if FW_OBJECT_NAMES == 1
1637  this->m_objName.toChar(),
1638 #endif
1639  "UplinkCanceled "
1640  );
1641 
1642  this->m_LogText_OutputPort[0].invoke(
1643  _id,
1644  _logTime,
1646  _logString
1647  );
1648  }
1649 #endif
1650  }
1651 
1654  {
1655  // Get the time
1656  Fw::Time _logTime;
1657  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1658  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1659  }
1660 
1661  FwEventIdType _id = static_cast<FwEventIdType>(0);
1662 
1663  _id = this->getIdBase() + EVENTID_DECODEERROR;
1664 
1665  // Emit the event on the log port
1666  if (this->m_eventOut_OutputPort[0].isConnected()) {
1667  Fw::LogBuffer _logBuff;
1669 
1670 #if FW_AMPCS_COMPATIBLE
1671  // Serialize the number of arguments
1672  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1673  FW_ASSERT(
1674  _status == Fw::FW_SERIALIZE_OK,
1675  static_cast<FwAssertArgType>(_status)
1676  );
1677 #endif
1678 
1679 #if FW_AMPCS_COMPATIBLE
1680  // Serialize the argument size
1681  _status = _logBuff.serializeFrom(
1682  static_cast<U8>(sizeof(I32))
1683  );
1684  FW_ASSERT(
1685  _status == Fw::FW_SERIALIZE_OK,
1686  static_cast<FwAssertArgType>(_status)
1687  );
1688 #endif
1689  _status = _logBuff.serializeFrom(status);
1690  FW_ASSERT(
1691  _status == Fw::FW_SERIALIZE_OK,
1692  static_cast<FwAssertArgType>(_status)
1693  );
1694 
1695  this->m_eventOut_OutputPort[0].invoke(
1696  _id,
1697  _logTime,
1699  _logBuff
1700  );
1701  }
1702 
1703  // Emit the event on the text log port
1704 #if FW_ENABLE_TEXT_LOGGING
1705  if (this->m_LogText_OutputPort[0].isConnected()) {
1706 #if FW_OBJECT_NAMES == 1
1707  const char* _formatString =
1708  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1709 #else
1710  const char* _formatString =
1711  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1712 #endif
1713 
1714  Fw::TextLogString _logString;
1715  _logString.format(
1716  _formatString,
1717 #if FW_OBJECT_NAMES == 1
1718  this->m_objName.toChar(),
1719 #endif
1720  "DecodeError ",
1721  status
1722  );
1723 
1724  this->m_LogText_OutputPort[0].invoke(
1725  _id,
1726  _logTime,
1728  _logString
1729  );
1730  }
1731 #endif
1732  }
1733 
1736  {
1737  // Get the time
1738  Fw::Time _logTime;
1739  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1740  this->m_timeCaller_OutputPort[0].invoke(_logTime);
1741  }
1742 
1743  FwEventIdType _id = static_cast<FwEventIdType>(0);
1744 
1745  _id = this->getIdBase() + EVENTID_INVALIDPACKETRECEIVED;
1746 
1747  // Emit the event on the log port
1748  if (this->m_eventOut_OutputPort[0].isConnected()) {
1749  Fw::LogBuffer _logBuff;
1751 
1752 #if FW_AMPCS_COMPATIBLE
1753  // Serialize the number of arguments
1754  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1755  FW_ASSERT(
1756  _status == Fw::FW_SERIALIZE_OK,
1757  static_cast<FwAssertArgType>(_status)
1758  );
1759 #endif
1760 
1761 #if FW_AMPCS_COMPATIBLE
1762  // Serialize the argument size
1763  _status = _logBuff.serializeFrom(
1764  static_cast<U8>(sizeof(FwPacketDescriptorType))
1765  );
1766  FW_ASSERT(
1767  _status == Fw::FW_SERIALIZE_OK,
1768  static_cast<FwAssertArgType>(_status)
1769  );
1770 #endif
1771  _status = _logBuff.serializeFrom(packetType);
1772  FW_ASSERT(
1773  _status == Fw::FW_SERIALIZE_OK,
1774  static_cast<FwAssertArgType>(_status)
1775  );
1776 
1777  this->m_eventOut_OutputPort[0].invoke(
1778  _id,
1779  _logTime,
1781  _logBuff
1782  );
1783  }
1784 
1785  // Emit the event on the text log port
1786 #if FW_ENABLE_TEXT_LOGGING
1787  if (this->m_LogText_OutputPort[0].isConnected()) {
1788 #if FW_OBJECT_NAMES == 1
1789  const char* _formatString =
1790  "(%s) %s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1791 #else
1792  const char* _formatString =
1793  "%s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1794 #endif
1795 
1796  Fw::TextLogString _logString;
1797  _logString.format(
1798  _formatString,
1799 #if FW_OBJECT_NAMES == 1
1800  this->m_objName.toChar(),
1801 #endif
1802  "InvalidPacketReceived ",
1803  packetType
1804  );
1805 
1806  this->m_LogText_OutputPort[0].invoke(
1807  _id,
1808  _logTime,
1810  _logString
1811  );
1812  }
1813 #endif
1814  }
1815 
1816  // ----------------------------------------------------------------------
1817  // Event throttle reset functions
1818  // ----------------------------------------------------------------------
1819 
1822  {
1823  // Reset throttle counter
1824  this->m_FileWriteErrorThrottle = 0;
1825  }
1826 
1829  {
1830  // Reset throttle counter
1831  this->m_InvalidReceiveModeThrottle = 0;
1832  }
1833 
1836  {
1837  // Reset throttle counter
1838  this->m_PacketOutOfBoundsThrottle = 0;
1839  }
1840 
1843  {
1844  // Reset throttle counter
1845  this->m_PacketOutOfOrderThrottle = 0;
1846  }
1847 
1850  {
1851  // Reset throttle counter
1852  this->m_PacketDuplicateThrottle = 0;
1853  }
1854 
1855  // ----------------------------------------------------------------------
1856  // Telemetry write functions
1857  // ----------------------------------------------------------------------
1858 
1861  U32 arg,
1862  Fw::Time _tlmTime
1863  ) const
1864  {
1865  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1866  if (
1867  this->m_timeCaller_OutputPort[0].isConnected() &&
1868  (_tlmTime == Fw::ZERO_TIME)
1869  ) {
1870  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1871  }
1872 
1873  Fw::TlmBuffer _tlmBuff;
1874  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1875  FW_ASSERT(
1876  _stat == Fw::FW_SERIALIZE_OK,
1877  static_cast<FwAssertArgType>(_stat)
1878  );
1879 
1880  FwChanIdType _id;
1881 
1882  _id = this->getIdBase() + CHANNELID_FILESRECEIVED;
1883 
1884  this->m_tlmOut_OutputPort[0].invoke(
1885  _id,
1886  _tlmTime,
1887  _tlmBuff
1888  );
1889  }
1890  }
1891 
1894  U32 arg,
1895  Fw::Time _tlmTime
1896  ) const
1897  {
1898  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1899  if (
1900  this->m_timeCaller_OutputPort[0].isConnected() &&
1901  (_tlmTime == Fw::ZERO_TIME)
1902  ) {
1903  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1904  }
1905 
1906  Fw::TlmBuffer _tlmBuff;
1907  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1908  FW_ASSERT(
1909  _stat == Fw::FW_SERIALIZE_OK,
1910  static_cast<FwAssertArgType>(_stat)
1911  );
1912 
1913  FwChanIdType _id;
1914 
1915  _id = this->getIdBase() + CHANNELID_PACKETSRECEIVED;
1916 
1917  this->m_tlmOut_OutputPort[0].invoke(
1918  _id,
1919  _tlmTime,
1920  _tlmBuff
1921  );
1922  }
1923  }
1924 
1927  U32 arg,
1928  Fw::Time _tlmTime
1929  ) const
1930  {
1931  if (this->m_tlmOut_OutputPort[0].isConnected()) {
1932  if (
1933  this->m_timeCaller_OutputPort[0].isConnected() &&
1934  (_tlmTime == Fw::ZERO_TIME)
1935  ) {
1936  this->m_timeCaller_OutputPort[0].invoke(_tlmTime);
1937  }
1938 
1939  Fw::TlmBuffer _tlmBuff;
1940  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1941  FW_ASSERT(
1942  _stat == Fw::FW_SERIALIZE_OK,
1943  static_cast<FwAssertArgType>(_stat)
1944  );
1945 
1946  FwChanIdType _id;
1947 
1948  _id = this->getIdBase() + CHANNELID_WARNINGS;
1949 
1950  this->m_tlmOut_OutputPort[0].invoke(
1951  _id,
1952  _tlmTime,
1953  _tlmBuff
1954  );
1955  }
1956  }
1957 
1958  // ----------------------------------------------------------------------
1959  // Time
1960  // ----------------------------------------------------------------------
1961 
1963  getTime() const
1964  {
1965  if (this->m_timeCaller_OutputPort[0].isConnected()) {
1966  Fw::Time _time;
1967  this->m_timeCaller_OutputPort[0].invoke(_time);
1968  return _time;
1969  }
1970  else {
1971  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1972  }
1973  }
1974 
1975  // ----------------------------------------------------------------------
1976  // Message dispatch functions
1977  // ----------------------------------------------------------------------
1978 
1979  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
1980  doDispatch()
1981  {
1982  ComponentIpcSerializableBuffer _msg;
1983  FwQueuePriorityType _priority = 0;
1984 
1985  Os::Queue::Status _msgStatus = this->m_queue.receive(
1986  _msg,
1988  _priority
1989  );
1990  FW_ASSERT(
1991  _msgStatus == Os::Queue::OP_OK,
1992  static_cast<FwAssertArgType>(_msgStatus)
1993  );
1994 
1995  // Reset to beginning of buffer
1996  _msg.resetDeser();
1997 
1998  FwEnumStoreType _desMsg = 0;
1999  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2000  FW_ASSERT(
2001  _deserStatus == Fw::FW_SERIALIZE_OK,
2002  static_cast<FwAssertArgType>(_deserStatus)
2003  );
2004 
2005  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2006 
2007  if (_msgType == FILEUPLINK_COMPONENT_EXIT) {
2008  return MSG_DISPATCH_EXIT;
2009  }
2010 
2011  FwIndexType portNum = 0;
2012  _deserStatus = _msg.deserializeTo(portNum);
2013  FW_ASSERT(
2014  _deserStatus == Fw::FW_SERIALIZE_OK,
2015  static_cast<FwAssertArgType>(_deserStatus)
2016  );
2017 
2018  switch (_msgType) {
2019  // Handle async input port bufferSendIn
2020  case BUFFERSENDIN_BUFFERSEND: {
2021  // Deserialize argument fwBuffer
2022  Fw::Buffer fwBuffer;
2023  _deserStatus = _msg.deserializeTo(fwBuffer);
2024  FW_ASSERT(
2025  _deserStatus == Fw::FW_SERIALIZE_OK,
2026  static_cast<FwAssertArgType>(_deserStatus)
2027  );
2028  // Call handler function
2029  this->bufferSendIn_handler(
2030  portNum,
2031  fwBuffer
2032  );
2033 
2034  break;
2035  }
2036 
2037  // Handle async input port pingIn
2038  case PINGIN_PING: {
2039  // Deserialize argument key
2040  U32 key;
2041  _deserStatus = _msg.deserializeTo(key);
2042  FW_ASSERT(
2043  _deserStatus == Fw::FW_SERIALIZE_OK,
2044  static_cast<FwAssertArgType>(_deserStatus)
2045  );
2046  // Call handler function
2047  this->pingIn_handler(
2048  portNum,
2049  key
2050  );
2051 
2052  break;
2053  }
2054 
2055  default:
2056  return MSG_DISPATCH_ERROR;
2057  }
2058 
2059  return MSG_DISPATCH_OK;
2060  }
2061 
2062  // ----------------------------------------------------------------------
2063  // Calls for messages received on typed input ports
2064  // ----------------------------------------------------------------------
2065 
2066  void FileUplinkComponentBase ::
2067  m_p_bufferSendIn_in(
2068  Fw::PassiveComponentBase* callComp,
2069  FwIndexType portNum,
2070  Fw::Buffer& fwBuffer
2071  )
2072  {
2073  FW_ASSERT(callComp);
2074  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
2075  compPtr->bufferSendIn_handlerBase(
2076  portNum,
2077  fwBuffer
2078  );
2079  }
2080 
2081  void FileUplinkComponentBase ::
2082  m_p_pingIn_in(
2083  Fw::PassiveComponentBase* callComp,
2084  FwIndexType portNum,
2085  U32 key
2086  )
2087  {
2088  FW_ASSERT(callComp);
2089  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
2090  compPtr->pingIn_handlerBase(
2091  portNum,
2092  key
2093  );
2094  }
2095 
2096 }
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.
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
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)
void addCallPort(InputFileAnnouncePort *callPort)
Register an input port.
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
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
The size of the serial representations of the port arguments.
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
A message was sent requesting an exit of the loop.
message to exit active component task
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void invoke(Fw::StringBase &file_name) const
Invoke a port interface.
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.
void init()
Initialization function.