mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 17:05:55 +08:00
更新
This commit is contained in:
@@ -38,29 +38,29 @@ String pEventTopic = "/event/post";
|
||||
|
||||
/********************************** begin 可配置的项 **********************************/
|
||||
// wifi信息
|
||||
char *wifiSsid = "MERCURY100";
|
||||
char *wifiPwd = "FastBee";
|
||||
char *userId = "1";
|
||||
char *wifiSsid = (char*)"MERCURY100";
|
||||
char *wifiPwd = (char*)"FastBee";
|
||||
char *userId = (char*)"1";
|
||||
// 产品启用授权码,则授权码不能为空
|
||||
char *authCode = "";
|
||||
char *authCode = (char*)"";
|
||||
|
||||
// 设备信息配置
|
||||
char *deviceNum = "D1PGLPG58KZ2";
|
||||
char *productId = "96";
|
||||
char *deviceNum = (char*)"D1PGLPG58K88";
|
||||
char *productId = (char*)"96";
|
||||
float firmwareVersion = 1.0;
|
||||
// 经度和纬度可选,如果产品使用设备定位,则必须传
|
||||
float latitude = 0;
|
||||
float longitude = 0;
|
||||
|
||||
// Mqtt配置
|
||||
char *mqttHost = "43.143.82.218";
|
||||
char *mqttHost = (char*)"iot.fastbee.cn";
|
||||
int mqttPort = 1883;
|
||||
char *mqttUserName = "FastBee";
|
||||
char *mqttPwd = "P467433O1MT8MXS2";
|
||||
char *mqttUserName = (char*)"FastBee";
|
||||
char *mqttPwd = (char*)"P467433O1MT8MXS2";
|
||||
char mqttSecret[17] = "KWF32S3H95LH14LO";
|
||||
|
||||
// NTP地址(用于获取时间,修改为自己部署项目的接口地址)
|
||||
String ntpServer = "http://wumei.live:8080/iot/tool/ntp?deviceSendTime=";
|
||||
String ntpServer = "http://fastbee.cn:8080/iot/tool/ntp?deviceSendTime=";
|
||||
|
||||
/********************************** end 可配置的项 **********************************/
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ void publishProperty(String msg) {
|
||||
|
||||
// 4.发布功能
|
||||
void publishFunction(String msg) {
|
||||
printMsg("发布功能:" + prefix + pFunctionTopic);
|
||||
printMsg("发布属性(功能):" + prefix + pPropertyTopic);
|
||||
printMsg("消息:" + msg);
|
||||
mqttClient.publish((prefix + pFunctionTopic).c_str(), msg.c_str());
|
||||
mqttClient.publish((prefix + pPropertyTopic).c_str(), msg.c_str());
|
||||
}
|
||||
|
||||
// 5.发布事件
|
||||
|
||||
@@ -72,7 +72,8 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) {
|
||||
printMsg("当前时间:" + String(now, 0));
|
||||
} else if (strcmp(topic, (prefix + sPropertyTopic).c_str()) == 0 || strcmp(topic, (prefix + sPropertyOnline).c_str()) == 0) {
|
||||
printMsg("订阅到属性指令...");
|
||||
processProperty(data);
|
||||
printMsg("新版本属性和功能合并为功能主题...");
|
||||
// processProperty(data);
|
||||
} else if (strcmp(topic, (prefix + sFunctionTopic).c_str()) == 0 || strcmp(topic, (prefix + sFunctionOnline).c_str()) == 0) {
|
||||
printMsg("订阅到功能指令...");
|
||||
processFunction(data);
|
||||
@@ -437,6 +438,8 @@ void processFunction(String msg) {
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
// 处理子设备的数据上报
|
||||
processSubDeviceReport(id, value);
|
||||
}
|
||||
// 最后发布功能,服务端订阅存储(重要)
|
||||
publishFunction(msg);
|
||||
|
||||
Reference in New Issue
Block a user