Commit 59446e94 authored by Pavel Vainerman's avatar Pavel Vainerman

Merge branch 'master' of git.eter:/projects/asu/uniset2

parents 84ee08fd 9dcb5d66
......@@ -161,7 +161,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query
while( i<query.count )
{
reply.addData(0);
for( unsigned int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
for( auto nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
reply.setBit(bnum,nbit,d.b[nbit]);
bnum++;
}
......@@ -172,7 +172,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query
if( (query.count % ModbusRTU::BitsPerByte) > 0 )
bcnt++;
for( unsigned int i=0; i<bcnt; i++ )
for( auto i=0; i<bcnt; i++ )
reply.addData(replyVal);
}
......
......@@ -860,10 +860,10 @@ bool MBExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
{
ModbusRTU::ReadInputStatusRetMessage ret = mb->read02(dev->mbaddr,p->mbreg,p->q_count);
int m=0;
for( unsigned int i=0; i<ret.bcnt; i++ )
for( auto i=0; i<ret.bcnt; i++ )
{
ModbusRTU::DataBits b(ret.data[i]);
for( unsigned int k=0;k<ModbusRTU::BitsPerByte && m<p->q_count; k++,it++,m++ )
for( auto k=0;k<ModbusRTU::BitsPerByte && m<p->q_count; k++,it++,m++ )
it->second->mbval = b[k];
}
it--;
......@@ -874,10 +874,10 @@ bool MBExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
{
ModbusRTU::ReadCoilRetMessage ret = mb->read01(dev->mbaddr,p->mbreg,p->q_count);
int m = 0;
for( unsigned int i=0; i<ret.bcnt; i++ )
for( auto i=0; i<ret.bcnt; i++ )
{
ModbusRTU::DataBits b(ret.data[i]);
for( unsigned int k=0;k<ModbusRTU::BitsPerByte && m<p->q_count; k++,it++,m++ )
for( auto k=0;k<ModbusRTU::BitsPerByte && m<p->q_count; k++,it++,m++ )
it->second->mbval = b[k] ? 1 : 0;
}
it--;
......@@ -925,7 +925,7 @@ bool MBExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
}
ModbusRTU::WriteOutputMessage msg(dev->mbaddr,p->mbreg);
for( unsigned int i=0; i<p->q_count; i++,it++ )
for( auto i=0; i<p->q_count; i++,it++ )
msg.addData(it->second->mbval);
it--;
......@@ -962,7 +962,7 @@ bool MBExchange::pollRTU( RTUDevice* dev, RegMap::iterator& it )
}
ModbusRTU::ForceCoilsMessage msg(dev->mbaddr,p->mbreg);
for( unsigned int i=0; i<p->q_count; i++,it++ )
for( auto i=0; i<p->q_count; i++,it++ )
msg.addBit( (it->second->mbval ? true : false) );
it--;
......@@ -2190,7 +2190,7 @@ bool MBExchange::initItem( UniXML::iterator& it )
{
ri->q_count = p1->rnum;
ri->q_num = 1;
for( unsigned int i=1; i<p1->rnum; i++ )
for( auto i=1; i<p1->rnum; i++ )
{
RegID id1 = genRegID(mbreg+i,ri->mbfunc);
RegInfo* r = addReg(dev->regmap,id1,mbreg+i,it,dev);
......
......@@ -36,4 +36,4 @@ pkgconfig_DATA = libUniSet2MBSlave.pc
all-local:
ln -sf ../ModbusSlave/$(devel_include_HEADERS) ../include
SUBDIRS=tests
# SUBDIRS=tests
......@@ -204,6 +204,8 @@ namespace UniSetTypes
/*! Проверка наличия параметра в командной строке
\param name - название параметра
\param _argc - argc
\param _argv - argv
\return Возвращает -1, если параметр не найден.
Или позицию параметра, если найден.
*/
......
......@@ -6,10 +6,10 @@ using namespace std;
// --------------------------------------------------------------------------
#if 0
UModbus::UModbus( UTypes::Params* p )throw(UException):
mb(0),
ip(""),
port(512),
tout_msec(5000)
mb(0),
port(512),
ip(""),
tout_msec(5000)
{
try
{
......
......@@ -36,19 +36,19 @@ ModbusAddr ModbusHelpers::autodetectSlave( ModbusRTUMaster* m,
{
if( fn == fnReadInputRegisters )
{
ReadInputRetMessage ret = m->read04(a,reg,1);
m->read04(a,reg,1);
}
else if( fn == fnReadInputStatus )
{
ReadInputStatusRetMessage ret = m->read02(a,reg,1);
m->read02(a,reg,1);
}
else if( fn == fnReadCoilStatus )
{
ReadCoilRetMessage ret = m->read01(a,reg,1);
m->read01(a,reg,1);
}
else if( fn == fnReadOutputRegisters )
{
ReadOutputRetMessage ret = m->read03(a,reg,1);
m->read03(a,reg,1);
}
else
throw mbException(erOperationFailed);
......@@ -95,19 +95,19 @@ ComPort::Speed ModbusHelpers::autodetectSpeed( ModbusRTUMaster* m, ModbusAddr sl
if( fn == fnReadInputRegisters )
{
ReadInputRetMessage ret = m->read04(slave,reg,1);
m->read04(slave,reg,1);
}
else if( fn == fnReadInputStatus )
{
ReadInputStatusRetMessage ret = m->read02(slave,reg,1);
m->read02(slave,reg,1);
}
else if( fn == fnReadCoilStatus )
{
ReadCoilRetMessage ret = m->read01(slave,reg,1);
m->read01(slave,reg,1);
}
else if( fn == fnReadOutputRegisters )
{
ReadOutputRetMessage ret = m->read03(slave,reg,1);
m->read03(slave,reg,1);
}
else
throw mbException(erOperationFailed);
......
......@@ -40,7 +40,9 @@ namespace ORepHelpers
// --------------------------------------------------------------------------
/*!
* \param cname - полное имя контекста ссылку на который, возвратит функция.
* \param argc, argv - параметры инициализации ORB
* \param argc - argc
* \param argc - argv
* \param nsName - параметры инициализации ORB
*/
CosNaming::NamingContext_ptr getContext(const string& cname, int argc, const char* const* argv, const string& nsName ) throw(ORepFailed)
{
......
......@@ -88,7 +88,7 @@ std::ostream& operator<<(std::ostream& os, ObjectIndex_Array& oi )
std::ostream& ObjectIndex_Array::printMap( std::ostream& os )
{
auto oind = uniset_conf()->oind;
for( unsigned int i=0;;i++)
for( auto i=0;;i++)
{
if( !objectInfo[i].repName )
break;
......
......@@ -489,7 +489,7 @@ int UniSetManager::objectsCount()
int UniSetManager::getObjectsInfo( UniSetManager* mngr, SimpleInfoSeq* seq,
int begin, const long uplimit )
{
unsigned int ind = begin;
auto ind = begin;
// получаем у самого менджера
SimpleInfo_var msi=mngr->getInfo();
......@@ -567,4 +567,4 @@ std::ostream& operator<<(std::ostream& os, UniSetManager::OManagerCommand& cmd )
return os << "unkwnown";
}
// ------------------------------------------------------------------------------------------
\ No newline at end of file
// ------------------------------------------------------------------------------------------
......@@ -279,7 +279,7 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
cout << " | " << setw(60) << sname << " | " << setw(5) << tlst[i].value << endl;
int m = tlst[i].tlist.length();
for( unsigned int k=0; k<m; k++ )
for( auto k=0; k<m; k++ )
{
IONotifyController_i::ThresholdInfo* ti = &tlst[i].tlist[k];
cout << "\t(" << setw(3) << ti->id << ") | " << ti->state << " | hi: " << setw(5) << ti->hilimit;
......
......@@ -267,7 +267,7 @@ xmlNode* UniXML::findNodeUtf8( xmlNode* node, const string& searchnode, const st
//depth means number of times we can go to the children, if 0 we can't go only to elements of the same level
xmlNode* UniXML::extFindNode( xmlNode* node, int depth, int width, const string& searchnode, const string& name, bool top ) const
{
unsigned int i=0;
auto i=0;
xmlNode* fnode = node;
while( fnode != NULL )
{
......
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