mirror of
https://github.com/Fishwaldo/qt-openzwave.git
synced 2025-07-12 16:18:22 +00:00
add these missing files
This commit is contained in:
parent
8aaa26aa28
commit
ea376a48cd
2 changed files with 144 additions and 0 deletions
52
qt-ozwdaemon/mqttcommands/mqttcommands.h
Normal file
52
qt-ozwdaemon/mqttcommands/mqttcommands.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
#ifndef MQTTCOMMANDS_H
|
||||
#define MQTTCOMMANDS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QtMqtt/QMqttClient>
|
||||
#include <QtMqtt/QMqttSubscription>
|
||||
|
||||
#include <qt-openzwave/qtopenzwave.h>
|
||||
#include <qt-openzwave/qtozwmanager.h>
|
||||
#include "mqttpublisher.h"
|
||||
|
||||
|
||||
class mqttpublisher;
|
||||
|
||||
class MqttCommand : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MqttCommand(QObject *parent = nullptr);
|
||||
void Setup(QMqttSubscription *);
|
||||
void messageReceived(QMqttMessage msg);
|
||||
virtual bool processMessage(QJsonDocument) = 0;
|
||||
virtual QString GetCommand() = 0;
|
||||
signals:
|
||||
void sendCommandUpdate(QString, QJsonObject);
|
||||
protected:
|
||||
QTOZWManager *getOZWManager();
|
||||
mqttpublisher *getMqttPublisher();
|
||||
QVector<QString> m_requiredFields;
|
||||
|
||||
private:
|
||||
QMqttSubscription *m_subscription;
|
||||
};
|
||||
|
||||
|
||||
typedef MqttCommand* (*pfnCreateCommand_t)(QObject *);
|
||||
|
||||
|
||||
class MqttCommands : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MqttCommands(QObject *parent = nullptr);
|
||||
void Register(QString command, pfnCreateCommand_t _create);
|
||||
void setupCommands();
|
||||
void setupSubscriptions(QMqttClient *, QString);
|
||||
private:
|
||||
QMap<QString, pfnCreateCommand_t> m_commands;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue