Hello all,
I'm afraid I can't update to 2.0 version because I'm using c++11.
About the older version, I'm having some trouble dealing with signals.
I have an application which creates a signal proxy in order to receive the signal sent by other dbus application. The problem is that the signal just works for the first time. Once I've received the signal, if it's sent again, for a second time, I don't receive it.
What do I need to do to receive the singal more than once?
Here is the implementation I have done:
// Signal Receiver application
int main() {
DBus::init();
DBus::Dispatcher::pointer dispatcher = DBus::Dispatcher::create();
DBus::Connection::pointer connection = dispatcher->create_connection(DBus::BUS_SESSION);
int ret = connection->request_name(busname, DBUS_NAME_FLAG_REPLACE_EXISTING );
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
return;
DBus::signal_proxy<void, uint8_t, std::vector<uint8_t>, uint8_t>::pointer signal = connection->create_signal_proxy<void, uint8_t, std::vector<uint8_t>, uint8_t>("interface.emitter.signal", "SignalName");
signal->connect(sigc::mem_fun(object, &method));
for(;;){}
}
// Signal emitter application
int main {
DBus::init();
DBus::Dispatcher::pointer dispatcher = DBus::Dispatcher::create();
DBus::Connection::pointer connection = dispatcher->create_connection(DBus::BUS_SESSION);
int ret = connection->request_name( "the.signal.emitter", DBUS_NAME_FLAG_REPLACE_EXISTING );
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
return;
DBus::Object::pointer objectR = connection->create_object("/the/signal/emitter");
DBus::signal<void, uint8_t, std::vector<uint8_t>, uint8_t>::pointer dbus_signal;
dbus_signal = connection->create_signal<void, uint8_t, std::vector<uint8_t>, uint8_t>("/the/signal/emitter", "interface.emitter.signal", "SignalName");
for(;;) {}
}