功能: - UDP端口监听,实时接收数据 - 解析16通道逗号分隔的ADC数据 - 实时波形绘制(支持滚轮缩放、右键拖拽、双击恢复) - 数据自动保存到 data_端口号/ 目录 - 支持打开历史CSV文件回放查看 - 16通道独立颜色,可切换显示/隐藏 - 深色主题界面
33 lines
546 B
C++
33 lines
546 B
C++
#ifndef UDPRECEIVER_H
|
|
#define UDPRECEIVER_H
|
|
|
|
#include <QObject>
|
|
#include <QUdpSocket>
|
|
#include <QHostAddress>
|
|
|
|
class UdpReceiver : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit UdpReceiver(QObject *parent = nullptr);
|
|
~UdpReceiver();
|
|
|
|
bool start(quint16 port);
|
|
void stop();
|
|
bool isRunning() const;
|
|
|
|
signals:
|
|
void dataReceived(const QByteArray &data);
|
|
void errorOccurred(const QString &error);
|
|
|
|
private slots:
|
|
void onReadyRead();
|
|
|
|
private:
|
|
QUdpSocket *m_socket;
|
|
quint16 m_port;
|
|
};
|
|
|
|
#endif // UDPRECEIVER_H
|