41 lines
956 B
C
41 lines
956 B
C
|
#ifndef TCPCLIENTEQUIPMENT_H
|
||
|
#define TCPCLIENTEQUIPMENT_H
|
||
|
|
||
|
#include <QObject>
|
||
|
#include <QTcpSocket>
|
||
|
#include <QObject>
|
||
|
#include <QMap>
|
||
|
#include <QHostAddress>
|
||
|
#include <QDebug>
|
||
|
#include <CommomFunc/tool.h>
|
||
|
#include <QByteArray>
|
||
|
#include "XYComFunc_global.h"
|
||
|
|
||
|
|
||
|
class XYCOMFUNC_EXPORT TcpClientEquipment : public QObject
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit TcpClientEquipment(QObject *parent = 0);
|
||
|
Q_INVOKABLE void setInfo(QString strIP,int iPort);
|
||
|
Q_INVOKABLE void connect2Server();
|
||
|
Q_INVOKABLE void connect2Server(QString strIP,int iPort);
|
||
|
Q_INVOKABLE bool getState();
|
||
|
Q_INVOKABLE bool sendMsg(QByteArray buffer);
|
||
|
Q_INVOKABLE bool sendMsg(QString buffer);
|
||
|
void reconnect2Server();
|
||
|
void disconnect2Server();
|
||
|
signals:
|
||
|
void dateReceived(QByteArray buffer);
|
||
|
|
||
|
public slots:
|
||
|
virtual void onDataReceived();
|
||
|
protected:
|
||
|
QTcpSocket *mClient;
|
||
|
QString ip;
|
||
|
int port;
|
||
|
bool flag;
|
||
|
};
|
||
|
|
||
|
#endif // TCPCLIENTEQUIPMENT_H
|