Commit 97e08a9c authored by Pavel Vainerman's avatar Pavel Vainerman

(Modbus): повторно исправил ошибку в конфигурировании для RTU188

parent cc96bb15
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
</item> </item>
<item id="7" iotype="DO" name="DO_C" priority="Medium" textname="Digital output"/> <item id="7" iotype="DO" name="DO_C" priority="Medium" textname="Digital output"/>
<item id="8" iotype="DO" name="DO1_C" priority="Medium" textname="Digital output"/> <item id="8" iotype="DO" name="DO1_C" priority="Medium" textname="Digital output"/>
<item id="9" default="1000" iotype="AO" rs_mbaddr="0x01" rs_mbfunc="0x06" rs_mbreg="0x02" precision="2" rs_mbtype="rtu" name="AO_AS" priority="Medium" rs="2" textname="Analog output"/> <item id="9" default="1000" iotype="AO" rs_mbaddr="0x01" rs_mbfunc="0x06" rs_mbreg="0x02" precision="2" rs_mbtype="rtu188" name="AO_AS" priority="Medium" rs="2" textname="Analog output"/>
<item id="10" default="378" iotype="AI" mbaddr="0x01" mbfunc="0x04" mbreg="0x01" mbtype="rtu" name="AI_AS" precision="45" priority="Medium" rs="1" textname="Analog input" vtype="F2"> <item id="10" default="378" iotype="AI" mbaddr="0x01" mbfunc="0x04" mbreg="0x01" mbtype="rtu" name="AI_AS" precision="45" priority="Medium" rs="1" textname="Analog input" vtype="F2">
<consumers> <consumers>
<consumer cfilter="test1" name="TestProc" type="objects"/> <consumer cfilter="test1" name="TestProc" type="objects"/>
......
...@@ -278,6 +278,9 @@ MBExchange::DeviceType MBExchange::getDeviceType( const std::string dtype ) ...@@ -278,6 +278,9 @@ MBExchange::DeviceType MBExchange::getDeviceType( const std::string dtype )
if( dtype == "rtu" || dtype == "RTU" ) if( dtype == "rtu" || dtype == "RTU" )
return dtRTU; return dtRTU;
if( dtype == "rtu188" || dtype == "RTU188" )
return dtRTU188;
return dtUnknown; return dtUnknown;
} }
...@@ -1840,6 +1843,12 @@ bool MBExchange::initRegInfo( RegInfo* r, UniXML_iterator& it, MBExchange::RTUD ...@@ -1840,6 +1843,12 @@ bool MBExchange::initRegInfo( RegInfo* r, UniXML_iterator& it, MBExchange::RTUD
if( !initMTRitem(it,r) ) if( !initMTRitem(it,r) )
return false; return false;
} }
else if( dev->dtype == MBExchange::dtRTU188 )
{
// only for RTU188
if( !initRTU188item(it,r) )
return false;
}
else else
{ {
dlog[Debug::CRIT] << myname << "(initRegInfo): Unknown mbtype='" << dev->dtype dlog[Debug::CRIT] << myname << "(initRegInfo): Unknown mbtype='" << dev->dtype
...@@ -2116,11 +2125,11 @@ bool MBExchange::initItem( UniXML_iterator& it ) ...@@ -2116,11 +2125,11 @@ bool MBExchange::initItem( UniXML_iterator& it )
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool MBExchange::initMTRitem( UniXML_iterator& it, RegInfo* p ) bool MBExchange::initMTRitem( UniXML_iterator& it, RegInfo* p )
{ {
p->mtrType = MTR::str2type(it.getProp("mtrtype")); p->mtrType = MTR::str2type(it.getProp(prop_prefix + "mtrtype"));
if( p->mtrType == MTR::mtUnknown ) if( p->mtrType == MTR::mtUnknown )
{ {
dlog[Debug::CRIT] << myname << "(readMTRItem): Unknown mtrtype '" dlog[Debug::CRIT] << myname << "(readMTRItem): Unknown mtrtype '"
<< it.getProp("mtrtype") << it.getProp(prop_prefix + "mtrtype")
<< "' for " << it.getProp("name") << endl; << "' for " << it.getProp("name") << endl;
return false; return false;
...@@ -2129,6 +2138,40 @@ bool MBExchange::initMTRitem( UniXML_iterator& it, RegInfo* p ) ...@@ -2129,6 +2138,40 @@ bool MBExchange::initMTRitem( UniXML_iterator& it, RegInfo* p )
return true; return true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool MBExchange::initRTU188item( UniXML_iterator& it, RegInfo* p )
{
string jack(it.getProp(prop_prefix + "jack"));
string chan(it.getProp(prop_prefix + "channel"));
if( jack.empty() )
{
dlog[Debug::CRIT] << myname << "(readRTU188Item): Unknown jack='' "
<< " for " << it.getProp("name") << endl;
return false;
}
p->rtuJack = RTUStorage::s2j(jack);
if( p->rtuJack == RTUStorage::nUnknown )
{
dlog[Debug::CRIT] << myname << "(readRTU188Item): Unknown jack=" << jack
<< " for " << it.getProp("name") << endl;
return false;
}
if( chan.empty() )
{
dlog[Debug::CRIT] << myname << "(readRTU188Item): Unknown channel='' "
<< " for " << it.getProp("name") << endl;
return false;
}
p->rtuChan = UniSetTypes::uni_atoi(chan);
if( dlog.debugging(Debug::LEVEL2) )
dlog[Debug::LEVEL2] << myname << "(readRTU188Item): " << p << endl;
return true;
}
// ------------------------------------------------------------------------------------------
std::ostream& operator<<( std::ostream& os, const MBExchange::DeviceType& dt ) std::ostream& operator<<( std::ostream& os, const MBExchange::DeviceType& dt )
{ {
switch(dt) switch(dt)
......
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