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::BufferSendPortBuffer::CAPACITY];
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  ComponentIpcSerializableBuffer() : Fw::LinearBufferBase(m_buff, sizeof(m_buff)) {
48 
49  }
50 
51  private:
52  // Should be the max of all the input ports serialized sizes...
53  U8 m_buff[SERIALIZATION_SIZE];
54 
55  };
56  }
57 
58  // ----------------------------------------------------------------------
59  // Component initialization
60  // ----------------------------------------------------------------------
61 
64  FwSizeType queueDepth,
65  FwEnumStoreType instance
66  )
67  {
68  // Initialize base class
70 
71 #if !FW_DIRECT_PORT_CALLS
72  // Connect input port bufferSendIn
73  for (
74  FwIndexType port = 0;
75  port < static_cast<FwIndexType>(this->getNum_bufferSendIn_InputPorts());
76  port++
77  ) {
78  this->m_bufferSendIn_InputPort[port].init();
79  this->m_bufferSendIn_InputPort[port].addCallComp(
80  this,
81  m_p_bufferSendIn_in
82  );
83  this->m_bufferSendIn_InputPort[port].setPortNum(port);
84 
85 #if FW_OBJECT_NAMES == 1
86  Fw::ObjectName portName;
87  portName.format(
88  "%s_bufferSendIn_InputPort[%" PRI_FwIndexType "]",
89  this->m_objName.toChar(),
90  port
91  );
92  this->m_bufferSendIn_InputPort[port].setObjName(portName.toChar());
93 #endif
94  }
95 #endif
96 
97 #if !FW_DIRECT_PORT_CALLS
98  // Connect input port pingIn
99  for (
100  FwIndexType port = 0;
101  port < static_cast<FwIndexType>(this->getNum_pingIn_InputPorts());
102  port++
103  ) {
104  this->m_pingIn_InputPort[port].init();
105  this->m_pingIn_InputPort[port].addCallComp(
106  this,
107  m_p_pingIn_in
108  );
109  this->m_pingIn_InputPort[port].setPortNum(port);
110 
111 #if FW_OBJECT_NAMES == 1
112  Fw::ObjectName portName;
113  portName.format(
114  "%s_pingIn_InputPort[%" PRI_FwIndexType "]",
115  this->m_objName.toChar(),
116  port
117  );
118  this->m_pingIn_InputPort[port].setObjName(portName.toChar());
119 #endif
120  }
121 #endif
122 
123 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
124  // Connect output port LogText
125  for (
126  FwIndexType port = 0;
127  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
128  port++
129  ) {
130  this->m_LogText_OutputPort[port].init();
131 
132 #if FW_OBJECT_NAMES == 1
133  Fw::ObjectName portName;
134  portName.format(
135  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
136  this->m_objName.toChar(),
137  port
138  );
139  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
140 #endif
141  }
142 #endif
143 
144 #if !FW_DIRECT_PORT_CALLS
145  // Connect output port eventOut
146  for (
147  FwIndexType port = 0;
148  port < static_cast<FwIndexType>(this->getNum_eventOut_OutputPorts());
149  port++
150  ) {
151  this->m_eventOut_OutputPort[port].init();
152 
153 #if FW_OBJECT_NAMES == 1
154  Fw::ObjectName portName;
155  portName.format(
156  "%s_eventOut_OutputPort[%" PRI_FwIndexType "]",
157  this->m_objName.toChar(),
158  port
159  );
160  this->m_eventOut_OutputPort[port].setObjName(portName.toChar());
161 #endif
162  }
163 #endif
164 
165 #if !FW_DIRECT_PORT_CALLS
166  // Connect output port timeCaller
167  for (
168  FwIndexType port = 0;
169  port < static_cast<FwIndexType>(this->getNum_timeCaller_OutputPorts());
170  port++
171  ) {
172  this->m_timeCaller_OutputPort[port].init();
173 
174 #if FW_OBJECT_NAMES == 1
175  Fw::ObjectName portName;
176  portName.format(
177  "%s_timeCaller_OutputPort[%" PRI_FwIndexType "]",
178  this->m_objName.toChar(),
179  port
180  );
181  this->m_timeCaller_OutputPort[port].setObjName(portName.toChar());
182 #endif
183  }
184 #endif
185 
186 #if !FW_DIRECT_PORT_CALLS
187  // Connect output port tlmOut
188  for (
189  FwIndexType port = 0;
190  port < static_cast<FwIndexType>(this->getNum_tlmOut_OutputPorts());
191  port++
192  ) {
193  this->m_tlmOut_OutputPort[port].init();
194 
195 #if FW_OBJECT_NAMES == 1
196  Fw::ObjectName portName;
197  portName.format(
198  "%s_tlmOut_OutputPort[%" PRI_FwIndexType "]",
199  this->m_objName.toChar(),
200  port
201  );
202  this->m_tlmOut_OutputPort[port].setObjName(portName.toChar());
203 #endif
204  }
205 #endif
206 
207 #if !FW_DIRECT_PORT_CALLS
208  // Connect output port bufferSendOut
209  for (
210  FwIndexType port = 0;
211  port < static_cast<FwIndexType>(this->getNum_bufferSendOut_OutputPorts());
212  port++
213  ) {
214  this->m_bufferSendOut_OutputPort[port].init();
215 
216 #if FW_OBJECT_NAMES == 1
217  Fw::ObjectName portName;
218  portName.format(
219  "%s_bufferSendOut_OutputPort[%" PRI_FwIndexType "]",
220  this->m_objName.toChar(),
221  port
222  );
223  this->m_bufferSendOut_OutputPort[port].setObjName(portName.toChar());
224 #endif
225  }
226 #endif
227 
228 #if !FW_DIRECT_PORT_CALLS
229  // Connect output port fileAnnounce
230  for (
231  FwIndexType port = 0;
232  port < static_cast<FwIndexType>(this->getNum_fileAnnounce_OutputPorts());
233  port++
234  ) {
235  this->m_fileAnnounce_OutputPort[port].init();
236 
237 #if FW_OBJECT_NAMES == 1
238  Fw::ObjectName portName;
239  portName.format(
240  "%s_fileAnnounce_OutputPort[%" PRI_FwIndexType "]",
241  this->m_objName.toChar(),
242  port
243  );
244  this->m_fileAnnounce_OutputPort[port].setObjName(portName.toChar());
245 #endif
246  }
247 #endif
248 
249 #if !FW_DIRECT_PORT_CALLS
250  // Connect output port pingOut
251  for (
252  FwIndexType port = 0;
253  port < static_cast<FwIndexType>(this->getNum_pingOut_OutputPorts());
254  port++
255  ) {
256  this->m_pingOut_OutputPort[port].init();
257 
258 #if FW_OBJECT_NAMES == 1
259  Fw::ObjectName portName;
260  portName.format(
261  "%s_pingOut_OutputPort[%" PRI_FwIndexType "]",
262  this->m_objName.toChar(),
263  port
264  );
265  this->m_pingOut_OutputPort[port].setObjName(portName.toChar());
266 #endif
267  }
268 #endif
269 
270  // Create the queue
271  Os::Queue::Status qStat = this->createQueue(
272  queueDepth,
273  static_cast<FwSizeType>(ComponentIpcSerializableBuffer::SERIALIZATION_SIZE)
274  );
275  FW_ASSERT(
276  Os::Queue::Status::OP_OK == qStat,
277  static_cast<FwAssertArgType>(qStat)
278  );
279  }
280 
281 #if !FW_DIRECT_PORT_CALLS
282 
283  // ----------------------------------------------------------------------
284  // Getters for typed input ports
285  // ----------------------------------------------------------------------
286 
289  {
290  FW_ASSERT(
291  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
292  static_cast<FwAssertArgType>(portNum)
293  );
294 
295  return &this->m_bufferSendIn_InputPort[portNum];
296  }
297 
300  {
301  FW_ASSERT(
302  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
303  static_cast<FwAssertArgType>(portNum)
304  );
305 
306  return &this->m_pingIn_InputPort[portNum];
307  }
308 
309 #endif
310 
311 #if !FW_DIRECT_PORT_CALLS
312 
313  // ----------------------------------------------------------------------
314  // Connect input ports to special output ports
315  // ----------------------------------------------------------------------
316 
317 #if FW_ENABLE_TEXT_LOGGING == 1
318 
319  void FileUplinkComponentBase ::
320  set_LogText_OutputPort(
321  FwIndexType portNum,
323  )
324  {
325  FW_ASSERT(
326  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
327  static_cast<FwAssertArgType>(portNum)
328  );
329 
330  this->m_LogText_OutputPort[portNum].addCallPort(port);
331  }
332 
333 #endif
334 
337  FwIndexType portNum,
338  Fw::InputLogPort* port
339  )
340  {
341  FW_ASSERT(
342  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
343  static_cast<FwAssertArgType>(portNum)
344  );
345 
346  this->m_eventOut_OutputPort[portNum].addCallPort(port);
347  }
348 
351  FwIndexType portNum,
352  Fw::InputTimePort* port
353  )
354  {
355  FW_ASSERT(
356  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
357  static_cast<FwAssertArgType>(portNum)
358  );
359 
360  this->m_timeCaller_OutputPort[portNum].addCallPort(port);
361  }
362 
365  FwIndexType portNum,
366  Fw::InputTlmPort* port
367  )
368  {
369  FW_ASSERT(
370  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
371  static_cast<FwAssertArgType>(portNum)
372  );
373 
374  this->m_tlmOut_OutputPort[portNum].addCallPort(port);
375  }
376 
377 #endif
378 
379 #if !FW_DIRECT_PORT_CALLS
380 
381  // ----------------------------------------------------------------------
382  // Connect typed input ports to typed output ports
383  // ----------------------------------------------------------------------
384 
387  FwIndexType portNum,
389  )
390  {
391  FW_ASSERT(
392  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
393  static_cast<FwAssertArgType>(portNum)
394  );
395 
396  this->m_bufferSendOut_OutputPort[portNum].addCallPort(port);
397  }
398 
401  FwIndexType portNum,
403  )
404  {
405  FW_ASSERT(
406  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
407  static_cast<FwAssertArgType>(portNum)
408  );
409 
410  this->m_fileAnnounce_OutputPort[portNum].addCallPort(port);
411  }
412 
415  FwIndexType portNum,
416  Svc::InputPingPort* port
417  )
418  {
419  FW_ASSERT(
420  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
421  static_cast<FwAssertArgType>(portNum)
422  );
423 
424  this->m_pingOut_OutputPort[portNum].addCallPort(port);
425  }
426 
427 #endif
428 
429 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
430 
431  // ----------------------------------------------------------------------
432  // Connect serial input ports to special output ports
433  // ----------------------------------------------------------------------
434 
435 #if FW_ENABLE_TEXT_LOGGING == 1
436 
437  void FileUplinkComponentBase ::
438  set_LogText_OutputPort(
439  FwIndexType portNum,
440  Fw::InputSerializePort* port
441  )
442  {
443  FW_ASSERT(
444  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
445  static_cast<FwAssertArgType>(portNum)
446  );
447 
448  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
449  }
450 
451 #endif
452 
455  FwIndexType portNum,
456  Fw::InputSerializePort* port
457  )
458  {
459  FW_ASSERT(
460  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
461  static_cast<FwAssertArgType>(portNum)
462  );
463 
464  this->m_eventOut_OutputPort[portNum].registerSerialPort(port);
465  }
466 
469  FwIndexType portNum,
470  Fw::InputSerializePort* port
471  )
472  {
473  FW_ASSERT(
474  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
475  static_cast<FwAssertArgType>(portNum)
476  );
477 
478  this->m_timeCaller_OutputPort[portNum].registerSerialPort(port);
479  }
480 
483  FwIndexType portNum,
484  Fw::InputSerializePort* port
485  )
486  {
487  FW_ASSERT(
488  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
489  static_cast<FwAssertArgType>(portNum)
490  );
491 
492  this->m_tlmOut_OutputPort[portNum].registerSerialPort(port);
493  }
494 
495 #endif
496 
497 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
498 
499  // ----------------------------------------------------------------------
500  // Connect serial input ports to typed output ports
501  // ----------------------------------------------------------------------
502 
505  FwIndexType portNum,
506  Fw::InputSerializePort* port
507  )
508  {
509  FW_ASSERT(
510  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
511  static_cast<FwAssertArgType>(portNum)
512  );
513 
514  this->m_bufferSendOut_OutputPort[portNum].registerSerialPort(port);
515  }
516 
519  FwIndexType portNum,
520  Fw::InputSerializePort* port
521  )
522  {
523  FW_ASSERT(
524  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
525  static_cast<FwAssertArgType>(portNum)
526  );
527 
528  this->m_fileAnnounce_OutputPort[portNum].registerSerialPort(port);
529  }
530 
533  FwIndexType portNum,
534  Fw::InputSerializePort* port
535  )
536  {
537  FW_ASSERT(
538  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
539  static_cast<FwAssertArgType>(portNum)
540  );
541 
542  this->m_pingOut_OutputPort[portNum].registerSerialPort(port);
543  }
544 
545 #endif
546 
547  // ----------------------------------------------------------------------
548  // Component construction and destruction
549  // ----------------------------------------------------------------------
550 
552  FileUplinkComponentBase(const char* compName) :
553  Fw::ActiveComponentBase(compName)
554  {
555  this->m_FileWriteErrorThrottle = 0;
556  this->m_InvalidReceiveModeThrottle = 0;
557  this->m_PacketOutOfBoundsThrottle = 0;
558  this->m_PacketOutOfOrderThrottle = 0;
559  this->m_PacketDuplicateThrottle = 0;
560  }
561 
564  {
565 
566  }
567 
568 #if !FW_DIRECT_PORT_CALLS
569 
570  // ----------------------------------------------------------------------
571  // Connection status queries for special output ports
572  // ----------------------------------------------------------------------
573 
574 #if FW_ENABLE_TEXT_LOGGING == 1
575 
576  bool FileUplinkComponentBase ::
577  isConnected_LogText_OutputPort(FwIndexType portNum) const
578  {
579  FW_ASSERT(
580  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
581  static_cast<FwAssertArgType>(portNum)
582  );
583 
584  return this->m_LogText_OutputPort[portNum].isConnected();
585  }
586 
587 #endif
588 
591  {
592  FW_ASSERT(
593  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
594  static_cast<FwAssertArgType>(portNum)
595  );
596 
597  return this->m_eventOut_OutputPort[portNum].isConnected();
598  }
599 
602  {
603  FW_ASSERT(
604  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
605  static_cast<FwAssertArgType>(portNum)
606  );
607 
608  return this->m_timeCaller_OutputPort[portNum].isConnected();
609  }
610 
613  {
614  FW_ASSERT(
615  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
616  static_cast<FwAssertArgType>(portNum)
617  );
618 
619  return this->m_tlmOut_OutputPort[portNum].isConnected();
620  }
621 
622 #endif
623 
624 #if !FW_DIRECT_PORT_CALLS
625 
626  // ----------------------------------------------------------------------
627  // Connection status queries for typed output ports
628  // ----------------------------------------------------------------------
629 
632  {
633  FW_ASSERT(
634  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
635  static_cast<FwAssertArgType>(portNum)
636  );
637 
638  return this->m_bufferSendOut_OutputPort[portNum].isConnected();
639  }
640 
643  {
644  FW_ASSERT(
645  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
646  static_cast<FwAssertArgType>(portNum)
647  );
648 
649  return this->m_fileAnnounce_OutputPort[portNum].isConnected();
650  }
651 
654  {
655  FW_ASSERT(
656  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
657  static_cast<FwAssertArgType>(portNum)
658  );
659 
660  return this->m_pingOut_OutputPort[portNum].isConnected();
661  }
662 
663 #endif
664 
665  // ----------------------------------------------------------------------
666  // Port handler base-class functions for typed input ports
667  //
668  // Call these functions directly to bypass the corresponding ports
669  // ----------------------------------------------------------------------
670 
673  FwIndexType portNum,
674  Fw::Buffer& fwBuffer
675  )
676  {
677  // Make sure port number is valid
678  FW_ASSERT(
679  (0 <= portNum) && (portNum < this->getNum_bufferSendIn_InputPorts()),
680  static_cast<FwAssertArgType>(portNum)
681  );
682 
683  // Call pre-message hook
685  portNum,
686  fwBuffer
687  );
688  ComponentIpcSerializableBuffer msg;
690 
691  // Serialize message ID
692  _status = msg.serializeFrom(
693  static_cast<FwEnumStoreType>(BUFFERSENDIN_BUFFERSEND)
694  );
695  FW_ASSERT(
696  _status == Fw::FW_SERIALIZE_OK,
697  static_cast<FwAssertArgType>(_status)
698  );
699 
700  // Serialize port number
701  _status = msg.serializeFrom(portNum);
702  FW_ASSERT(
703  _status == Fw::FW_SERIALIZE_OK,
704  static_cast<FwAssertArgType>(_status)
705  );
706 
707  // Serialize argument fwBuffer
708  _status = msg.serializeFrom(fwBuffer);
709  FW_ASSERT(
710  _status == Fw::FW_SERIALIZE_OK,
711  static_cast<FwAssertArgType>(_status)
712  );
713 
714  // Send message
716  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
717 
718  FW_ASSERT(
719  qStatus == Os::Queue::OP_OK,
720  static_cast<FwAssertArgType>(qStatus)
721  );
722  }
723 
726  FwIndexType portNum,
727  U32 key
728  )
729  {
730  // Make sure port number is valid
731  FW_ASSERT(
732  (0 <= portNum) && (portNum < this->getNum_pingIn_InputPorts()),
733  static_cast<FwAssertArgType>(portNum)
734  );
735 
736  // Call pre-message hook
738  portNum,
739  key
740  );
741  ComponentIpcSerializableBuffer msg;
743 
744  // Serialize message ID
745  _status = msg.serializeFrom(
746  static_cast<FwEnumStoreType>(PINGIN_PING)
747  );
748  FW_ASSERT(
749  _status == Fw::FW_SERIALIZE_OK,
750  static_cast<FwAssertArgType>(_status)
751  );
752 
753  // Serialize port number
754  _status = msg.serializeFrom(portNum);
755  FW_ASSERT(
756  _status == Fw::FW_SERIALIZE_OK,
757  static_cast<FwAssertArgType>(_status)
758  );
759 
760  // Serialize argument key
761  _status = msg.serializeFrom(key);
762  FW_ASSERT(
763  _status == Fw::FW_SERIALIZE_OK,
764  static_cast<FwAssertArgType>(_status)
765  );
766 
767  // Send message
769  Os::Queue::Status qStatus = this->m_queue.send(msg, 0, _block);
770 
771  if (qStatus == Os::Queue::Status::FULL) {
772  this->incNumMsgDropped();
773  return;
774  }
775 
776  FW_ASSERT(
777  qStatus == Os::Queue::OP_OK,
778  static_cast<FwAssertArgType>(qStatus)
779  );
780  }
781 
782  // ----------------------------------------------------------------------
783  // Pre-message hooks for typed async input ports
784  //
785  // Each of these functions is invoked just before processing a message
786  // on the corresponding port. By default, they do nothing. You can
787  // override them to provide specific pre-message behavior.
788  // ----------------------------------------------------------------------
789 
792  FwIndexType portNum,
793  Fw::Buffer& fwBuffer
794  )
795  {
796  // Default: no-op
797  }
798 
801  FwIndexType portNum,
802  U32 key
803  )
804  {
805  // Default: no-op
806  }
807 
808 #if !FW_DIRECT_PORT_CALLS
809 
810  // ----------------------------------------------------------------------
811  // Invocation functions for typed output ports
812  // ----------------------------------------------------------------------
813 
816  FwIndexType portNum,
817  Fw::Buffer& fwBuffer
818  ) const
819  {
820  FW_ASSERT(
821  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
822  static_cast<FwAssertArgType>(portNum)
823  );
824 
825  FW_ASSERT(
826  this->m_bufferSendOut_OutputPort[portNum].isConnected(),
827  static_cast<FwAssertArgType>(portNum)
828  );
829  this->m_bufferSendOut_OutputPort[portNum].invoke(
830  fwBuffer
831  );
832  }
833 
836  FwIndexType portNum,
837  Fw::StringBase& file_name
838  ) const
839  {
840  FW_ASSERT(
841  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
842  static_cast<FwAssertArgType>(portNum)
843  );
844 
845  FW_ASSERT(
846  this->m_fileAnnounce_OutputPort[portNum].isConnected(),
847  static_cast<FwAssertArgType>(portNum)
848  );
849  this->m_fileAnnounce_OutputPort[portNum].invoke(
850  file_name
851  );
852  }
853 
856  FwIndexType portNum,
857  U32 key
858  ) const
859  {
860  FW_ASSERT(
861  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
862  static_cast<FwAssertArgType>(portNum)
863  );
864 
865  FW_ASSERT(
866  this->m_pingOut_OutputPort[portNum].isConnected(),
867  static_cast<FwAssertArgType>(portNum)
868  );
869  this->m_pingOut_OutputPort[portNum].invoke(
870  key
871  );
872  }
873 
874 #endif
875 
876  // ----------------------------------------------------------------------
877  // Event logging functions
878  // ----------------------------------------------------------------------
879 
882  const Fw::StringBase& fileName,
883  U32 computed,
884  U32 read
885  ) const
886  {
887  // Get the time
888  Fw::Time _logTime;
889  if (this->isConnected_timeCaller_OutputPort(0)) {
890  this->timeCaller_out(0, _logTime);
891  }
892 
893  const FwEventIdType _id = this->getIdBase() + EVENTID_BADCHECKSUM;
894 
895  // Emit the event on the log port
896  if (this->isConnected_eventOut_OutputPort(0)) {
897  Fw::LogBuffer _logBuff;
899 
900 #if FW_AMPCS_COMPATIBLE
901  // Serialize the number of arguments
902  _status = _logBuff.serializeFrom(static_cast<U8>(3));
903  FW_ASSERT(
904  _status == Fw::FW_SERIALIZE_OK,
905  static_cast<FwAssertArgType>(_status)
906  );
907 #endif
908 
909  _status = fileName.serializeTo(
910  _logBuff,
911  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
912  );
913  FW_ASSERT(
914  _status == Fw::FW_SERIALIZE_OK,
915  static_cast<FwAssertArgType>(_status)
916  );
917 
918 #if FW_AMPCS_COMPATIBLE
919  // Serialize the argument size
920  _status = _logBuff.serializeFrom(
921  static_cast<U8>(sizeof(U32))
922  );
923  FW_ASSERT(
924  _status == Fw::FW_SERIALIZE_OK,
925  static_cast<FwAssertArgType>(_status)
926  );
927 #endif
928  _status = _logBuff.serializeFrom(computed);
929  FW_ASSERT(
930  _status == Fw::FW_SERIALIZE_OK,
931  static_cast<FwAssertArgType>(_status)
932  );
933 
934 #if FW_AMPCS_COMPATIBLE
935  // Serialize the argument size
936  _status = _logBuff.serializeFrom(
937  static_cast<U8>(sizeof(U32))
938  );
939  FW_ASSERT(
940  _status == Fw::FW_SERIALIZE_OK,
941  static_cast<FwAssertArgType>(_status)
942  );
943 #endif
944  _status = _logBuff.serializeFrom(read);
945  FW_ASSERT(
946  _status == Fw::FW_SERIALIZE_OK,
947  static_cast<FwAssertArgType>(_status)
948  );
949 
950  this->eventOut_out(
951  0,
952  _id,
953  _logTime,
955  _logBuff
956  );
957  }
958 
959  // Emit the event on the text log port
960 #if FW_ENABLE_TEXT_LOGGING
961  if (this->isConnected_LogText_OutputPort(0)) {
962 #if FW_OBJECT_NAMES == 1
963  const char* _formatString =
964  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
965 #else
966  const char* _formatString =
967  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
968 #endif
969 
970  Fw::TextLogString _logString;
971  (void) _logString.format(
972  _formatString,
973 #if FW_OBJECT_NAMES == 1
974  this->m_objName.toChar(),
975 #endif
976  "BadChecksum ",
977  fileName.toChar(),
978  computed,
979  read
980  );
981 
982  this->LogText_out(
983  0,
984  _id,
985  _logTime,
987  _logString
988  );
989  }
990 #endif
991  }
992 
995  {
996  // Get the time
997  Fw::Time _logTime;
998  if (this->isConnected_timeCaller_OutputPort(0)) {
999  this->timeCaller_out(0, _logTime);
1000  }
1001 
1002  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEOPENERROR;
1003 
1004  // Emit the event on the log port
1005  if (this->isConnected_eventOut_OutputPort(0)) {
1006  Fw::LogBuffer _logBuff;
1008 
1009 #if FW_AMPCS_COMPATIBLE
1010  // Serialize the number of arguments
1011  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1012  FW_ASSERT(
1013  _status == Fw::FW_SERIALIZE_OK,
1014  static_cast<FwAssertArgType>(_status)
1015  );
1016 #endif
1017 
1018  _status = fileName.serializeTo(
1019  _logBuff,
1020  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1021  );
1022  FW_ASSERT(
1023  _status == Fw::FW_SERIALIZE_OK,
1024  static_cast<FwAssertArgType>(_status)
1025  );
1026 
1027  this->eventOut_out(
1028  0,
1029  _id,
1030  _logTime,
1032  _logBuff
1033  );
1034  }
1035 
1036  // Emit the event on the text log port
1037 #if FW_ENABLE_TEXT_LOGGING
1038  if (this->isConnected_LogText_OutputPort(0)) {
1039 #if FW_OBJECT_NAMES == 1
1040  const char* _formatString =
1041  "(%s) %s: Could not open file %s";
1042 #else
1043  const char* _formatString =
1044  "%s: Could not open file %s";
1045 #endif
1046 
1047  Fw::TextLogString _logString;
1048  (void) _logString.format(
1049  _formatString,
1050 #if FW_OBJECT_NAMES == 1
1051  this->m_objName.toChar(),
1052 #endif
1053  "FileOpenError ",
1054  fileName.toChar()
1055  );
1056 
1057  this->LogText_out(
1058  0,
1059  _id,
1060  _logTime,
1062  _logString
1063  );
1064  }
1065 #endif
1066  }
1067 
1070  {
1071  // Get the time
1072  Fw::Time _logTime;
1073  if (this->isConnected_timeCaller_OutputPort(0)) {
1074  this->timeCaller_out(0, _logTime);
1075  }
1076 
1077  const FwEventIdType _id = this->getIdBase() + EVENTID_FILERECEIVED;
1078 
1079  // Emit the event on the log port
1080  if (this->isConnected_eventOut_OutputPort(0)) {
1081  Fw::LogBuffer _logBuff;
1083 
1084 #if FW_AMPCS_COMPATIBLE
1085  // Serialize the number of arguments
1086  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1087  FW_ASSERT(
1088  _status == Fw::FW_SERIALIZE_OK,
1089  static_cast<FwAssertArgType>(_status)
1090  );
1091 #endif
1092 
1093  _status = fileName.serializeTo(
1094  _logBuff,
1095  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1096  );
1097  FW_ASSERT(
1098  _status == Fw::FW_SERIALIZE_OK,
1099  static_cast<FwAssertArgType>(_status)
1100  );
1101 
1102  this->eventOut_out(
1103  0,
1104  _id,
1105  _logTime,
1107  _logBuff
1108  );
1109  }
1110 
1111  // Emit the event on the text log port
1112 #if FW_ENABLE_TEXT_LOGGING
1113  if (this->isConnected_LogText_OutputPort(0)) {
1114 #if FW_OBJECT_NAMES == 1
1115  const char* _formatString =
1116  "(%s) %s: Received file %s";
1117 #else
1118  const char* _formatString =
1119  "%s: Received file %s";
1120 #endif
1121 
1122  Fw::TextLogString _logString;
1123  (void) _logString.format(
1124  _formatString,
1125 #if FW_OBJECT_NAMES == 1
1126  this->m_objName.toChar(),
1127 #endif
1128  "FileReceived ",
1129  fileName.toChar()
1130  );
1131 
1132  this->LogText_out(
1133  0,
1134  _id,
1135  _logTime,
1137  _logString
1138  );
1139  }
1140 #endif
1141  }
1142 
1145  {
1146  // Check throttle value
1147  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1148  return;
1149  }
1150  else {
1151  this->m_FileWriteErrorThrottle++;
1152  }
1153 
1154  // Get the time
1155  Fw::Time _logTime;
1156  if (this->isConnected_timeCaller_OutputPort(0)) {
1157  this->timeCaller_out(0, _logTime);
1158  }
1159 
1160  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1161 
1162  // Emit the event on the log port
1163  if (this->isConnected_eventOut_OutputPort(0)) {
1164  Fw::LogBuffer _logBuff;
1166 
1167 #if FW_AMPCS_COMPATIBLE
1168  // Serialize the number of arguments
1169  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1170  FW_ASSERT(
1171  _status == Fw::FW_SERIALIZE_OK,
1172  static_cast<FwAssertArgType>(_status)
1173  );
1174 #endif
1175 
1176  _status = fileName.serializeTo(
1177  _logBuff,
1178  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1179  );
1180  FW_ASSERT(
1181  _status == Fw::FW_SERIALIZE_OK,
1182  static_cast<FwAssertArgType>(_status)
1183  );
1184 
1185  this->eventOut_out(
1186  0,
1187  _id,
1188  _logTime,
1190  _logBuff
1191  );
1192  }
1193 
1194  // Emit the event on the text log port
1195 #if FW_ENABLE_TEXT_LOGGING
1196  if (this->isConnected_LogText_OutputPort(0)) {
1197 #if FW_OBJECT_NAMES == 1
1198  const char* _formatString =
1199  "(%s) %s: Could not write to file %s";
1200 #else
1201  const char* _formatString =
1202  "%s: Could not write to file %s";
1203 #endif
1204 
1205  Fw::TextLogString _logString;
1206  (void) _logString.format(
1207  _formatString,
1208 #if FW_OBJECT_NAMES == 1
1209  this->m_objName.toChar(),
1210 #endif
1211  "FileWriteError ",
1212  fileName.toChar()
1213  );
1214 
1215  this->LogText_out(
1216  0,
1217  _id,
1218  _logTime,
1220  _logString
1221  );
1222  }
1223 #endif
1224  }
1225 
1228  FwPacketDescriptorType packetType,
1229  U32 mode
1230  )
1231  {
1232  // Check throttle value
1233  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1234  return;
1235  }
1236  else {
1237  this->m_InvalidReceiveModeThrottle++;
1238  }
1239 
1240  // Get the time
1241  Fw::Time _logTime;
1242  if (this->isConnected_timeCaller_OutputPort(0)) {
1243  this->timeCaller_out(0, _logTime);
1244  }
1245 
1246  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1247 
1248  // Emit the event on the log port
1249  if (this->isConnected_eventOut_OutputPort(0)) {
1250  Fw::LogBuffer _logBuff;
1252 
1253 #if FW_AMPCS_COMPATIBLE
1254  // Serialize the number of arguments
1255  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1256  FW_ASSERT(
1257  _status == Fw::FW_SERIALIZE_OK,
1258  static_cast<FwAssertArgType>(_status)
1259  );
1260 #endif
1261 
1262 #if FW_AMPCS_COMPATIBLE
1263  // Serialize the argument size
1264  _status = _logBuff.serializeFrom(
1265  static_cast<U8>(sizeof(FwPacketDescriptorType))
1266  );
1267  FW_ASSERT(
1268  _status == Fw::FW_SERIALIZE_OK,
1269  static_cast<FwAssertArgType>(_status)
1270  );
1271 #endif
1272  _status = _logBuff.serializeFrom(packetType);
1273  FW_ASSERT(
1274  _status == Fw::FW_SERIALIZE_OK,
1275  static_cast<FwAssertArgType>(_status)
1276  );
1277 
1278 #if FW_AMPCS_COMPATIBLE
1279  // Serialize the argument size
1280  _status = _logBuff.serializeFrom(
1281  static_cast<U8>(sizeof(U32))
1282  );
1283  FW_ASSERT(
1284  _status == Fw::FW_SERIALIZE_OK,
1285  static_cast<FwAssertArgType>(_status)
1286  );
1287 #endif
1288  _status = _logBuff.serializeFrom(mode);
1289  FW_ASSERT(
1290  _status == Fw::FW_SERIALIZE_OK,
1291  static_cast<FwAssertArgType>(_status)
1292  );
1293 
1294  this->eventOut_out(
1295  0,
1296  _id,
1297  _logTime,
1299  _logBuff
1300  );
1301  }
1302 
1303  // Emit the event on the text log port
1304 #if FW_ENABLE_TEXT_LOGGING
1305  if (this->isConnected_LogText_OutputPort(0)) {
1306 #if FW_OBJECT_NAMES == 1
1307  const char* _formatString =
1308  "(%s) %s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1309 #else
1310  const char* _formatString =
1311  "%s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1312 #endif
1313 
1314  Fw::TextLogString _logString;
1315  (void) _logString.format(
1316  _formatString,
1317 #if FW_OBJECT_NAMES == 1
1318  this->m_objName.toChar(),
1319 #endif
1320  "InvalidReceiveMode ",
1321  packetType,
1322  mode
1323  );
1324 
1325  this->LogText_out(
1326  0,
1327  _id,
1328  _logTime,
1330  _logString
1331  );
1332  }
1333 #endif
1334  }
1335 
1338  U32 packetIndex,
1339  const Fw::StringBase& fileName
1340  )
1341  {
1342  // Check throttle value
1343  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1344  return;
1345  }
1346  else {
1347  this->m_PacketOutOfBoundsThrottle++;
1348  }
1349 
1350  // Get the time
1351  Fw::Time _logTime;
1352  if (this->isConnected_timeCaller_OutputPort(0)) {
1353  this->timeCaller_out(0, _logTime);
1354  }
1355 
1356  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1357 
1358  // Emit the event on the log port
1359  if (this->isConnected_eventOut_OutputPort(0)) {
1360  Fw::LogBuffer _logBuff;
1362 
1363 #if FW_AMPCS_COMPATIBLE
1364  // Serialize the number of arguments
1365  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1366  FW_ASSERT(
1367  _status == Fw::FW_SERIALIZE_OK,
1368  static_cast<FwAssertArgType>(_status)
1369  );
1370 #endif
1371 
1372 #if FW_AMPCS_COMPATIBLE
1373  // Serialize the argument size
1374  _status = _logBuff.serializeFrom(
1375  static_cast<U8>(sizeof(U32))
1376  );
1377  FW_ASSERT(
1378  _status == Fw::FW_SERIALIZE_OK,
1379  static_cast<FwAssertArgType>(_status)
1380  );
1381 #endif
1382  _status = _logBuff.serializeFrom(packetIndex);
1383  FW_ASSERT(
1384  _status == Fw::FW_SERIALIZE_OK,
1385  static_cast<FwAssertArgType>(_status)
1386  );
1387 
1388  _status = fileName.serializeTo(
1389  _logBuff,
1390  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1391  );
1392  FW_ASSERT(
1393  _status == Fw::FW_SERIALIZE_OK,
1394  static_cast<FwAssertArgType>(_status)
1395  );
1396 
1397  this->eventOut_out(
1398  0,
1399  _id,
1400  _logTime,
1402  _logBuff
1403  );
1404  }
1405 
1406  // Emit the event on the text log port
1407 #if FW_ENABLE_TEXT_LOGGING
1408  if (this->isConnected_LogText_OutputPort(0)) {
1409 #if FW_OBJECT_NAMES == 1
1410  const char* _formatString =
1411  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1412 #else
1413  const char* _formatString =
1414  "%s: Packet %" PRIu32 " out of bounds for file %s";
1415 #endif
1416 
1417  Fw::TextLogString _logString;
1418  (void) _logString.format(
1419  _formatString,
1420 #if FW_OBJECT_NAMES == 1
1421  this->m_objName.toChar(),
1422 #endif
1423  "PacketOutOfBounds ",
1424  packetIndex,
1425  fileName.toChar()
1426  );
1427 
1428  this->LogText_out(
1429  0,
1430  _id,
1431  _logTime,
1433  _logString
1434  );
1435  }
1436 #endif
1437  }
1438 
1441  U32 packetIndex,
1442  U32 lastPacketIndex
1443  )
1444  {
1445  // Check throttle value
1446  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1447  return;
1448  }
1449  else {
1450  this->m_PacketOutOfOrderThrottle++;
1451  }
1452 
1453  // Get the time
1454  Fw::Time _logTime;
1455  if (this->isConnected_timeCaller_OutputPort(0)) {
1456  this->timeCaller_out(0, _logTime);
1457  }
1458 
1459  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETOUTOFORDER;
1460 
1461  // Emit the event on the log port
1462  if (this->isConnected_eventOut_OutputPort(0)) {
1463  Fw::LogBuffer _logBuff;
1465 
1466 #if FW_AMPCS_COMPATIBLE
1467  // Serialize the number of arguments
1468  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1469  FW_ASSERT(
1470  _status == Fw::FW_SERIALIZE_OK,
1471  static_cast<FwAssertArgType>(_status)
1472  );
1473 #endif
1474 
1475 #if FW_AMPCS_COMPATIBLE
1476  // Serialize the argument size
1477  _status = _logBuff.serializeFrom(
1478  static_cast<U8>(sizeof(U32))
1479  );
1480  FW_ASSERT(
1481  _status == Fw::FW_SERIALIZE_OK,
1482  static_cast<FwAssertArgType>(_status)
1483  );
1484 #endif
1485  _status = _logBuff.serializeFrom(packetIndex);
1486  FW_ASSERT(
1487  _status == Fw::FW_SERIALIZE_OK,
1488  static_cast<FwAssertArgType>(_status)
1489  );
1490 
1491 #if FW_AMPCS_COMPATIBLE
1492  // Serialize the argument size
1493  _status = _logBuff.serializeFrom(
1494  static_cast<U8>(sizeof(U32))
1495  );
1496  FW_ASSERT(
1497  _status == Fw::FW_SERIALIZE_OK,
1498  static_cast<FwAssertArgType>(_status)
1499  );
1500 #endif
1501  _status = _logBuff.serializeFrom(lastPacketIndex);
1502  FW_ASSERT(
1503  _status == Fw::FW_SERIALIZE_OK,
1504  static_cast<FwAssertArgType>(_status)
1505  );
1506 
1507  this->eventOut_out(
1508  0,
1509  _id,
1510  _logTime,
1512  _logBuff
1513  );
1514  }
1515 
1516  // Emit the event on the text log port
1517 #if FW_ENABLE_TEXT_LOGGING
1518  if (this->isConnected_LogText_OutputPort(0)) {
1519 #if FW_OBJECT_NAMES == 1
1520  const char* _formatString =
1521  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1522 #else
1523  const char* _formatString =
1524  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1525 #endif
1526 
1527  Fw::TextLogString _logString;
1528  (void) _logString.format(
1529  _formatString,
1530 #if FW_OBJECT_NAMES == 1
1531  this->m_objName.toChar(),
1532 #endif
1533  "PacketOutOfOrder ",
1534  packetIndex,
1535  lastPacketIndex
1536  );
1537 
1538  this->LogText_out(
1539  0,
1540  _id,
1541  _logTime,
1543  _logString
1544  );
1545  }
1546 #endif
1547  }
1548 
1551  {
1552  // Check throttle value
1553  if (this->m_PacketDuplicateThrottle >= EVENTID_PACKETDUPLICATE_THROTTLE) {
1554  return;
1555  }
1556  else {
1557  this->m_PacketDuplicateThrottle++;
1558  }
1559 
1560  // Get the time
1561  Fw::Time _logTime;
1562  if (this->isConnected_timeCaller_OutputPort(0)) {
1563  this->timeCaller_out(0, _logTime);
1564  }
1565 
1566  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETDUPLICATE;
1567 
1568  // Emit the event on the log port
1569  if (this->isConnected_eventOut_OutputPort(0)) {
1570  Fw::LogBuffer _logBuff;
1572 
1573 #if FW_AMPCS_COMPATIBLE
1574  // Serialize the number of arguments
1575  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1576  FW_ASSERT(
1577  _status == Fw::FW_SERIALIZE_OK,
1578  static_cast<FwAssertArgType>(_status)
1579  );
1580 #endif
1581 
1582 #if FW_AMPCS_COMPATIBLE
1583  // Serialize the argument size
1584  _status = _logBuff.serializeFrom(
1585  static_cast<U8>(sizeof(U32))
1586  );
1587  FW_ASSERT(
1588  _status == Fw::FW_SERIALIZE_OK,
1589  static_cast<FwAssertArgType>(_status)
1590  );
1591 #endif
1592  _status = _logBuff.serializeFrom(packetIndex);
1593  FW_ASSERT(
1594  _status == Fw::FW_SERIALIZE_OK,
1595  static_cast<FwAssertArgType>(_status)
1596  );
1597 
1598  this->eventOut_out(
1599  0,
1600  _id,
1601  _logTime,
1603  _logBuff
1604  );
1605  }
1606 
1607  // Emit the event on the text log port
1608 #if FW_ENABLE_TEXT_LOGGING
1609  if (this->isConnected_LogText_OutputPort(0)) {
1610 #if FW_OBJECT_NAMES == 1
1611  const char* _formatString =
1612  "(%s) %s: Received a duplicate of packet %" PRIu32 "";
1613 #else
1614  const char* _formatString =
1615  "%s: Received a duplicate of packet %" PRIu32 "";
1616 #endif
1617 
1618  Fw::TextLogString _logString;
1619  (void) _logString.format(
1620  _formatString,
1621 #if FW_OBJECT_NAMES == 1
1622  this->m_objName.toChar(),
1623 #endif
1624  "PacketDuplicate ",
1625  packetIndex
1626  );
1627 
1628  this->LogText_out(
1629  0,
1630  _id,
1631  _logTime,
1633  _logString
1634  );
1635  }
1636 #endif
1637  }
1638 
1641  {
1642  // Get the time
1643  Fw::Time _logTime;
1644  if (this->isConnected_timeCaller_OutputPort(0)) {
1645  this->timeCaller_out(0, _logTime);
1646  }
1647 
1648  const FwEventIdType _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1649 
1650  // Emit the event on the log port
1651  if (this->isConnected_eventOut_OutputPort(0)) {
1652  Fw::LogBuffer _logBuff;
1653 
1654 #if FW_AMPCS_COMPATIBLE
1656  // Serialize the number of arguments
1657  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1658  FW_ASSERT(
1659  _status == Fw::FW_SERIALIZE_OK,
1660  static_cast<FwAssertArgType>(_status)
1661  );
1662 #endif
1663 
1664  this->eventOut_out(
1665  0,
1666  _id,
1667  _logTime,
1669  _logBuff
1670  );
1671  }
1672 
1673  // Emit the event on the text log port
1674 #if FW_ENABLE_TEXT_LOGGING
1675  if (this->isConnected_LogText_OutputPort(0)) {
1676 #if FW_OBJECT_NAMES == 1
1677  const char* _formatString =
1678  "(%s) %s: Received CANCEL packet";
1679 #else
1680  const char* _formatString =
1681  "%s: Received CANCEL packet";
1682 #endif
1683 
1684  Fw::TextLogString _logString;
1685  (void) _logString.format(
1686  _formatString,
1687 #if FW_OBJECT_NAMES == 1
1688  this->m_objName.toChar(),
1689 #endif
1690  "UplinkCanceled "
1691  );
1692 
1693  this->LogText_out(
1694  0,
1695  _id,
1696  _logTime,
1698  _logString
1699  );
1700  }
1701 #endif
1702  }
1703 
1706  {
1707  // Get the time
1708  Fw::Time _logTime;
1709  if (this->isConnected_timeCaller_OutputPort(0)) {
1710  this->timeCaller_out(0, _logTime);
1711  }
1712 
1713  const FwEventIdType _id = this->getIdBase() + EVENTID_DECODEERROR;
1714 
1715  // Emit the event on the log port
1716  if (this->isConnected_eventOut_OutputPort(0)) {
1717  Fw::LogBuffer _logBuff;
1719 
1720 #if FW_AMPCS_COMPATIBLE
1721  // Serialize the number of arguments
1722  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1723  FW_ASSERT(
1724  _status == Fw::FW_SERIALIZE_OK,
1725  static_cast<FwAssertArgType>(_status)
1726  );
1727 #endif
1728 
1729 #if FW_AMPCS_COMPATIBLE
1730  // Serialize the argument size
1731  _status = _logBuff.serializeFrom(
1732  static_cast<U8>(sizeof(I32))
1733  );
1734  FW_ASSERT(
1735  _status == Fw::FW_SERIALIZE_OK,
1736  static_cast<FwAssertArgType>(_status)
1737  );
1738 #endif
1739  _status = _logBuff.serializeFrom(status);
1740  FW_ASSERT(
1741  _status == Fw::FW_SERIALIZE_OK,
1742  static_cast<FwAssertArgType>(_status)
1743  );
1744 
1745  this->eventOut_out(
1746  0,
1747  _id,
1748  _logTime,
1750  _logBuff
1751  );
1752  }
1753 
1754  // Emit the event on the text log port
1755 #if FW_ENABLE_TEXT_LOGGING
1756  if (this->isConnected_LogText_OutputPort(0)) {
1757 #if FW_OBJECT_NAMES == 1
1758  const char* _formatString =
1759  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1760 #else
1761  const char* _formatString =
1762  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1763 #endif
1764 
1765  Fw::TextLogString _logString;
1766  (void) _logString.format(
1767  _formatString,
1768 #if FW_OBJECT_NAMES == 1
1769  this->m_objName.toChar(),
1770 #endif
1771  "DecodeError ",
1772  status
1773  );
1774 
1775  this->LogText_out(
1776  0,
1777  _id,
1778  _logTime,
1780  _logString
1781  );
1782  }
1783 #endif
1784  }
1785 
1788  {
1789  // Get the time
1790  Fw::Time _logTime;
1791  if (this->isConnected_timeCaller_OutputPort(0)) {
1792  this->timeCaller_out(0, _logTime);
1793  }
1794 
1796 
1797  // Emit the event on the log port
1798  if (this->isConnected_eventOut_OutputPort(0)) {
1799  Fw::LogBuffer _logBuff;
1801 
1802 #if FW_AMPCS_COMPATIBLE
1803  // Serialize the number of arguments
1804  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1805  FW_ASSERT(
1806  _status == Fw::FW_SERIALIZE_OK,
1807  static_cast<FwAssertArgType>(_status)
1808  );
1809 #endif
1810 
1811 #if FW_AMPCS_COMPATIBLE
1812  // Serialize the argument size
1813  _status = _logBuff.serializeFrom(
1814  static_cast<U8>(sizeof(FwPacketDescriptorType))
1815  );
1816  FW_ASSERT(
1817  _status == Fw::FW_SERIALIZE_OK,
1818  static_cast<FwAssertArgType>(_status)
1819  );
1820 #endif
1821  _status = _logBuff.serializeFrom(packetType);
1822  FW_ASSERT(
1823  _status == Fw::FW_SERIALIZE_OK,
1824  static_cast<FwAssertArgType>(_status)
1825  );
1826 
1827  this->eventOut_out(
1828  0,
1829  _id,
1830  _logTime,
1832  _logBuff
1833  );
1834  }
1835 
1836  // Emit the event on the text log port
1837 #if FW_ENABLE_TEXT_LOGGING
1838  if (this->isConnected_LogText_OutputPort(0)) {
1839 #if FW_OBJECT_NAMES == 1
1840  const char* _formatString =
1841  "(%s) %s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1842 #else
1843  const char* _formatString =
1844  "%s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1845 #endif
1846 
1847  Fw::TextLogString _logString;
1848  (void) _logString.format(
1849  _formatString,
1850 #if FW_OBJECT_NAMES == 1
1851  this->m_objName.toChar(),
1852 #endif
1853  "InvalidPacketReceived ",
1854  packetType
1855  );
1856 
1857  this->LogText_out(
1858  0,
1859  _id,
1860  _logTime,
1862  _logString
1863  );
1864  }
1865 #endif
1866  }
1867 
1868  // ----------------------------------------------------------------------
1869  // Event throttle reset functions
1870  // ----------------------------------------------------------------------
1871 
1874  {
1875  // Reset throttle counter
1876  this->m_FileWriteErrorThrottle = 0;
1877  }
1878 
1881  {
1882  // Reset throttle counter
1883  this->m_InvalidReceiveModeThrottle = 0;
1884  }
1885 
1888  {
1889  // Reset throttle counter
1890  this->m_PacketOutOfBoundsThrottle = 0;
1891  }
1892 
1895  {
1896  // Reset throttle counter
1897  this->m_PacketOutOfOrderThrottle = 0;
1898  }
1899 
1902  {
1903  // Reset throttle counter
1904  this->m_PacketDuplicateThrottle = 0;
1905  }
1906 
1907  // ----------------------------------------------------------------------
1908  // Telemetry serialized write
1909  // ----------------------------------------------------------------------
1910 
1913  FwChanIdType id,
1914  Fw::TlmBuffer& _tlmBuff,
1915  Fw::Time _tlmTime
1916  ) const
1917  {
1918  if (this->isConnected_tlmOut_OutputPort(0)) {
1919  if (
1921  (_tlmTime == Fw::ZERO_TIME)
1922  ) {
1923  this->timeCaller_out(0, _tlmTime);
1924  }
1925 
1926  FwChanIdType _id;
1927  _id = this->getIdBase() + id;
1928 
1929  this->tlmOut_out(
1930  0,
1931  _id,
1932  _tlmTime,
1933  _tlmBuff
1934  );
1935  }
1936  }
1937 
1938  // ----------------------------------------------------------------------
1939  // Telemetry write functions
1940  // ----------------------------------------------------------------------
1941 
1944  U32 arg,
1945  Fw::Time _tlmTime
1946  ) const
1947  {
1948  if (this->isConnected_tlmOut_OutputPort(0)) {
1949  Fw::TlmBuffer _tlmBuff;
1950  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1951  FW_ASSERT(
1952  _stat == Fw::FW_SERIALIZE_OK,
1953  static_cast<FwAssertArgType>(_stat)
1954  );
1955 
1956  this->tlmWrite(
1958  _tlmBuff,
1959  _tlmTime
1960  );
1961  }
1962  }
1963 
1966  U32 arg,
1967  Fw::Time _tlmTime
1968  ) const
1969  {
1970  if (this->isConnected_tlmOut_OutputPort(0)) {
1971  Fw::TlmBuffer _tlmBuff;
1972  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1973  FW_ASSERT(
1974  _stat == Fw::FW_SERIALIZE_OK,
1975  static_cast<FwAssertArgType>(_stat)
1976  );
1977 
1978  this->tlmWrite(
1980  _tlmBuff,
1981  _tlmTime
1982  );
1983  }
1984  }
1985 
1988  U32 arg,
1989  Fw::Time _tlmTime
1990  ) const
1991  {
1992  if (this->isConnected_tlmOut_OutputPort(0)) {
1993  Fw::TlmBuffer _tlmBuff;
1994  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1995  FW_ASSERT(
1996  _stat == Fw::FW_SERIALIZE_OK,
1997  static_cast<FwAssertArgType>(_stat)
1998  );
1999 
2000  this->tlmWrite(
2002  _tlmBuff,
2003  _tlmTime
2004  );
2005  }
2006  }
2007 
2010  U32 arg,
2011  Fw::Time _tlmTime
2012  ) const
2013  {
2014  if (this->isConnected_tlmOut_OutputPort(0)) {
2015  Fw::TlmBuffer _tlmBuff;
2016  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2017  FW_ASSERT(
2018  _stat == Fw::FW_SERIALIZE_OK,
2019  static_cast<FwAssertArgType>(_stat)
2020  );
2021 
2022  this->tlmWrite(
2024  _tlmBuff,
2025  _tlmTime
2026  );
2027  }
2028  }
2029 
2030  // ----------------------------------------------------------------------
2031  // Time
2032  // ----------------------------------------------------------------------
2033 
2035  getTime() const
2036  {
2037  if (this->isConnected_timeCaller_OutputPort(0)) {
2038  Fw::Time _time;
2039  this->timeCaller_out(0, _time);
2040  return _time;
2041  }
2042  else {
2043  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2044  }
2045  }
2046 
2047  // ----------------------------------------------------------------------
2048  // Message dispatch functions
2049  // ----------------------------------------------------------------------
2050 
2051  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
2052  doDispatch()
2053  {
2054  ComponentIpcSerializableBuffer _msg;
2055  FwQueuePriorityType _priority = 0;
2056 
2057  Os::Queue::Status _msgStatus = this->m_queue.receive(
2058  _msg,
2060  _priority
2061  );
2062  FW_ASSERT(
2063  _msgStatus == Os::Queue::OP_OK,
2064  static_cast<FwAssertArgType>(_msgStatus)
2065  );
2066 
2067  // Reset to beginning of buffer
2068  _msg.resetDeser();
2069 
2070  FwEnumStoreType _desMsg = 0;
2071  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2072  FW_ASSERT(
2073  _deserStatus == Fw::FW_SERIALIZE_OK,
2074  static_cast<FwAssertArgType>(_deserStatus)
2075  );
2076 
2077  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2078 
2079  if (_msgType == FILEUPLINK_COMPONENT_EXIT) {
2080  return MSG_DISPATCH_EXIT;
2081  }
2082 
2083  FwIndexType portNum = 0;
2084  _deserStatus = _msg.deserializeTo(portNum);
2085  FW_ASSERT(
2086  _deserStatus == Fw::FW_SERIALIZE_OK,
2087  static_cast<FwAssertArgType>(_deserStatus)
2088  );
2089 
2090  switch (_msgType) {
2091  // Handle async input port bufferSendIn
2092  case BUFFERSENDIN_BUFFERSEND: {
2093  // Deserialize argument fwBuffer
2094  Fw::Buffer fwBuffer;
2095  _deserStatus = _msg.deserializeTo(fwBuffer);
2096  FW_ASSERT(
2097  _deserStatus == Fw::FW_SERIALIZE_OK,
2098  static_cast<FwAssertArgType>(_deserStatus)
2099  );
2100  // Call handler function
2101  this->bufferSendIn_handler(
2102  portNum,
2103  fwBuffer
2104  );
2105 
2106  break;
2107  }
2108 
2109  // Handle async input port pingIn
2110  case PINGIN_PING: {
2111  // Deserialize argument key
2112  U32 key;
2113  _deserStatus = _msg.deserializeTo(key);
2114  FW_ASSERT(
2115  _deserStatus == Fw::FW_SERIALIZE_OK,
2116  static_cast<FwAssertArgType>(_deserStatus)
2117  );
2118  // Call handler function
2119  this->pingIn_handler(
2120  portNum,
2121  key
2122  );
2123 
2124  break;
2125  }
2126 
2127  default:
2128  return MSG_DISPATCH_ERROR;
2129  }
2130 
2131  return MSG_DISPATCH_OK;
2132  }
2133 
2134  // ----------------------------------------------------------------------
2135  // Calls for messages received on typed input ports
2136  // ----------------------------------------------------------------------
2137 
2138  void FileUplinkComponentBase ::
2139  m_p_bufferSendIn_in(
2140  Fw::PassiveComponentBase* callComp,
2141  FwIndexType portNum,
2142  Fw::Buffer& fwBuffer
2143  )
2144  {
2145  FW_ASSERT(callComp != nullptr);
2146  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
2147  compPtr->bufferSendIn_handlerBase(
2148  portNum,
2149  fwBuffer
2150  );
2151  }
2152 
2153  void FileUplinkComponentBase ::
2154  m_p_pingIn_in(
2155  Fw::PassiveComponentBase* callComp,
2156  FwIndexType portNum,
2157  U32 key
2158  )
2159  {
2160  FW_ASSERT(callComp != nullptr);
2161  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
2162  compPtr->pingIn_handlerBase(
2163  portNum,
2164  key
2165  );
2166  }
2167 
2168 #if !FW_DIRECT_PORT_CALLS
2169 
2170  // ----------------------------------------------------------------------
2171  // Invocation functions for special output ports
2172  // ----------------------------------------------------------------------
2173 
2174 #if FW_ENABLE_TEXT_LOGGING
2175 
2176  void FileUplinkComponentBase ::
2177  LogText_out(
2178  FwIndexType portNum,
2179  FwEventIdType id,
2180  Fw::Time& timeTag,
2181  const Fw::LogSeverity& severity,
2182  Fw::TextLogString& text
2183  ) const
2184  {
2185  FW_ASSERT(
2186  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
2187  static_cast<FwAssertArgType>(portNum)
2188  );
2189 
2190  FW_ASSERT(
2191  this->m_LogText_OutputPort[portNum].isConnected(),
2192  static_cast<FwAssertArgType>(portNum)
2193  );
2194  this->m_LogText_OutputPort[portNum].invoke(
2195  id,
2196  timeTag,
2197  severity,
2198  text
2199  );
2200  }
2201 
2202 #endif
2203 
2204  void FileUplinkComponentBase ::
2205  eventOut_out(
2206  FwIndexType portNum,
2207  FwEventIdType id,
2208  Fw::Time& timeTag,
2209  const Fw::LogSeverity& severity,
2210  Fw::LogBuffer& args
2211  ) const
2212  {
2213  FW_ASSERT(
2214  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
2215  static_cast<FwAssertArgType>(portNum)
2216  );
2217 
2218  FW_ASSERT(
2219  this->m_eventOut_OutputPort[portNum].isConnected(),
2220  static_cast<FwAssertArgType>(portNum)
2221  );
2222  this->m_eventOut_OutputPort[portNum].invoke(
2223  id,
2224  timeTag,
2225  severity,
2226  args
2227  );
2228  }
2229 
2230  void FileUplinkComponentBase ::
2231  timeCaller_out(
2232  FwIndexType portNum,
2233  Fw::Time& time
2234  ) const
2235  {
2236  FW_ASSERT(
2237  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
2238  static_cast<FwAssertArgType>(portNum)
2239  );
2240 
2241  FW_ASSERT(
2242  this->m_timeCaller_OutputPort[portNum].isConnected(),
2243  static_cast<FwAssertArgType>(portNum)
2244  );
2245  this->m_timeCaller_OutputPort[portNum].invoke(
2246  time
2247  );
2248  }
2249 
2250  void FileUplinkComponentBase ::
2251  tlmOut_out(
2252  FwIndexType portNum,
2253  FwChanIdType id,
2254  Fw::Time& timeTag,
2255  Fw::TlmBuffer& val
2256  ) const
2257  {
2258  FW_ASSERT(
2259  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
2260  static_cast<FwAssertArgType>(portNum)
2261  );
2262 
2263  FW_ASSERT(
2264  this->m_tlmOut_OutputPort[portNum].isConnected(),
2265  static_cast<FwAssertArgType>(portNum)
2266  );
2267  this->m_tlmOut_OutputPort[portNum].invoke(
2268  id,
2269  timeTag,
2270  val
2271  );
2272  }
2273 
2274 #endif
2275 
2276 }
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
U16 FwPacketDescriptorType
The width of packet descriptors when they are serialized by the framework.
Operation succeeded.
Definition: Os.hpp:27
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.
BYTE pingInPortSize[Svc::PingPortBuffer::CAPACITY]
static constexpr FwSizeType CAPACITY
void invoke(U32 key) const
Invoke a port connection.
Definition: PingPortAc.cpp:170
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
const Time ZERO_TIME
Definition: Time.cpp:5
message to exit active component task
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
No time base has been established (Required)
void addCallPort(InputFileAnnouncePort *callPort)
Register an input port.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
Os::Queue m_queue
queue object for active component
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
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.
static constexpr FwSizeType CAPACITY
Definition: PingPortAc.hpp:34
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
Os::Queue::Status createQueue(FwSizeType depth, FwSizeType msgSize)
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:99
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
void init()
Initialization function.
Definition: PingPortAc.cpp:151
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
FwIdType FwChanIdType
The type of a telemetry channel identifier.
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:157
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 connection.
Definition: TlmPortAc.cpp:190
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void setPortNum(FwIndexType portNum)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
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 connection.
Definition: LogPortAc.cpp:199
A message was sent requesting an exit of the loop.
PlatformIndexType FwIndexType
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void invoke(Fw::StringBase &file_name) const
Invoke a port connection.
void incNumMsgDropped()
increment the number of messages dropped
void init()
Initialization function.
Definition: PingPortAc.cpp:73
RateGroupDivider component implementation.
message sent/received okay
Definition: Queue.hpp:31
U8 BYTE
byte type
Definition: BasicTypes.h:57
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:79
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.