tcp解析和无线脑电采集
This commit is contained in:
41
testNetGUI/tcpclient.h
Normal file
41
testNetGUI/tcpclient.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef TCPCLIENT_H
|
||||
#define TCPCLIENT_H
|
||||
#include <QTcpSocket>
|
||||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
class TcpClient:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TcpClient(QObject * parent = nullptr);
|
||||
virtual ~TcpClient();
|
||||
/*
|
||||
des: 连接服务端
|
||||
*/
|
||||
bool connectServer(QString ip ,qint16 port);
|
||||
/*
|
||||
des: 获取数据
|
||||
*/
|
||||
QByteArray GetData();
|
||||
|
||||
bool sendMessage(QByteArray & data);
|
||||
/*
|
||||
des: 断开连接
|
||||
*/
|
||||
bool disConnectServer();
|
||||
|
||||
signals:
|
||||
void SigRectMsg(QByteArray & dataPack);
|
||||
private slots:
|
||||
|
||||
void slotReadMessage();
|
||||
void slotTestReadMessage();
|
||||
void slotDisconnected();
|
||||
void slotSendMessage(QByteArray & data);
|
||||
|
||||
private:
|
||||
QTcpSocket m_TcpSocket;
|
||||
bool m_isConnected;
|
||||
QByteArray m_msgArray;
|
||||
};
|
||||
#endif // TCPCLIENT_H
|
||||
Reference in New Issue
Block a user