diff --git a/radeon-profile-daemon/rpdthread.cpp b/radeon-profile-daemon/rpdthread.cpp index f682ca7..4cf0ac0 100644 --- a/radeon-profile-daemon/rpdthread.cpp +++ b/radeon-profile-daemon/rpdthread.cpp @@ -28,7 +28,7 @@ rpdThread::rpdThread() : QThread(), void rpdThread::newConn() { qInfo() << "Connecting to the client"; signalReceiver = daemonServer.nextPendingConnection(); - connect(signalReceiver,SIGNAL(readyRead()),this,SLOT(decodeSignal())); + connect(signalReceiver,SIGNAL(readyRead()),this,SLOT(readSignalAndPerformTask())); connect(signalReceiver,SIGNAL(disconnected()),this,SLOT(disconnected())); connectionConfirmed = true; @@ -77,6 +77,7 @@ void rpdThread::sendMessage(const QString &msg) { QByteArray feedback; QDataStream out(&feedback, QIODevice::WriteOnly); + out.setVersion(QDataStream::Qt_5_7); out << msg; @@ -99,13 +100,6 @@ void rpdThread::checkConnection() { sendMessage("7#1#"); } -void rpdThread::decodeSignal() { - char signal[1024] = {0}; - - signalReceiver->read(signal,signalReceiver->bytesAvailable()); - performTask(QString(signal)); -} - void rpdThread::onTimer() { if (signalReceiver->state() == QLocalSocket::ConnectedState) readData(); @@ -121,8 +115,9 @@ void rpdThread::onTimer() { // 5 - stop timer // 6 - shared mem key // 7 - alive msg -void rpdThread::performTask(const QString &signal) { - qDebug() << "Performing task: " << signal; +void rpdThread::readSignalAndPerformTask() { + const auto signal = QString(signalReceiver->readAll()); + qDebug() << "Received signal: " << signal; if (signal.isEmpty()) { qWarning() << "Received empty signal"; diff --git a/radeon-profile-daemon/rpdthread.h b/radeon-profile-daemon/rpdthread.h index e2bb521..5e03a32 100644 --- a/radeon-profile-daemon/rpdthread.h +++ b/radeon-profile-daemon/rpdthread.h @@ -30,7 +30,7 @@ #define SIGNAL_SHAREDMEM_KEY '6' #define SIGNAL_ALIVE '7' -const QString appVersion = "20190301"; +const QString appVersion = "20190309"; const QString serverName = "radeon-profile-daemon-server"; class rpdThread : public QThread @@ -44,10 +44,10 @@ class rpdThread : public QThread public slots: void newConn(); - void decodeSignal(); void onTimer(); void disconnected(); void checkConnection(); + void readSignalAndPerformTask(); private: QLocalSocket *signalReceiver; @@ -60,7 +60,6 @@ public slots: void readData(); bool setNewValue(const QString &filePath, const QString &newValue); - void performTask(const QString &signal); bool configure(const QString &type, const QString &filePath); void configureSharedMem(const QString &key); bool checkRequiredCommandLength(unsigned required, unsigned currentIndex, unsigned size);