Commit a85d2886 authored by Pavel Vainerman's avatar Pavel Vainerman

cleaning MBSlave

parent 1e4af3a1
......@@ -49,7 +49,7 @@ prefix(prefix)
dlog[Debug::INFO] << myname << "(init): read s_field='" << s_field
<< "' s_fvalue='" << s_fvalue << "'" << endl;
force = atoi(conf->getArgParam("--" + prefix + "-force",it.getProp("force")).c_str());
force = atoi(conf->getArgParam("--" + prefix + "-force",it.getProp("force")).c_str());
int recv_timeout = atoi(conf->getArgParam("--" + prefix + "-recv-timeout",it.getProp("recv_timeout")).c_str());
......@@ -687,25 +687,13 @@ bool MBSlave::initItem( UniXML_iterator& it )
stype = it.getProp("iotype");
if( stype == "AI" )
{
p.stype = UniversalIO::AnalogInput;
p.mbfunc = ModbusRTU::fnReadInputRegisters;
}
else if ( stype == "DI" )
{
p.stype = UniversalIO::DigitalInput;
p.mbfunc = ModbusRTU::fnReadInputRegisters;
}
else if ( stype == "AO" )
{
p.stype = UniversalIO::AnalogOutput;
p.mbfunc = ModbusRTU::fnWriteOutputRegisters;
}
else if ( stype == "DO" )
{
p.stype = UniversalIO::DigitalOutput;
p.mbfunc = ModbusRTU::fnWriteOutputRegisters;
}
p.amode = MBSlave::amRW;
string am(it.getProp("mb_accessmode"));
......@@ -714,19 +702,6 @@ bool MBSlave::initItem( UniXML_iterator& it )
else if( am == "rw" )
p.amode = MBSlave::amRW;
string f = it.getProp("mbfunc");
if( !f.empty() )
{
p.mbfunc = (ModbusRTU::SlaveFunctionCode)UniSetTypes::uni_atoi(f.c_str());
if( p.mbfunc == ModbusRTU::fnUnknown )
{
dlog[Debug::CRIT] << myname << "(initItem): mbfunc ='" << f
<< "' " << it.getProp("name") << endl;
return false;
}
}
iomap[p.mbreg] = p;
if( dlog.debugging(Debug::INFO) )
......
......@@ -46,11 +46,10 @@ class MBSlave:
public IOBase
{
ModbusRTU::ModbusData mbreg; /*!< */
ModbusRTU::SlaveFunctionCode mbfunc; /*!< / */
AccessMode amode;
IOProperty():
mbreg(0),mbfunc(ModbusRTU::fnUnknown)
IOProperty():
mbreg(0)
{}
friend std::ostream& operator<<( std::ostream& os, IOProperty& p );
......
#!/bin/sh
uniset-start.sh -f ./uniset-mbslave --mbs-name MBSlave1 --confile configure.xml --dlog-add-levels info,crit,warn \
uniset-start.sh -f ./uniset-mbslave --mbs-name MBSlave1 --confile test.xml --dlog-add-levels info,crit,warn \
--mbs-name MBSlave1 \
--mbs-type TCP --mbs-inet-addr 127.0.0.1 --mbs-inet-port 2048 --mbs-reg-from-id 1 --mbs-my-addr 0x01 \
--mbs-askcount-id SVU_AskCount_AS
......
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