Commit 5c24b069 authored by Axel Auweter's avatar Axel Auweter
Browse files

Fixed sysfspusher config file parser bug.

parent 181a662a
include ../config.mk
CXXFLAGS = -std=c++0x -O0 -g -Wall -Werror -I$(DCDBDEPLOYPATH)/include
CXXFLAGS = -std=c++0x -O0 -g -Wall -Werror -Wno-unused-local-typedefs -I$(DCDBDEPLOYPATH)/include
OBJS = sysfspusher.o helper.o
LIBS = -L$(DCDBDEPLOYPATH)/lib -lrudeconfig -lmosquitto -lpthread
TARGET = sysfspusher
......
......@@ -49,22 +49,22 @@ int readConfiguration(string configFileName) {
BOOST_FOREACH(ptree::value_type &v, pt) {
if (!v.second.empty()) {
sensor_t sensorConfig;
BOOST_FOREACH(ptree::value_type &v2, pt.get_child(v.first.data())) {
sensorConfig.name = v.first.data();
sensorConfig.path = "";
sensorConfig.interval = 1000;
sensorConfig.mqtt = "";
sensorConfig.convert = false;
sensorConfig.name = v.first.data();
sensorConfig.path = "";
sensorConfig.interval = 1000;
sensorConfig.mqtt = "";
sensorConfig.convert = false;
BOOST_FOREACH(ptree::value_type &v2, pt.get_child(v.first.data())) {
const char* dataName = v2.first.data();
string sn(v.first.data());
if (strcasecmp(dataName, "path") == 0) {
cout << "getting " << sn << ".path...";
sensorConfig.path = pt.get<char*>(sn + ".path");
sensorConfig.path = pt.get<string>(sn + ".path");
} else if (strcasecmp(dataName, "interval") == 0) {
sensorConfig.interval = pt.get<int>(sn + ".interval");
} else if (strcasecmp(dataName, "mqtt") == 0) {
sensorConfig.mqtt = pt.get<char*>(sn + ".mqtt");
sensorConfig.mqtt = pt.get<string>(sn + ".mqtt");
} else if (strcasecmp(dataName, "minI") == 0) {
sensorConfig.convert = true;
sensorConfig.minI = pt.get<uint64_t>(sn + ".minI");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment