Skip to content

Commit

Permalink
Updated plugins for Wintermute.
Browse files Browse the repository at this point in the history
  * zeromq, daemon and dbus got a polishing.
  • Loading branch information
Jacky Alciné committed Feb 28, 2014
1 parent 748ddfe commit 436f437
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 22 deletions.
2 changes: 2 additions & 0 deletions lib/daemon/README.md
@@ -0,0 +1,2 @@
# Daemon

1 change: 1 addition & 0 deletions lib/daemon/plugin.cpp
Expand Up @@ -45,6 +45,7 @@ Plugin::stop()
void
Plugin::start()
{
// TODO Ask for the loading of a messaging plug-in.
}

Version
Expand Down
1 change: 1 addition & 0 deletions lib/dbus/README.md
@@ -0,0 +1 @@
# D-Bus Support in Wintermute.
1 change: 1 addition & 0 deletions lib/heartbeat/README.md
@@ -0,0 +1 @@
# Heartbeat
1 change: 1 addition & 0 deletions lib/zeromq/README.md
@@ -0,0 +1 @@
# ZeroMQ Support in Wintermute
28 changes: 7 additions & 21 deletions lib/zeromq/module.cpp
Expand Up @@ -39,37 +39,23 @@ Module::Module ( ZeroMQ::Plugin* plugin ) : Wintermute::Procedure::Module ( plug
{
setDomain ( WINTERMUTE_DOMAIN );
setPackage ( "zeromq" );
m_dispatcher = new Dispatcher(this);
m_receiver = new Receiver(this);
m_dispatcher = new Dispatcher(this);
connect(m_context, SIGNAL(polled()), this, SLOT(pollInvoked()));
}

void
Module::start()
Module::pollInvoked()
{
m_context->start();
winfo(this, "Checking for new messages...");
}

void
Module::bindIncomingSocket(){
//m_incomingSocket = dynamic_cast<QtZeroMQ::PollingSocket*>(m_context->createSocket(QtZeroMQ::Socket::TypeSubscribe, this));
//m_incomingSocket->setIdentity("wintermute:in");
//m_incomingSocket->connectTo(WINTERMUTE_SOCKET_IPC);
//m_incomingSocket->subscribeTo("wintermute:global");
Module::start()
{
m_context->start();
}

//void
//Module::onMessageReceived(const QList<QByteArray>& message)
//{
//winfo(this, "Got some messages...");
//QByteArray data;
//foreach(const QByteArray& part, message){
//data += part;
//}

//QtZeroMQ::Message msg(data);
//winfo(this, QString(msg.toByteArray()));
//}

void
Module::stop()
{
Expand Down
3 changes: 3 additions & 0 deletions lib/zeromq/module.hpp
Expand Up @@ -36,13 +36,16 @@ class Module : public Wintermute::Procedure::Module
friend class Wintermute::ZeroMQ::Receiver;
friend class Wintermute::ZeroMQ::Dispatcher;
QtZeroMQ::PollingSocket* m_incomingSocket;

public:
explicit Module ( ZeroMQ::Plugin* plugin );
Q_SLOT virtual void start();
Q_SLOT virtual void stop();
virtual ~Module();

private:
void bindIncomingSocket();
Q_SLOT void pollInvoked();
QtZeroMQ::PollingContext* m_context;
Dispatcher* m_dispatcher;
Receiver* m_receiver;
Expand Down
2 changes: 1 addition & 1 deletion lib/zeromq/receiver.cpp
Expand Up @@ -35,7 +35,7 @@ Receiver::Receiver(Module* a_module) :
setParent(a_module);
m_socket = dynamic_cast<QtZeroMQ::PollingSocket*>(
a_module->m_context->createSocket(QtZeroMQ::Socket::TypeSubscribe, this));
m_socket->subscribeTo(QString::null);
m_socket->subscribeTo(QString(""));
m_socket->connectTo(WINTERMUTE_SOCKET_IPC);
winfo(this, "Hey, listening on ZeroMQ.");
}
Expand Down

0 comments on commit 436f437

Please sign in to comment.