updated WM and aliot loop scheduler
This commit is contained in:
@@ -84,27 +84,8 @@ void connectToAliyunIoT() {
|
||||
|
||||
}
|
||||
|
||||
void checkAlinkMQTT() {
|
||||
int mqttStatus = 0;
|
||||
mqttStatus = iot.loop();
|
||||
|
||||
if (0 == mqttStatus) {
|
||||
iot_retry = 0;
|
||||
if (false == downstream_topic_subscribed) {
|
||||
INFOF("subscribe topic : %s\n", g_downstream_topic.c_str());
|
||||
registerCallback(g_downstream_topic.c_str(), 0);
|
||||
downstream_topic_subscribed = true;
|
||||
} else {
|
||||
sendIrisKitHeartBeat();
|
||||
}
|
||||
} else {
|
||||
INFOF("Alink MQTT check failed, retry = %d\n", iot_retry);
|
||||
iot_retry++;
|
||||
}
|
||||
if (iot_retry >= IOT_RETRY_MAX) {
|
||||
ERRORLN("Alink could not established, something went wrong, reset...");
|
||||
factoryReset();
|
||||
}
|
||||
void aliotKeepAlive() {
|
||||
iot.loop();
|
||||
}
|
||||
|
||||
// not only for IRIS related topic based session
|
||||
@@ -129,3 +110,25 @@ static void irisAlinkCallback(const char *topic, uint8_t *data, int length) {
|
||||
handleIrisKitMessage((const char*) data, length);
|
||||
}
|
||||
}
|
||||
|
||||
void checkAlinkMQTT() {
|
||||
int mqttStatus = 0;
|
||||
|
||||
if (0 == mqttStatus) {
|
||||
iot_retry = 0;
|
||||
if (false == downstream_topic_subscribed) {
|
||||
INFOF("subscribe topic : %s\n", g_downstream_topic.c_str());
|
||||
registerCallback(g_downstream_topic.c_str(), 0);
|
||||
downstream_topic_subscribed = true;
|
||||
} else {
|
||||
sendIrisKitHeartBeat();
|
||||
}
|
||||
} else {
|
||||
INFOF("Alink MQTT check failed, retry = %d\n", iot_retry);
|
||||
iot_retry++;
|
||||
}
|
||||
if (iot_retry >= IOT_RETRY_MAX) {
|
||||
ERRORLN("Alink could not established, something went wrong, reset...");
|
||||
factoryReset();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user