dataanalyzerresult.h
1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include <vector>
#include "hantekprotocol/definitions.h"
////////////////////////////////////////////////////////////////////////////////
/// \struct SampleValues dataanalyzer.h
/// \brief Struct for a array of sample values.
struct SampleValues {
std::vector<double> sample; ///< Vector holding the sampling data
double interval = 0.0; ///< The interval between two sample values
};
////////////////////////////////////////////////////////////////////////////////
/// \struct AnalyzedData dataanalyzer.h
/// \brief Struct for the analyzed data.
struct DataChannel {
SampleValues voltage; ///< The time-domain voltage levels (V)
SampleValues spectrum; ///< The frequency-domain power levels (dB)
double amplitude = 0.0; ///< The amplitude of the signal
double frequency = 0.0; ///< The frequency of the signal
};
class DataAnalyzerResult {
public:
DataAnalyzerResult(unsigned int channelCount);
const DataChannel *data(ChannelID channel) const;
DataChannel *modifyData(ChannelID channel);
unsigned int sampleCount() const;
unsigned int channelCount() const;
/**
* Applies a new maximum samples value, if the given value is higher than the
* already stored one
* @param newMaxSamples Maximum samples value
*/
void challengeMaxSamples(unsigned int newMaxSamples);
unsigned int getMaxSamples() const;
private:
std::vector<DataChannel> analyzedData; ///< The analyzed data for each channel
unsigned int maxSamples = 0; ///< The maximum record length of the analyzed data
};