feat: AiAnalysis - 16通道AI数据UDP实时采集与分析
功能: - UDP端口监听,实时接收数据 - 解析16通道逗号分隔的ADC数据 - 实时波形绘制(支持滚轮缩放、右键拖拽、双击恢复) - 数据自动保存到 data_端口号/ 目录 - 支持打开历史CSV文件回放查看 - 16通道独立颜色,可切换显示/隐藏 - 深色主题界面
This commit is contained in:
67
mainwindow.h
Normal file
67
mainwindow.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QSpinBox>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
class PlotWidget;
|
||||
class UdpReceiver;
|
||||
class DataManager;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void onStartStop();
|
||||
void onOpenFile();
|
||||
void onClear();
|
||||
void onDataReceived(const QByteArray &data);
|
||||
void onDisplayPointsChanged(int count);
|
||||
void onToggleChannel(int channel, bool visible);
|
||||
|
||||
private:
|
||||
void setupUi();
|
||||
void startReceiving();
|
||||
void stopReceiving();
|
||||
void processDataLine(const QString &line);
|
||||
void loadAndDisplayFile(const QString &filePath);
|
||||
|
||||
// 控件
|
||||
QLineEdit *m_portEdit;
|
||||
QPushButton *m_startStopBtn;
|
||||
QPushButton *m_openFileBtn;
|
||||
QPushButton *m_clearBtn;
|
||||
QLabel *m_statusLabel;
|
||||
QLabel *m_packetLabel;
|
||||
QSpinBox *m_displaySpinBox;
|
||||
PlotWidget *m_plotWidget;
|
||||
|
||||
// 功能组件
|
||||
UdpReceiver *m_udpReceiver;
|
||||
DataManager *m_dataManager;
|
||||
|
||||
// 状态
|
||||
bool m_isReceiving;
|
||||
int m_packetCount;
|
||||
QString m_dataDir;
|
||||
|
||||
// 通道选择复选框
|
||||
QList<QCheckBox*> m_channelChecks;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
Reference in New Issue
Block a user