mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
添加QT的webengineview开发者调试功能
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "common/Utils.h"
|
||||
#include "protocol/MqttEntity.h"
|
||||
#include "common/JsonN.h"
|
||||
#include "app/Config.h"
|
||||
|
||||
Station::Station() : stationId(0)
|
||||
{
|
||||
@@ -181,6 +182,14 @@ void Station::writeRuntimeData(std::string dt, int npos)
|
||||
}
|
||||
}
|
||||
|
||||
void Station::initMqtt()
|
||||
{
|
||||
if (status!=0 && mqttCli)
|
||||
{
|
||||
auto& optionMqtt = Config::option.mqtt;
|
||||
mqttCli->init(optionMqtt.host, code, optionMqtt.username, optionMqtt.password);
|
||||
}
|
||||
}
|
||||
|
||||
void Station::polling()
|
||||
{
|
||||
@@ -188,4 +197,20 @@ void Station::polling()
|
||||
{
|
||||
mqttCli->polling();
|
||||
}
|
||||
}
|
||||
|
||||
void Station::setGarewayWorkMode()
|
||||
{
|
||||
if (!mqttCli)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
njson json;
|
||||
json["ts"] = Utils::time();
|
||||
json["no"] = 1; // 设备编号
|
||||
json["40001"] = this->workModeId;
|
||||
|
||||
std::string text = json.dump();
|
||||
mqttCli->publish("Gateway_YT", text);
|
||||
}
|
||||
Reference in New Issue
Block a user