move configure parser source code to etc folder, and set default log file to /tmp
3 files modified
3 files renamed
| | |
| | | # 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 |
File was renamed from src/nbiotd/core/iotd_conf.c |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | |
| | | 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 ) |
File was renamed from src/nbiotd/core/iotd_conf.h |
| | |
| | | #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 |
| | |
| | | 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); |
| | |
| | | # 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)) |