From f22ec1a61392d8b42771405cd3afc7cc6fc65b17 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Wed, 31 Jul 2019 01:33:51 +0800 Subject: [PATCH] update mqttd.conf for inbreak support --- mqttd/etc/conf.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/mqttd/etc/conf.c b/mqttd/etc/conf.c index a32683d..f998ce4 100644 --- a/mqttd/etc/conf.c +++ b/mqttd/etc/conf.c @@ -101,6 +101,53 @@ /*+------------------------------------------------------+ + *| parser hardware module configuration ID | + *+------------------------------------------------------+*/ + + /* hardware module enable or not */ + ctx->hwconf.enable=iniparser_getint(ini, "hardware:enable", 0); + log_nrml("Parser hardware modules [%s]\n", ctx->hwconf.enable ? "enable" : "disable"); + + /* relay control light */ + ctx->hwconf.relay=iniparser_getint(ini, "hardware:relay_pin", 0); + if( !ctx->hwconf.relay ) + log_nrml("Parser relay module disabled\n"); + else + log_nrml("Parser relay connected wPI #pin nubmer [%d]\n", ctx->hwconf.relay); + + /* buzzer */ + ctx->hwconf.beep=iniparser_getint(ini, "hardware:beep_pin", 0); + + /* RGB 3-colors LED */ + ctx->hwconf.redled=iniparser_getint(ini, "hardware:red_pin", 0); + ctx->hwconf.greenled=iniparser_getint(ini, "hardware:green_pin", 0); + ctx->hwconf.blueled=iniparser_getint(ini, "hardware:blue_pin", 0); + if( !ctx->hwconf.redled && !ctx->hwconf.greenled && !ctx->hwconf.blueled ) + { + ctx->hwconf.leds = 0; + log_nrml("Parser RGB leds module disabled\n"); + } + else + { + ctx->hwconf.leds = 1; + log_nrml("Parser RGB led connected wPI #pin nubmer [%d,%d,%d]\n", + ctx->hwconf.redled, ctx->hwconf.greenled, ctx->hwconf.blueled); + } + + /* temperature sensor ds18b20 */ + ctx->hwconf.ds18b20=iniparser_getint(ini, "hardware:ds18b20", 0); + log_nrml("Parser temperature sensor DS18B20 modules [%s]\n", ctx->hwconf.ds18b20 ? "enable" : "disable"); + + /* temperature and hummidity sensor sht2x */ + ctx->hwconf.sht2x=iniparser_getint(ini, "hardware:sht2x", 0); + log_nrml("Parser temperature and hummidity sensor sht2x modules [%s]\n", ctx->hwconf.sht2x ? "enable" : "disable"); + + /* light intensity sensor TSL2561 */ + ctx->hwconf.lux=iniparser_getint(ini, "hardware:lux", 0); + log_nrml("Parser light intensity sensor TSL2561 modules [%s]\n", ctx->hwconf.ds18b20 ? "enable" : "disable"); + + + /*+------------------------------------------------------+ *| parser production ID | *+------------------------------------------------------+*/ -- Gitblit v1.9.1