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