北京星立方云软件,将productId改为可配置
This commit is contained in:
parent
a9e444d7ec
commit
c9a9e37beb
|
@ -111,16 +111,18 @@ bool mqtt_publish(const char *title, const char *info, bool will_set)
|
||||||
|
|
||||||
bool mqtt_pulish_online()
|
bool mqtt_pulish_online()
|
||||||
{
|
{
|
||||||
|
std::string productId = getCfgValue("mqtt", "productId", QString("GSYJ-BZ")).toStdString();
|
||||||
std::string deviceId = getCfgValue("mqtt", "deviceId", QString("testID")).toStdString();
|
std::string deviceId = getCfgValue("mqtt", "deviceId", QString("testID")).toStdString();
|
||||||
std::string title = "/GSYJ-BZ/" + deviceId + "/online";
|
std::string title = "/" + productId + "/" + deviceId + "/online";
|
||||||
std::string info = "{\"deviceId\": \"" + deviceId + "\"}";
|
std::string info = "{\"deviceId\": \"" + deviceId + "\"}";
|
||||||
return mqtt_publish(title.c_str(), info.c_str(), false);
|
return mqtt_publish(title.c_str(), info.c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mqtt_pulish_offline()
|
bool mqtt_pulish_offline()
|
||||||
{
|
{
|
||||||
|
std::string productId = getCfgValue("mqtt", "productId", QString("GSYJ-BZ")).toStdString();
|
||||||
std::string deviceId = getCfgValue("mqtt", "deviceId", QString("testID")).toStdString();
|
std::string deviceId = getCfgValue("mqtt", "deviceId", QString("testID")).toStdString();
|
||||||
std::string title = "/GSYJ-BZ/" + deviceId + "/offline";
|
std::string title = "/" + productId + "/" + deviceId + "/offline";
|
||||||
std::string info = "{\"deviceId\": \"" + deviceId + "\"}";
|
std::string info = "{\"deviceId\": \"" + deviceId + "\"}";
|
||||||
return mqtt_publish(title.c_str(), info.c_str(), true);
|
return mqtt_publish(title.c_str(), info.c_str(), true);
|
||||||
}
|
}
|
||||||
|
@ -128,8 +130,9 @@ bool mqtt_pulish_offline()
|
||||||
bool mqtt_publish_device_properties(const char *ip, const char *sysVerion,
|
bool mqtt_publish_device_properties(const char *ip, const char *sysVerion,
|
||||||
const char *deviceModel, const char *companyCode)
|
const char *deviceModel, const char *companyCode)
|
||||||
{
|
{
|
||||||
|
std::string productId = getCfgValue("mqtt", "productId", QString("GSYJ-BZ")).toStdString();
|
||||||
std::string deviceId = getCfgValue("mqtt", "deviceId", QString("testID")).toStdString();
|
std::string deviceId = getCfgValue("mqtt", "deviceId", QString("testID")).toStdString();
|
||||||
std::string title = "/GSYJ-BZ/" + deviceId + "/properties/report";
|
std::string title = "/" + productId + "/" + deviceId + "/properties/report";
|
||||||
std::string info = "{\"deviceId\": \"" + deviceId + "\", \"properties\": {\"ip\": \""
|
std::string info = "{\"deviceId\": \"" + deviceId + "\", \"properties\": {\"ip\": \""
|
||||||
+ ip + "\", \"sysVersion\": \"" + sysVerion + "\", \"deviceModel\": \"" + deviceModel + "\", \"companyCode\": \"" + companyCode + "\"}}";
|
+ ip + "\", \"sysVersion\": \"" + sysVerion + "\", \"deviceModel\": \"" + deviceModel + "\", \"companyCode\": \"" + companyCode + "\"}}";
|
||||||
return mqtt_publish(title.c_str(), info.c_str(), false);
|
return mqtt_publish(title.c_str(), info.c_str(), false);
|
||||||
|
|
Loading…
Reference in New Issue