An InterfaceProxy represents a remote Interface in another application on the DBus. More...
#include <interfaceproxy.h>
Public Types | |
typedef std::multimap< std::string, std::shared_ptr< MethodProxyBase > > | Methods |
typedef std::set< std::shared_ptr< SignalProxyBase > > | Signals |
Public Member Functions | |
virtual | ~InterfaceProxy () |
ObjectProxy * | object () const |
Path | path () const |
std::weak_ptr< Connection > | connection () const |
const std::string & | name () const |
const Methods & | methods () const |
std::shared_ptr< MethodProxyBase > | method (const std::string &name) const |
Returns the first method with the given name. More... | |
template<class T_type > | |
std::shared_ptr< MethodProxy< T_type > > | create_method (const std::string &name) |
bool | add_method (std::shared_ptr< MethodProxyBase > method) |
Adds the named method. More... | |
void | remove_method (const std::string &name) |
Removes the method with the given name. More... | |
void | remove_method (std::shared_ptr< MethodProxyBase > method) |
Removed the specific method. More... | |
bool | has_method (const std::string &name) const |
True if the interface has a method with the given name. More... | |
bool | has_method (std::shared_ptr< MethodProxyBase > method) const |
True if the interface has the specified method. More... | |
const std::map< std::string, std::shared_ptr< PropertyProxyBase > > & | properties () const |
Get the (local) cache of all properties. More... | |
std::shared_ptr< PropertyProxyBase > | property (const std::string &name) const |
bool | has_property (const std::string &name) const |
True if the interface has a property with the given name. More... | |
bool | has_property (std::shared_ptr< PropertyProxyBase > property) const |
True if the interface has the specified property. More... | |
void | remove_property (const std::string &name) |
Removes the property with the given name. More... | |
void | remove_property (std::shared_ptr< PropertyProxyBase > method) |
Removed the specific property. More... | |
template<class T_type > | |
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. More... | |
bool | add_property (std::shared_ptr< PropertyProxyBase > property) |
Adds the given property. More... | |
void | cache_properties () |
Ask the remote object for the status of all of its properties. More... | |
std::shared_ptr< CallMessage > | create_call_message (const std::string &method_name) const |
std::shared_ptr< const ReturnMessage > | call (std::shared_ptr< const CallMessage >, int timeout_milliseconds=-1) const |
template<class T_arg > | |
std::shared_ptr< SignalProxy< T_arg > > | create_signal (const std::string &sig_name) |
const Signals & | signals () const |
std::shared_ptr< SignalProxyBase > | signal (const std::string &signame) |
bool | add_signal (std::shared_ptr< SignalProxyBase > sig) |
bool | remove_signal (const std::string &signame) |
bool | remove_signal (std::shared_ptr< SignalProxyBase > sig) |
bool | has_signal (const std::string &signame) const |
bool | has_signal (std::shared_ptr< SignalProxyBase > sig) const |
Static Public Member Functions | |
static std::shared_ptr< InterfaceProxy > | create (const std::string &name=std::string()) |
Protected Member Functions | |
InterfaceProxy (const std::string &name) | |
Private Member Functions | |
void | on_object_set_path (const std::string &path) |
void | set_object (ObjectProxy *obj) |
void | property_updated (std::string, std::map< std::string, DBus::Variant >, std::vector< std::string >) |
DBUS_CXX_PROPAGATE_CONST (std::unique_ptr< priv_data >) m_priv | |
Friends | |
class | ObjectProxy |
An InterfaceProxy represents a remote Interface in another application on the DBus.
Note that the interface name is immutable and cannot be changed once the interface has been created.
typedef std::multimap<std::string, std::shared_ptr<MethodProxyBase> > DBus::InterfaceProxy::Methods |
typedef std::set<std::shared_ptr<SignalProxyBase> > DBus::InterfaceProxy::Signals |
|
protected |
|
virtual |
bool DBus::InterfaceProxy::add_method | ( | std::shared_ptr< MethodProxyBase > | method | ) |
Adds the named method.
If a method with the same name already exists, does not replace the current method(returns false).
References has_method(), and method().
Referenced by create_method().
bool DBus::InterfaceProxy::add_property | ( | std::shared_ptr< PropertyProxyBase > | property | ) |
Adds the given property.
If a property with the same name already exists, does not replace the current property(returns false).
References has_property(), and property().
Referenced by create_property().
bool DBus::InterfaceProxy::add_signal | ( | std::shared_ptr< SignalProxyBase > | sig | ) |
References connection(), name(), and path().
Referenced by create_signal().
void DBus::InterfaceProxy::cache_properties | ( | ) |
Ask the remote object for the status of all of its properties.
References call(), DBus::CallMessage::create(), LOGGER_NAME, property(), and SIMPLELOGGER_TRACE.
std::shared_ptr< const ReturnMessage > DBus::InterfaceProxy::call | ( | std::shared_ptr< const CallMessage > | call_message, |
int | timeout_milliseconds = -1 |
||
) | const |
Referenced by cache_properties().
std::weak_ptr< Connection > DBus::InterfaceProxy::connection | ( | ) | const |
Referenced by add_signal(), and set_object().
|
static |
References InterfaceProxy(), and name().
Referenced by DBus::ObjectProxy::create_interface().
std::shared_ptr< CallMessage > DBus::InterfaceProxy::create_call_message | ( | const std::string & | method_name | ) | const |
|
inline |
References add_method(), method(), and name().
|
inline |
Create a property with the given type, and the given name.
References add_property(), DBus::PropertyProxy< T_type >::create(), and name().
|
inline |
|
private |
bool DBus::InterfaceProxy::has_method | ( | const std::string & | name | ) | const |
True if the interface has a method with the given name.
References name().
Referenced by add_method().
bool DBus::InterfaceProxy::has_method | ( | std::shared_ptr< MethodProxyBase > | method | ) | const |
True if the interface has the specified method.
References method().
bool DBus::InterfaceProxy::has_property | ( | const std::string & | name | ) | const |
True if the interface has a property with the given name.
References name().
Referenced by add_property().
bool DBus::InterfaceProxy::has_property | ( | std::shared_ptr< PropertyProxyBase > | property | ) | const |
True if the interface has the specified property.
References property().
bool DBus::InterfaceProxy::has_signal | ( | const std::string & | signame | ) | const |
Referenced by remove_signal().
bool DBus::InterfaceProxy::has_signal | ( | std::shared_ptr< SignalProxyBase > | sig | ) | const |
std::shared_ptr< MethodProxyBase > DBus::InterfaceProxy::method | ( | const std::string & | name | ) | const |
Returns the first method with the given name.
References name().
Referenced by add_method(), create_method(), has_method(), and remove_method().
const InterfaceProxy::Methods & DBus::InterfaceProxy::methods | ( | ) | const |
const std::string & DBus::InterfaceProxy::name | ( | ) | const |
Referenced by add_signal(), create(), create_method(), create_property(), create_signal(), has_method(), has_property(), InterfaceProxy(), method(), property(), remove_method(), and remove_property().
ObjectProxy * DBus::InterfaceProxy::object | ( | ) | const |
|
private |
References path().
Path DBus::InterfaceProxy::path | ( | ) | const |
Referenced by add_signal(), create_signal(), on_object_set_path(), and set_object().
const std::map< std::string, std::shared_ptr< PropertyProxyBase > > & DBus::InterfaceProxy::properties | ( | ) | const |
Get the (local) cache of all properties.
std::shared_ptr< PropertyProxyBase > DBus::InterfaceProxy::property | ( | const std::string & | name | ) | const |
References name().
Referenced by add_property(), cache_properties(), has_property(), property_updated(), and remove_property().
|
private |
References LOGGER_NAME, property(), and SIMPLELOGGER_TRACE.
Referenced by set_object().
void DBus::InterfaceProxy::remove_method | ( | const std::string & | name | ) |
void DBus::InterfaceProxy::remove_method | ( | std::shared_ptr< MethodProxyBase > | method | ) |
Removed the specific method.
References method().
void DBus::InterfaceProxy::remove_property | ( | const std::string & | name | ) |
Removes the property with the given name.
References name(), and property().
void DBus::InterfaceProxy::remove_property | ( | std::shared_ptr< PropertyProxyBase > | method | ) |
Removed the specific property.
References property().
bool DBus::InterfaceProxy::remove_signal | ( | const std::string & | signame | ) |
References signal().
bool DBus::InterfaceProxy::remove_signal | ( | std::shared_ptr< SignalProxyBase > | sig | ) |
References has_signal().
|
private |
std::shared_ptr< SignalProxyBase > DBus::InterfaceProxy::signal | ( | const std::string & | signame | ) |
Referenced by remove_signal().
const InterfaceProxy::Signals & DBus::InterfaceProxy::signals | ( | ) | const |
|
friend |