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  FW_ASSERT(
772  qStatus == Os::Queue::OP_OK,
773  static_cast<FwAssertArgType>(qStatus)
774  );
775  }
776 
777  // ----------------------------------------------------------------------
778  // Pre-message hooks for typed async input ports
779  //
780  // Each of these functions is invoked just before processing a message
781  // on the corresponding port. By default, they do nothing. You can
782  // override them to provide specific pre-message behavior.
783  // ----------------------------------------------------------------------
784 
787  FwIndexType portNum,
788  Fw::Buffer& fwBuffer
789  )
790  {
791  // Default: no-op
792  }
793 
796  FwIndexType portNum,
797  U32 key
798  )
799  {
800  // Default: no-op
801  }
802 
803 #if !FW_DIRECT_PORT_CALLS
804 
805  // ----------------------------------------------------------------------
806  // Invocation functions for typed output ports
807  // ----------------------------------------------------------------------
808 
811  FwIndexType portNum,
812  Fw::Buffer& fwBuffer
813  ) const
814  {
815  FW_ASSERT(
816  (0 <= portNum) && (portNum < this->getNum_bufferSendOut_OutputPorts()),
817  static_cast<FwAssertArgType>(portNum)
818  );
819 
820  FW_ASSERT(
821  this->m_bufferSendOut_OutputPort[portNum].isConnected(),
822  static_cast<FwAssertArgType>(portNum)
823  );
824  this->m_bufferSendOut_OutputPort[portNum].invoke(
825  fwBuffer
826  );
827  }
828 
831  FwIndexType portNum,
832  Fw::StringBase& file_name
833  ) const
834  {
835  FW_ASSERT(
836  (0 <= portNum) && (portNum < this->getNum_fileAnnounce_OutputPorts()),
837  static_cast<FwAssertArgType>(portNum)
838  );
839 
840  FW_ASSERT(
841  this->m_fileAnnounce_OutputPort[portNum].isConnected(),
842  static_cast<FwAssertArgType>(portNum)
843  );
844  this->m_fileAnnounce_OutputPort[portNum].invoke(
845  file_name
846  );
847  }
848 
851  FwIndexType portNum,
852  U32 key
853  ) const
854  {
855  FW_ASSERT(
856  (0 <= portNum) && (portNum < this->getNum_pingOut_OutputPorts()),
857  static_cast<FwAssertArgType>(portNum)
858  );
859 
860  FW_ASSERT(
861  this->m_pingOut_OutputPort[portNum].isConnected(),
862  static_cast<FwAssertArgType>(portNum)
863  );
864  this->m_pingOut_OutputPort[portNum].invoke(
865  key
866  );
867  }
868 
869 #endif
870 
871  // ----------------------------------------------------------------------
872  // Event logging functions
873  // ----------------------------------------------------------------------
874 
877  const Fw::StringBase& fileName,
878  U32 computed,
879  U32 read
880  ) const
881  {
882  // Get the time
883  Fw::Time _logTime;
884  if (this->isConnected_timeCaller_OutputPort(0)) {
885  this->timeCaller_out(0, _logTime);
886  }
887 
888  const FwEventIdType _id = this->getIdBase() + EVENTID_BADCHECKSUM;
889 
890  // Emit the event on the log port
891  if (this->isConnected_eventOut_OutputPort(0)) {
892  Fw::LogBuffer _logBuff;
894 
895 #if FW_AMPCS_COMPATIBLE
896  // Serialize the number of arguments
897  _status = _logBuff.serializeFrom(static_cast<U8>(3));
898  FW_ASSERT(
899  _status == Fw::FW_SERIALIZE_OK,
900  static_cast<FwAssertArgType>(_status)
901  );
902 #endif
903 
904  _status = fileName.serializeTo(
905  _logBuff,
906  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
907  );
908  FW_ASSERT(
909  _status == Fw::FW_SERIALIZE_OK,
910  static_cast<FwAssertArgType>(_status)
911  );
912 
913 #if FW_AMPCS_COMPATIBLE
914  // Serialize the argument size
915  _status = _logBuff.serializeFrom(
916  static_cast<U8>(sizeof(U32))
917  );
918  FW_ASSERT(
919  _status == Fw::FW_SERIALIZE_OK,
920  static_cast<FwAssertArgType>(_status)
921  );
922 #endif
923  _status = _logBuff.serializeFrom(computed);
924  FW_ASSERT(
925  _status == Fw::FW_SERIALIZE_OK,
926  static_cast<FwAssertArgType>(_status)
927  );
928 
929 #if FW_AMPCS_COMPATIBLE
930  // Serialize the argument size
931  _status = _logBuff.serializeFrom(
932  static_cast<U8>(sizeof(U32))
933  );
934  FW_ASSERT(
935  _status == Fw::FW_SERIALIZE_OK,
936  static_cast<FwAssertArgType>(_status)
937  );
938 #endif
939  _status = _logBuff.serializeFrom(read);
940  FW_ASSERT(
941  _status == Fw::FW_SERIALIZE_OK,
942  static_cast<FwAssertArgType>(_status)
943  );
944 
945  this->eventOut_out(
946  0,
947  _id,
948  _logTime,
950  _logBuff
951  );
952  }
953 
954  // Emit the event on the text log port
955 #if FW_ENABLE_TEXT_LOGGING
956  if (this->isConnected_LogText_OutputPort(0)) {
957 #if FW_OBJECT_NAMES == 1
958  const char* _formatString =
959  "(%s) %s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
960 #else
961  const char* _formatString =
962  "%s: Bad checksum value during receipt of file %s: computed 0x%" PRIx32 ", read 0x%" PRIx32 "";
963 #endif
964 
965  Fw::TextLogString _logString;
966  (void) _logString.format(
967  _formatString,
968 #if FW_OBJECT_NAMES == 1
969  this->m_objName.toChar(),
970 #endif
971  "BadChecksum ",
972  fileName.toChar(),
973  computed,
974  read
975  );
976 
977  this->LogText_out(
978  0,
979  _id,
980  _logTime,
982  _logString
983  );
984  }
985 #endif
986  }
987 
990  {
991  // Get the time
992  Fw::Time _logTime;
993  if (this->isConnected_timeCaller_OutputPort(0)) {
994  this->timeCaller_out(0, _logTime);
995  }
996 
997  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEOPENERROR;
998 
999  // Emit the event on the log port
1000  if (this->isConnected_eventOut_OutputPort(0)) {
1001  Fw::LogBuffer _logBuff;
1003 
1004 #if FW_AMPCS_COMPATIBLE
1005  // Serialize the number of arguments
1006  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1007  FW_ASSERT(
1008  _status == Fw::FW_SERIALIZE_OK,
1009  static_cast<FwAssertArgType>(_status)
1010  );
1011 #endif
1012 
1013  _status = fileName.serializeTo(
1014  _logBuff,
1015  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1016  );
1017  FW_ASSERT(
1018  _status == Fw::FW_SERIALIZE_OK,
1019  static_cast<FwAssertArgType>(_status)
1020  );
1021 
1022  this->eventOut_out(
1023  0,
1024  _id,
1025  _logTime,
1027  _logBuff
1028  );
1029  }
1030 
1031  // Emit the event on the text log port
1032 #if FW_ENABLE_TEXT_LOGGING
1033  if (this->isConnected_LogText_OutputPort(0)) {
1034 #if FW_OBJECT_NAMES == 1
1035  const char* _formatString =
1036  "(%s) %s: Could not open file %s";
1037 #else
1038  const char* _formatString =
1039  "%s: Could not open file %s";
1040 #endif
1041 
1042  Fw::TextLogString _logString;
1043  (void) _logString.format(
1044  _formatString,
1045 #if FW_OBJECT_NAMES == 1
1046  this->m_objName.toChar(),
1047 #endif
1048  "FileOpenError ",
1049  fileName.toChar()
1050  );
1051 
1052  this->LogText_out(
1053  0,
1054  _id,
1055  _logTime,
1057  _logString
1058  );
1059  }
1060 #endif
1061  }
1062 
1065  {
1066  // Get the time
1067  Fw::Time _logTime;
1068  if (this->isConnected_timeCaller_OutputPort(0)) {
1069  this->timeCaller_out(0, _logTime);
1070  }
1071 
1072  const FwEventIdType _id = this->getIdBase() + EVENTID_FILERECEIVED;
1073 
1074  // Emit the event on the log port
1075  if (this->isConnected_eventOut_OutputPort(0)) {
1076  Fw::LogBuffer _logBuff;
1078 
1079 #if FW_AMPCS_COMPATIBLE
1080  // Serialize the number of arguments
1081  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1082  FW_ASSERT(
1083  _status == Fw::FW_SERIALIZE_OK,
1084  static_cast<FwAssertArgType>(_status)
1085  );
1086 #endif
1087 
1088  _status = fileName.serializeTo(
1089  _logBuff,
1090  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1091  );
1092  FW_ASSERT(
1093  _status == Fw::FW_SERIALIZE_OK,
1094  static_cast<FwAssertArgType>(_status)
1095  );
1096 
1097  this->eventOut_out(
1098  0,
1099  _id,
1100  _logTime,
1102  _logBuff
1103  );
1104  }
1105 
1106  // Emit the event on the text log port
1107 #if FW_ENABLE_TEXT_LOGGING
1108  if (this->isConnected_LogText_OutputPort(0)) {
1109 #if FW_OBJECT_NAMES == 1
1110  const char* _formatString =
1111  "(%s) %s: Received file %s";
1112 #else
1113  const char* _formatString =
1114  "%s: Received file %s";
1115 #endif
1116 
1117  Fw::TextLogString _logString;
1118  (void) _logString.format(
1119  _formatString,
1120 #if FW_OBJECT_NAMES == 1
1121  this->m_objName.toChar(),
1122 #endif
1123  "FileReceived ",
1124  fileName.toChar()
1125  );
1126 
1127  this->LogText_out(
1128  0,
1129  _id,
1130  _logTime,
1132  _logString
1133  );
1134  }
1135 #endif
1136  }
1137 
1140  {
1141  // Check throttle value
1142  if (this->m_FileWriteErrorThrottle >= EVENTID_FILEWRITEERROR_THROTTLE) {
1143  return;
1144  }
1145  else {
1146  this->m_FileWriteErrorThrottle++;
1147  }
1148 
1149  // Get the time
1150  Fw::Time _logTime;
1151  if (this->isConnected_timeCaller_OutputPort(0)) {
1152  this->timeCaller_out(0, _logTime);
1153  }
1154 
1155  const FwEventIdType _id = this->getIdBase() + EVENTID_FILEWRITEERROR;
1156 
1157  // Emit the event on the log port
1158  if (this->isConnected_eventOut_OutputPort(0)) {
1159  Fw::LogBuffer _logBuff;
1161 
1162 #if FW_AMPCS_COMPATIBLE
1163  // Serialize the number of arguments
1164  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1165  FW_ASSERT(
1166  _status == Fw::FW_SERIALIZE_OK,
1167  static_cast<FwAssertArgType>(_status)
1168  );
1169 #endif
1170 
1171  _status = fileName.serializeTo(
1172  _logBuff,
1173  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1174  );
1175  FW_ASSERT(
1176  _status == Fw::FW_SERIALIZE_OK,
1177  static_cast<FwAssertArgType>(_status)
1178  );
1179 
1180  this->eventOut_out(
1181  0,
1182  _id,
1183  _logTime,
1185  _logBuff
1186  );
1187  }
1188 
1189  // Emit the event on the text log port
1190 #if FW_ENABLE_TEXT_LOGGING
1191  if (this->isConnected_LogText_OutputPort(0)) {
1192 #if FW_OBJECT_NAMES == 1
1193  const char* _formatString =
1194  "(%s) %s: Could not write to file %s";
1195 #else
1196  const char* _formatString =
1197  "%s: Could not write to file %s";
1198 #endif
1199 
1200  Fw::TextLogString _logString;
1201  (void) _logString.format(
1202  _formatString,
1203 #if FW_OBJECT_NAMES == 1
1204  this->m_objName.toChar(),
1205 #endif
1206  "FileWriteError ",
1207  fileName.toChar()
1208  );
1209 
1210  this->LogText_out(
1211  0,
1212  _id,
1213  _logTime,
1215  _logString
1216  );
1217  }
1218 #endif
1219  }
1220 
1223  FwPacketDescriptorType packetType,
1224  U32 mode
1225  )
1226  {
1227  // Check throttle value
1228  if (this->m_InvalidReceiveModeThrottle >= EVENTID_INVALIDRECEIVEMODE_THROTTLE) {
1229  return;
1230  }
1231  else {
1232  this->m_InvalidReceiveModeThrottle++;
1233  }
1234 
1235  // Get the time
1236  Fw::Time _logTime;
1237  if (this->isConnected_timeCaller_OutputPort(0)) {
1238  this->timeCaller_out(0, _logTime);
1239  }
1240 
1241  const FwEventIdType _id = this->getIdBase() + EVENTID_INVALIDRECEIVEMODE;
1242 
1243  // Emit the event on the log port
1244  if (this->isConnected_eventOut_OutputPort(0)) {
1245  Fw::LogBuffer _logBuff;
1247 
1248 #if FW_AMPCS_COMPATIBLE
1249  // Serialize the number of arguments
1250  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1251  FW_ASSERT(
1252  _status == Fw::FW_SERIALIZE_OK,
1253  static_cast<FwAssertArgType>(_status)
1254  );
1255 #endif
1256 
1257 #if FW_AMPCS_COMPATIBLE
1258  // Serialize the argument size
1259  _status = _logBuff.serializeFrom(
1260  static_cast<U8>(sizeof(FwPacketDescriptorType))
1261  );
1262  FW_ASSERT(
1263  _status == Fw::FW_SERIALIZE_OK,
1264  static_cast<FwAssertArgType>(_status)
1265  );
1266 #endif
1267  _status = _logBuff.serializeFrom(packetType);
1268  FW_ASSERT(
1269  _status == Fw::FW_SERIALIZE_OK,
1270  static_cast<FwAssertArgType>(_status)
1271  );
1272 
1273 #if FW_AMPCS_COMPATIBLE
1274  // Serialize the argument size
1275  _status = _logBuff.serializeFrom(
1276  static_cast<U8>(sizeof(U32))
1277  );
1278  FW_ASSERT(
1279  _status == Fw::FW_SERIALIZE_OK,
1280  static_cast<FwAssertArgType>(_status)
1281  );
1282 #endif
1283  _status = _logBuff.serializeFrom(mode);
1284  FW_ASSERT(
1285  _status == Fw::FW_SERIALIZE_OK,
1286  static_cast<FwAssertArgType>(_status)
1287  );
1288 
1289  this->eventOut_out(
1290  0,
1291  _id,
1292  _logTime,
1294  _logBuff
1295  );
1296  }
1297 
1298  // Emit the event on the text log port
1299 #if FW_ENABLE_TEXT_LOGGING
1300  if (this->isConnected_LogText_OutputPort(0)) {
1301 #if FW_OBJECT_NAMES == 1
1302  const char* _formatString =
1303  "(%s) %s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1304 #else
1305  const char* _formatString =
1306  "%s: Packet type %" PRIu16 " received in mode %" PRIu32 "";
1307 #endif
1308 
1309  Fw::TextLogString _logString;
1310  (void) _logString.format(
1311  _formatString,
1312 #if FW_OBJECT_NAMES == 1
1313  this->m_objName.toChar(),
1314 #endif
1315  "InvalidReceiveMode ",
1316  packetType,
1317  mode
1318  );
1319 
1320  this->LogText_out(
1321  0,
1322  _id,
1323  _logTime,
1325  _logString
1326  );
1327  }
1328 #endif
1329  }
1330 
1333  U32 packetIndex,
1334  const Fw::StringBase& fileName
1335  )
1336  {
1337  // Check throttle value
1338  if (this->m_PacketOutOfBoundsThrottle >= EVENTID_PACKETOUTOFBOUNDS_THROTTLE) {
1339  return;
1340  }
1341  else {
1342  this->m_PacketOutOfBoundsThrottle++;
1343  }
1344 
1345  // Get the time
1346  Fw::Time _logTime;
1347  if (this->isConnected_timeCaller_OutputPort(0)) {
1348  this->timeCaller_out(0, _logTime);
1349  }
1350 
1351  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETOUTOFBOUNDS;
1352 
1353  // Emit the event on the log port
1354  if (this->isConnected_eventOut_OutputPort(0)) {
1355  Fw::LogBuffer _logBuff;
1357 
1358 #if FW_AMPCS_COMPATIBLE
1359  // Serialize the number of arguments
1360  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1361  FW_ASSERT(
1362  _status == Fw::FW_SERIALIZE_OK,
1363  static_cast<FwAssertArgType>(_status)
1364  );
1365 #endif
1366 
1367 #if FW_AMPCS_COMPATIBLE
1368  // Serialize the argument size
1369  _status = _logBuff.serializeFrom(
1370  static_cast<U8>(sizeof(U32))
1371  );
1372  FW_ASSERT(
1373  _status == Fw::FW_SERIALIZE_OK,
1374  static_cast<FwAssertArgType>(_status)
1375  );
1376 #endif
1377  _status = _logBuff.serializeFrom(packetIndex);
1378  FW_ASSERT(
1379  _status == Fw::FW_SERIALIZE_OK,
1380  static_cast<FwAssertArgType>(_status)
1381  );
1382 
1383  _status = fileName.serializeTo(
1384  _logBuff,
1385  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1386  );
1387  FW_ASSERT(
1388  _status == Fw::FW_SERIALIZE_OK,
1389  static_cast<FwAssertArgType>(_status)
1390  );
1391 
1392  this->eventOut_out(
1393  0,
1394  _id,
1395  _logTime,
1397  _logBuff
1398  );
1399  }
1400 
1401  // Emit the event on the text log port
1402 #if FW_ENABLE_TEXT_LOGGING
1403  if (this->isConnected_LogText_OutputPort(0)) {
1404 #if FW_OBJECT_NAMES == 1
1405  const char* _formatString =
1406  "(%s) %s: Packet %" PRIu32 " out of bounds for file %s";
1407 #else
1408  const char* _formatString =
1409  "%s: Packet %" PRIu32 " out of bounds for file %s";
1410 #endif
1411 
1412  Fw::TextLogString _logString;
1413  (void) _logString.format(
1414  _formatString,
1415 #if FW_OBJECT_NAMES == 1
1416  this->m_objName.toChar(),
1417 #endif
1418  "PacketOutOfBounds ",
1419  packetIndex,
1420  fileName.toChar()
1421  );
1422 
1423  this->LogText_out(
1424  0,
1425  _id,
1426  _logTime,
1428  _logString
1429  );
1430  }
1431 #endif
1432  }
1433 
1436  U32 packetIndex,
1437  U32 lastPacketIndex
1438  )
1439  {
1440  // Check throttle value
1441  if (this->m_PacketOutOfOrderThrottle >= EVENTID_PACKETOUTOFORDER_THROTTLE) {
1442  return;
1443  }
1444  else {
1445  this->m_PacketOutOfOrderThrottle++;
1446  }
1447 
1448  // Get the time
1449  Fw::Time _logTime;
1450  if (this->isConnected_timeCaller_OutputPort(0)) {
1451  this->timeCaller_out(0, _logTime);
1452  }
1453 
1454  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETOUTOFORDER;
1455 
1456  // Emit the event on the log port
1457  if (this->isConnected_eventOut_OutputPort(0)) {
1458  Fw::LogBuffer _logBuff;
1460 
1461 #if FW_AMPCS_COMPATIBLE
1462  // Serialize the number of arguments
1463  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1464  FW_ASSERT(
1465  _status == Fw::FW_SERIALIZE_OK,
1466  static_cast<FwAssertArgType>(_status)
1467  );
1468 #endif
1469 
1470 #if FW_AMPCS_COMPATIBLE
1471  // Serialize the argument size
1472  _status = _logBuff.serializeFrom(
1473  static_cast<U8>(sizeof(U32))
1474  );
1475  FW_ASSERT(
1476  _status == Fw::FW_SERIALIZE_OK,
1477  static_cast<FwAssertArgType>(_status)
1478  );
1479 #endif
1480  _status = _logBuff.serializeFrom(packetIndex);
1481  FW_ASSERT(
1482  _status == Fw::FW_SERIALIZE_OK,
1483  static_cast<FwAssertArgType>(_status)
1484  );
1485 
1486 #if FW_AMPCS_COMPATIBLE
1487  // Serialize the argument size
1488  _status = _logBuff.serializeFrom(
1489  static_cast<U8>(sizeof(U32))
1490  );
1491  FW_ASSERT(
1492  _status == Fw::FW_SERIALIZE_OK,
1493  static_cast<FwAssertArgType>(_status)
1494  );
1495 #endif
1496  _status = _logBuff.serializeFrom(lastPacketIndex);
1497  FW_ASSERT(
1498  _status == Fw::FW_SERIALIZE_OK,
1499  static_cast<FwAssertArgType>(_status)
1500  );
1501 
1502  this->eventOut_out(
1503  0,
1504  _id,
1505  _logTime,
1507  _logBuff
1508  );
1509  }
1510 
1511  // Emit the event on the text log port
1512 #if FW_ENABLE_TEXT_LOGGING
1513  if (this->isConnected_LogText_OutputPort(0)) {
1514 #if FW_OBJECT_NAMES == 1
1515  const char* _formatString =
1516  "(%s) %s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1517 #else
1518  const char* _formatString =
1519  "%s: Received packet %" PRIu32 " after packet %" PRIu32 "";
1520 #endif
1521 
1522  Fw::TextLogString _logString;
1523  (void) _logString.format(
1524  _formatString,
1525 #if FW_OBJECT_NAMES == 1
1526  this->m_objName.toChar(),
1527 #endif
1528  "PacketOutOfOrder ",
1529  packetIndex,
1530  lastPacketIndex
1531  );
1532 
1533  this->LogText_out(
1534  0,
1535  _id,
1536  _logTime,
1538  _logString
1539  );
1540  }
1541 #endif
1542  }
1543 
1546  {
1547  // Check throttle value
1548  if (this->m_PacketDuplicateThrottle >= EVENTID_PACKETDUPLICATE_THROTTLE) {
1549  return;
1550  }
1551  else {
1552  this->m_PacketDuplicateThrottle++;
1553  }
1554 
1555  // Get the time
1556  Fw::Time _logTime;
1557  if (this->isConnected_timeCaller_OutputPort(0)) {
1558  this->timeCaller_out(0, _logTime);
1559  }
1560 
1561  const FwEventIdType _id = this->getIdBase() + EVENTID_PACKETDUPLICATE;
1562 
1563  // Emit the event on the log port
1564  if (this->isConnected_eventOut_OutputPort(0)) {
1565  Fw::LogBuffer _logBuff;
1567 
1568 #if FW_AMPCS_COMPATIBLE
1569  // Serialize the number of arguments
1570  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1571  FW_ASSERT(
1572  _status == Fw::FW_SERIALIZE_OK,
1573  static_cast<FwAssertArgType>(_status)
1574  );
1575 #endif
1576 
1577 #if FW_AMPCS_COMPATIBLE
1578  // Serialize the argument size
1579  _status = _logBuff.serializeFrom(
1580  static_cast<U8>(sizeof(U32))
1581  );
1582  FW_ASSERT(
1583  _status == Fw::FW_SERIALIZE_OK,
1584  static_cast<FwAssertArgType>(_status)
1585  );
1586 #endif
1587  _status = _logBuff.serializeFrom(packetIndex);
1588  FW_ASSERT(
1589  _status == Fw::FW_SERIALIZE_OK,
1590  static_cast<FwAssertArgType>(_status)
1591  );
1592 
1593  this->eventOut_out(
1594  0,
1595  _id,
1596  _logTime,
1598  _logBuff
1599  );
1600  }
1601 
1602  // Emit the event on the text log port
1603 #if FW_ENABLE_TEXT_LOGGING
1604  if (this->isConnected_LogText_OutputPort(0)) {
1605 #if FW_OBJECT_NAMES == 1
1606  const char* _formatString =
1607  "(%s) %s: Received a duplicate of packet %" PRIu32 "";
1608 #else
1609  const char* _formatString =
1610  "%s: Received a duplicate of packet %" PRIu32 "";
1611 #endif
1612 
1613  Fw::TextLogString _logString;
1614  (void) _logString.format(
1615  _formatString,
1616 #if FW_OBJECT_NAMES == 1
1617  this->m_objName.toChar(),
1618 #endif
1619  "PacketDuplicate ",
1620  packetIndex
1621  );
1622 
1623  this->LogText_out(
1624  0,
1625  _id,
1626  _logTime,
1628  _logString
1629  );
1630  }
1631 #endif
1632  }
1633 
1636  {
1637  // Get the time
1638  Fw::Time _logTime;
1639  if (this->isConnected_timeCaller_OutputPort(0)) {
1640  this->timeCaller_out(0, _logTime);
1641  }
1642 
1643  const FwEventIdType _id = this->getIdBase() + EVENTID_UPLINKCANCELED;
1644 
1645  // Emit the event on the log port
1646  if (this->isConnected_eventOut_OutputPort(0)) {
1647  Fw::LogBuffer _logBuff;
1648 
1649 #if FW_AMPCS_COMPATIBLE
1651  // Serialize the number of arguments
1652  _status = _logBuff.serializeFrom(static_cast<U8>(0));
1653  FW_ASSERT(
1654  _status == Fw::FW_SERIALIZE_OK,
1655  static_cast<FwAssertArgType>(_status)
1656  );
1657 #endif
1658 
1659  this->eventOut_out(
1660  0,
1661  _id,
1662  _logTime,
1664  _logBuff
1665  );
1666  }
1667 
1668  // Emit the event on the text log port
1669 #if FW_ENABLE_TEXT_LOGGING
1670  if (this->isConnected_LogText_OutputPort(0)) {
1671 #if FW_OBJECT_NAMES == 1
1672  const char* _formatString =
1673  "(%s) %s: Received CANCEL packet";
1674 #else
1675  const char* _formatString =
1676  "%s: Received CANCEL packet";
1677 #endif
1678 
1679  Fw::TextLogString _logString;
1680  (void) _logString.format(
1681  _formatString,
1682 #if FW_OBJECT_NAMES == 1
1683  this->m_objName.toChar(),
1684 #endif
1685  "UplinkCanceled "
1686  );
1687 
1688  this->LogText_out(
1689  0,
1690  _id,
1691  _logTime,
1693  _logString
1694  );
1695  }
1696 #endif
1697  }
1698 
1701  {
1702  // Get the time
1703  Fw::Time _logTime;
1704  if (this->isConnected_timeCaller_OutputPort(0)) {
1705  this->timeCaller_out(0, _logTime);
1706  }
1707 
1708  const FwEventIdType _id = this->getIdBase() + EVENTID_DECODEERROR;
1709 
1710  // Emit the event on the log port
1711  if (this->isConnected_eventOut_OutputPort(0)) {
1712  Fw::LogBuffer _logBuff;
1714 
1715 #if FW_AMPCS_COMPATIBLE
1716  // Serialize the number of arguments
1717  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1718  FW_ASSERT(
1719  _status == Fw::FW_SERIALIZE_OK,
1720  static_cast<FwAssertArgType>(_status)
1721  );
1722 #endif
1723 
1724 #if FW_AMPCS_COMPATIBLE
1725  // Serialize the argument size
1726  _status = _logBuff.serializeFrom(
1727  static_cast<U8>(sizeof(I32))
1728  );
1729  FW_ASSERT(
1730  _status == Fw::FW_SERIALIZE_OK,
1731  static_cast<FwAssertArgType>(_status)
1732  );
1733 #endif
1734  _status = _logBuff.serializeFrom(status);
1735  FW_ASSERT(
1736  _status == Fw::FW_SERIALIZE_OK,
1737  static_cast<FwAssertArgType>(_status)
1738  );
1739 
1740  this->eventOut_out(
1741  0,
1742  _id,
1743  _logTime,
1745  _logBuff
1746  );
1747  }
1748 
1749  // Emit the event on the text log port
1750 #if FW_ENABLE_TEXT_LOGGING
1751  if (this->isConnected_LogText_OutputPort(0)) {
1752 #if FW_OBJECT_NAMES == 1
1753  const char* _formatString =
1754  "(%s) %s: Unable to decode file packet. Status: %" PRIi32 "";
1755 #else
1756  const char* _formatString =
1757  "%s: Unable to decode file packet. Status: %" PRIi32 "";
1758 #endif
1759 
1760  Fw::TextLogString _logString;
1761  (void) _logString.format(
1762  _formatString,
1763 #if FW_OBJECT_NAMES == 1
1764  this->m_objName.toChar(),
1765 #endif
1766  "DecodeError ",
1767  status
1768  );
1769 
1770  this->LogText_out(
1771  0,
1772  _id,
1773  _logTime,
1775  _logString
1776  );
1777  }
1778 #endif
1779  }
1780 
1783  {
1784  // Get the time
1785  Fw::Time _logTime;
1786  if (this->isConnected_timeCaller_OutputPort(0)) {
1787  this->timeCaller_out(0, _logTime);
1788  }
1789 
1791 
1792  // Emit the event on the log port
1793  if (this->isConnected_eventOut_OutputPort(0)) {
1794  Fw::LogBuffer _logBuff;
1796 
1797 #if FW_AMPCS_COMPATIBLE
1798  // Serialize the number of arguments
1799  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1800  FW_ASSERT(
1801  _status == Fw::FW_SERIALIZE_OK,
1802  static_cast<FwAssertArgType>(_status)
1803  );
1804 #endif
1805 
1806 #if FW_AMPCS_COMPATIBLE
1807  // Serialize the argument size
1808  _status = _logBuff.serializeFrom(
1809  static_cast<U8>(sizeof(FwPacketDescriptorType))
1810  );
1811  FW_ASSERT(
1812  _status == Fw::FW_SERIALIZE_OK,
1813  static_cast<FwAssertArgType>(_status)
1814  );
1815 #endif
1816  _status = _logBuff.serializeFrom(packetType);
1817  FW_ASSERT(
1818  _status == Fw::FW_SERIALIZE_OK,
1819  static_cast<FwAssertArgType>(_status)
1820  );
1821 
1822  this->eventOut_out(
1823  0,
1824  _id,
1825  _logTime,
1827  _logBuff
1828  );
1829  }
1830 
1831  // Emit the event on the text log port
1832 #if FW_ENABLE_TEXT_LOGGING
1833  if (this->isConnected_LogText_OutputPort(0)) {
1834 #if FW_OBJECT_NAMES == 1
1835  const char* _formatString =
1836  "(%s) %s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1837 #else
1838  const char* _formatString =
1839  "%s: Invalid packet received. Wrong packet type: %" PRIu16 "";
1840 #endif
1841 
1842  Fw::TextLogString _logString;
1843  (void) _logString.format(
1844  _formatString,
1845 #if FW_OBJECT_NAMES == 1
1846  this->m_objName.toChar(),
1847 #endif
1848  "InvalidPacketReceived ",
1849  packetType
1850  );
1851 
1852  this->LogText_out(
1853  0,
1854  _id,
1855  _logTime,
1857  _logString
1858  );
1859  }
1860 #endif
1861  }
1862 
1863  // ----------------------------------------------------------------------
1864  // Event throttle reset functions
1865  // ----------------------------------------------------------------------
1866 
1869  {
1870  // Reset throttle counter
1871  this->m_FileWriteErrorThrottle = 0;
1872  }
1873 
1876  {
1877  // Reset throttle counter
1878  this->m_InvalidReceiveModeThrottle = 0;
1879  }
1880 
1883  {
1884  // Reset throttle counter
1885  this->m_PacketOutOfBoundsThrottle = 0;
1886  }
1887 
1890  {
1891  // Reset throttle counter
1892  this->m_PacketOutOfOrderThrottle = 0;
1893  }
1894 
1897  {
1898  // Reset throttle counter
1899  this->m_PacketDuplicateThrottle = 0;
1900  }
1901 
1902  // ----------------------------------------------------------------------
1903  // Telemetry serialized write
1904  // ----------------------------------------------------------------------
1905 
1908  FwChanIdType id,
1909  Fw::TlmBuffer& _tlmBuff,
1910  Fw::Time _tlmTime
1911  ) const
1912  {
1913  if (this->isConnected_tlmOut_OutputPort(0)) {
1914  if (
1916  (_tlmTime == Fw::ZERO_TIME)
1917  ) {
1918  this->timeCaller_out(0, _tlmTime);
1919  }
1920 
1921  FwChanIdType _id;
1922  _id = this->getIdBase() + id;
1923 
1924  this->tlmOut_out(
1925  0,
1926  _id,
1927  _tlmTime,
1928  _tlmBuff
1929  );
1930  }
1931  }
1932 
1933  // ----------------------------------------------------------------------
1934  // Telemetry write functions
1935  // ----------------------------------------------------------------------
1936 
1939  U32 arg,
1940  Fw::Time _tlmTime
1941  ) const
1942  {
1943  if (this->isConnected_tlmOut_OutputPort(0)) {
1944  Fw::TlmBuffer _tlmBuff;
1945  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1946  FW_ASSERT(
1947  _stat == Fw::FW_SERIALIZE_OK,
1948  static_cast<FwAssertArgType>(_stat)
1949  );
1950 
1951  this->tlmWrite(
1953  _tlmBuff,
1954  _tlmTime
1955  );
1956  }
1957  }
1958 
1961  U32 arg,
1962  Fw::Time _tlmTime
1963  ) const
1964  {
1965  if (this->isConnected_tlmOut_OutputPort(0)) {
1966  Fw::TlmBuffer _tlmBuff;
1967  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1968  FW_ASSERT(
1969  _stat == Fw::FW_SERIALIZE_OK,
1970  static_cast<FwAssertArgType>(_stat)
1971  );
1972 
1973  this->tlmWrite(
1975  _tlmBuff,
1976  _tlmTime
1977  );
1978  }
1979  }
1980 
1983  U32 arg,
1984  Fw::Time _tlmTime
1985  ) const
1986  {
1987  if (this->isConnected_tlmOut_OutputPort(0)) {
1988  Fw::TlmBuffer _tlmBuff;
1989  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1990  FW_ASSERT(
1991  _stat == Fw::FW_SERIALIZE_OK,
1992  static_cast<FwAssertArgType>(_stat)
1993  );
1994 
1995  this->tlmWrite(
1997  _tlmBuff,
1998  _tlmTime
1999  );
2000  }
2001  }
2002 
2005  U32 arg,
2006  Fw::Time _tlmTime
2007  ) const
2008  {
2009  if (this->isConnected_tlmOut_OutputPort(0)) {
2010  Fw::TlmBuffer _tlmBuff;
2011  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
2012  FW_ASSERT(
2013  _stat == Fw::FW_SERIALIZE_OK,
2014  static_cast<FwAssertArgType>(_stat)
2015  );
2016 
2017  this->tlmWrite(
2019  _tlmBuff,
2020  _tlmTime
2021  );
2022  }
2023  }
2024 
2025  // ----------------------------------------------------------------------
2026  // Time
2027  // ----------------------------------------------------------------------
2028 
2030  getTime() const
2031  {
2032  if (this->isConnected_timeCaller_OutputPort(0)) {
2033  Fw::Time _time;
2034  this->timeCaller_out(0, _time);
2035  return _time;
2036  }
2037  else {
2038  return Fw::Time(TimeBase::TB_NONE, 0, 0);
2039  }
2040  }
2041 
2042  // ----------------------------------------------------------------------
2043  // Message dispatch functions
2044  // ----------------------------------------------------------------------
2045 
2046  Fw::QueuedComponentBase::MsgDispatchStatus FileUplinkComponentBase ::
2047  doDispatch()
2048  {
2049  ComponentIpcSerializableBuffer _msg;
2050  FwQueuePriorityType _priority = 0;
2051 
2052  Os::Queue::Status _msgStatus = this->m_queue.receive(
2053  _msg,
2055  _priority
2056  );
2057  FW_ASSERT(
2058  _msgStatus == Os::Queue::OP_OK,
2059  static_cast<FwAssertArgType>(_msgStatus)
2060  );
2061 
2062  // Reset to beginning of buffer
2063  _msg.resetDeser();
2064 
2065  FwEnumStoreType _desMsg = 0;
2066  Fw::SerializeStatus _deserStatus = _msg.deserializeTo(_desMsg);
2067  FW_ASSERT(
2068  _deserStatus == Fw::FW_SERIALIZE_OK,
2069  static_cast<FwAssertArgType>(_deserStatus)
2070  );
2071 
2072  MsgTypeEnum _msgType = static_cast<MsgTypeEnum>(_desMsg);
2073 
2074  if (_msgType == FILEUPLINK_COMPONENT_EXIT) {
2075  return MSG_DISPATCH_EXIT;
2076  }
2077 
2078  FwIndexType portNum = 0;
2079  _deserStatus = _msg.deserializeTo(portNum);
2080  FW_ASSERT(
2081  _deserStatus == Fw::FW_SERIALIZE_OK,
2082  static_cast<FwAssertArgType>(_deserStatus)
2083  );
2084 
2085  switch (_msgType) {
2086  // Handle async input port bufferSendIn
2087  case BUFFERSENDIN_BUFFERSEND: {
2088  // Deserialize argument fwBuffer
2089  Fw::Buffer fwBuffer;
2090  _deserStatus = _msg.deserializeTo(fwBuffer);
2091  FW_ASSERT(
2092  _deserStatus == Fw::FW_SERIALIZE_OK,
2093  static_cast<FwAssertArgType>(_deserStatus)
2094  );
2095  // Call handler function
2096  this->bufferSendIn_handler(
2097  portNum,
2098  fwBuffer
2099  );
2100 
2101  break;
2102  }
2103 
2104  // Handle async input port pingIn
2105  case PINGIN_PING: {
2106  // Deserialize argument key
2107  U32 key;
2108  _deserStatus = _msg.deserializeTo(key);
2109  FW_ASSERT(
2110  _deserStatus == Fw::FW_SERIALIZE_OK,
2111  static_cast<FwAssertArgType>(_deserStatus)
2112  );
2113  // Call handler function
2114  this->pingIn_handler(
2115  portNum,
2116  key
2117  );
2118 
2119  break;
2120  }
2121 
2122  default:
2123  return MSG_DISPATCH_ERROR;
2124  }
2125 
2126  return MSG_DISPATCH_OK;
2127  }
2128 
2129  // ----------------------------------------------------------------------
2130  // Calls for messages received on typed input ports
2131  // ----------------------------------------------------------------------
2132 
2133  void FileUplinkComponentBase ::
2134  m_p_bufferSendIn_in(
2135  Fw::PassiveComponentBase* callComp,
2136  FwIndexType portNum,
2137  Fw::Buffer& fwBuffer
2138  )
2139  {
2140  FW_ASSERT(callComp != nullptr);
2141  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
2142  compPtr->bufferSendIn_handlerBase(
2143  portNum,
2144  fwBuffer
2145  );
2146  }
2147 
2148  void FileUplinkComponentBase ::
2149  m_p_pingIn_in(
2150  Fw::PassiveComponentBase* callComp,
2151  FwIndexType portNum,
2152  U32 key
2153  )
2154  {
2155  FW_ASSERT(callComp != nullptr);
2156  FileUplinkComponentBase* compPtr = static_cast<FileUplinkComponentBase*>(callComp);
2157  compPtr->pingIn_handlerBase(
2158  portNum,
2159  key
2160  );
2161  }
2162 
2163 #if !FW_DIRECT_PORT_CALLS
2164 
2165  // ----------------------------------------------------------------------
2166  // Invocation functions for special output ports
2167  // ----------------------------------------------------------------------
2168 
2169 #if FW_ENABLE_TEXT_LOGGING
2170 
2171  void FileUplinkComponentBase ::
2172  LogText_out(
2173  FwIndexType portNum,
2174  FwEventIdType id,
2175  Fw::Time& timeTag,
2176  const Fw::LogSeverity& severity,
2177  Fw::TextLogString& text
2178  ) const
2179  {
2180  FW_ASSERT(
2181  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
2182  static_cast<FwAssertArgType>(portNum)
2183  );
2184 
2185  FW_ASSERT(
2186  this->m_LogText_OutputPort[portNum].isConnected(),
2187  static_cast<FwAssertArgType>(portNum)
2188  );
2189  this->m_LogText_OutputPort[portNum].invoke(
2190  id,
2191  timeTag,
2192  severity,
2193  text
2194  );
2195  }
2196 
2197 #endif
2198 
2199  void FileUplinkComponentBase ::
2200  eventOut_out(
2201  FwIndexType portNum,
2202  FwEventIdType id,
2203  Fw::Time& timeTag,
2204  const Fw::LogSeverity& severity,
2205  Fw::LogBuffer& args
2206  ) const
2207  {
2208  FW_ASSERT(
2209  (0 <= portNum) && (portNum < this->getNum_eventOut_OutputPorts()),
2210  static_cast<FwAssertArgType>(portNum)
2211  );
2212 
2213  FW_ASSERT(
2214  this->m_eventOut_OutputPort[portNum].isConnected(),
2215  static_cast<FwAssertArgType>(portNum)
2216  );
2217  this->m_eventOut_OutputPort[portNum].invoke(
2218  id,
2219  timeTag,
2220  severity,
2221  args
2222  );
2223  }
2224 
2225  void FileUplinkComponentBase ::
2226  timeCaller_out(
2227  FwIndexType portNum,
2228  Fw::Time& time
2229  ) const
2230  {
2231  FW_ASSERT(
2232  (0 <= portNum) && (portNum < this->getNum_timeCaller_OutputPorts()),
2233  static_cast<FwAssertArgType>(portNum)
2234  );
2235 
2236  FW_ASSERT(
2237  this->m_timeCaller_OutputPort[portNum].isConnected(),
2238  static_cast<FwAssertArgType>(portNum)
2239  );
2240  this->m_timeCaller_OutputPort[portNum].invoke(
2241  time
2242  );
2243  }
2244 
2245  void FileUplinkComponentBase ::
2246  tlmOut_out(
2247  FwIndexType portNum,
2248  FwChanIdType id,
2249  Fw::Time& timeTag,
2250  Fw::TlmBuffer& val
2251  ) const
2252  {
2253  FW_ASSERT(
2254  (0 <= portNum) && (portNum < this->getNum_tlmOut_OutputPorts()),
2255  static_cast<FwAssertArgType>(portNum)
2256  );
2257 
2258  FW_ASSERT(
2259  this->m_tlmOut_OutputPort[portNum].isConnected(),
2260  static_cast<FwAssertArgType>(portNum)
2261  );
2262  this->m_tlmOut_OutputPort[portNum].invoke(
2263  id,
2264  timeTag,
2265  val
2266  );
2267  }
2268 
2269 #endif
2270 
2271 }
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.
message to exit active component task
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
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 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.