F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SignalGen.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SignalGen.hpp
3 // \author bocchino
4 // \brief hpp file for SequenceFileLoader component implementation class
5 //
6 // \copyright
7 // Copyright (C) 2009-2016 California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef Svc_SignalGen_HPP
14 #define Svc_SignalGen_HPP
15 
16 #include <Fw/Types/ByteArray.hpp>
18 #include <Os/File.hpp>
19 #include <Os/ValidateFile.hpp>
20 #include <Ref/SignalGen/SignalGenComponentAc.hpp>
21 #include <cmath>
22 
23 namespace Ref {
24 
25 class SignalGen final : public SignalGenComponentBase {
26  private:
27  void schedIn_handler(FwIndexType portNum,
28  U32 context
29  ) final;
30 
31  void Settings_cmdHandler(FwOpcodeType opCode,
32  U32 cmdSeq,
33  U32 Frequency,
34  F32 Amplitude,
35  F32 Phase,
36  Ref::SignalType SigType) final;
37 
38  void Toggle_cmdHandler(FwOpcodeType opCode,
39  U32 cmdSeq
40  ) final;
41 
42  void Skip_cmdHandler(FwOpcodeType opCode,
43  U32 cmdSeq
44  ) final;
45 
49  void Dp_cmdHandler(FwOpcodeType opCode,
50  U32 cmdSeq,
51  Ref::SignalGen_DpReqType reqType,
52  U32 records,
53  U32 priority) final;
54 
55  // ----------------------------------------------------------------------
56  // Handler implementations for data products
57  // ----------------------------------------------------------------------
58 
60  void dpRecv_DataContainer_handler(DpContainer& container,
61  Fw::Success::T status
62  ) final;
63 
64  public:
66  SignalGen(const char* compName
67  );
68 
70  ~SignalGen();
71 
72  private:
73  // Generate the next sample internal helper
74  F32 generateSample(U32 ticks);
75 
76  // DP cleanup helper
77  void cleanupAndSendDp();
78 
79  // Member variables
80  U32 sampleFrequency;
81  U32 signalFrequency;
82  F32 signalAmplitude;
83  F32 signalPhase;
84  U32 ticks;
85  SignalType sigType;
86  SignalSet sigHistory;
87  SignalPairSet sigPairHistory;
88  bool running;
89  bool skipOne;
90  DpContainer m_dpContainer;
91  bool m_dpInProgress;
92  U32 m_numDps;
93  U32 m_currDp;
94  U32 m_dpBytes;
95  FwDpPriorityType m_dpPriority;
96 };
97 } // namespace Ref
98 #endif
FwIdType FwOpcodeType
The type of a command opcode.
U32 FwDpPriorityType
The type of a data product priority.
float F32
32-bit floating point
Definition: BasicTypes.h:84
T
The raw enum type.
Defines a file class to validate files or generate a file validator file.
PlatformIndexType FwIndexType
~SignalGen()
Destroy a SignalGen.
Definition: SignalGen.cpp:46
SignalGen(const char *compName)
Construct a SignalGen.
Definition: SignalGen.cpp:29