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
22 #include "Fw/Time/TimePortAc.hpp"
23 #include "Fw/Tlm/TlmPortAc.hpp"
24 #include "Fw/Tlm/TlmString.hpp"
25 #include "Svc/Ping/PingPortAc.hpp"
29 
30 namespace Svc {
31 
38  {
39 
40  // ----------------------------------------------------------------------
41  // Friend classes
42  // ----------------------------------------------------------------------
43 
45  friend class FileUplinkTesterBase;
47  friend class FileUplinkTester;
48 
49  protected:
50 
51  // ----------------------------------------------------------------------
52  // Constants
53  // ----------------------------------------------------------------------
54 
56  enum {
59  };
60 
62  enum {
67  };
68 
70  enum {
74  };
75 
77  enum {
89  };
90 
92  enum {
98  };
99 
101  enum {
105  };
106 
107  public:
108 
109  // ----------------------------------------------------------------------
110  // Component initialization
111  // ----------------------------------------------------------------------
112 
114  void init(
115  FwSizeType queueDepth,
116  FwEnumStoreType instance = 0
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Getters for typed input ports
123  // ----------------------------------------------------------------------
124 
129  FwIndexType portNum
130  );
131 
136  FwIndexType portNum
137  );
138 
139  public:
140 
141  // ----------------------------------------------------------------------
142  // Connect input ports to special output ports
143  // ----------------------------------------------------------------------
144 
145 #if FW_ENABLE_TEXT_LOGGING == 1
146 
148  void set_LogText_OutputPort(
149  FwIndexType portNum,
150  Fw::InputLogTextPort* port
151  );
152 
153 #endif
154 
157  FwIndexType portNum,
158  Fw::InputLogPort* port
159  );
160 
163  FwIndexType portNum,
164  Fw::InputTimePort* port
165  );
166 
169  FwIndexType portNum,
170  Fw::InputTlmPort* port
171  );
172 
173  public:
174 
175  // ----------------------------------------------------------------------
176  // Connect typed input ports to typed output ports
177  // ----------------------------------------------------------------------
178 
181  FwIndexType portNum,
183  );
184 
187  FwIndexType portNum,
189  );
190 
193  FwIndexType portNum,
194  Svc::InputPingPort* port
195  );
196 
197 #if FW_PORT_SERIALIZATION
198 
199  public:
200 
201  // ----------------------------------------------------------------------
202  // Connect serial input ports to special output ports
203  // ----------------------------------------------------------------------
204 
205 #if FW_ENABLE_TEXT_LOGGING == 1
206 
208  void set_LogText_OutputPort(
209  FwIndexType portNum,
210  Fw::InputSerializePort* port
211  );
212 
213 #endif
214 
217  FwIndexType portNum,
218  Fw::InputSerializePort* port
219  );
220 
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
233 #endif
234 
235 #if FW_PORT_SERIALIZATION
236 
237  public:
238 
239  // ----------------------------------------------------------------------
240  // Connect serial input ports to typed output ports
241  // ----------------------------------------------------------------------
242 
245  FwIndexType portNum,
246  Fw::InputSerializePort* port
247  );
248 
251  FwIndexType portNum,
252  Fw::InputSerializePort* port
253  );
254 
257  FwIndexType portNum,
258  Fw::InputSerializePort* port
259  );
260 
261 #endif
262 
263  protected:
264 
265  // ----------------------------------------------------------------------
266  // Component construction and destruction
267  // ----------------------------------------------------------------------
268 
271  const char* compName = ""
272  );
273 
275  virtual ~FileUplinkComponentBase();
276 
277  protected:
278 
279  // ----------------------------------------------------------------------
280  // Getters for numbers of typed input ports
281  // ----------------------------------------------------------------------
282 
288  }
289 
294  return NUM_PINGIN_INPUT_PORTS;
295  }
296 
297  protected:
298 
299  // ----------------------------------------------------------------------
300  // Getters for numbers of special output ports
301  // ----------------------------------------------------------------------
302 
303 #if FW_ENABLE_TEXT_LOGGING == 1
304 
308  static constexpr FwIndexType getNum_LogText_OutputPorts() {
310  }
311 
312 #endif
313 
319  }
320 
326  }
327 
333  }
334 
335  protected:
336 
337  // ----------------------------------------------------------------------
338  // Getters for numbers of typed output ports
339  // ----------------------------------------------------------------------
340 
346  }
347 
353  }
354 
360  }
361 
362  protected:
363 
364  // ----------------------------------------------------------------------
365  // Connection status queries for special output ports
366  // ----------------------------------------------------------------------
367 
368 #if FW_ENABLE_TEXT_LOGGING == 1
369 
373  bool isConnected_LogText_OutputPort(
374  FwIndexType portNum
375  );
376 
377 #endif
378 
383  FwIndexType portNum
384  );
385 
390  FwIndexType portNum
391  );
392 
397  FwIndexType portNum
398  );
399 
400  protected:
401 
402  // ----------------------------------------------------------------------
403  // Connection status queries for typed output ports
404  // ----------------------------------------------------------------------
405 
410  FwIndexType portNum
411  );
412 
417  FwIndexType portNum
418  );
419 
424  FwIndexType portNum
425  );
426 
427  protected:
428 
429  // ----------------------------------------------------------------------
430  // Handlers to implement for typed input ports
431  // ----------------------------------------------------------------------
432 
434  virtual void bufferSendIn_handler(
435  FwIndexType portNum,
436  Fw::Buffer& fwBuffer
437  ) = 0;
438 
440  virtual void pingIn_handler(
441  FwIndexType portNum,
442  U32 key
443  ) = 0;
444 
445  protected:
446 
447  // ----------------------------------------------------------------------
448  // Port handler base-class functions for typed input ports
449  //
450  // Call these functions directly to bypass the corresponding ports
451  // ----------------------------------------------------------------------
452 
455  FwIndexType portNum,
456  Fw::Buffer& fwBuffer
457  );
458 
460  void pingIn_handlerBase(
461  FwIndexType portNum,
462  U32 key
463  );
464 
465  protected:
466 
467  // ----------------------------------------------------------------------
468  // Pre-message hooks for typed async input ports
469  //
470  // Each of these functions is invoked just before processing a message
471  // on the corresponding port. By default, they do nothing. You can
472  // override them to provide specific pre-message behavior.
473  // ----------------------------------------------------------------------
474 
476  virtual void bufferSendIn_preMsgHook(
477  FwIndexType portNum,
478  Fw::Buffer& fwBuffer
479  );
480 
482  virtual void pingIn_preMsgHook(
483  FwIndexType portNum,
484  U32 key
485  );
486 
487  protected:
488 
489  // ----------------------------------------------------------------------
490  // Invocation functions for typed output ports
491  // ----------------------------------------------------------------------
492 
494  void bufferSendOut_out(
495  FwIndexType portNum,
496  Fw::Buffer& fwBuffer
497  );
498 
500  void fileAnnounce_out(
501  FwIndexType portNum,
502  Fw::StringBase& file_name
503  );
504 
506  void pingOut_out(
507  FwIndexType portNum,
508  U32 key
509  );
510 
511  protected:
512 
513  // ----------------------------------------------------------------------
514  // Event logging functions
515  // ----------------------------------------------------------------------
516 
521  const Fw::StringBase& fileName,
522  U32 computed,
523  U32 read
524  ) const;
525 
530  const Fw::StringBase& fileName
531  ) const;
532 
537  const Fw::StringBase& fileName
538  ) const;
539 
544  const Fw::StringBase& fileName
545  );
546 
551  FwPacketDescriptorType packetType,
552  U32 mode
553  );
554 
559  U32 packetIndex,
560  const Fw::StringBase& fileName
561  );
562 
567  U32 packetIndex,
568  U32 lastPacketIndex
569  );
570 
575  U32 packetIndex
576  );
577 
581  void log_ACTIVITY_HI_UplinkCanceled() const;
582 
587  I32 status
588  ) const;
589 
594  FwPacketDescriptorType packetType
595  ) const;
596 
597  protected:
598 
599  // ----------------------------------------------------------------------
600  // Event throttle reset functions
601  // ----------------------------------------------------------------------
602 
605 
608 
611 
614 
617 
618  protected:
619 
620  // ----------------------------------------------------------------------
621  // Telemetry write functions
622  // ----------------------------------------------------------------------
623 
628  U32 arg,
629  Fw::Time _tlmTime = Fw::Time()
630  ) const;
631 
636  U32 arg,
637  Fw::Time _tlmTime = Fw::Time()
638  ) const;
639 
643  void tlmWrite_Warnings(
644  U32 arg,
645  Fw::Time _tlmTime = Fw::Time()
646  ) const;
647 
648  protected:
649 
650  // ----------------------------------------------------------------------
651  // Time
652  // ----------------------------------------------------------------------
653 
657  Fw::Time getTime() const;
658 
659  private:
660 
661  // ----------------------------------------------------------------------
662  // Message dispatch functions
663  // ----------------------------------------------------------------------
664 
666  virtual MsgDispatchStatus doDispatch();
667 
668  private:
669 
670  // ----------------------------------------------------------------------
671  // Calls for messages received on typed input ports
672  // ----------------------------------------------------------------------
673 
675  static void m_p_bufferSendIn_in(
676  Fw::PassiveComponentBase* callComp,
677  FwIndexType portNum,
678  Fw::Buffer& fwBuffer
679  );
680 
682  static void m_p_pingIn_in(
683  Fw::PassiveComponentBase* callComp,
684  FwIndexType portNum,
685  U32 key
686  );
687 
688  private:
689 
690  // ----------------------------------------------------------------------
691  // Typed input ports
692  // ----------------------------------------------------------------------
693 
695  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
696 
698  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
699 
700  private:
701 
702  // ----------------------------------------------------------------------
703  // Special output ports
704  // ----------------------------------------------------------------------
705 
706 #if FW_ENABLE_TEXT_LOGGING == 1
707 
709  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
710 
711 #endif
712 
714  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
715 
717  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
718 
720  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
721 
722  private:
723 
724  // ----------------------------------------------------------------------
725  // Typed output ports
726  // ----------------------------------------------------------------------
727 
729  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
730 
733 
735  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
736 
737  private:
738 
739  // ----------------------------------------------------------------------
740  // Counter values for event throttling
741  // ----------------------------------------------------------------------
742 
744  std::atomic<FwIndexType> m_FileWriteErrorThrottle;
745 
747  std::atomic<FwIndexType> m_InvalidReceiveModeThrottle;
748 
750  std::atomic<FwIndexType> m_PacketOutOfBoundsThrottle;
751 
753  std::atomic<FwIndexType> m_PacketOutOfOrderThrottle;
754 
756  std::atomic<FwIndexType> m_PacketDuplicateThrottle;
757 
758  };
759 
760 }
761 
762 #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
PlatformIndexType FwIndexType
RateGroupDivider component implementation.