14 #include <shared_mutex>
17 #include <sigc++/sigc++.h>
20 #ifndef DBUSCXX_INTERFACEPROXY_H
21 #define DBUSCXX_INTERFACEPROXY_H
48 typedef std::multimap<std::string, std::shared_ptr<MethodProxyBase>>
Methods;
50 typedef std::set<std::shared_ptr<SignalProxyBase>>
Signals;
52 static std::shared_ptr<InterfaceProxy>
create(
const std::string&
name = std::string() );
62 const std::string&
name()
const;
67 std::shared_ptr<MethodProxyBase>
method(
const std::string&
name )
const;
69 template <
class T_type>
71 std::shared_ptr< MethodProxy<T_type> >
method;
75 return std::shared_ptr< MethodProxy<T_type> >();
103 const std::map<std::string,std::shared_ptr<PropertyProxyBase>>&
properties()
const;
105 std::shared_ptr<PropertyProxyBase>
property(
const std::string&
name )
const;
122 template <
class T_type>
125 std::shared_ptr< PropertyProxy<T_type> > prop;
129 return std::shared_ptr< PropertyProxy<T_type> >();
148 std::shared_ptr<const ReturnMessage>
call( std::shared_ptr<const CallMessage>,
int timeout_milliseconds = -1 )
const;
152 template <
class T_arg>
153 std::shared_ptr<SignalProxy<T_arg >>
create_signal(
const std::string& sig_name ) {
154 std::shared_ptr< SignalProxy<T_arg> > sig;
167 std::shared_ptr<SignalProxyBase>
signal(
const std::string& signame );
169 bool add_signal( std::shared_ptr<SignalProxyBase> sig );
175 bool has_signal(
const std::string& signame )
const;
177 bool has_signal( std::shared_ptr<SignalProxyBase> sig )
const;
184 void property_updated( std::string,std::map<std::string,DBus::Variant>,std::vector<std::string> );
An InterfaceProxy represents a remote Interface in another application on the DBus.
Definition: interfaceproxy.h:43
std::shared_ptr< SignalProxy< T_arg > > create_signal(const std::string &sig_name)
Definition: interfaceproxy.h:153
void cache_properties()
Ask the remote object for the status of all of its properties.
Definition: interfaceproxy.cpp:402
static std::shared_ptr< InterfaceProxy > create(const std::string &name=std::string())
Definition: interfaceproxy.cpp:46
std::shared_ptr< SignalProxyBase > signal(const std::string &signame)
Definition: interfaceproxy.cpp:237
std::shared_ptr< CallMessage > create_call_message(const std::string &method_name) const
Definition: interfaceproxy.cpp:215
bool has_method(const std::string &name) const
True if the interface has a method with the given name.
Definition: interfaceproxy.cpp:182
bool remove_signal(const std::string &signame)
Definition: interfaceproxy.cpp:267
bool has_property(const std::string &name) const
True if the interface has a property with the given name.
Definition: interfaceproxy.cpp:332
void remove_property(const std::string &name)
Removes the property with the given name.
Definition: interfaceproxy.cpp:365
bool add_property(std::shared_ptr< PropertyProxyBase > property)
Adds the given property.
Definition: interfaceproxy.cpp:313
std::multimap< std::string, std::shared_ptr< MethodProxyBase > > Methods
Definition: interfaceproxy.h:48
std::shared_ptr< PropertyProxy< T_type > > create_property(const std::string &name, PropertyUpdateType update=PropertyUpdateType::Updates)
Create a property with the given type, and the given name.
Definition: interfaceproxy.h:123
void remove_method(const std::string &name)
Removes the method with the given name.
Definition: interfaceproxy.cpp:145
std::shared_ptr< const ReturnMessage > call(std::shared_ptr< const CallMessage >, int timeout_milliseconds=-1) const
Definition: interfaceproxy.cpp:221
const std::map< std::string, std::shared_ptr< PropertyProxyBase > > & properties() const
Get the (local) cache of all properties.
Definition: interfaceproxy.cpp:298
const Methods & methods() const
Definition: interfaceproxy.cpp:111
const std::string & name() const
Definition: interfaceproxy.cpp:107
InterfaceProxy(const std::string &name)
Definition: interfaceproxy.cpp:42
bool add_method(std::shared_ptr< MethodProxyBase > method)
Adds the named method.
Definition: interfaceproxy.cpp:126
void property_updated(std::string, std::map< std::string, DBus::Variant >, std::vector< std::string >)
Definition: interfaceproxy.cpp:423
std::weak_ptr< Connection > connection() const
Definition: interfaceproxy.cpp:101
std::set< std::shared_ptr< SignalProxyBase > > Signals
Definition: interfaceproxy.h:50
bool has_signal(const std::string &signame) const
Definition: interfaceproxy.cpp:280
ObjectProxy * object() const
Definition: interfaceproxy.cpp:61
virtual ~InterfaceProxy()
Definition: interfaceproxy.cpp:50
void set_object(ObjectProxy *obj)
Definition: interfaceproxy.cpp:65
bool add_signal(std::shared_ptr< SignalProxyBase > sig)
Definition: interfaceproxy.cpp:245
std::shared_ptr< MethodProxyBase > method(const std::string &name) const
Returns the first method with the given name.
Definition: interfaceproxy.cpp:115
std::shared_ptr< MethodProxy< T_type > > create_method(const std::string &name)
Definition: interfaceproxy.h:70
void on_object_set_path(const std::string &path)
Definition: interfaceproxy.cpp:292
const Signals & signals() const
Definition: interfaceproxy.cpp:233
Path path() const
Definition: interfaceproxy.cpp:95
std::shared_ptr< PropertyProxyBase > property(const std::string &name) const
Definition: interfaceproxy.cpp:302
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
MatchRuleBuilder & set_interface(const std::string &interface_name)
Definition: matchrule.cpp:43
MatchRuleBuilder & set_path(const std::string &path)
Definition: matchrule.cpp:38
SignalMatchRule as_signal_match()
Definition: matchrule.cpp:63
static MatchRuleBuilder create()
Definition: matchrule.cpp:87
MatchRuleBuilder & set_member(const std::string &member)
Definition: matchrule.cpp:48
Definition: interfaceproxy.h:30
Object proxies are local proxies that provide local methods and signals for remote objects with dbus ...
Definition: objectproxy.h:44
Represents a DBus Path.
Definition: path.h:21
static std::shared_ptr< PropertyProxy< T_type > > create(std::string name, PropertyUpdateType update)
Definition: propertyproxy.h:101
A special MatchRule for signals.
Definition: matchrule.h:45
Definition: signalproxy.h:26
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
PropertyUpdateType
Definition: enums.h:23
@ Updates
When this property changes, the PropertyChanged signal will be emitted with the new value.