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/refreshnodeinfo.h"
MqttCommand_RefreshNodeInfo::MqttCommand_RefreshNodeInfo(QObject *parent) :
MqttCommand(parent)
{
this->m_requiredFields << "node";
}
MqttCommand* MqttCommand_RefreshNodeInfo::Create(QObject *parent) {
return new MqttCommand_RefreshNodeInfo(parent);
}
bool MqttCommand_RefreshNodeInfo::processMessage(QJsonDocument msg) {
QTOZWManager *mgr = getOZWManager();
if (mgr->refreshNodeInfo(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;
}