功能: - UDP端口监听,实时接收数据 - 解析16通道逗号分隔的ADC数据 - 实时波形绘制(支持滚轮缩放、右键拖拽、双击恢复) - 数据自动保存到 data_端口号/ 目录 - 支持打开历史CSV文件回放查看 - 16通道独立颜色,可切换显示/隐藏 - 深色主题界面
35 lines
716 B
C++
35 lines
716 B
C++
#ifndef DATAMANAGER_H
|
|
#define DATAMANAGER_H
|
|
|
|
#include <QObject>
|
|
#include <QFile>
|
|
#include <QTextStream>
|
|
#include <QVector>
|
|
#include <QDateTime>
|
|
|
|
class DataManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DataManager(QObject *parent = nullptr);
|
|
~DataManager();
|
|
|
|
bool startRecording(const QString &dirPath);
|
|
void stopRecording();
|
|
bool isRecording() const;
|
|
void appendDataPoint(const QVector<int> &values);
|
|
QString currentFilePath() const;
|
|
|
|
static QVector<QVector<double>> loadFile(const QString &filePath, QString &error);
|
|
|
|
private:
|
|
QFile m_file;
|
|
QTextStream m_stream;
|
|
bool m_recording;
|
|
QString m_filePath;
|
|
bool m_headerWritten;
|
|
};
|
|
|
|
#endif // DATAMANAGER_H
|