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.
40 lines
850 B
C++
40 lines
850 B
C++
#ifndef _H_ECHOCLIENT_H_
|
|
#define _H_ECHOCLIENT_H_
|
|
|
|
#include <QObject>
|
|
#include <QtWebSockets/QWebSocket>
|
|
#include <QJsonObject>
|
|
#include <QImage>
|
|
#include <QTimer>
|
|
|
|
class webClient : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
webClient(QObject *parent = Q_NULLPTR);
|
|
~webClient();
|
|
void openUrl(QString url);
|
|
void onClose();
|
|
void onSendJson(QJsonObject &obj);
|
|
void sendSmallImage(QImage &img);
|
|
void parasImage(QJsonObject &imgData);
|
|
void saveJson(QJsonObject obj);
|
|
signals:
|
|
void closed();
|
|
void sgConnect(bool bflag);
|
|
void sgRecvStrData(QString data);
|
|
void sgRecvBinData(QByteArray data);
|
|
private:
|
|
Q_SLOT void onConnected();
|
|
Q_SLOT void onDisConnected();
|
|
Q_SLOT void onTextMessageReceived(QString message);
|
|
Q_SLOT void onBinaryMessageReceived(const QByteArray &message);
|
|
private:
|
|
QWebSocket m_webSocket;
|
|
QUrl m_url;
|
|
bool m_debug;
|
|
};
|
|
|
|
#endif
|