diff --git a/examples/echo/echo-client.cpp b/examples/echo/echo-client.cpp index 093595f..03433b7 100644 --- a/examples/echo/echo-client.cpp +++ b/examples/echo/echo-client.cpp @@ -42,7 +42,9 @@ void *greeter_thread(void *arg) for (int i = 0; i < 30 && spin; ++i) { + cout << "+Hello" << endl; cout << client.Hello(idstr) << endl; + cout << "-Hello" << endl; } cout << idstr << " done " << endl; diff --git a/examples/echo/echo-server.cpp b/examples/echo/echo-server.cpp index 188f0d5..1d1cb07 100644 --- a/examples/echo/echo-server.cpp +++ b/examples/echo/echo-server.cpp @@ -24,7 +24,7 @@ int32_t EchoServer::Random() std::string EchoServer::Hello(const std::string &name) { - sleep (10); + sleep (5); return "Hello " + name + "!"; } diff --git a/include/dbus-c++/interface.h b/include/dbus-c++/interface.h index 1eccfbc..7a5297b 100644 --- a/include/dbus-c++/interface.h +++ b/include/dbus-c++/interface.h @@ -95,6 +95,8 @@ protected: {} virtual Message _invoke_method(CallMessage &) = 0; + + virtual bool _invoke_method_noreply(CallMessage &call) = 0; InterfaceProxyTable _interfaces; }; @@ -164,6 +166,8 @@ public: InterfaceProxy(const std::string &name); Message invoke_method(const CallMessage &); + + bool invoke_method_noreply(const CallMessage &call); bool dispatch_signal(const SignalMessage &); diff --git a/include/dbus-c++/object.h b/include/dbus-c++/object.h index 851488e..9d81d9d 100644 --- a/include/dbus-c++/object.h +++ b/include/dbus-c++/object.h @@ -201,6 +201,8 @@ public: private: Message _invoke_method(CallMessage &); + + bool _invoke_method_noreply(CallMessage &call); bool handle_message(const Message &); diff --git a/src/interface.cpp b/src/interface.cpp index c1dfedd..b0360ac 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -157,3 +157,13 @@ Message InterfaceProxy::invoke_method(const CallMessage &call) return _invoke_method(call2); } + +bool InterfaceProxy::invoke_method_noreply(const CallMessage &call) +{ + CallMessage &call2 = const_cast(call); + + if (call.interface() == NULL) + call2.interface(name().c_str()); + + return _invoke_method_noreply(call2); +} diff --git a/src/object.cpp b/src/object.cpp index 0dd1bb1..f7d0916 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -332,6 +332,17 @@ Message ObjectProxy::_invoke_method(CallMessage &call) return conn().send_blocking(call); } +bool ObjectProxy::_invoke_method_noreply(CallMessage &call) +{ + if (call.path() == NULL) + call.path(path().c_str()); + + if (call.destination() == NULL) + call.destination(service().c_str()); + + return conn().send(call); +} + bool ObjectProxy::handle_message(const Message &msg) { switch (msg.type())