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 
272 
277 
278  protected:
279 
280  // ----------------------------------------------------------------------
281  // Getters for numbers of special output ports
282  // ----------------------------------------------------------------------
283 
284 #if FW_ENABLE_TEXT_LOGGING == 1
285 
289  FwIndexType getNum_LogText_OutputPorts() const;
290 
291 #endif
292 
297 
302 
307 
308  protected:
309 
310  // ----------------------------------------------------------------------
311  // Getters for numbers of typed output ports
312  // ----------------------------------------------------------------------
313 
318 
323 
324  protected:
325 
326  // ----------------------------------------------------------------------
327  // Connection status queries for special output ports
328  // ----------------------------------------------------------------------
329 
330 #if FW_ENABLE_TEXT_LOGGING == 1
331 
335  bool isConnected_LogText_OutputPort(
336  FwIndexType portNum
337  );
338 
339 #endif
340 
345  FwIndexType portNum
346  );
347 
352  FwIndexType portNum
353  );
354 
359  FwIndexType portNum
360  );
361 
362  protected:
363 
364  // ----------------------------------------------------------------------
365  // Connection status queries for typed output ports
366  // ----------------------------------------------------------------------
367 
372  FwIndexType portNum
373  );
374 
379  FwIndexType portNum
380  );
381 
382  protected:
383 
384  // ----------------------------------------------------------------------
385  // Handlers to implement for typed input ports
386  // ----------------------------------------------------------------------
387 
389  virtual void bufferSendIn_handler(
390  FwIndexType portNum,
391  Fw::Buffer& fwBuffer
392  ) = 0;
393 
395  virtual void pingIn_handler(
396  FwIndexType portNum,
397  U32 key
398  ) = 0;
399 
400  protected:
401 
402  // ----------------------------------------------------------------------
403  // Port handler base-class functions for typed input ports
404  //
405  // Call these functions directly to bypass the corresponding ports
406  // ----------------------------------------------------------------------
407 
410  FwIndexType portNum,
411  Fw::Buffer& fwBuffer
412  );
413 
415  void pingIn_handlerBase(
416  FwIndexType portNum,
417  U32 key
418  );
419 
420  protected:
421 
422  // ----------------------------------------------------------------------
423  // Pre-message hooks for typed async input ports
424  //
425  // Each of these functions is invoked just before processing a message
426  // on the corresponding port. By default, they do nothing. You can
427  // override them to provide specific pre-message behavior.
428  // ----------------------------------------------------------------------
429 
431  virtual void bufferSendIn_preMsgHook(
432  FwIndexType portNum,
433  Fw::Buffer& fwBuffer
434  );
435 
437  virtual void pingIn_preMsgHook(
438  FwIndexType portNum,
439  U32 key
440  );
441 
442  protected:
443 
444  // ----------------------------------------------------------------------
445  // Invocation functions for typed output ports
446  // ----------------------------------------------------------------------
447 
449  void bufferSendOut_out(
450  FwIndexType portNum,
451  Fw::Buffer& fwBuffer
452  );
453 
455  void pingOut_out(
456  FwIndexType portNum,
457  U32 key
458  );
459 
460  protected:
461 
462  // ----------------------------------------------------------------------
463  // Event logging functions
464  // ----------------------------------------------------------------------
465 
470  const Fw::StringBase& fileName,
471  U32 computed,
472  U32 read
473  ) const;
474 
479  const Fw::StringBase& fileName
480  ) const;
481 
486  const Fw::StringBase& fileName
487  ) const;
488 
493  const Fw::StringBase& fileName
494  );
495 
500  FwPacketDescriptorType packetType,
501  U32 mode
502  );
503 
508  U32 packetIndex,
509  const Fw::StringBase& fileName
510  );
511 
516  U32 packetIndex,
517  U32 lastPacketIndex
518  );
519 
524  U32 packetIndex
525  );
526 
530  void log_ACTIVITY_HI_UplinkCanceled() const;
531 
536  I32 status
537  ) const;
538 
543  FwPacketDescriptorType packetType
544  ) const;
545 
546  protected:
547 
548  // ----------------------------------------------------------------------
549  // Event throttle reset functions
550  // ----------------------------------------------------------------------
551 
554 
557 
560 
563 
566 
567  protected:
568 
569  // ----------------------------------------------------------------------
570  // Telemetry write functions
571  // ----------------------------------------------------------------------
572 
577  U32 arg,
578  Fw::Time _tlmTime = Fw::Time()
579  ) const;
580 
585  U32 arg,
586  Fw::Time _tlmTime = Fw::Time()
587  ) const;
588 
592  void tlmWrite_Warnings(
593  U32 arg,
594  Fw::Time _tlmTime = Fw::Time()
595  ) const;
596 
597  protected:
598 
599  // ----------------------------------------------------------------------
600  // Time
601  // ----------------------------------------------------------------------
602 
606  Fw::Time getTime() const;
607 
608  private:
609 
610  // ----------------------------------------------------------------------
611  // Message dispatch functions
612  // ----------------------------------------------------------------------
613 
615  virtual MsgDispatchStatus doDispatch();
616 
617  private:
618 
619  // ----------------------------------------------------------------------
620  // Calls for messages received on typed input ports
621  // ----------------------------------------------------------------------
622 
624  static void m_p_bufferSendIn_in(
625  Fw::PassiveComponentBase* callComp,
626  FwIndexType portNum,
627  Fw::Buffer& fwBuffer
628  );
629 
631  static void m_p_pingIn_in(
632  Fw::PassiveComponentBase* callComp,
633  FwIndexType portNum,
634  U32 key
635  );
636 
637  private:
638 
639  // ----------------------------------------------------------------------
640  // Typed input ports
641  // ----------------------------------------------------------------------
642 
644  Fw::InputBufferSendPort m_bufferSendIn_InputPort[NUM_BUFFERSENDIN_INPUT_PORTS];
645 
647  Svc::InputPingPort m_pingIn_InputPort[NUM_PINGIN_INPUT_PORTS];
648 
649  private:
650 
651  // ----------------------------------------------------------------------
652  // Special output ports
653  // ----------------------------------------------------------------------
654 
655 #if FW_ENABLE_TEXT_LOGGING == 1
656 
658  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
659 
660 #endif
661 
663  Fw::OutputLogPort m_eventOut_OutputPort[NUM_EVENTOUT_OUTPUT_PORTS];
664 
666  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
667 
669  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
670 
671  private:
672 
673  // ----------------------------------------------------------------------
674  // Typed output ports
675  // ----------------------------------------------------------------------
676 
678  Fw::OutputBufferSendPort m_bufferSendOut_OutputPort[NUM_BUFFERSENDOUT_OUTPUT_PORTS];
679 
681  Svc::OutputPingPort m_pingOut_OutputPort[NUM_PINGOUT_OUTPUT_PORTS];
682 
683  private:
684 
685  // ----------------------------------------------------------------------
686  // Counter values for event throttling
687  // ----------------------------------------------------------------------
688 
690  std::atomic<FwIndexType> m_FileWriteErrorThrottle;
691 
693  std::atomic<FwIndexType> m_InvalidReceiveModeThrottle;
694 
696  std::atomic<FwIndexType> m_PacketOutOfBoundsThrottle;
697 
699  std::atomic<FwIndexType> m_PacketOutOfOrderThrottle;
700 
702  std::atomic<FwIndexType> m_PacketDuplicateThrottle;
703 
704  };
705 
706 }
707 
708 #endif
FwIdType FwPacketDescriptorType
The type of a com packet descriptor.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
void init()
Object initializer.
Definition: ObjBase.cpp:24
PlatformIndexType FwIndexType
RateGroupDivider component implementation.