Add a bunch of Manager Methods for MQTT Commands

This commit is contained in:
Justin Hammond 2019-11-03 19:02:51 +08:00
parent ea376a48cd
commit 6a088c931b
67 changed files with 1272 additions and 13 deletions

View file

@ -0,0 +1,24 @@
#include "mqttcommands/checkLatestConfigFileRevision.h"
MqttCommand_CheckLatestConfigFileRevision::MqttCommand_CheckLatestConfigFileRevision(QObject *parent) :
MqttCommand(parent)
{
this->m_requiredFields << "node";
}
MqttCommand* MqttCommand_CheckLatestConfigFileRevision::Create(QObject *parent) {
return new MqttCommand_CheckLatestConfigFileRevision(parent);
}
bool MqttCommand_CheckLatestConfigFileRevision::processMessage(QJsonDocument msg) {
QTOZWManager *mgr = getOZWManager();
if (mgr->checkLatestConfigFileRevision(msg["node"].toInt())) {
QJsonObject js;
js["status"] = "ok";
emit sendCommandUpdate(GetCommand(), js);
return true;
}
QJsonObject js;
js["status"] = "failed";
emit sendCommandUpdate(GetCommand(), js);
return false;
}