Commit 337de1f1 authored by Pavel Vainerman's avatar Pavel Vainerman

(NCRestorer): добавил проверку на тип указанного датчика связанного с порогом.

Потому-что пока пороги умеют работать только с 'DI'.
parent 3f4ab8f6
...@@ -427,41 +427,37 @@ bool NCRestorer_XML::getConsumerList( UniXML& xml,xmlNode* node, ...@@ -427,41 +427,37 @@ bool NCRestorer_XML::getConsumerList( UniXML& xml,xmlNode* node,
bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node, bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node,
IONotifyController::ThresholdInfoExt& ti ) IONotifyController::ThresholdInfoExt& ti )
{ {
string sid_name = xml.getProp(node,"sid"); UniXML_iterator uit(node);
string sid_name = uit.getProp("sid");
if( !sid_name.empty() ) if( !sid_name.empty() )
{ {
ti.sid = conf->getSensorID(sid_name); ti.sid = conf->getSensorID(sid_name);
if( ti.sid == UniSetTypes::DefaultObjectId ) if( ti.sid == UniSetTypes::DefaultObjectId )
{ {
unideb[Debug::CRIT] << "(NCRestorer_XML:getThresholdInfo): " unideb[Debug::CRIT] << "(NCRestorer_XML:getThresholdInfo): "
<< " Неверно указан НАЗВАНИЕ датчика " << sid_name << " Not found ID for " << sid_name << endl;
<< " Не найден ID для данного дачика\n" << flush; }
else
{
UniversalIO::IOTypes iotype = conf->getIOType(sid_name);
// Пока что IONotifyController поддерживает работу только с 'DI'.
if( iotype != UniversalIO::DigitalInput )
{
unideb[Debug::CRIT] << "(NCRestorer_XML:getThresholdInfo): "
<< " Bad iotype for " << sid_name << ". iotype must be 'DI'!" << endl;
return false;
}
} }
} }
UniXML_iterator uit(node);
ti.id = uit.getIntProp("id"); ti.id = uit.getIntProp("id");
ti.lowlimit = uit.getIntProp("lowlimit"); ti.lowlimit = uit.getIntProp("lowlimit");
ti.hilimit = uit.getIntProp("hilimit"); ti.hilimit = uit.getIntProp("hilimit");
ti.sensibility = uit.getIntProp("sensibility"); ti.sensibility = uit.getIntProp("sensibility");
ti.inverse = uit.getIntProp("inverse"); ti.inverse = uit.getIntProp("inverse");
ti.state = IONotifyController_i::NormalThreshold; ti.state = IONotifyController_i::NormalThreshold;
if( ti.sid == UniSetTypes::DefaultObjectId )
{
string sid_name(uit.getProp("sid"));
if( !sid_name.empty() )
{
ti.sid = conf->getSensorID(sid_name);
if( ti.sid == UniSetTypes::DefaultObjectId )
{
unideb[Debug::CRIT] << "(NCRestorer_XML:getThresholdInfo): "
<< " Неверно указан НАЗВАНИЕ датчика " << sid_name
<< " Не найден ID для данного дачика\n" << flush;
}
}
}
return true; return true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
......
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