Without a continue idle timer the cpu usage is lower...

parent b6ff20d0
......@@ -46,10 +46,9 @@ void SkyliveProtocol::startPlugin()
std::cout << "SkyliveProtocol initialized in thread " << thread() << std::endl;
registerHandler((QString)"connectTelescopes", &SkyliveProtocol::handle_connect);
QTimer *parsetimer = new QTimer();
QObject::connect(parsetimer, SIGNAL(timeout()), this, SLOT(processPackets()));
parsetimer->start();
pktTimer = new QTimer();
QObject::connect(pktTimer, SIGNAL(timeout()), this, SLOT(processPackets()));
pktTimer->start();
}
......@@ -63,6 +62,9 @@ void SkyliveProtocol::processPackets()
QString cmd(pkt.cmd);
std::cout << "Packages in Queue: " << cmd.toStdString() <<std::endl;
} else {
if(pktTimer->isActive())
pktTimer->stop();
}
}
......@@ -144,6 +146,9 @@ void SkyliveProtocol::readFromNetwork()
}
case PROTO_END:
protoQueue.enqueue(protoMsg);
//processPackets();
if(!pktTimer->isActive())
pktTimer->start();
case CMD_END:
case PARAM_END:
SM_TCPCLIENT=CONNECTED;
......
......@@ -43,6 +43,7 @@
//#include <QNetworkSession>
#include <QByteArray>
#include <QQueue>
#include <QTimer>
#include "pluginsinterfaces.h"
#include "ipcmsg.h"
......@@ -93,6 +94,7 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface
_SM_TCPCLIENT SM_TCPCLIENT;
SKProtoMsg protoMsg;
QQueue<SKProtoMsg> protoQueue;
QTimer* pktTimer;
public:
......
......@@ -72,11 +72,6 @@ int main(int argc, char *argv[])
// and give a slot to the ITC/IPC in the main loop
QTimer::singleShot(0, skx, SLOT(initialize()));
// process IPC events when we are in idle from the main window
QTimer *skxprocess = new QTimer(skx);
QObject::connect(skxprocess, SIGNAL(timeout()), skx, SLOT(process()));
skxprocess->start();
// connect core with the mainwin
QObject::connect(skx, SIGNAL(msgForMainWin(SKMessage::SKMessage&)), &mainw, SLOT(msgFromCore(SKMessage::SKMessage&)));
QObject::connect(&mainw, SIGNAL(putMessage(SKMessage::SKMessage&)), skx, SLOT(receiveFromMainWin(SKMessage::SKMessage&)));
......
......@@ -55,10 +55,6 @@ void SkyliveX::initialize()
}
void SkyliveX::process()
{
}
void SkyliveX::loadPlugins()
{
......
......@@ -66,7 +66,6 @@ class SkyliveX : public QObject
public slots:
void initialize();
void process();
void receiveFromMainWin(SKMessage::SKMessage &msg);
void receiveFromPlugins(SKMessage::SKMessage msg);
......
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