Commit d5bdd661 authored by Pavel Vainerman's avatar Pavel Vainerman

make style

parent 969fac56
...@@ -3300,6 +3300,7 @@ UniSetTypes::SimpleInfo* MBExchange::getInfo( CORBA::Long userparam ) ...@@ -3300,6 +3300,7 @@ UniSetTypes::SimpleInfo* MBExchange::getInfo( CORBA::Long userparam )
inf << "Statistics: " << statInfo << endl; inf << "Statistics: " << statInfo << endl;
inf << "Devices: " << endl; inf << "Devices: " << endl;
for( const auto& it : devices ) for( const auto& it : devices )
inf << " " << it.second->getShortInfo() << endl; inf << " " << it.second->getShortInfo() << endl;
......
...@@ -51,7 +51,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -51,7 +51,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
// Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после // Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после
// неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout.. // неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout..
int channelTimeout = conf->getArgPInt("--" + prefix + "-default-channel-timeout", it.getProp("channelTimeout"),default_timeout); int channelTimeout = conf->getArgPInt("--" + prefix + "-default-channel-timeout", it.getProp("channelTimeout"), default_timeout);
ptReopen.setTiming(channelTimeout); ptReopen.setTiming(channelTimeout);
UniXML::iterator it1(it); UniXML::iterator it1(it);
...@@ -174,7 +174,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -174,7 +174,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
// Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после // Т.к. при "многоканальном" доступе к slave, смена канала должна происходит сразу после
// неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout.. // неудачной попытки запросов по одному из каналов, то ПЕРЕОПРЕДЕЛЯЕМ reopen, на channel-timeout..
int tout = conf->getArgPInt("--" + prefix + "-default-channel-timeout", it.getProp("channelTimeout"),default_timeout); int tout = conf->getArgPInt("--" + prefix + "-default-channel-timeout", it.getProp("channelTimeout"), default_timeout);
ptReopen.setTiming(tout); ptReopen.setTiming(tout);
if( mblog->is_info() ) if( mblog->is_info() )
......
...@@ -614,7 +614,7 @@ void MBSlave::execute_tcp() ...@@ -614,7 +614,7 @@ void MBSlave::execute_tcp()
mbinfo << myname << "(execute_tcp): run tcpserver (" mbinfo << myname << "(execute_tcp): run tcpserver ("
<< tcpserver->getInetAddress() << ":" << tcpserver->getInetPort() << tcpserver->getInetAddress() << ":" << tcpserver->getInetPort()
<<")" << endl; << ")" << endl;
tcpCancelled = false; tcpCancelled = false;
...@@ -2564,8 +2564,10 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam ) ...@@ -2564,8 +2564,10 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
inf << "LogServer: " << logserv_host << ":" << logserv_port << endl; inf << "LogServer: " << logserv_host << ":" << logserv_port << endl;
inf << "iomap[" << iomap.size() << "]: " << endl; inf << "iomap[" << iomap.size() << "]: " << endl;
for( const auto& m: iomap )
for( const auto& m : iomap )
inf << " " << ModbusRTU::addr2str(m.first) << ": iomap=" << m.second.size() << endl; inf << " " << ModbusRTU::addr2str(m.first) << ": iomap=" << m.second.size() << endl;
inf << " myaddr: " << ModbusServer::vaddr2str(vaddr) << endl; inf << " myaddr: " << ModbusServer::vaddr2str(vaddr) << endl;
inf << "Statistic: askCount=" << askCount << " pingOK=" << pingOK << endl; inf << "Statistic: askCount=" << askCount << " pingOK=" << pingOK << endl;
...@@ -2592,6 +2594,7 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam ) ...@@ -2592,6 +2594,7 @@ UniSetTypes::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
{ {
uniset_mutex_lock l(sessMutex); uniset_mutex_lock l(sessMutex);
inf << "TCP sessions[" << sess.size() << "]: max=" << sessMaxNum << " updateStatTime=" << updateStatTime << endl; inf << "TCP sessions[" << sess.size() << "]: max=" << sessMaxNum << " updateStatTime=" << updateStatTime << endl;
for( const auto& m : sess ) for( const auto& m : sess )
inf << " " << m.iaddr << " askCount=" << m.askCount << endl; inf << " " << m.iaddr << " askCount=" << m.askCount << endl;
} }
......
...@@ -186,30 +186,30 @@ TEST_CASE("[SM]: depend test", "[sm][depend]") ...@@ -186,30 +186,30 @@ TEST_CASE("[SM]: depend test", "[sm][depend]")
REQUIRE( ui->getValue(513) == 0 ); REQUIRE( ui->getValue(513) == 0 );
// проверяем что датчик DI работает // проверяем что датчик DI работает
ui->setValue(513,1); ui->setValue(513, 1);
msleep(300); msleep(300);
REQUIRE( obj->in_dependDI_s == 1 ); REQUIRE( obj->in_dependDI_s == 1 );
ui->setValue(513,0); ui->setValue(513, 0);
msleep(300); msleep(300);
REQUIRE( obj->in_dependDI_s == 0 ); REQUIRE( obj->in_dependDI_s == 0 );
// проверяем что датчик AI не работает, т.к. забклоирован // проверяем что датчик AI не работает, т.к. забклоирован
ui->setValue(512,100); ui->setValue(512, 100);
REQUIRE( ui->getValue(512) == 1000 ); REQUIRE( ui->getValue(512) == 1000 );
msleep(300); msleep(300);
REQUIRE( obj->in_dependAI_s == 1000 ); REQUIRE( obj->in_dependAI_s == 1000 );
ui->setValue(512,50); ui->setValue(512, 50);
REQUIRE( ui->getValue(512) == 1000 ); REQUIRE( ui->getValue(512) == 1000 );
msleep(300); msleep(300);
REQUIRE( obj->in_dependAI_s == 1000 ); REQUIRE( obj->in_dependAI_s == 1000 );
// проверяем что после разблолокирования датчик принимает текущее значение // проверяем что после разблолокирования датчик принимает текущее значение
// и процесс приходит sensorInfo // и процесс приходит sensorInfo
ui->setValue(512,40); // выставляем значение (находясь под блокировкой) ui->setValue(512, 40); // выставляем значение (находясь под блокировкой)
REQUIRE( obj->in_dependAI_s == 1000 ); // у процесса пока блокированное значение REQUIRE( obj->in_dependAI_s == 1000 ); // у процесса пока блокированное значение
// ----- разблокируем // ----- разблокируем
ui->setValue(514,1); ui->setValue(514, 1);
msleep(300); msleep(300);
REQUIRE( ui->getValue(514) == 1 ); REQUIRE( ui->getValue(514) == 1 );
...@@ -220,14 +220,14 @@ TEST_CASE("[SM]: depend test", "[sm][depend]") ...@@ -220,14 +220,14 @@ TEST_CASE("[SM]: depend test", "[sm][depend]")
// dependDI наоборот заблокировался // dependDI наоборот заблокировался
REQUIRE( ui->getValue(513) == 0 ); REQUIRE( ui->getValue(513) == 0 );
ui->setValue(513,1); ui->setValue(513, 1);
msleep(300); msleep(300);
REQUIRE( ui->getValue(513) == 0 ); REQUIRE( ui->getValue(513) == 0 );
REQUIRE( obj->in_dependDI_s == 0 ); REQUIRE( obj->in_dependDI_s == 0 );
// ----- блокируем // ----- блокируем
ui->setValue(514,0); ui->setValue(514, 0);
msleep(300); msleep(300);
REQUIRE( ui->getValue(514) == 0 ); REQUIRE( ui->getValue(514) == 0 );
......
...@@ -74,6 +74,7 @@ void TestProc::sysCommand( const UniSetTypes::SystemMessage* sm ) ...@@ -74,6 +74,7 @@ void TestProc::sysCommand( const UniSetTypes::SystemMessage* sm )
askTimer(tmCheck, checkTime); askTimer(tmCheck, checkTime);
askTimer(tmCheckWorking, checkWorkingTime); askTimer(tmCheckWorking, checkWorkingTime);
askTimer(tmLogControl, checkLogTime); askTimer(tmLogControl, checkLogTime);
if( mbthr ) if( mbthr )
mbthr->start(); mbthr->start();
......
...@@ -100,7 +100,7 @@ class DelayTimer ...@@ -100,7 +100,7 @@ class DelayTimer
if( st ) if( st )
{ {
if( onDelay <=0 ) if( onDelay <= 0 )
{ {
pt.setTiming(0); pt.setTiming(0);
state = st; state = st;
...@@ -112,7 +112,7 @@ class DelayTimer ...@@ -112,7 +112,7 @@ class DelayTimer
} }
else else
{ {
if( offDelay <=0 ) if( offDelay <= 0 )
{ {
pt.setTiming(0); pt.setTiming(0);
state = st; state = st;
......
...@@ -141,13 +141,13 @@ class IOController: ...@@ -141,13 +141,13 @@ class IOController:
// доступ к элементам через итератор // доступ к элементам через итератор
virtual void localSetValueIt( IOStateList::iterator& it, const UniSetTypes::ObjectId sid, virtual void localSetValueIt( IOStateList::iterator& it, const UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id ); CORBA::Long value, UniSetTypes::ObjectId sup_id );
virtual long localGetValue( IOStateList::iterator& it, const UniSetTypes::ObjectId sid ); virtual long localGetValue( IOStateList::iterator& it, const UniSetTypes::ObjectId sid );
// вариант с указателем // вариант с указателем
virtual void localSetValue( std::shared_ptr<USensorInfo>& usi, UniSetTypes::ObjectId sid, virtual void localSetValue( std::shared_ptr<USensorInfo>& usi, UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id ); CORBA::Long value, UniSetTypes::ObjectId sup_id );
long localGetValue( std::shared_ptr<USensorInfo>& it, const UniSetTypes::ObjectId sid ); long localGetValue( std::shared_ptr<USensorInfo>& it, const UniSetTypes::ObjectId sid );
......
...@@ -283,7 +283,7 @@ class IONotifyController: ...@@ -283,7 +283,7 @@ class IONotifyController:
//! проверка срабатывания пороговых датчиков //! проверка срабатывания пороговых датчиков
virtual void checkThreshold( std::shared_ptr<USensorInfo>& usi, const UniSetTypes::ObjectId sid, bool send = true ); virtual void checkThreshold( std::shared_ptr<USensorInfo>& usi, const UniSetTypes::ObjectId sid, bool send = true );
virtual void checkThreshold(IOController::IOStateList::iterator& li, const UniSetTypes::ObjectId sid, bool send_msg=true ); virtual void checkThreshold(IOController::IOStateList::iterator& li, const UniSetTypes::ObjectId sid, bool send_msg = true );
//! поиск информации о пороговом датчике //! поиск информации о пороговом датчике
ThresholdExtList::iterator findThreshold( const UniSetTypes::ObjectId sid, const UniSetTypes::ThresholdId tid ); ThresholdExtList::iterator findThreshold( const UniSetTypes::ObjectId sid, const UniSetTypes::ThresholdId tid );
......
...@@ -118,7 +118,7 @@ class ModbusTCPSession: ...@@ -118,7 +118,7 @@ class ModbusTCPSession:
virtual ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query, virtual ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply ); ModbusRTU::FileTransferRetMessage& reply );
private: private:
std::queue<unsigned char> qrecv; std::queue<unsigned char> qrecv;
ModbusTCP::MBAPHeader curQueryHeader; ModbusTCP::MBAPHeader curQueryHeader;
std::unordered_set<ModbusRTU::ModbusAddr> vaddr; std::unordered_set<ModbusRTU::ModbusAddr> vaddr;
......
...@@ -199,6 +199,7 @@ void ModbusTCPServer::setTimer( timeout_t msec ) ...@@ -199,6 +199,7 @@ void ModbusTCPServer::setTimer( timeout_t msec )
void ModbusTCPServer::iowait( timeout_t msec ) void ModbusTCPServer::iowait( timeout_t msec )
{ {
ptWait.setTiming(msec); ptWait.setTiming(msec);
while( !ptWait.checkTime() ) while( !ptWait.checkTime() )
io.loop.iteration(); io.loop.iteration();
} }
......
...@@ -92,6 +92,7 @@ void ModbusTCPSession::setSessionTimeout( double t ) ...@@ -92,6 +92,7 @@ void ModbusTCPSession::setSessionTimeout( double t )
void ModbusTCPSession::iowait( timeout_t msec ) void ModbusTCPSession::iowait( timeout_t msec )
{ {
ptWait.setTiming(msec); ptWait.setTiming(msec);
while( !ptWait.checkTime() ) while( !ptWait.checkTime() )
io.loop.iteration(); io.loop.iteration();
} }
...@@ -329,9 +330,11 @@ mbErrCode ModbusTCPSession::tcp_processing( ModbusTCP::MBAPHeader& mhead ) ...@@ -329,9 +330,11 @@ mbErrCode ModbusTCPSession::tcp_processing( ModbusTCP::MBAPHeader& mhead )
} }
pt.setTiming(10); pt.setTiming(10);
do do
{ {
len = ModbusTCPCore::readDataFD( sock->getSocket(), qrecv, mhead.len ); len = ModbusTCPCore::readDataFD( sock->getSocket(), qrecv, mhead.len );
if( len == 0 ) if( len == 0 )
io.loop.iteration(); io.loop.iteration();
} }
......
...@@ -252,8 +252,8 @@ void IOController::setValue( UniSetTypes::ObjectId sid, CORBA::Long value, UniSe ...@@ -252,8 +252,8 @@ void IOController::setValue( UniSetTypes::ObjectId sid, CORBA::Long value, UniSe
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void IOController::localSetValueIt( IOController::IOStateList::iterator& li, void IOController::localSetValueIt( IOController::IOStateList::iterator& li,
UniSetTypes::ObjectId sid, UniSetTypes::ObjectId sid,
CORBA::Long value, UniSetTypes::ObjectId sup_id ) CORBA::Long value, UniSetTypes::ObjectId sup_id )
{ {
if( sup_id == UniSetTypes::DefaultObjectId ) if( sup_id == UniSetTypes::DefaultObjectId )
sup_id = getId(); sup_id = getId();
......
...@@ -681,7 +681,7 @@ void IONotifyController::checkThreshold( IOController::IOStateList::iterator& li ...@@ -681,7 +681,7 @@ void IONotifyController::checkThreshold( IOController::IOStateList::iterator& li
if( li == myioEnd() ) if( li == myioEnd() )
return; // ??? return; // ???
checkThreshold(li->second,sid,send_msg); checkThreshold(li->second, sid, send_msg);
} }
// -------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------
void IONotifyController::checkThreshold( std::shared_ptr<IOController::USensorInfo>& s, void IONotifyController::checkThreshold( std::shared_ptr<IOController::USensorInfo>& s,
......
...@@ -20,13 +20,13 @@ using namespace std; ...@@ -20,13 +20,13 @@ using namespace std;
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
unsigned char dat[] = { '1', '2', '3' ,'4' }; unsigned char dat[] = { '1', '2', '3' , '4' };
// UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 0 ); // UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 0 );
UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 3 ); UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 3 );
// if( buf->nbytes() == 0 ) // if( buf->nbytes() == 0 )
// delete buf; // delete buf;
cout << "buf: " << buf->dpos() << endl; cout << "buf: " << buf->dpos() << endl;
......
...@@ -190,9 +190,10 @@ TEST_CASE("[DelayTimer]: zero time", "[DelayTimer]" ) ...@@ -190,9 +190,10 @@ TEST_CASE("[DelayTimer]: zero time", "[DelayTimer]" )
SECTION("off delay") SECTION("off delay")
{ {
DelayTimer dt(0,2000); DelayTimer dt(0, 2000);
PassiveTimer pt; PassiveTimer pt;
dt.check(true); dt.check(true);
while( dt.check(false) ) while( dt.check(false) )
msleep(100); msleep(100);
......
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