36 lines
996 B
C++
36 lines
996 B
C++
#ifndef MQTTCLIENT_H
|
|
#define MQTTCLIENT_H
|
|
|
|
#include <QObject>
|
|
#include "qmqtt.h"
|
|
#include "global.h"
|
|
|
|
class MqttClient : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit MqttClient(QObject *parent = nullptr);
|
|
void ConnectMQTT(QString strIP);
|
|
QMQTT::Client *m_client;
|
|
void Push(const QMQTT::Message &message);
|
|
void subscribed(QString strTopic);
|
|
public slots:
|
|
void onMQTT_Connected();
|
|
void onMQTT_Connacked(quint8 ack);
|
|
void onMQTT_error(QMQTT::ClientError err);
|
|
void onMQTT_Published(const QMQTT::Message &message);
|
|
void onMQTT_Pubacked(quint8 type, quint16 msgid);
|
|
void onMQTT_Received(const QMQTT::Message &message);
|
|
void onMQTT_subscribed(const QString &topic);
|
|
void onMQTT_subacked(quint16 msgid, quint8 qos);
|
|
void onMQTT_unsubscribed(const QString &topic);
|
|
void onMQTT_unsubacked(quint16 msgid);
|
|
void onMQTT_disconnected();
|
|
signals:
|
|
void Recevive_sig(QString,QByteArray);
|
|
void DoConnect_sig();
|
|
};
|
|
|
|
#endif // MQTTCLIENT_H
|
|
|