18#include <sigc++/sigc++.h>
21#ifndef DBUSCXX_METHODPROXYBASE_H
22#define DBUSCXX_METHODPROXYBASE_H
29template <
typename signature>
class MethodProxy;
49 static std::shared_ptr<MethodProxyBase>
create(
const std::string&
name );
55 const std::string&
name()
const;
59 std::shared_ptr<const ReturnMessage>
call( std::shared_ptr<const CallMessage>,
int timeout_milliseconds = -1 )
const;
139template<
typename... T_arg>
147 std::ostringstream debug_str;
150 debug_str <<
"DBus::MethodProxy<";
151 debug_str << method_sig_gen.debug_string();
152 debug_str <<
"> calling method=";
156 std::shared_ptr<CallMessage> _callmsg = this->create_call_message();
157 ( *_callmsg << ... << args );
158 std::shared_ptr<const ReturnMessage> retmsg = this->call( _callmsg, -1 );
162 std::ostringstream debug_str;
165 debug_str <<
"DBus::MethodProxy<";
166 debug_str << method_sig_gen.debug_string();
167 debug_str <<
"> calling async method=";
171 return std::async( std::launch::async, *
this, args... );
174 static std::shared_ptr<MethodProxy>
create(
const std::string& name ) {
175 return std::shared_ptr<MethodProxy>(
new MethodProxy( name ) );
185template<
typename T_return,
typename... T_arg>
193 std::ostringstream debug_str;
196 debug_str <<
"DBus::MethodProxy<";
197 debug_str << method_sig_gen.debug_string();
198 debug_str <<
"> calling method=";
202 std::shared_ptr<CallMessage> _callmsg = this->create_call_message();
204 ( void )( iter << ... << args );
205 std::shared_ptr<const ReturnMessage> retmsg = this->call( _callmsg, -1 );
212 std::ostringstream debug_str;
215 debug_str <<
"DBus::MethodProxy<";
216 debug_str << method_sig_gen.debug_string();
217 debug_str <<
"> calling async method=";
221 return std::async( std::launch::async, *
this, args... );
224 static std::shared_ptr<MethodProxy>
create(
const std::string& name ) {
225 return std::shared_ptr<MethodProxy>(
new MethodProxy( name ) );
An InterfaceProxy represents a remote Interface in another application on the DBus.
Definition: interfaceproxy.h:43
Insertion iterator allow values to be appended to a message.
Definition: messageappenditerator.h:38
Base class for all proxy(remote) methods.
Definition: methodproxybase.h:41
void disable_interactive_authorization()
Disable interactive authorization for method call.
Definition: methodproxybase.cpp:103
void enable_interactive_authorization(unsigned int timeout_milliseconds=0)
Enable interactive authorization for method call.
Definition: methodproxybase.cpp:90
static std::shared_ptr< MethodProxyBase > create(const std::string &name)
Definition: methodproxybase.cpp:52
const std::string & name() const
Definition: methodproxybase.cpp:63
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
void set_interface(InterfaceProxy *proxy)
Definition: methodproxybase.cpp:113
InterfaceProxy * interface_name() const
Definition: methodproxybase.cpp:59
MethodProxyBase(const std::string &name)
Definition: methodproxybase.cpp:43
std::shared_ptr< const ReturnMessage > call(std::shared_ptr< const CallMessage >, int timeout_milliseconds=-1) const
Definition: methodproxybase.cpp:76
std::shared_ptr< CallMessage > create_call_message() const
Definition: methodproxybase.cpp:67
~MethodProxyBase()
Definition: methodproxybase.cpp:56
std::future< T_return > call_async(T_arg... args)
Definition: methodproxybase.h:211
MethodProxy(const std::string &name)
Definition: methodproxybase.h:188
T_return operator()(T_arg... args)
Definition: methodproxybase.h:192
static std::shared_ptr< MethodProxy > create(const std::string &name)
Definition: methodproxybase.h:224
MethodProxy(const std::string &name)
Definition: methodproxybase.h:142
void operator()(T_arg... args)
Definition: methodproxybase.h:146
std::future< void > call_async(T_arg... args)
Definition: methodproxybase.h:161
static std::shared_ptr< MethodProxy > create(const std::string &name)
Definition: methodproxybase.h:174
Definition: interfaceproxy.h:30
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
Definition: utility.h:235