From e361b1654fefd1a563a82d335795f94b794b4873 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Tue, 20 Nov 2018 14:06:54 +0800
Subject: [PATCH] move configure parser source code to etc folder, and set default log file to /tmp

---
 src/nbiotd/etc/iotd_conf.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/nbiotd/core/iotd_conf.c b/src/nbiotd/etc/iotd_conf.c
similarity index 96%
rename from src/nbiotd/core/iotd_conf.c
rename to src/nbiotd/etc/iotd_conf.c
index 6d52ec3..7935d17 100644
--- a/src/nbiotd/core/iotd_conf.c
+++ b/src/nbiotd/etc/iotd_conf.c
@@ -37,7 +37,8 @@
         return -2 ;
     }   
 
-    memset(iotd_conf, 0, sizeof(*iotd_conf));
+    log_nrml("Start parser iotd configure file \"%s\"\n", conf_file);
+
     logger = &iotd_conf->logger;
     nbiot = &iotd_conf->nbiot_conf;
     lora = &iotd_conf->lora_conf;
@@ -82,7 +83,7 @@
         log_err("Configure without NB-IoT comport device, thread will not start\n");
         nbiot->enable = DISABLE;
     }
-    log_nrml("Configure NB-IoT comport device as '%s'\n", lora->comport);
+    log_nrml("Configure NB-IoT comport device as '%s'\n", nbiot->comport);
 
     nbiot->baudrate = iniparser_getint(ini, "nbiot:baudrate", 9600);
     log_nrml("Configure NB-IoT comport baudrate as '%d'\n", nbiot->baudrate);
@@ -142,7 +143,7 @@
 
     data = iniparser_getint(ini, "mqtt:enable", 0);
     mqtt->enable = data? ENABLE : DISABLE;
-    log_nrml("Confiugre MQTT thread [%s]\n", lora->enable ? "enable" : "disable");
+    log_nrml("Confiugre MQTT thread [%s]\n", mqtt->enable ? "enable" : "disable");
 
     str = iniparser_getstring(ini, "mqtt:hostname", NULL);
     if( !str || strlen(str) <= 0 )

--
Gitblit v1.9.1