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 #include "Fw/Log/LogTextPortAc.hpp"
18 #if !FW_DIRECT_PORT_CALLS
20 #endif
21 #if !FW_DIRECT_PORT_CALLS
23 #endif
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Fw/Tlm/TlmPortAc.hpp"
26 #include "Fw/Tlm/TlmString.hpp"
27 #include "Svc/Ping/PingPortAc.hpp"
31 
32 namespace Svc {
33 
40  {
41 
42  // ----------------------------------------------------------------------
43  // Friend classes
44  // ----------------------------------------------------------------------
45 
47  friend class FileUplinkTesterBase;
49  friend class FileUplinkTester;
50 
51  protected:
52 
53  // ----------------------------------------------------------------------
54  // Constants
55  // ----------------------------------------------------------------------
56 
58  enum {
61  };
62 
64  enum {
69  };
70 
72  enum {
76  };
77 
79  enum {
91  };
92 
94  enum {
100  };
101 
103  enum {
108  };
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Component initialization
114  // ----------------------------------------------------------------------
115 
117  void init(
118  FwSizeType queueDepth,
119  FwEnumStoreType instance = 0
120  );
121 
122 #if !FW_DIRECT_PORT_CALLS
123 
124  public:
125 
126  // ----------------------------------------------------------------------
127  // Getters for typed input ports
128  // ----------------------------------------------------------------------
129 
134  FwIndexType portNum
135  );
136 
141  FwIndexType portNum
142  );
143 
144 #endif
145 
146 #if !FW_DIRECT_PORT_CALLS
147 
148  public:
149 
150  // ----------------------------------------------------------------------
151  // Connect input ports to special output ports
152  // ----------------------------------------------------------------------
153 
154 #if FW_ENABLE_TEXT_LOGGING == 1
155 
157  void set_LogText_OutputPort(
158  FwIndexType portNum,
159  Fw::InputLogTextPort* port
160  );
161 
162 #endif
163 
166  FwIndexType portNum,
167  Fw::InputLogPort* port
168  );
169 
172  FwIndexType portNum,
173  Fw::InputTimePort* port
174  );
175 
178  FwIndexType portNum,
179  Fw::InputTlmPort* port
180  );
181 
182 #endif
183 
184 #if !FW_DIRECT_PORT_CALLS
185 
186  public:
187 
188  // ----------------------------------------------------------------------
189  // Connect typed input ports to typed output ports
190  // ----------------------------------------------------------------------
191 
194  FwIndexType portNum,
196  );
197 
200  FwIndexType portNum,
202  );
203 
206  FwIndexType portNum,
207  Svc::InputPingPort* port
208  );
209 
210 #endif
211 
212 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
213 
214  public:
215 
216  // ----------------------------------------------------------------------
217  // Connect serial input ports to special output ports
218  // ----------------------------------------------------------------------
219 
220 #if FW_ENABLE_TEXT_LOGGING == 1
221 
223  void set_LogText_OutputPort(
224  FwIndexType portNum,
225  Fw::InputSerializePort* port
226  );
227 
228 #endif
229 
232  FwIndexType portNum,
233  Fw::InputSerializePort* port
234  );
235 
238  FwIndexType portNum,
239  Fw::InputSerializePort* port
240  );
241 
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
248 #endif
249 
250 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
251 
252  public:
253 
254  // ----------------------------------------------------------------------
255  // Connect serial input ports to typed output ports
256  // ----------------------------------------------------------------------
257 
260  FwIndexType portNum,
261  Fw::InputSerializePort* port
262  );
263 
266  FwIndexType portNum,
267  Fw::InputSerializePort* port
268  );
269 
272  FwIndexType portNum,
273  Fw::InputSerializePort* port
274  );
275 
276 #endif
277 
278  protected:
279 
280  // ----------------------------------------------------------------------
281  // Component construction and destruction
282  // ----------------------------------------------------------------------
283 
286  const char* compName = ""
287  );
288 
290  virtual ~FileUplinkComponentBase();
291 
292  protected:
293 
294  // ----------------------------------------------------------------------
295  // Getters for numbers of typed input ports
296  // ----------------------------------------------------------------------
297 
303  }
304 
309  return NUM_PINGIN_INPUT_PORTS;
310  }
311 
312  protected:
313 
314  // ----------------------------------------------------------------------
315  // Getters for numbers of special output ports
316  // ----------------------------------------------------------------------
317 
318 #if FW_ENABLE_TEXT_LOGGING == 1
319 
323  static constexpr FwIndexType getNum_LogText_OutputPorts() {
325  }
326 
327 #endif
328 
334  }
335 
341  }
342 
348  }
349 
350  protected:
351 
352  // ----------------------------------------------------------------------
353  // Getters for numbers of typed output ports
354  // ----------------------------------------------------------------------
355 
361  }
362 
368  }
369 
375  }
376 
377  protected:
378 
379  // ----------------------------------------------------------------------
380  // Connection status queries for special output ports
381  // ----------------------------------------------------------------------
382 
383 #if FW_ENABLE_TEXT_LOGGING == 1
384 
388  bool isConnected_LogText_OutputPort(
389  FwIndexType portNum
390  ) const;
391 
392 #endif
393 
398  FwIndexType portNum
399  ) const;
400 
405  FwIndexType portNum
406  ) const;
407 
412  FwIndexType portNum
413  ) const;
414 
415  protected:
416 
417  // ----------------------------------------------------------------------
418  // Connection status queries for typed output ports
419  // ----------------------------------------------------------------------
420 
425  FwIndexType portNum
426  ) const;
427 
432  FwIndexType portNum
433  ) const;
434 
439  FwIndexType portNum
440  ) const;
441 
442  protected:
443 
444  // ----------------------------------------------------------------------
445  // Handlers to implement for typed input ports
446  // ----------------------------------------------------------------------
447 
449  virtual void bufferSendIn_handler(
450  FwIndexType portNum,
451  Fw::Buffer& fwBuffer
452  ) = 0;
453 
455  virtual void pingIn_handler(
456  FwIndexType portNum,
457  U32 key
458  ) = 0;
459 
460 #if FW_DIRECT_PORT_CALLS
461  public:
462 #else
463  protected:
464 #endif
465 
466  // ----------------------------------------------------------------------
467  // Port handler base-class functions for typed input ports
468  //
469  // Call these functions directly to bypass the corresponding ports
470  // ----------------------------------------------------------------------
471 
474  FwIndexType portNum,
475  Fw::Buffer& fwBuffer
476  );
477 
479  void pingIn_handlerBase(
480  FwIndexType portNum,
481  U32 key
482  );
483 
484  protected:
485 
486  // ----------------------------------------------------------------------
487  // Pre-message hooks for typed async input ports
488  //
489  // Each of these functions is invoked just before processing a message
490  // on the corresponding port. By default, they do nothing. You can
491  // override them to provide specific pre-message behavior.
492  // ----------------------------------------------------------------------
493 
495  virtual void bufferSendIn_preMsgHook(
496  FwIndexType portNum,
497  Fw::Buffer& fwBuffer
498  );
499 
501  virtual void pingIn_preMsgHook(
502  FwIndexType portNum,
503  U32 key
504  );
505 
506  protected:
507 
508  // ----------------------------------------------------------------------
509  // Invocation functions for typed output ports
510  // ----------------------------------------------------------------------
511 
513  void bufferSendOut_out(
514  FwIndexType portNum,
515  Fw::Buffer& fwBuffer
516  ) const;
517 
519  void fileAnnounce_out(
520  FwIndexType portNum,
521  Fw::StringBase& file_name
522  ) const;
523 
525  void pingOut_out(
526  FwIndexType portNum,
527  U32 key
528  ) const;
529 
530  protected:
531 
532  // ----------------------------------------------------------------------
533  // Event logging functions
534  // ----------------------------------------------------------------------
535 
540  const Fw::StringBase& fileName,
541  U32 computed,
542  U32 read
543  ) const;
544 
549  const Fw::StringBase& fileName
550  ) const;
551 
556  const Fw::StringBase& fileName
557  ) const;
558 
563  const Fw::StringBase& fileName
564  );
565 
570  FwPacketDescriptorType packetType,
571  U32 mode
572  );
573 
578  U32 packetIndex,
579  const Fw::StringBase& fileName
580  );
581 
586  U32 packetIndex,
587  U32 lastPacketIndex
588  );
589 
594  U32 packetIndex
595  );
596 
600  void log_ACTIVITY_HI_UplinkCanceled() const;
601 
606  I32 status
607  ) const;
608 
613  FwPacketDescriptorType packetType
614  ) const;
615 
616  protected:
617 
618  // ----------------------------------------------------------------------
619  // Event throttle reset functions
620  // ----------------------------------------------------------------------
621 
624 
627 
630 
633 
636 
637  protected:
638 
639  // ----------------------------------------------------------------------
640  // Telemetry serialized write
641  // ----------------------------------------------------------------------
642 
647  void tlmWrite(
648  FwChanIdType id,
649  Fw::TlmBuffer& _tlmBuff,
650  Fw::Time _tlmTime = Fw::Time()
651  ) const;
652 
653  protected:
654 
655  // ----------------------------------------------------------------------
656  // Telemetry write functions
657  // ----------------------------------------------------------------------
658 
663  U32 arg,
664  Fw::Time _tlmTime = Fw::Time()
665  ) const;
666 
671  U32 arg,
672  Fw::Time _tlmTime = Fw::Time()
673  ) const;
674 
678  void tlmWrite_Warnings(
679  U32 arg,
680  Fw::Time _tlmTime = Fw::Time()
681  ) const;
682 
687  U32 arg,
688  Fw::Time _tlmTime = Fw::Time()
689  ) const;
690 
691  protected:
692 
693  // ----------------------------------------------------------------------
694  // Time
695  // ----------------------------------------------------------------------
696 
700  Fw::Time getTime() const;
701 
702  private:
703 
704  // ----------------------------------------------------------------------
705  // Message dispatch functions
706  // ----------------------------------------------------------------------
707 
709  virtual MsgDispatchStatus doDispatch();
710 
711  private:
712 
713  // ----------------------------------------------------------------------
714  // Calls for messages received on typed input ports
715  // ----------------------------------------------------------------------
716 
718  static void m_p_bufferSendIn_in(
719  Fw::PassiveComponentBase* callComp,
720  FwIndexType portNum,
721  Fw::Buffer& fwBuffer
722  );
723 
725  static void m_p_pingIn_in(
726  Fw::PassiveComponentBase* callComp,
727  FwIndexType portNum,
728  U32 key
729  );
730 
731  private:
732 
733  // ----------------------------------------------------------------------
734  // Invocation functions for special output ports
735  // ----------------------------------------------------------------------
736 
737 #if FW_ENABLE_TEXT_LOGGING
738 
740  void LogText_out(
741  FwIndexType portNum,
742  FwEventIdType id,
743  Fw::Time& timeTag,
744  const Fw::LogSeverity& severity,
745  Fw::TextLogString& text
746  ) const;
747 
748 #endif
749 
751  void eventOut_out(
752  FwIndexType portNum,
753  FwEventIdType id,
754  Fw::Time& timeTag,
755  const Fw::LogSeverity& severity,
756  Fw::LogBuffer& args
757  ) const;
758 
760  void timeCaller_out(
761  FwIndexType portNum,
762  Fw::Time& time
763  ) const;
764 
766  void tlmOut_out(
767  FwIndexType portNum,
768  FwChanIdType id,
769  Fw::Time& timeTag,
770  Fw::TlmBuffer& val
771  ) const;
772 
773 #if !FW_DIRECT_PORT_CALLS
774 
775  private:
776 
777  // ----------------------------------------------------------------------
778  // Typed input ports
779  // ----------------------------------------------------------------------
780 
782  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
783 
785  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
786 
787 #endif
788 
789 #if !FW_DIRECT_PORT_CALLS
790 
791  private:
792 
793  // ----------------------------------------------------------------------
794  // Special output ports
795  // ----------------------------------------------------------------------
796 
797 #if FW_ENABLE_TEXT_LOGGING == 1
798 
800  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
801 
802 #endif
803 
805  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
806 
808  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
809 
811  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
812 
813 #endif
814 
815 #if !FW_DIRECT_PORT_CALLS
816 
817  private:
818 
819  // ----------------------------------------------------------------------
820  // Typed output ports
821  // ----------------------------------------------------------------------
822 
824  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
825 
828 
830  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
831 
832 #endif
833 
834  private:
835 
836  // ----------------------------------------------------------------------
837  // Counter values for event throttling
838  // ----------------------------------------------------------------------
839 
841  std::atomic<FwIndexType> m_FileWriteErrorThrottle;
842 
844  std::atomic<FwIndexType> m_InvalidReceiveModeThrottle;
845 
847  std::atomic<FwIndexType> m_PacketOutOfBoundsThrottle;
848 
850  std::atomic<FwIndexType> m_PacketOutOfOrderThrottle;
851 
853  std::atomic<FwIndexType> m_PacketDuplicateThrottle;
854 
855  };
856 
857 }
858 
859 #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.