From 995ca76581e3f4134b1e9f3b2d9b4c3efb0855d4 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Tue, 20 Nov 2018 13:28:47 +0800 Subject: [PATCH] Update nbiot all makefile and add nbiot parser code --- src/nbiotd/iotd.c | 35 +++++++++++++++++------------------ 1 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/nbiotd/iotd.c b/src/nbiotd/iotd.c index d901ab4..061618d 100644 --- a/src/nbiotd/iotd.c +++ b/src/nbiotd/iotd.c @@ -23,21 +23,11 @@ #include <sys/stat.h> #include <fcntl.h> -#include "cp_logger.h" #include "cp_proc.h" +#include "iotd_conf.h" -#define DEF_LOG_FILE "/var/log/iotd.log" -#define DEF_LOG_LEVEL LOG_LEVEL_NRML void *watchdog_worker(void *arg); - - - -typedef struct iotd_conf_s -{ - cp_logger logger; - -} iotd_conf_t; typedef struct iotd_ctx_s @@ -85,7 +75,7 @@ pthread_t tid; iotd_conf_t *conf; - cp_logger *logger; + logger_t *logger; memset(&iotd_ctx, 0, sizeof(iotd_ctx)); conf = &iotd_ctx.conf; @@ -187,16 +177,25 @@ thread_start(&tid, watchdog_worker, NULL); /* Start MQTT thread worker */ - log_nrml("start MQTT socket process thread\n"); - //thread_start(&tid, mqtt_worker, (void *)&iotd_ctx ); + if( conf->mqtt_conf.enable ) + { + log_nrml("start MQTT publish process thread\n"); + //thread_start(&tid, mqtt_worker, (void *)&iotd_ctx ); + } /* Start NB-IoT thread worker */ - log_nrml("start NB-IoT process thread\n"); - //thread_start(&tid, nbiot_worker, (void *)&iotd_ctx ); + if( conf->nbiot_conf.enable ) + { + log_nrml("start NB-IoT process thread\n"); + //thread_start(&tid, nbiot_worker, (void *)&iotd_ctx ); + } /* Start LoRa thread worker */ - log_nrml("start LoRa AP process thread\n"); - //thread_start(&tid, nbiot_worker, (void *)&iotd_ctx ); + if( conf->nbiot_conf.enable ) + { + log_nrml("start LoRa AP process thread\n"); + //thread_start(&tid, nbiot_worker, (void *)&iotd_ctx ); + } while( !g_cp_signal.stop ) { -- Gitblit v1.9.1