From 57b8d8022cf8444cf59cd20a25cfee491ec88799 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 26 Jun 2019 13:16:27 +0800
Subject: [PATCH] update mqttd, add ID match support

---
 mqttd/etc/conf.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/mqttd/etc/conf.c b/mqttd/etc/conf.c
index c78e24d..a32683d 100644
--- a/mqttd/etc/conf.c
+++ b/mqttd/etc/conf.c
@@ -25,6 +25,7 @@
 
     if( !conf_file )
     { 
+        strncpy(ctx->id, "\"rpi3b001\"", sizeof(ctx->id));
 
         /* logger settings */
         strncpy(ctx->logfile, DBG_LOG_FILE, sizeof(ctx->logfile));
@@ -99,6 +100,19 @@
     log_nrml("Logger system initialise ok\n");
 
 
+    /*+------------------------------------------------------+
+     *|               parser production ID                   |
+     *+------------------------------------------------------+*/
+
+    if( !(str=iniparser_getstring(ini, "common:id", NULL)) )
+    {
+        log_err("ERROR: Parser production ID failure\n");
+        return -2;
+    }
+    /* cJSON parser ID will get ""  */
+    snprintf(ctx->id, sizeof(ctx->id), "\"%s\"", str);
+    log_nrml("Parser production ID [%s]\n", ctx->id);
+
 
     /*+------------------------------------------------------+
      *|              parser broker settings                  |

--
Gitblit v1.9.1