From e0e3a637e92dbe3c7700cc541410ff19b3b0c80c Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 21 Apr 2021 12:44:30 +0800
Subject: [PATCH] update iotd hal functions

---
 iotd/conf/conf.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/iotd/conf/conf.c b/iotd/conf/conf.c
index de7ee2e..6c3ebcf 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,16 @@
 
     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->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