Move skproto timer in the same thread

parent 0172fe95
...@@ -45,6 +45,11 @@ void SkyliveAuth::startPlugin() ...@@ -45,6 +45,11 @@ void SkyliveAuth::startPlugin()
} }
void SkyliveAuth::pluginKicked()
{
}
void SkyliveAuth::receiveMessage(SKMessage msg) void SkyliveAuth::receiveMessage(SKMessage msg)
{ {
std::cout << "SkyliveAuth msg received: " << msg.handle.toStdString() << std::endl; std::cout << "SkyliveAuth msg received: " << msg.handle.toStdString() << std::endl;
......
...@@ -66,6 +66,7 @@ class SkyliveAuth : public QObject, SkylivexPluginInterface ...@@ -66,6 +66,7 @@ class SkyliveAuth : public QObject, SkylivexPluginInterface
public slots: public slots:
void receiveMessage(SKMessage msg); void receiveMessage(SKMessage msg);
void pluginKicked();
signals: signals:
void putMessage(SKMessage msg); void putMessage(SKMessage msg);
......
...@@ -49,13 +49,19 @@ void SkyliveProtocol::startPlugin() ...@@ -49,13 +49,19 @@ void SkyliveProtocol::startPlugin()
registerHandler((QString)"connectTelescopes", &SkyliveProtocol::handle_connect); registerHandler((QString)"connectTelescopes", &SkyliveProtocol::handle_connect);
registerHandler((QString)"putlogin", &SkyliveProtocol::handle_putlogin); registerHandler((QString)"putlogin", &SkyliveProtocol::handle_putlogin);
pktTimer = new QTimer(); //pktTimer = new QTimer();
QObject::connect(pktTimer, SIGNAL(timeout()), this, SLOT(processPackets())); //QObject::connect(pktTimer, SIGNAL(timeout()), this, SLOT(processPackets()));
//pktTimer->start(); //pktTimer->start();
} }
void SkyliveProtocol::pluginKicked()
{
pktTimer = new QTimer();
QObject::connect(pktTimer, SIGNAL(timeout()), this, SLOT(processPackets()));
pktTimer->start();
}
void SkyliveProtocol::sendPacket(QString &cmd, QList<QString> &paramlist) void SkyliveProtocol::sendPacket(QString &cmd, QList<QString> &paramlist)
{ {
......
...@@ -120,6 +120,7 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface ...@@ -120,6 +120,7 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface
void displayError(QAbstractSocket::SocketError); void displayError(QAbstractSocket::SocketError);
public slots: public slots:
void pluginKicked();
void receiveMessage(SKMessage msg); void receiveMessage(SKMessage msg);
private slots: private slots:
......
...@@ -79,6 +79,7 @@ void SkyliveX::loadPlugins() ...@@ -79,6 +79,7 @@ void SkyliveX::loadPlugins()
std::cout << plugin << std::endl; std::cout << plugin << std::endl;
} }
} }
emit kickPlugins();
SKMessage msg("coreStarted"); SKMessage msg("coreStarted");
sendMessage(msg); sendMessage(msg);
} }
...@@ -89,6 +90,7 @@ void SkyliveX::initializePlugin(QObject *plugin, QString filename) ...@@ -89,6 +90,7 @@ void SkyliveX::initializePlugin(QObject *plugin, QString filename)
// connect signals/slots // connect signals/slots
connect(plugin, SIGNAL(putMessage(SKMessage)), this, SLOT(receiveFromPlugins(SKMessage))); connect(plugin, SIGNAL(putMessage(SKMessage)), this, SLOT(receiveFromPlugins(SKMessage)));
connect(this, SIGNAL(msgForPlugins(SKMessage)), plugin, SLOT(receiveMessage(SKMessage))); connect(this, SIGNAL(msgForPlugins(SKMessage)), plugin, SLOT(receiveMessage(SKMessage)));
connect(this, SIGNAL(kickPlugins()), plugin, SLOT(pluginKicked()));
// Move the plugin in it's own thread // Move the plugin in it's own thread
QThread* consumer = new QThread(); QThread* consumer = new QThread();
......
...@@ -71,6 +71,7 @@ class SkyliveX : public QObject ...@@ -71,6 +71,7 @@ class SkyliveX : public QObject
signals: signals:
void finished(); void finished();
void kickPlugins();
void msgForMainWin(SKMessage &msg); void msgForMainWin(SKMessage &msg);
void msgForPlugins(SKMessage msg); void msgForPlugins(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