Commit 430b4f55 authored by Micha Mueller's avatar Micha Mueller
Browse files

Remove helper-class and conversion-feature from SYSFSSensor

parent 5f76ba03
...@@ -8,7 +8,7 @@ include $(DCDBCOREPATH)/common.mk ...@@ -8,7 +8,7 @@ include $(DCDBCOREPATH)/common.mk
CXXFLAGS = -std=c++0x -O2 -g -Wall -Werror -Wno-unused-local-typedefs -Wno-unknown-warning-option -Wno-deprecated-declarations -I$(DCDBDEPLOYPATH)/include -I$(DCDBBASEPATH)/include CXXFLAGS = -std=c++0x -O2 -g -Wall -Werror -Wno-unused-local-typedefs -Wno-unknown-warning-option -Wno-deprecated-declarations -I$(DCDBDEPLOYPATH)/include -I$(DCDBBASEPATH)/include
CXXFLAGS = -O2 -g -Wall -Wno-unused-function $(CXX11FLAGS) -I$(DCDBBASEPATH)/dcdb/include -I$(DCDBDEPLOYPATH)/include CXXFLAGS = -O2 -g -Wall -Wno-unused-function $(CXX11FLAGS) -I$(DCDBBASEPATH)/dcdb/include -I$(DCDBDEPLOYPATH)/include
LIBS = -L../deps/mosquitto_build/lib -L$(DCDBDEPLOYPATH)/lib/ -lmosquitto -lboost_system -lboost_thread LIBS = -L../deps/mosquitto_build/lib -L$(DCDBDEPLOYPATH)/lib/ -lmosquitto -lboost_system -lboost_thread
OBJS = sysfspusher.o helper.o SYSFSConfiguration.o SYSFSSensor.o MQTTPusher.o OBJS = sysfspusher.o SYSFSConfiguration.o SYSFSSensor.o MQTTPusher.o
$(TARGET): $(OBJS) $(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) $(CXX) -o $(TARGET) $(OBJS) $(LIBS)
......
...@@ -99,15 +99,6 @@ void SYSFSConfiguration::readSensor(SYSFSSensor& sensor, boost::property_tree::i ...@@ -99,15 +99,6 @@ void SYSFSConfiguration::readSensor(SYSFSSensor& sensor, boost::property_tree::i
sensor.setMqtt(s.second.data()); sensor.setMqtt(s.second.data());
} else if (boost::iequals(s.first, "minValues")) { } else if (boost::iequals(s.first, "minValues")) {
sensor.setMinValues(stoull(s.second.data())); sensor.setMinValues(stoull(s.second.data()));
} else if (boost::iequals(s.first, "minI")) {
sensor.setConvert(true);
sensor.setMinI(stoull(s.second.data()));
} else if (boost::iequals(s.first, "maxI")) {
sensor.setConvert(true);
sensor.setMaxI(stoull(s.second.data()));
} else if (boost::iequals(s.first, "maxV")) {
sensor.setConvert(true);
sensor.setMaxV(stoull(s.second.data()));
} else if (boost::iequals(s.first, "filter")) { } else if (boost::iequals(s.first, "filter")) {
sensor.setFilter(true); sensor.setFilter(true);
string input = s.second.data(); string input = s.second.data();
...@@ -154,11 +145,6 @@ void SYSFSConfiguration::readSensor(SYSFSSensor& sensor, boost::property_tree::i ...@@ -154,11 +145,6 @@ void SYSFSConfiguration::readSensor(SYSFSSensor& sensor, boost::property_tree::i
cout << " MQTT : " << sensor.getMqtt() << endl; cout << " MQTT : " << sensor.getMqtt() << endl;
cout << " Interval: " << sensor.getInterval() << endl; cout << " Interval: " << sensor.getInterval() << endl;
cout << " minValues:" << sensor.getMinValues() << endl; cout << " minValues:" << sensor.getMinValues() << endl;
if (sensor.doConvert()) {
cout << " minI : " << sensor.getMinI() << endl;
cout << " maxI : " << sensor.getMaxI() << endl;
cout << " maxV : " << sensor.getMaxV() << endl;
}
if (sensor.hasFilter()) { if (sensor.hasFilter()) {
//regex cannot be converted back to string //regex cannot be converted back to string
cout << " Using regular expression to filter data" << endl; cout << " Using regular expression to filter data" << endl;
......
...@@ -19,10 +19,6 @@ SYSFSSensor::SYSFSSensor(const std::string& name) { ...@@ -19,10 +19,6 @@ SYSFSSensor::SYSFSSensor(const std::string& name) {
_mqtt = ""; _mqtt = "";
_minValues = 1; _minValues = 1;
_interval = 1000; _interval = 1000;
_convert = false;
_minI = 0;
_maxI = 0;
_maxV = 0;
_file = NULL; _file = NULL;
_filter = false; _filter = false;
//_regx = ""; //_regx = "";
...@@ -72,15 +68,6 @@ void SYSFSSensor::read() { ...@@ -72,15 +68,6 @@ void SYSFSSensor::read() {
return; return;
} }
if (_convert) {
if(reading.value > _minI) {
reading.value = (reading.value - _minI) * _maxV / (_maxI - _minI);
} else {
reading.value = 0;
//return;
}
}
#ifdef DEBUG #ifdef DEBUG
cout << "[" << prettyPrintTimestamp(reading.timestamp) << "] " << _name << ": \"" << reading.value << "\"" << endl; cout << "[" << prettyPrintTimestamp(reading.timestamp) << "] " << _name << ": \"" << reading.value << "\"" << endl;
#endif #endif
......
...@@ -74,38 +74,6 @@ public: ...@@ -74,38 +74,6 @@ public:
_interval = interval; _interval = interval;
} }
bool doConvert() const {
return _convert;
}
void setConvert(bool convert) {
_convert = convert;
}
int64_t getMinI() const {
return _minI;
}
void setMinI(int64_t minI) {
_minI = minI;
}
int64_t getMaxI() const {
return _maxI;
}
void setMaxI(int64_t maxI) {
_maxI = maxI;
}
int64_t getMaxV() const {
return _maxV;
}
void setMaxV(int64_t maxV) {
_maxV = maxV;
}
bool hasFilter() const { bool hasFilter() const {
return _filter; return _filter;
} }
...@@ -153,10 +121,6 @@ private: ...@@ -153,10 +121,6 @@ private:
std::string _path; std::string _path;
std::string _mqtt; std::string _mqtt;
uint64_t _minValues; uint64_t _minValues;
bool _convert;
int64_t _minI;
int64_t _maxI;
int64_t _maxV;
FILE* _file; FILE* _file;
int _interval; int _interval;
bool _filter; bool _filter;
......
//================================================================================
// Name : helper.cpp
// Author : Michael Ott
// Copyright : Leibniz Supercomputing Centre
// Description : Implementation of helper functions for the SysFS Pusher
//================================================================================
//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2011-2016 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//================================================================================
#include "helper.h"
#include <sys/time.h>
#include <stddef.h>
uint64_t getMsTime() {
struct timeval t;
if (gettimeofday(&t, NULL) == 0)
return t.tv_sec * 1000 + t.tv_usec / 1000;
else
return 0;
}
//================================================================================
// Name : helper.h
// Author : Michael Ott
// Copyright : Leibniz Supercomputing Centre
// Description : Definition of helper functions for the SysFS Pusher
//================================================================================
//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2011-2016 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//================================================================================
#ifndef HELPER_H_
#define HELPER_H_
#include <stdint.h>
uint64_t getMsTime();
#endif /* HELPER_H_ */
...@@ -71,7 +71,7 @@ void printSyntax() ...@@ -71,7 +71,7 @@ void printSyntax()
cout << " -t<string> MQTT topic prefix" << endl; cout << " -t<string> MQTT topic prefix" << endl;
cout << endl; cout << endl;
cout << " -d Daemonize" << endl; cout << " -d Daemonize" << endl;
cout << " -v Be verbose" << endl; cout << " -v Be verbose (Currently not implemented)" << endl;
cout << " -h This help page" << endl; cout << " -h This help page" << endl;
cout << endl; cout << endl;
} }
......
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