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"
28 
29 namespace Svc {
30 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
44  friend class FileUplinkTesterBase;
46  friend class FileUplinkTester;
47 
48  protected:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
58  };
59 
61  enum {
66  };
67 
69  enum {
73  };
74 
76  enum {
88  };
89 
91  enum {
97  };
98 
100  enum {
104  };
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Component initialization
110  // ----------------------------------------------------------------------
111 
113  void init(
114  FwSizeType queueDepth,
115  FwEnumStoreType instance = 0
116  );
117 
118  public:
119 
120  // ----------------------------------------------------------------------
121  // Getters for typed input ports
122  // ----------------------------------------------------------------------
123 
128  FwIndexType portNum
129  );
130 
135  FwIndexType portNum
136  );
137 
138  public:
139 
140  // ----------------------------------------------------------------------
141  // Connect input ports to special output ports
142  // ----------------------------------------------------------------------
143 
144 #if FW_ENABLE_TEXT_LOGGING == 1
145 
147  void set_LogText_OutputPort(
148  FwIndexType portNum,
149  Fw::InputLogTextPort* port
150  );
151 
152 #endif
153 
156  FwIndexType portNum,
157  Fw::InputLogPort* port
158  );
159 
162  FwIndexType portNum,
163  Fw::InputTimePort* port
164  );
165 
168  FwIndexType portNum,
169  Fw::InputTlmPort* port
170  );
171 
172  public:
173 
174  // ----------------------------------------------------------------------
175  // Connect typed input ports to typed output ports
176  // ----------------------------------------------------------------------
177 
180  FwIndexType portNum,
182  );
183 
186  FwIndexType portNum,
188  );
189 
192  FwIndexType portNum,
193  Svc::InputPingPort* port
194  );
195 
196 #if FW_PORT_SERIALIZATION
197 
198  public:
199 
200  // ----------------------------------------------------------------------
201  // Connect serial input ports to special output ports
202  // ----------------------------------------------------------------------
203 
204 #if FW_ENABLE_TEXT_LOGGING == 1
205 
207  void set_LogText_OutputPort(
208  FwIndexType portNum,
209  Fw::InputSerializePort* port
210  );
211 
212 #endif
213 
216  FwIndexType portNum,
217  Fw::InputSerializePort* port
218  );
219 
222  FwIndexType portNum,
223  Fw::InputSerializePort* port
224  );
225 
228  FwIndexType portNum,
229  Fw::InputSerializePort* port
230  );
231 
232 #endif
233 
234 #if FW_PORT_SERIALIZATION
235 
236  public:
237 
238  // ----------------------------------------------------------------------
239  // Connect serial input ports to typed output ports
240  // ----------------------------------------------------------------------
241 
244  FwIndexType portNum,
245  Fw::InputSerializePort* port
246  );
247 
250  FwIndexType portNum,
251  Fw::InputSerializePort* port
252  );
253 
256  FwIndexType portNum,
257  Fw::InputSerializePort* port
258  );
259 
260 #endif
261 
262  protected:
263 
264  // ----------------------------------------------------------------------
265  // Component construction and destruction
266  // ----------------------------------------------------------------------
267 
270  const char* compName = ""
271  );
272 
274  virtual ~FileUplinkComponentBase();
275 
276  protected:
277 
278  // ----------------------------------------------------------------------
279  // Getters for numbers of typed input ports
280  // ----------------------------------------------------------------------
281 
287  }
288 
293  return NUM_PINGIN_INPUT_PORTS;
294  }
295 
296  protected:
297 
298  // ----------------------------------------------------------------------
299  // Getters for numbers of special output ports
300  // ----------------------------------------------------------------------
301 
302 #if FW_ENABLE_TEXT_LOGGING == 1
303 
307  static constexpr FwIndexType getNum_LogText_OutputPorts() {
309  }
310 
311 #endif
312 
318  }
319 
325  }
326 
332  }
333 
334  protected:
335 
336  // ----------------------------------------------------------------------
337  // Getters for numbers of typed output ports
338  // ----------------------------------------------------------------------
339 
345  }
346 
352  }
353 
359  }
360 
361  protected:
362 
363  // ----------------------------------------------------------------------
364  // Connection status queries for special output ports
365  // ----------------------------------------------------------------------
366 
367 #if FW_ENABLE_TEXT_LOGGING == 1
368 
372  bool isConnected_LogText_OutputPort(
373  FwIndexType portNum
374  );
375 
376 #endif
377 
382  FwIndexType portNum
383  );
384 
389  FwIndexType portNum
390  );
391 
396  FwIndexType portNum
397  );
398 
399  protected:
400 
401  // ----------------------------------------------------------------------
402  // Connection status queries for typed output ports
403  // ----------------------------------------------------------------------
404 
409  FwIndexType portNum
410  );
411 
416  FwIndexType portNum
417  );
418 
423  FwIndexType portNum
424  );
425 
426  protected:
427 
428  // ----------------------------------------------------------------------
429  // Handlers to implement for typed input ports
430  // ----------------------------------------------------------------------
431 
433  virtual void bufferSendIn_handler(
434  FwIndexType portNum,
435  Fw::Buffer& fwBuffer
436  ) = 0;
437 
439  virtual void pingIn_handler(
440  FwIndexType portNum,
441  U32 key
442  ) = 0;
443 
444  protected:
445 
446  // ----------------------------------------------------------------------
447  // Port handler base-class functions for typed input ports
448  //
449  // Call these functions directly to bypass the corresponding ports
450  // ----------------------------------------------------------------------
451 
454  FwIndexType portNum,
455  Fw::Buffer& fwBuffer
456  );
457 
459  void pingIn_handlerBase(
460  FwIndexType portNum,
461  U32 key
462  );
463 
464  protected:
465 
466  // ----------------------------------------------------------------------
467  // Pre-message hooks for typed async input ports
468  //
469  // Each of these functions is invoked just before processing a message
470  // on the corresponding port. By default, they do nothing. You can
471  // override them to provide specific pre-message behavior.
472  // ----------------------------------------------------------------------
473 
475  virtual void bufferSendIn_preMsgHook(
476  FwIndexType portNum,
477  Fw::Buffer& fwBuffer
478  );
479 
481  virtual void pingIn_preMsgHook(
482  FwIndexType portNum,
483  U32 key
484  );
485 
486  protected:
487 
488  // ----------------------------------------------------------------------
489  // Invocation functions for typed output ports
490  // ----------------------------------------------------------------------
491 
493  void bufferSendOut_out(
494  FwIndexType portNum,
495  Fw::Buffer& fwBuffer
496  );
497 
499  void fileAnnounce_out(
500  FwIndexType portNum,
501  Fw::StringBase& file_name
502  );
503 
505  void pingOut_out(
506  FwIndexType portNum,
507  U32 key
508  );
509 
510  protected:
511 
512  // ----------------------------------------------------------------------
513  // Event logging functions
514  // ----------------------------------------------------------------------
515 
520  const Fw::StringBase& fileName,
521  U32 computed,
522  U32 read
523  ) const;
524 
529  const Fw::StringBase& fileName
530  ) const;
531 
536  const Fw::StringBase& fileName
537  ) const;
538 
543  const Fw::StringBase& fileName
544  );
545 
550  FwPacketDescriptorType packetType,
551  U32 mode
552  );
553 
558  U32 packetIndex,
559  const Fw::StringBase& fileName
560  );
561 
566  U32 packetIndex,
567  U32 lastPacketIndex
568  );
569 
574  U32 packetIndex
575  );
576 
580  void log_ACTIVITY_HI_UplinkCanceled() const;
581 
586  I32 status
587  ) const;
588 
593  FwPacketDescriptorType packetType
594  ) const;
595 
596  protected:
597 
598  // ----------------------------------------------------------------------
599  // Event throttle reset functions
600  // ----------------------------------------------------------------------
601 
604 
607 
610 
613 
616 
617  protected:
618 
619  // ----------------------------------------------------------------------
620  // Telemetry write functions
621  // ----------------------------------------------------------------------
622 
627  U32 arg,
628  Fw::Time _tlmTime = Fw::Time()
629  ) const;
630 
635  U32 arg,
636  Fw::Time _tlmTime = Fw::Time()
637  ) const;
638 
642  void tlmWrite_Warnings(
643  U32 arg,
644  Fw::Time _tlmTime = Fw::Time()
645  ) const;
646 
647  protected:
648 
649  // ----------------------------------------------------------------------
650  // Time
651  // ----------------------------------------------------------------------
652 
656  Fw::Time getTime() const;
657 
658  private:
659 
660  // ----------------------------------------------------------------------
661  // Message dispatch functions
662  // ----------------------------------------------------------------------
663 
665  virtual MsgDispatchStatus doDispatch();
666 
667  private:
668 
669  // ----------------------------------------------------------------------
670  // Calls for messages received on typed input ports
671  // ----------------------------------------------------------------------
672 
674  static void m_p_bufferSendIn_in(
675  Fw::PassiveComponentBase* callComp,
676  FwIndexType portNum,
677  Fw::Buffer& fwBuffer
678  );
679 
681  static void m_p_pingIn_in(
682  Fw::PassiveComponentBase* callComp,
683  FwIndexType portNum,
684  U32 key
685  );
686 
687  private:
688 
689  // ----------------------------------------------------------------------
690  // Typed input ports
691  // ----------------------------------------------------------------------
692 
694  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
695 
697  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
698 
699  private:
700 
701  // ----------------------------------------------------------------------
702  // Special output ports
703  // ----------------------------------------------------------------------
704 
705 #if FW_ENABLE_TEXT_LOGGING == 1
706 
708  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
709 
710 #endif
711 
713  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
714 
716  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
717 
719  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
720 
721  private:
722 
723  // ----------------------------------------------------------------------
724  // Typed output ports
725  // ----------------------------------------------------------------------
726 
728  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
729 
732 
734  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
735 
736  private:
737 
738  // ----------------------------------------------------------------------
739  // Counter values for event throttling
740  // ----------------------------------------------------------------------
741 
743  std::atomic<FwIndexType> m_FileWriteErrorThrottle;
744 
746  std::atomic<FwIndexType> m_InvalidReceiveModeThrottle;
747 
749  std::atomic<FwIndexType> m_PacketOutOfBoundsThrottle;
750 
752  std::atomic<FwIndexType> m_PacketOutOfOrderThrottle;
753 
755  std::atomic<FwIndexType> m_PacketDuplicateThrottle;
756 
757  };
758 
759 }
760 
761 #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.