From 0fa05ec9d808e1872a1c7d75bffeaa3114a3be61 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Wed, 21 Apr 2021 16:22:53 +0800 Subject: [PATCH] Publisher test ok in iotd --- iotd/conf/conf.c | 29 +++++++++++++++++------------ 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/iotd/conf/conf.c b/iotd/conf/conf.c index de7ee2e..7797af6 100644 --- a/iotd/conf/conf.c +++ b/iotd/conf/conf.c @@ -266,14 +266,16 @@ if( !(str=iniparser_getstring(ini, "subsciber:subTopic", NULL)) ) { - log_err("ERROR: Parser MQTT subscribe topic failure\n"); - return -2; + log_warn("WARNNING: Parser MQTT subscribe topic failure\n"); } - strncpy(mqtt_ctx->subTopic, str, sizeof(mqtt_ctx->subTopic) ); + else + { + strncpy(mqtt_ctx->subTopic, str, sizeof(mqtt_ctx->subTopic) ); + mqtt_ctx->subQos = iniparser_getint(ini, "subsciber:subQos", 0); + mqtt_ctx->sub_enable = 1; - mqtt_ctx->subQos = iniparser_getint(ini, "subsciber:subQos", 0); - log_nrml("Parser subscriber topic \"%s\" with Qos[%d]\n", mqtt_ctx->subTopic, mqtt_ctx->subQos); - mqtt_ctx->sub_enable = 1; + log_nrml("Parser subscriber topic \"%s\" with Qos[%d]\n", mqtt_ctx->subTopic, mqtt_ctx->subQos); + } /*+------------------------------------------------------+ *| parser publisher settings | @@ -281,14 +283,17 @@ if( !(str=iniparser_getstring(ini, "publisher:pubTopic", NULL)) ) { - log_err("ERROR: Parser MQTT publisher topic failure\n"); - return -2; + log_warn("WARNNING: Parser MQTT publisher topic failure\n"); } - strncpy(mqtt_ctx->pubTopic, str, sizeof(mqtt_ctx->pubTopic) ); + else + { + strncpy(mqtt_ctx->pubTopic, str, sizeof(mqtt_ctx->pubTopic) ); + mqtt_ctx->pubQos = iniparser_getint(ini, "publisher:pubQos", 0); + mqtt_ctx->interval = iniparser_getint(ini, "publisher:interval", 60); + mqtt_ctx->pub_enable = 1; - mqtt_ctx->pubQos = iniparser_getint(ini, "publisher:pubQos", 0); - log_nrml("Parser publisher topic \"%s\" with Qos[%d]\n", mqtt_ctx->pubTopic, mqtt_ctx->pubQos); - mqtt_ctx->pub_enable = 1; + log_nrml("Parser publisher topic \"%s\" with Qos[%d]\n", mqtt_ctx->pubTopic, mqtt_ctx->pubQos); + } return 0; -- Gitblit v1.9.1