Commit 0f7909c7 authored by Michael Ott's avatar Michael Ott
Browse files

Bugfix: Parse for functions and modifiers in a sensorname string first, then...

Bugfix: Parse for functions and modifiers in a sensorname string first, then lookup the actual sensor name in the DB
parent 5f69ad3b
......@@ -298,23 +298,24 @@ void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DC
boost::smatch match;
baseUnit = DCDB::Unit_None;
sensorName = *it;
DCDB::PublicSensor sen;
sensorConfig.getPublicSensorByName(sen, it->c_str());
/* Base scaling factor and unit of the public sensor */
baseUnit = DCDB::UnitConv::fromString(sen.unit);
baseScalingFactor = sen.scaling_factor;
/* Retrieve sensor object first */
boost::regex functExp("^delta|^delta_t|^derivative|^integral", boost::regex::extended);
if(boost::regex_search(*it, match, functExp))
sensorName = it->substr(it->find('(') + 1, it->size() - it->find('(') - (it->size() - it->find(')')) - 1 );
else if (it->find('/') != std::string::npos)
sensorName = it->substr(0, it->find('/'));
else
sensorName = *it;
DCDB::PublicSensor sen;
sensorConfig.getPublicSensorByName(sen, sensorName.c_str());
DCDB::Sensor sensor(connection, sensorName);
/* Base scaling factor and unit of the public sensor */
baseUnit = DCDB::UnitConv::fromString(sen.unit);
baseScalingFactor = sen.scaling_factor;
DCDB::Sensor sensor(connection, sen);
/* Iterate over the list to detect all instances of the sensor with name "sensorName" */
while(it != sensors.end()) {
......
Markdown is supported
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