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 {
107  };
108 
109  public:
110 
111  // ----------------------------------------------------------------------
112  // Component initialization
113  // ----------------------------------------------------------------------
114 
116  void init(
117  FwSizeType queueDepth,
118  FwEnumStoreType instance = 0
119  );
120 
121 #if !FW_DIRECT_PORT_CALLS
122 
123  public:
124 
125  // ----------------------------------------------------------------------
126  // Getters for typed input ports
127  // ----------------------------------------------------------------------
128 
133  FwIndexType portNum
134  );
135 
140  FwIndexType portNum
141  );
142 
143 #endif
144 
145 #if !FW_DIRECT_PORT_CALLS
146 
147  public:
148 
149  // ----------------------------------------------------------------------
150  // Connect input ports to special output ports
151  // ----------------------------------------------------------------------
152 
153 #if FW_ENABLE_TEXT_LOGGING == 1
154 
156  void set_LogText_OutputPort(
157  FwIndexType portNum,
158  Fw::InputLogTextPort* port
159  );
160 
161 #endif
162 
165  FwIndexType portNum,
166  Fw::InputLogPort* port
167  );
168 
171  FwIndexType portNum,
172  Fw::InputTimePort* port
173  );
174 
177  FwIndexType portNum,
178  Fw::InputTlmPort* port
179  );
180 
181 #endif
182 
183 #if !FW_DIRECT_PORT_CALLS
184 
185  public:
186 
187  // ----------------------------------------------------------------------
188  // Connect typed input ports to typed output ports
189  // ----------------------------------------------------------------------
190 
193  FwIndexType portNum,
195  );
196 
199  FwIndexType portNum,
201  );
202 
205  FwIndexType portNum,
206  Svc::InputPingPort* port
207  );
208 
209 #endif
210 
211 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
212 
213  public:
214 
215  // ----------------------------------------------------------------------
216  // Connect serial input ports to special output ports
217  // ----------------------------------------------------------------------
218 
219 #if FW_ENABLE_TEXT_LOGGING == 1
220 
222  void set_LogText_OutputPort(
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
227 #endif
228 
231  FwIndexType portNum,
232  Fw::InputSerializePort* port
233  );
234 
237  FwIndexType portNum,
238  Fw::InputSerializePort* port
239  );
240 
243  FwIndexType portNum,
244  Fw::InputSerializePort* port
245  );
246 
247 #endif
248 
249 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
250 
251  public:
252 
253  // ----------------------------------------------------------------------
254  // Connect serial input ports to typed output ports
255  // ----------------------------------------------------------------------
256 
259  FwIndexType portNum,
260  Fw::InputSerializePort* port
261  );
262 
265  FwIndexType portNum,
266  Fw::InputSerializePort* port
267  );
268 
271  FwIndexType portNum,
272  Fw::InputSerializePort* port
273  );
274 
275 #endif
276 
277  protected:
278 
279  // ----------------------------------------------------------------------
280  // Component construction and destruction
281  // ----------------------------------------------------------------------
282 
285  const char* compName = ""
286  );
287 
289  virtual ~FileUplinkComponentBase();
290 
291  protected:
292 
293  // ----------------------------------------------------------------------
294  // Getters for numbers of typed input ports
295  // ----------------------------------------------------------------------
296 
302  }
303 
308  return NUM_PINGIN_INPUT_PORTS;
309  }
310 
311  protected:
312 
313  // ----------------------------------------------------------------------
314  // Getters for numbers of special output ports
315  // ----------------------------------------------------------------------
316 
317 #if FW_ENABLE_TEXT_LOGGING == 1
318 
322  static constexpr FwIndexType getNum_LogText_OutputPorts() {
324  }
325 
326 #endif
327 
333  }
334 
340  }
341 
347  }
348 
349  protected:
350 
351  // ----------------------------------------------------------------------
352  // Getters for numbers of typed output ports
353  // ----------------------------------------------------------------------
354 
360  }
361 
367  }
368 
374  }
375 
376  protected:
377 
378  // ----------------------------------------------------------------------
379  // Connection status queries for special output ports
380  // ----------------------------------------------------------------------
381 
382 #if FW_ENABLE_TEXT_LOGGING == 1
383 
387  bool isConnected_LogText_OutputPort(
388  FwIndexType portNum
389  ) const;
390 
391 #endif
392 
397  FwIndexType portNum
398  ) const;
399 
404  FwIndexType portNum
405  ) const;
406 
411  FwIndexType portNum
412  ) const;
413 
414  protected:
415 
416  // ----------------------------------------------------------------------
417  // Connection status queries for typed output ports
418  // ----------------------------------------------------------------------
419 
424  FwIndexType portNum
425  ) const;
426 
431  FwIndexType portNum
432  ) const;
433 
438  FwIndexType portNum
439  ) const;
440 
441  protected:
442 
443  // ----------------------------------------------------------------------
444  // Handlers to implement for typed input ports
445  // ----------------------------------------------------------------------
446 
448  virtual void bufferSendIn_handler(
449  FwIndexType portNum,
450  Fw::Buffer& fwBuffer
451  ) = 0;
452 
454  virtual void pingIn_handler(
455  FwIndexType portNum,
456  U32 key
457  ) = 0;
458 
459 #if FW_DIRECT_PORT_CALLS
460  public:
461 #else
462  protected:
463 #endif
464 
465  // ----------------------------------------------------------------------
466  // Port handler base-class functions for typed input ports
467  //
468  // Call these functions directly to bypass the corresponding ports
469  // ----------------------------------------------------------------------
470 
473  FwIndexType portNum,
474  Fw::Buffer& fwBuffer
475  );
476 
478  void pingIn_handlerBase(
479  FwIndexType portNum,
480  U32 key
481  );
482 
483  protected:
484 
485  // ----------------------------------------------------------------------
486  // Pre-message hooks for typed async input ports
487  //
488  // Each of these functions is invoked just before processing a message
489  // on the corresponding port. By default, they do nothing. You can
490  // override them to provide specific pre-message behavior.
491  // ----------------------------------------------------------------------
492 
494  virtual void bufferSendIn_preMsgHook(
495  FwIndexType portNum,
496  Fw::Buffer& fwBuffer
497  );
498 
500  virtual void pingIn_preMsgHook(
501  FwIndexType portNum,
502  U32 key
503  );
504 
505  protected:
506 
507  // ----------------------------------------------------------------------
508  // Invocation functions for typed output ports
509  // ----------------------------------------------------------------------
510 
512  void bufferSendOut_out(
513  FwIndexType portNum,
514  Fw::Buffer& fwBuffer
515  ) const;
516 
518  void fileAnnounce_out(
519  FwIndexType portNum,
520  Fw::StringBase& file_name
521  ) const;
522 
524  void pingOut_out(
525  FwIndexType portNum,
526  U32 key
527  ) const;
528 
529  protected:
530 
531  // ----------------------------------------------------------------------
532  // Event logging functions
533  // ----------------------------------------------------------------------
534 
539  const Fw::StringBase& fileName,
540  U32 computed,
541  U32 read
542  ) const;
543 
548  const Fw::StringBase& fileName
549  ) const;
550 
555  const Fw::StringBase& fileName
556  ) const;
557 
562  const Fw::StringBase& fileName
563  );
564 
569  FwPacketDescriptorType packetType,
570  U32 mode
571  );
572 
577  U32 packetIndex,
578  const Fw::StringBase& fileName
579  );
580 
585  U32 packetIndex,
586  U32 lastPacketIndex
587  );
588 
593  U32 packetIndex
594  );
595 
599  void log_ACTIVITY_HI_UplinkCanceled() const;
600 
605  I32 status
606  ) const;
607 
612  FwPacketDescriptorType packetType
613  ) const;
614 
615  protected:
616 
617  // ----------------------------------------------------------------------
618  // Event throttle reset functions
619  // ----------------------------------------------------------------------
620 
623 
626 
629 
632 
635 
636  protected:
637 
638  // ----------------------------------------------------------------------
639  // Telemetry serialized write
640  // ----------------------------------------------------------------------
641 
646  void tlmWrite(
647  FwChanIdType id,
648  Fw::TlmBuffer& _tlmBuff,
649  Fw::Time _tlmTime = Fw::Time()
650  ) const;
651 
652  protected:
653 
654  // ----------------------------------------------------------------------
655  // Telemetry write functions
656  // ----------------------------------------------------------------------
657 
662  U32 arg,
663  Fw::Time _tlmTime = Fw::Time()
664  ) const;
665 
670  U32 arg,
671  Fw::Time _tlmTime = Fw::Time()
672  ) const;
673 
677  void tlmWrite_Warnings(
678  U32 arg,
679  Fw::Time _tlmTime = Fw::Time()
680  ) const;
681 
682  protected:
683 
684  // ----------------------------------------------------------------------
685  // Time
686  // ----------------------------------------------------------------------
687 
691  Fw::Time getTime() const;
692 
693  private:
694 
695  // ----------------------------------------------------------------------
696  // Message dispatch functions
697  // ----------------------------------------------------------------------
698 
700  virtual MsgDispatchStatus doDispatch();
701 
702  private:
703 
704  // ----------------------------------------------------------------------
705  // Calls for messages received on typed input ports
706  // ----------------------------------------------------------------------
707 
709  static void m_p_bufferSendIn_in(
710  Fw::PassiveComponentBase* callComp,
711  FwIndexType portNum,
712  Fw::Buffer& fwBuffer
713  );
714 
716  static void m_p_pingIn_in(
717  Fw::PassiveComponentBase* callComp,
718  FwIndexType portNum,
719  U32 key
720  );
721 
722  private:
723 
724  // ----------------------------------------------------------------------
725  // Invocation functions for special output ports
726  // ----------------------------------------------------------------------
727 
728 #if FW_ENABLE_TEXT_LOGGING
729 
731  void LogText_out(
732  FwIndexType portNum,
733  FwEventIdType id,
734  Fw::Time& timeTag,
735  const Fw::LogSeverity& severity,
736  Fw::TextLogString& text
737  ) const;
738 
739 #endif
740 
742  void eventOut_out(
743  FwIndexType portNum,
744  FwEventIdType id,
745  Fw::Time& timeTag,
746  const Fw::LogSeverity& severity,
747  Fw::LogBuffer& args
748  ) const;
749 
751  void timeCaller_out(
752  FwIndexType portNum,
753  Fw::Time& time
754  ) const;
755 
757  void tlmOut_out(
758  FwIndexType portNum,
759  FwChanIdType id,
760  Fw::Time& timeTag,
761  Fw::TlmBuffer& val
762  ) const;
763 
764 #if !FW_DIRECT_PORT_CALLS
765 
766  private:
767 
768  // ----------------------------------------------------------------------
769  // Typed input ports
770  // ----------------------------------------------------------------------
771 
773  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
774 
776  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
777 
778 #endif
779 
780 #if !FW_DIRECT_PORT_CALLS
781 
782  private:
783 
784  // ----------------------------------------------------------------------
785  // Special output ports
786  // ----------------------------------------------------------------------
787 
788 #if FW_ENABLE_TEXT_LOGGING == 1
789 
791  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
792 
793 #endif
794 
796  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
797 
799  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
800 
802  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
803 
804 #endif
805 
806 #if !FW_DIRECT_PORT_CALLS
807 
808  private:
809 
810  // ----------------------------------------------------------------------
811  // Typed output ports
812  // ----------------------------------------------------------------------
813 
815  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
816 
819 
821  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
822 
823 #endif
824 
825  private:
826 
827  // ----------------------------------------------------------------------
828  // Counter values for event throttling
829  // ----------------------------------------------------------------------
830 
832  std::atomic<FwIndexType> m_FileWriteErrorThrottle;
833 
835  std::atomic<FwIndexType> m_InvalidReceiveModeThrottle;
836 
838  std::atomic<FwIndexType> m_PacketOutOfBoundsThrottle;
839 
841  std::atomic<FwIndexType> m_PacketOutOfOrderThrottle;
842 
844  std::atomic<FwIndexType> m_PacketDuplicateThrottle;
845 
846  };
847 
848 }
849 
850 #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.