F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DpWriter.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title DpWriter.hpp
3 // \author bocchino
4 // \brief hpp file for DpWriter component implementation class
5 // ======================================================================
6 
7 #ifndef Svc_DpWriter_HPP
8 #define Svc_DpWriter_HPP
9 
10 #include <config/DpCfg.hpp>
11 
12 #include "Fw/Dp/DpContainer.hpp"
14 #include "Fw/Types/String.hpp"
17 
18 namespace Svc {
19 
20 class DpWriter final : public DpWriterComponentBase {
21  friend class DpWriterTester;
22 
23  // Keep the generated routing arrays consistent with the forwarding contract.
24  static_assert(DpWriter::NUM_BUFFERSENDIN_INPUT_PORTS == static_cast<FwSizeType>(DpWriterNumPorts),
25  "Number of buffer send in ports must equal DpWriterNumPorts");
26  static_assert(DpWriter::NUM_DPWRITTENOUT_OUTPUT_PORTS == static_cast<FwSizeType>(DpWriterNumPorts),
27  "Number of dp written out ports must equal DpWriterNumPorts");
28  static_assert(DpWriter::NUM_DEALLOCBUFFERSENDOUT_OUTPUT_PORTS == static_cast<FwSizeType>(DpWriterNumPorts),
29  "Number of dealloc buffer send out ports must equal DpWriterNumPorts");
30 
31  public:
32  // ----------------------------------------------------------------------
33  // Construction, initialization, and destruction
34  // ----------------------------------------------------------------------
35 
38  DpWriter(const char* const compName
39  );
40 
43  ~DpWriter();
44 
46  void configure(const Fw::ConstStringBase& dpFileNamePrefix
47  );
48 
49  private:
50  // ----------------------------------------------------------------------
51  // Handler implementations for user-defined typed input ports
52  // ----------------------------------------------------------------------
53 
56  void bufferSendIn_handler(const FwIndexType portNum,
57  Fw::Buffer& fwBuffer
58  ) final;
59 
62  void schedIn_handler(const FwIndexType portNum,
63  U32 context
64  ) final;
65 
66  private:
67  // ----------------------------------------------------------------------
68  // Handler implementations for commands
69  // ----------------------------------------------------------------------
70 
74  void CLEAR_EVENT_THROTTLE_cmdHandler(FwOpcodeType opCode,
75  U32 cmdSeq
76  ) final;
77 
78  private:
79  // ----------------------------------------------------------------------
80  // Private helper functions
81  // ----------------------------------------------------------------------
82 
85  Fw::Success::T deserializePacketHeader(Fw::Buffer& buffer,
86  Fw::DpContainer& container
87  );
88 
90  void performProcessing(Fw::DpContainer& container
91  );
92 
95  Fw::Success::T writeFile(const Fw::DpContainer& container,
96  const Fw::FileNameString& fileName,
97  FwSizeType& fileSize
98  );
99 
101  void sendNotification(FwIndexType portNum,
102  const Fw::DpContainer& container,
103  const Fw::FileNameString& fileName,
104  FwSizeType fileSize
105  );
106 
107  private:
108  // ----------------------------------------------------------------------
109  // Private member variables
110  // ----------------------------------------------------------------------
111 
113  U32 m_numBuffersReceived = 0;
114 
116  U64 m_numBytesWritten = 0;
117 
119  U32 m_numSuccessfulWrites = 0;
120 
122  U32 m_numFailedWrites = 0;
123 
125  U32 m_numErrors = 0;
126 
130  Fw::FileNameString m_dpFileNamePrefix;
131 };
132 
133 } // end namespace Svc
134 
135 #endif
A data product Container.
Definition: DpContainer.hpp:26
FwIdType FwOpcodeType
The type of a command opcode.
PlatformSizeType FwSizeType
T
The raw enum type.
A read-only abstract superclass for StringBase.
PlatformIndexType FwIndexType
void configure(const Fw::ConstStringBase &dpFileNamePrefix)
Configure writer.
Definition: DpWriter.cpp:26
RateGroupDivider component implementation.
DpWriter(const char *const compName)
Definition: DpWriter.cpp:22
friend class DpWriterTester
Definition: DpWriter.hpp:21
Auto-generated base for DpWriter component.