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"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
43  friend class FileUplinkTesterBase;
45  friend class FileUplinkTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
57  };
58 
60  enum {
65  };
66 
68  enum {
71  };
72 
74  enum {
86  };
87 
89  enum {
95  };
96 
98  enum {
102  };
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Component initialization
108  // ----------------------------------------------------------------------
109 
111  void init(
112  FwSizeType queueDepth,
113  FwEnumStoreType instance = 0
114  );
115 
116  public:
117 
118  // ----------------------------------------------------------------------
119  // Getters for typed input ports
120  // ----------------------------------------------------------------------
121 
126  FwIndexType portNum
127  );
128 
133  FwIndexType portNum
134  );
135 
136  public:
137 
138  // ----------------------------------------------------------------------
139  // Connect input ports to special output ports
140  // ----------------------------------------------------------------------
141 
142 #if FW_ENABLE_TEXT_LOGGING == 1
143 
145  void set_LogText_OutputPort(
146  FwIndexType portNum,
147  Fw::InputLogTextPort* port
148  );
149 
150 #endif
151 
154  FwIndexType portNum,
155  Fw::InputLogPort* port
156  );
157 
160  FwIndexType portNum,
161  Fw::InputTimePort* port
162  );
163 
166  FwIndexType portNum,
167  Fw::InputTlmPort* port
168  );
169 
170  public:
171 
172  // ----------------------------------------------------------------------
173  // Connect typed input ports to typed output ports
174  // ----------------------------------------------------------------------
175 
178  FwIndexType portNum,
180  );
181 
184  FwIndexType portNum,
185  Svc::InputPingPort* port
186  );
187 
188 #if FW_PORT_SERIALIZATION
189 
190  public:
191 
192  // ----------------------------------------------------------------------
193  // Connect serial input ports to special output ports
194  // ----------------------------------------------------------------------
195 
196 #if FW_ENABLE_TEXT_LOGGING == 1
197 
199  void set_LogText_OutputPort(
200  FwIndexType portNum,
201  Fw::InputSerializePort* port
202  );
203 
204 #endif
205 
208  FwIndexType portNum,
209  Fw::InputSerializePort* port
210  );
211 
214  FwIndexType portNum,
215  Fw::InputSerializePort* port
216  );
217 
220  FwIndexType portNum,
221  Fw::InputSerializePort* port
222  );
223 
224 #endif
225 
226 #if FW_PORT_SERIALIZATION
227 
228  public:
229 
230  // ----------------------------------------------------------------------
231  // Connect serial input ports to typed output ports
232  // ----------------------------------------------------------------------
233 
236  FwIndexType portNum,
237  Fw::InputSerializePort* port
238  );
239 
242  FwIndexType portNum,
243  Fw::InputSerializePort* port
244  );
245 
246 #endif
247 
248  protected:
249 
250  // ----------------------------------------------------------------------
251  // Component construction and destruction
252  // ----------------------------------------------------------------------
253 
256  const char* compName = ""
257  );
258 
260  virtual ~FileUplinkComponentBase();
261 
262  protected:
263 
264  // ----------------------------------------------------------------------
265  // Getters for numbers of typed input ports
266  // ----------------------------------------------------------------------
267 
273  }
274 
279  return NUM_PINGIN_INPUT_PORTS;
280  }
281 
282  protected:
283 
284  // ----------------------------------------------------------------------
285  // Getters for numbers of special output ports
286  // ----------------------------------------------------------------------
287 
288 #if FW_ENABLE_TEXT_LOGGING == 1
289 
293  static constexpr FwIndexType getNum_LogText_OutputPorts() {
295  }
296 
297 #endif
298 
304  }
305 
311  }
312 
318  }
319 
320  protected:
321 
322  // ----------------------------------------------------------------------
323  // Getters for numbers of typed output ports
324  // ----------------------------------------------------------------------
325 
331  }
332 
338  }
339 
340  protected:
341 
342  // ----------------------------------------------------------------------
343  // Connection status queries for special output ports
344  // ----------------------------------------------------------------------
345 
346 #if FW_ENABLE_TEXT_LOGGING == 1
347 
351  bool isConnected_LogText_OutputPort(
352  FwIndexType portNum
353  );
354 
355 #endif
356 
361  FwIndexType portNum
362  );
363 
368  FwIndexType portNum
369  );
370 
375  FwIndexType portNum
376  );
377 
378  protected:
379 
380  // ----------------------------------------------------------------------
381  // Connection status queries for typed output ports
382  // ----------------------------------------------------------------------
383 
388  FwIndexType portNum
389  );
390 
395  FwIndexType portNum
396  );
397 
398  protected:
399 
400  // ----------------------------------------------------------------------
401  // Handlers to implement for typed input ports
402  // ----------------------------------------------------------------------
403 
405  virtual void bufferSendIn_handler(
406  FwIndexType portNum,
407  Fw::Buffer& fwBuffer
408  ) = 0;
409 
411  virtual void pingIn_handler(
412  FwIndexType portNum,
413  U32 key
414  ) = 0;
415 
416  protected:
417 
418  // ----------------------------------------------------------------------
419  // Port handler base-class functions for typed input ports
420  //
421  // Call these functions directly to bypass the corresponding ports
422  // ----------------------------------------------------------------------
423 
426  FwIndexType portNum,
427  Fw::Buffer& fwBuffer
428  );
429 
431  void pingIn_handlerBase(
432  FwIndexType portNum,
433  U32 key
434  );
435 
436  protected:
437 
438  // ----------------------------------------------------------------------
439  // Pre-message hooks for typed async input ports
440  //
441  // Each of these functions is invoked just before processing a message
442  // on the corresponding port. By default, they do nothing. You can
443  // override them to provide specific pre-message behavior.
444  // ----------------------------------------------------------------------
445 
447  virtual void bufferSendIn_preMsgHook(
448  FwIndexType portNum,
449  Fw::Buffer& fwBuffer
450  );
451 
453  virtual void pingIn_preMsgHook(
454  FwIndexType portNum,
455  U32 key
456  );
457 
458  protected:
459 
460  // ----------------------------------------------------------------------
461  // Invocation functions for typed output ports
462  // ----------------------------------------------------------------------
463 
465  void bufferSendOut_out(
466  FwIndexType portNum,
467  Fw::Buffer& fwBuffer
468  );
469 
471  void pingOut_out(
472  FwIndexType portNum,
473  U32 key
474  );
475 
476  protected:
477 
478  // ----------------------------------------------------------------------
479  // Event logging functions
480  // ----------------------------------------------------------------------
481 
486  const Fw::StringBase& fileName,
487  U32 computed,
488  U32 read
489  ) const;
490 
495  const Fw::StringBase& fileName
496  ) const;
497 
502  const Fw::StringBase& fileName
503  ) const;
504 
509  const Fw::StringBase& fileName
510  );
511 
516  FwPacketDescriptorType packetType,
517  U32 mode
518  );
519 
524  U32 packetIndex,
525  const Fw::StringBase& fileName
526  );
527 
532  U32 packetIndex,
533  U32 lastPacketIndex
534  );
535 
540  U32 packetIndex
541  );
542 
546  void log_ACTIVITY_HI_UplinkCanceled() const;
547 
552  I32 status
553  ) const;
554 
559  FwPacketDescriptorType packetType
560  ) const;
561 
562  protected:
563 
564  // ----------------------------------------------------------------------
565  // Event throttle reset functions
566  // ----------------------------------------------------------------------
567 
570 
573 
576 
579 
582 
583  protected:
584 
585  // ----------------------------------------------------------------------
586  // Telemetry write functions
587  // ----------------------------------------------------------------------
588 
593  U32 arg,
594  Fw::Time _tlmTime = Fw::Time()
595  ) const;
596 
601  U32 arg,
602  Fw::Time _tlmTime = Fw::Time()
603  ) const;
604 
608  void tlmWrite_Warnings(
609  U32 arg,
610  Fw::Time _tlmTime = Fw::Time()
611  ) const;
612 
613  protected:
614 
615  // ----------------------------------------------------------------------
616  // Time
617  // ----------------------------------------------------------------------
618 
622  Fw::Time getTime() const;
623 
624  private:
625 
626  // ----------------------------------------------------------------------
627  // Message dispatch functions
628  // ----------------------------------------------------------------------
629 
631  virtual MsgDispatchStatus doDispatch();
632 
633  private:
634 
635  // ----------------------------------------------------------------------
636  // Calls for messages received on typed input ports
637  // ----------------------------------------------------------------------
638 
640  static void m_p_bufferSendIn_in(
641  Fw::PassiveComponentBase* callComp,
642  FwIndexType portNum,
643  Fw::Buffer& fwBuffer
644  );
645 
647  static void m_p_pingIn_in(
648  Fw::PassiveComponentBase* callComp,
649  FwIndexType portNum,
650  U32 key
651  );
652 
653  private:
654 
655  // ----------------------------------------------------------------------
656  // Typed input ports
657  // ----------------------------------------------------------------------
658 
660  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
661 
663  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
664 
665  private:
666 
667  // ----------------------------------------------------------------------
668  // Special output ports
669  // ----------------------------------------------------------------------
670 
671 #if FW_ENABLE_TEXT_LOGGING == 1
672 
674  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
675 
676 #endif
677 
679  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
680 
682  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
683 
685  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
686 
687  private:
688 
689  // ----------------------------------------------------------------------
690  // Typed output ports
691  // ----------------------------------------------------------------------
692 
694  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
695 
697  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
698 
699  private:
700 
701  // ----------------------------------------------------------------------
702  // Counter values for event throttling
703  // ----------------------------------------------------------------------
704 
706  std::atomic<FwIndexType> m_FileWriteErrorThrottle;
707 
709  std::atomic<FwIndexType> m_InvalidReceiveModeThrottle;
710 
712  std::atomic<FwIndexType> m_PacketOutOfBoundsThrottle;
713 
715  std::atomic<FwIndexType> m_PacketOutOfOrderThrottle;
716 
718  std::atomic<FwIndexType> m_PacketDuplicateThrottle;
719 
720  };
721 
722 }
723 
724 #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.