From df5cc31355ac38c27acd2d2f911a0e93822d60ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 2 Apr 2015 22:56:57 +0100 Subject: [PATCH] Do not emit stateChanged when receiving discover (too verbose). --- consolereader.cpp | 2 +- socket.cpp | 7 +------ socket.h | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/consolereader.cpp b/consolereader.cpp index 0f23d9e..53bc423 100644 --- a/consolereader.cpp +++ b/consolereader.cpp @@ -119,7 +119,7 @@ void ConsoleReader::listSockets() std::cout << "a - add unpaired socket (WiFi needed)\n"; std::cout << "A - add unpaired socket (no WiFi needed)\n"; std::cout << "d - update table data\n"; - std::cout << "D - print internal socket date and time\n"; + std::cout << "D - resend discovery packet to the current socket\n"; std::cout << "n - change socket name (max 16 characters)\n"; std::cout << "p - toggle power state\n"; std::cout << "P - change remote password (max 12 characters)\nq - quit\ns - pick another socket (default is 1)\nt - change timezone" << std::endl; diff --git a/socket.cpp b/socket.cpp index 222f4b5..fb44fd2 100644 --- a/socket.cpp +++ b/socket.cpp @@ -215,10 +215,6 @@ bool Socket::parseReply ( QByteArray reply ) socketDateTime.setDate(QDate(1900, 01, 01)); // midnight 1900-01-01 socketDateTime.setTime(QTime(0, 0, 0)); socketDateTime = socketDateTime.addSecs(time); - if ( !initializing ) - { - Q_EMIT stateChanged(); - } } case Subscribe: case PowerOff: @@ -279,11 +275,10 @@ bool Socket::parseReply ( QByteArray reply ) ++index; countdown = reply.mid ( index, 2 ); Q_EMIT stateChanged(); - initializing = false; break; } case TimingData: - std::cout << reply.toHex().toStdString() << " " << datagram << std::endl; // for debugging purposes only +// std::cout << reply.toHex().toStdString() << " " << datagram << std::endl; // for debugging purposes only break; case WriteSocketData: sendDatagram ( SocketData ); diff --git a/socket.h b/socket.h index f76004f..e91a89d 100644 --- a/socket.h +++ b/socket.h @@ -91,7 +91,7 @@ private: QUdpSocket *udpSocket; QTimer *subscribeTimer; - bool subscribed, initializing = true; + bool subscribed; QQueue commands; };