Commit a85d2886 authored by Pavel Vainerman's avatar Pavel Vainerman

cleaning MBSlave

parent 1e4af3a1
...@@ -49,7 +49,7 @@ prefix(prefix) ...@@ -49,7 +49,7 @@ prefix(prefix)
dlog[Debug::INFO] << myname << "(init): read s_field='" << s_field dlog[Debug::INFO] << myname << "(init): read s_field='" << s_field
<< "' s_fvalue='" << s_fvalue << "'" << endl; << "' 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()); 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 ) ...@@ -687,25 +687,13 @@ bool MBSlave::initItem( UniXML_iterator& it )
stype = it.getProp("iotype"); stype = it.getProp("iotype");
if( stype == "AI" ) if( stype == "AI" )
{
p.stype = UniversalIO::AnalogInput; p.stype = UniversalIO::AnalogInput;
p.mbfunc = ModbusRTU::fnReadInputRegisters;
}
else if ( stype == "DI" ) else if ( stype == "DI" )
{
p.stype = UniversalIO::DigitalInput; p.stype = UniversalIO::DigitalInput;
p.mbfunc = ModbusRTU::fnReadInputRegisters;
}
else if ( stype == "AO" ) else if ( stype == "AO" )
{
p.stype = UniversalIO::AnalogOutput; p.stype = UniversalIO::AnalogOutput;
p.mbfunc = ModbusRTU::fnWriteOutputRegisters;
}
else if ( stype == "DO" ) else if ( stype == "DO" )
{
p.stype = UniversalIO::DigitalOutput; p.stype = UniversalIO::DigitalOutput;
p.mbfunc = ModbusRTU::fnWriteOutputRegisters;
}
p.amode = MBSlave::amRW; p.amode = MBSlave::amRW;
string am(it.getProp("mb_accessmode")); string am(it.getProp("mb_accessmode"));
...@@ -714,19 +702,6 @@ bool MBSlave::initItem( UniXML_iterator& it ) ...@@ -714,19 +702,6 @@ bool MBSlave::initItem( UniXML_iterator& it )
else if( am == "rw" ) else if( am == "rw" )
p.amode = MBSlave::amRW; 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; iomap[p.mbreg] = p;
if( dlog.debugging(Debug::INFO) ) if( dlog.debugging(Debug::INFO) )
......
...@@ -46,11 +46,10 @@ class MBSlave: ...@@ -46,11 +46,10 @@ class MBSlave:
public IOBase public IOBase
{ {
ModbusRTU::ModbusData mbreg; /*!< */ ModbusRTU::ModbusData mbreg; /*!< */
ModbusRTU::SlaveFunctionCode mbfunc; /*!< / */
AccessMode amode; AccessMode amode;
IOProperty(): IOProperty():
mbreg(0),mbfunc(ModbusRTU::fnUnknown) mbreg(0)
{} {}
friend std::ostream& operator<<( std::ostream& os, IOProperty& p ); friend std::ostream& operator<<( std::ostream& os, IOProperty& p );
......
#!/bin/sh #!/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-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-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 --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