Commit ee60e63f authored by Pavel Vainerman's avatar Pavel Vainerman

make style

parent 4b00be19
...@@ -125,6 +125,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::readCoilStatus( ReadCoilMessage& query, ...@@ -125,6 +125,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::readCoilStatus( ReadCoilMessage& query,
{ {
if( verbose ) if( verbose )
cout << "(readCoilStatus): ERROR qount=0" << endl; cout << "(readCoilStatus): ERROR qount=0" << endl;
return ModbusRTU::erBadDataValue; return ModbusRTU::erBadDataValue;
} }
...@@ -171,6 +172,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::readInputStatus( ReadInputStatusMessage& q ...@@ -171,6 +172,7 @@ ModbusRTU::mbErrCode MBTCPTestServer::readInputStatus( ReadInputStatusMessage& q
{ {
if( verbose ) if( verbose )
cout << "(readInputStatus): ERROR qount=0" << endl; cout << "(readInputStatus): ERROR qount=0" << endl;
return ModbusRTU::erBadDataValue; return ModbusRTU::erBadDataValue;
} }
......
...@@ -71,7 +71,7 @@ static void InitTest() ...@@ -71,7 +71,7 @@ static void InitTest()
throw; throw;
} }
// mbs->setVerbose(true); // mbs->setVerbose(true);
CHECK( mbs != nullptr ); CHECK( mbs != nullptr );
mbs->execute(); mbs->execute();
......
...@@ -3656,6 +3656,7 @@ namespace uniset ...@@ -3656,6 +3656,7 @@ namespace uniset
return 1; return 1;
size_t bcnt = ( nbits / ModbusRTU::BitsPerByte ); size_t bcnt = ( nbits / ModbusRTU::BitsPerByte );
if( nbits % BitsPerByte ) if( nbits % BitsPerByte )
bcnt++; bcnt++;
......
...@@ -9,7 +9,8 @@ int main(int argc, const char** argv) ...@@ -9,7 +9,8 @@ int main(int argc, const char** argv)
try try
{ {
std::string host = "localhost"; std::string host = "localhost";
if( argc >1 )
if( argc > 1 )
host = std::string(argv[1]); host = std::string(argv[1]);
uniset::UTCPStream tcp; uniset::UTCPStream tcp;
...@@ -17,10 +18,10 @@ int main(int argc, const char** argv) ...@@ -17,10 +18,10 @@ int main(int argc, const char** argv)
while(true) while(true)
{ {
{ {
tcp.create(host,2048); tcp.create(host, 2048);
std::string buf = "1234567890.10.11.12.13.14.15.16.17.18.29.20.21ksdjcb sdjcb sldfjvbds fljvhbds jfvhbdsbvjksdbfvjdssvksdbvjsdbvjsbfjskdfbvjsdfbvjdfbvFINISH\n"; std::string buf = "1234567890.10.11.12.13.14.15.16.17.18.29.20.21ksdjcb sdjcb sldfjvbds fljvhbds jfvhbdsbvjksdbfvjdssvksdbvjsdbvjsbfjskdfbvjsdfbvjdfbvFINISH\n";
size_t nbytes = tcp.sendBytes(buf.data(),buf.size()); size_t nbytes = tcp.sendBytes(buf.data(), buf.size());
cout << "real bytes: " << buf.size()<< " send: " << nbytes << " bytes" << endl; cout << "real bytes: " << buf.size() << " send: " << nbytes << " bytes" << endl;
tcp.disconnect(); tcp.disconnect();
} }
msleep(5000); msleep(5000);
......
...@@ -10,7 +10,7 @@ int main(int argc, const char** argv) ...@@ -10,7 +10,7 @@ int main(int argc, const char** argv)
{ {
try try
{ {
uniset::UTCPSocket sock("localhost",2048); uniset::UTCPSocket sock("localhost", 2048);
while(true) while(true)
{ {
...@@ -22,12 +22,13 @@ int main(int argc, const char** argv) ...@@ -22,12 +22,13 @@ int main(int argc, const char** argv)
int r = ss.receiveBytes(buf); int r = ss.receiveBytes(buf);
cout << "recv(" << r << "): used=" << buf.used() << " [ "; cout << "recv(" << r << "): used=" << buf.used() << " [ ";
for( size_t i=0; i<r; i++)
for( size_t i = 0; i < r; i++)
cout << (int)buf[i]; cout << (int)buf[i];
// std::unique_ptr<char[]> data(new char[buf.used()]); // std::unique_ptr<char[]> data(new char[buf.used()]);
// buf.read(data.get(), r); // buf.read(data.get(), r);
// cout << std::string(data.get(), r) << endl; // cout << std::string(data.get(), r) << endl;
cout << " ]" << endl; cout << " ]" << endl;
} }
} }
......
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