LingYun IoT Studio NB-IoT research project
guowenxue
2018-11-20 e361b1654fefd1a563a82d335795f94b794b4873
move configure parser source code to etc folder, and set default log file to /tmp
3 files modified
3 files renamed
14 ■■■■■ changed files
src/nbiotd/etc/iotd.conf 2 ●●● patch | view | raw | blame | history
src/nbiotd/etc/iotd_conf.c 7 ●●●●● patch | view | raw | blame | history
src/nbiotd/etc/iotd_conf.h 2 ●●● patch | view | raw | blame | history
src/nbiotd/etc/makefile patch | view | raw | blame | history
src/nbiotd/iotd.c 1 ●●●● patch | view | raw | blame | history
src/nbiotd/makefile 2 ●●● patch | view | raw | blame | history
src/nbiotd/etc/iotd.conf
@@ -1,6 +1,6 @@
# uited program configure file
[log]
file=/var/log/nbiotd.log
file=/tmp/nbiotd.log
#Loglevel: 0:Disable 1:Fatal 2:ERROR 3:warnning 4:Normal 5:Debug 6:Infor 7:Trace
level=5
src/nbiotd/etc/iotd_conf.c
File was renamed from src/nbiotd/core/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 )
src/nbiotd/etc/iotd_conf.h
File was renamed from src/nbiotd/core/iotd_conf.h
@@ -24,7 +24,7 @@
#define FILEN_LEN              64
#endif
#define DEF_LOG_FILE         "/var/log/iotd.log"
#define DEF_LOG_FILE         "/tmp/iotd.log"
#define DEF_LOG_LEVEL        LOG_LEVEL_NRML
typedef struct lora_conf_s 
src/nbiotd/etc/makefile
src/nbiotd/iotd.c
@@ -139,6 +139,7 @@
        printf("Logger initialize failure with file: %s\n", logger->file);
        return -1;
    }
    log_nrml("Init default logger file \"%s\" ok\n", log_file);
    /*  Parser configure file and start the initialize log */
    rv = parser_iotd_conf(conf_file, conf);
src/nbiotd/makefile
@@ -49,7 +49,7 @@
# archive to a static library, named lib${subdir_name}.a
OBJFILES = $(patsubst %.c,%,$(wildcard *.c))
SUBSRCS = $(shell find . -follow  -maxdepth 1 -type d|sed -n 's/.\///p'|grep -v 'libs' \
          |grep -v 'etc' | grep -v '.svn'|grep -v '.git'|grep -v 'include'|grep -v 'bin')
          | grep -v '.svn'|grep -v '.git'|grep -v 'include'|grep -v 'bin')
# Add the subdir compiled static library into LDFLAGS
#LDFLAGS+=$(patsubst %,-L%,$(SUBSRCS))