You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#ifndef UDPDATATHREAD_H
|
|
#define UDPDATATHREAD_H
|
|
|
|
#include <QObject>
|
|
#include <QThread>
|
|
#include "udpsocketworker.h"
|
|
typedef enum {
|
|
SIGNAL_EMPTY = 0,
|
|
SIGNAL_SN , //SN号
|
|
SIGNAL_DONE , //成功
|
|
SIGNAL_CLOSE , //关闭
|
|
SIGNAL_BEATSRC, //注KEY状态
|
|
SIGNAL_BEATDST //外挂软件状态
|
|
}SIGNALTYPE;
|
|
|
|
#define CONSTHEAD 59
|
|
|
|
class UdpDataThread : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
UdpDataThread(QObject *parent = nullptr);
|
|
~UdpDataThread();
|
|
void sendSnId(const QString& data);
|
|
void sendStop();
|
|
void sendClose();
|
|
void stopClose();
|
|
signals:
|
|
void connectStatus(bool);
|
|
void registerRet(bool);
|
|
private slots:
|
|
void recvData(const QByteArray &data);
|
|
void checkConnectSlot();
|
|
private:
|
|
QThread *m_workerThread;
|
|
UdpSocketWorker *m_udpWorker;
|
|
|
|
QHostAddress m_hostAddr;
|
|
QTimer *m_checkConnectTimer;
|
|
// 判断注KEY软件状态
|
|
volatile bool m_connectStatus;
|
|
volatile bool m_isSending;
|
|
QString m_currSn;
|
|
};
|
|
|
|
#endif // UDPDATATHREAD_H
|