Commit 3ec6ad95 authored by Michael Ott's avatar Michael Ott
Browse files

Only allow units to be configured UnitConv knows about

parent 72ebad22
......@@ -32,6 +32,7 @@
#include <cinttypes>
#include <dcdb/sensorconfig.h>
#include <dcdb/unitconv.h>
#include "cassandra.h"
#include "sensoraction.h"
......@@ -375,7 +376,11 @@ void SensorAction::doUnit(const char* publicName, const char* unit)
switch (err) {
case DCDB::SC_OK:
sensorConfig.setSensorUnit(publicName, unit);
if (DCDB::UnitConv::fromString(unit) != DCDB::Unit_None) {
sensorConfig.setSensorUnit(publicName, unit);
} else {
std::cout << "Unknown unit: " << unit << std::endl;
}
break;
case DCDB::SC_UNKNOWNSENSOR:
std::cout << "Unknown sensor name: " << publicName << std::endl;
......
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