F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileUplinkComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileUplinkComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for FileUplink component base class
5 // ======================================================================
6 
7 #ifndef Svc_FileUplinkComponentAc_HPP
8 #define Svc_FileUplinkComponentAc_HPP
9 
10 #include <atomic>
11 
14 #include "Fw/FPrimeBasicTypes.hpp"
15 #include "Fw/Log/LogPortAc.hpp"
16 #include "Fw/Log/LogString.hpp"
17 #if FW_ENABLE_TEXT_LOGGING == 1
18 #include "Fw/Log/LogTextPortAc.hpp"
19 #endif
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #if !FW_DIRECT_PORT_CALLS
25 #endif
26 #include "Fw/Time/TimePortAc.hpp"
27 #include "Fw/Tlm/TlmPortAc.hpp"
28 #include "Fw/Tlm/TlmString.hpp"
29 #include "Svc/Ping/PingPortAc.hpp"
33 
34 namespace Svc {
35 
42  {
43 
44  // ----------------------------------------------------------------------
45  // Friend classes
46  // ----------------------------------------------------------------------
47 
49  friend class FileUplinkTesterBase;
51  friend class FileUplinkTester;
52 
53  protected:
54 
55  // ----------------------------------------------------------------------
56  // Constants
57  // ----------------------------------------------------------------------
58 
60  enum {
63  };
64 
66  enum {
71  };
72 
74  enum {
78  };
79 
81  enum {
93  };
94 
96  enum {
102  };
103 
105  enum {
109  };
110 
111  public:
112 
113  // ----------------------------------------------------------------------
114  // Component initialization
115  // ----------------------------------------------------------------------
116 
118  void init(
119  FwSizeType queueDepth,
120  FwEnumStoreType instance = 0
121  );
122 
123 #if !FW_DIRECT_PORT_CALLS
124 
125  public:
126 
127  // ----------------------------------------------------------------------
128  // Getters for typed input ports
129  // ----------------------------------------------------------------------
130 
135  FwIndexType portNum
136  );
137 
142  FwIndexType portNum
143  );
144 
145 #endif
146 
147 #if !FW_DIRECT_PORT_CALLS
148 
149  public:
150 
151  // ----------------------------------------------------------------------
152  // Connect input ports to special output ports
153  // ----------------------------------------------------------------------
154 
155 #if FW_ENABLE_TEXT_LOGGING == 1
156 
158  void set_LogText_OutputPort(
159  FwIndexType portNum,
160  Fw::InputLogTextPort* port
161  );
162 
163 #endif
164 
167  FwIndexType portNum,
168  Fw::InputLogPort* port
169  );
170 
173  FwIndexType portNum,
174  Fw::InputTimePort* port
175  );
176 
179  FwIndexType portNum,
180  Fw::InputTlmPort* port
181  );
182 
183 #endif
184 
185 #if !FW_DIRECT_PORT_CALLS
186 
187  public:
188 
189  // ----------------------------------------------------------------------
190  // Connect typed input ports to typed output ports
191  // ----------------------------------------------------------------------
192 
195  FwIndexType portNum,
197  );
198 
201  FwIndexType portNum,
203  );
204 
207  FwIndexType portNum,
208  Svc::InputPingPort* port
209  );
210 
211 #endif
212 
213 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
214 
215  public:
216 
217  // ----------------------------------------------------------------------
218  // Connect serial input ports to special output ports
219  // ----------------------------------------------------------------------
220 
221 #if FW_ENABLE_TEXT_LOGGING == 1
222 
224  void set_LogText_OutputPort(
225  FwIndexType portNum,
226  Fw::InputSerializePort* port
227  );
228 
229 #endif
230 
233  FwIndexType portNum,
234  Fw::InputSerializePort* port
235  );
236 
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
245  FwIndexType portNum,
246  Fw::InputSerializePort* port
247  );
248 
249 #endif
250 
251 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
252 
253  public:
254 
255  // ----------------------------------------------------------------------
256  // Connect serial input ports to typed output ports
257  // ----------------------------------------------------------------------
258 
261  FwIndexType portNum,
262  Fw::InputSerializePort* port
263  );
264 
267  FwIndexType portNum,
268  Fw::InputSerializePort* port
269  );
270 
273  FwIndexType portNum,
274  Fw::InputSerializePort* port
275  );
276 
277 #endif
278 
279  protected:
280 
281  // ----------------------------------------------------------------------
282  // Component construction and destruction
283  // ----------------------------------------------------------------------
284 
287  const char* compName = ""
288  );
289 
291  virtual ~FileUplinkComponentBase();
292 
293  protected:
294 
295  // ----------------------------------------------------------------------
296  // Getters for numbers of typed input ports
297  // ----------------------------------------------------------------------
298 
304  }
305 
310  return NUM_PINGIN_INPUT_PORTS;
311  }
312 
313  protected:
314 
315  // ----------------------------------------------------------------------
316  // Getters for numbers of special output ports
317  // ----------------------------------------------------------------------
318 
319 #if FW_ENABLE_TEXT_LOGGING == 1
320 
324  static constexpr FwIndexType getNum_LogText_OutputPorts() {
326  }
327 
328 #endif
329 
335  }
336 
342  }
343 
349  }
350 
351  protected:
352 
353  // ----------------------------------------------------------------------
354  // Getters for numbers of typed output ports
355  // ----------------------------------------------------------------------
356 
362  }
363 
369  }
370 
376  }
377 
378  protected:
379 
380  // ----------------------------------------------------------------------
381  // Connection status queries for special output ports
382  // ----------------------------------------------------------------------
383 
384 #if FW_ENABLE_TEXT_LOGGING == 1
385 
389  bool isConnected_LogText_OutputPort(
390  FwIndexType portNum
391  ) const;
392 
393 #endif
394 
399  FwIndexType portNum
400  ) const;
401 
406  FwIndexType portNum
407  ) const;
408 
413  FwIndexType portNum
414  ) const;
415 
416  protected:
417 
418  // ----------------------------------------------------------------------
419  // Connection status queries for typed output ports
420  // ----------------------------------------------------------------------
421 
426  FwIndexType portNum
427  ) const;
428 
433  FwIndexType portNum
434  ) const;
435 
440  FwIndexType portNum
441  ) const;
442 
443  protected:
444 
445  // ----------------------------------------------------------------------
446  // Handlers to implement for typed input ports
447  // ----------------------------------------------------------------------
448 
450  virtual void bufferSendIn_handler(
451  FwIndexType portNum,
452  Fw::Buffer& fwBuffer
453  ) = 0;
454 
456  virtual void pingIn_handler(
457  FwIndexType portNum,
458  U32 key
459  ) = 0;
460 
461 #if FW_DIRECT_PORT_CALLS
462  public:
463 #else
464  protected:
465 #endif
466 
467  // ----------------------------------------------------------------------
468  // Port handler base-class functions for typed input ports
469  //
470  // Call these functions directly to bypass the corresponding ports
471  // ----------------------------------------------------------------------
472 
475  FwIndexType portNum,
476  Fw::Buffer& fwBuffer
477  );
478 
480  void pingIn_handlerBase(
481  FwIndexType portNum,
482  U32 key
483  );
484 
485  protected:
486 
487  // ----------------------------------------------------------------------
488  // Pre-message hooks for typed async input ports
489  //
490  // Each of these functions is invoked just before processing a message
491  // on the corresponding port. By default, they do nothing. You can
492  // override them to provide specific pre-message behavior.
493  // ----------------------------------------------------------------------
494 
496  virtual void bufferSendIn_preMsgHook(
497  FwIndexType portNum,
498  Fw::Buffer& fwBuffer
499  );
500 
502  virtual void pingIn_preMsgHook(
503  FwIndexType portNum,
504  U32 key
505  );
506 
507  protected:
508 
509  // ----------------------------------------------------------------------
510  // Invocation functions for typed output ports
511  // ----------------------------------------------------------------------
512 
514  void bufferSendOut_out(
515  FwIndexType portNum,
516  Fw::Buffer& fwBuffer
517  ) const;
518 
520  void fileAnnounce_out(
521  FwIndexType portNum,
522  Fw::StringBase& file_name
523  ) const;
524 
526  void pingOut_out(
527  FwIndexType portNum,
528  U32 key
529  ) const;
530 
531  protected:
532 
533  // ----------------------------------------------------------------------
534  // Event logging functions
535  // ----------------------------------------------------------------------
536 
541  const Fw::StringBase& fileName,
542  U32 computed,
543  U32 read
544  ) const;
545 
550  const Fw::StringBase& fileName
551  ) const;
552 
557  const Fw::StringBase& fileName
558  ) const;
559 
564  const Fw::StringBase& fileName
565  );
566 
571  FwPacketDescriptorType packetType,
572  U32 mode
573  );
574 
579  U32 packetIndex,
580  const Fw::StringBase& fileName
581  );
582 
587  U32 packetIndex,
588  U32 lastPacketIndex
589  );
590 
595  U32 packetIndex
596  );
597 
601  void log_ACTIVITY_HI_UplinkCanceled() const;
602 
607  I32 status
608  ) const;
609 
614  FwPacketDescriptorType packetType
615  ) const;
616 
617  protected:
618 
619  // ----------------------------------------------------------------------
620  // Event throttle reset functions
621  // ----------------------------------------------------------------------
622 
625 
628 
631 
634 
637 
638  protected:
639 
640  // ----------------------------------------------------------------------
641  // Telemetry serialized write
642  // ----------------------------------------------------------------------
643 
648  void tlmWrite(
649  FwChanIdType id,
650  Fw::TlmBuffer& _tlmBuff,
651  Fw::Time _tlmTime = Fw::Time()
652  ) const;
653 
654  protected:
655 
656  // ----------------------------------------------------------------------
657  // Telemetry write functions
658  // ----------------------------------------------------------------------
659 
664  U32 arg,
665  Fw::Time _tlmTime = Fw::Time()
666  ) const;
667 
672  U32 arg,
673  Fw::Time _tlmTime = Fw::Time()
674  ) const;
675 
679  void tlmWrite_Warnings(
680  U32 arg,
681  Fw::Time _tlmTime = Fw::Time()
682  ) const;
683 
684  protected:
685 
686  // ----------------------------------------------------------------------
687  // Time
688  // ----------------------------------------------------------------------
689 
693  Fw::Time getTime() const;
694 
695  private:
696 
697  // ----------------------------------------------------------------------
698  // Message dispatch functions
699  // ----------------------------------------------------------------------
700 
702  virtual MsgDispatchStatus doDispatch();
703 
704  private:
705 
706  // ----------------------------------------------------------------------
707  // Calls for messages received on typed input ports
708  // ----------------------------------------------------------------------
709 
711  static void m_p_bufferSendIn_in(
712  Fw::PassiveComponentBase* callComp,
713  FwIndexType portNum,
714  Fw::Buffer& fwBuffer
715  );
716 
718  static void m_p_pingIn_in(
719  Fw::PassiveComponentBase* callComp,
720  FwIndexType portNum,
721  U32 key
722  );
723 
724  private:
725 
726  // ----------------------------------------------------------------------
727  // Invocation functions for special output ports
728  // ----------------------------------------------------------------------
729 
730 #if FW_ENABLE_TEXT_LOGGING
731 
733  void LogText_out(
734  FwIndexType portNum,
735  FwEventIdType id,
736  Fw::Time& timeTag,
737  const Fw::LogSeverity& severity,
738  Fw::TextLogString& text
739  ) const;
740 
741 #endif
742 
744  void eventOut_out(
745  FwIndexType portNum,
746  FwEventIdType id,
747  Fw::Time& timeTag,
748  const Fw::LogSeverity& severity,
749  Fw::LogBuffer& args
750  ) const;
751 
753  void timeCaller_out(
754  FwIndexType portNum,
755  Fw::Time& time
756  ) const;
757 
759  void tlmOut_out(
760  FwIndexType portNum,
761  FwChanIdType id,
762  Fw::Time& timeTag,
763  Fw::TlmBuffer& val
764  ) const;
765 
766 #if !FW_DIRECT_PORT_CALLS
767 
768  private:
769 
770  // ----------------------------------------------------------------------
771  // Typed input ports
772  // ----------------------------------------------------------------------
773 
775  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
776 
778  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
779 
780 #endif
781 
782 #if !FW_DIRECT_PORT_CALLS
783 
784  private:
785 
786  // ----------------------------------------------------------------------
787  // Special output ports
788  // ----------------------------------------------------------------------
789 
790 #if FW_ENABLE_TEXT_LOGGING == 1
791 
793  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
794 
795 #endif
796 
798  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
799 
801  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
802 
804  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
805 
806 #endif
807 
808 #if !FW_DIRECT_PORT_CALLS
809 
810  private:
811 
812  // ----------------------------------------------------------------------
813  // Typed output ports
814  // ----------------------------------------------------------------------
815 
817  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
818 
821 
823  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
824 
825 #endif
826 
827  private:
828 
829  // ----------------------------------------------------------------------
830  // Counter values for event throttling
831  // ----------------------------------------------------------------------
832 
834  std::atomic<FwIndexType> m_FileWriteErrorThrottle;
835 
837  std::atomic<FwIndexType> m_InvalidReceiveModeThrottle;
838 
840  std::atomic<FwIndexType> m_PacketOutOfBoundsThrottle;
841 
843  std::atomic<FwIndexType> m_PacketOutOfOrderThrottle;
844 
846  std::atomic<FwIndexType> m_PacketDuplicateThrottle;
847 
848  };
849 
850 }
851 
852 #endif
U16 FwPacketDescriptorType
The width of packet descriptors when they are serialized by the framework.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIdType FwEventIdType
The type of an event identifier.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
Enum representing event severity.
PlatformIndexType FwIndexType
RateGroupDivider component implementation.