diff --git a/consolereader.cpp b/consolereader.cpp index 7182a2d..9cb9696 100644 --- a/consolereader.cpp +++ b/consolereader.cpp @@ -64,7 +64,7 @@ void ConsoleReader::run() (*sockets) [number]->setCountDown(countdown); break; case 'C': - (*sockets) [number]->setCountDown(countdown); + (*sockets) [number]->toggleCountDown(); break; case 'd': (*sockets) [number]->tableData(); diff --git a/socket.cpp b/socket.cpp index fe1c584..5ebf157 100644 --- a/socket.cpp +++ b/socket.cpp @@ -161,6 +161,12 @@ void Socket::setCountDown(uint16_t countdown) writeSocketData(socketName, remotePassword, timeZone, countdown); } +void Socket::toggleCountDown() +{ + countdownEnabled=!countdownEnabled; + writeSocketData(socketName, remotePassword, timeZone, countdown); +} + void Socket::writeSocketData(QByteArray socketName, QByteArray remotePassword, QByteArray timeZone, uint16_t countdown) { QByteArray countDown; diff --git a/socket.h b/socket.h index 89428b9..9f4bcc0 100644 --- a/socket.h +++ b/socket.h @@ -49,6 +49,7 @@ public: void changeSocketPassword(QString newPassword); void changeTimezone(int8_t newTimezone); void setCountDown(uint16_t countdown); + void toggleCountDown(); bool parseReply(QByteArray); QHostAddress ip;