12#include <dbus-cxx/dbus-cxx-config.h> 
   14#include <sigc++/sigc++.h> 
   18#include <shared_mutex> 
   20#ifndef DBUSCXX_INTERFACE_H 
   21#define DBUSCXX_INTERFACE_H 
   59    typedef std::map<std::string, std::shared_ptr<MethodBase>> 
Methods;
 
   68    typedef std::set<std::shared_ptr<SignalBase>> 
Signals;
 
   74    static std::shared_ptr<Interface> 
create( 
const std::string& 
name = std::string() );
 
  105    const std::string& 
name() 
const;
 
  114    std::shared_ptr<MethodBase> 
method( 
const std::string& 
name ) 
const;
 
  121    template <
typename T_type>
 
  122    std::shared_ptr<Method<T_type> >
 
  124        std::shared_ptr< Method<T_type> > 
method;
 
  138    template <
typename T_type>
 
  139    std::shared_ptr<Method<T_type> >
 
  141        std::shared_ptr< Method<T_type> > 
method;
 
  143        method->set_method( slot );
 
  148    template <
typename T_type>
 
  149    std::shared_ptr<Property<T_type>>
 
  158    bool add_property( std::shared_ptr<PropertyBase> prop );
 
  209    template <
class... T_type>
 
  210    std::shared_ptr<
Signal<T_type...> >
 
  223    const std::set<std::shared_ptr<PropertyBase>>& 
properties();
 
  230    std::shared_ptr<SignalBase> 
signal( 
const std::string& signal_name );
 
  239    std::string 
introspect( 
int space_depth = 0 ) 
const;
 
  242    void set_path( 
const std::string& new_path );
 
An Interface represents a local copy of a DBus interface.
Definition: interface.h:41
 
sigc::signal< void(std::shared_ptr< MethodBase >)> signal_method_removed()
Signal emitted when a method of the given name is removed.
Definition: interface.cpp:260
 
std::shared_ptr< Method< T_type > > create_method(const std::string &name)
Creates a method with a return value (possibly void ) and $1 parameters.
Definition: interface.h:123
 
std::shared_ptr< Property< T_type > > create_property(const std::string &name, PropertyAccess access_type=PropertyAccess::ReadWrite, PropertyUpdateType update_type=PropertyUpdateType::Updates)
Definition: interface.h:150
 
bool add_signal(std::shared_ptr< SignalBase > signal)
Adds the given signal.
Definition: interface.cpp:156
 
std::map< std::string, std::shared_ptr< MethodBase > > Methods
Typedef to the storage structure for methods.
Definition: interface.h:59
 
Interface(const std::string &name)
This class has a protected constructor.
Definition: interface.cpp:42
 
std::shared_ptr< Method< T_type > > create_method(const std::string &name, sigc::slot< T_type > slot)
Creates a method with a signature equivalent to the provided.
Definition: interface.h:140
 
sigc::signal< void(std::shared_ptr< MethodBase >)> signal_method_added()
Signal emitted when a method of the given name is added.
Definition: interface.cpp:256
 
const Methods & methods() const
Returns the methods associated with this interface.
Definition: interface.cpp:62
 
const std::string & name() const
Get the name of this interface.
Definition: interface.cpp:58
 
bool remove_method(const std::string &name)
Removes the first method with the given name.
Definition: interface.cpp:98
 
Path path() const
Returns the path of the object associated with this interface or a null string if no object is associ...
Definition: interface.cpp:54
 
const std::set< std::shared_ptr< PropertyBase > > & properties()
Definition: interface.cpp:463
 
const Signals & signals()
Returns the signals associated with this interface.
Definition: interface.cpp:238
 
std::string introspect(int space_depth=0) const
Returns a DBus XML description of this interface.
Definition: interface.cpp:264
 
bool has_signal(std::shared_ptr< SignalBase > signal) const
True if the given signal is part of this interface.
Definition: interface.cpp:215
 
bool remove_signal(std::shared_ptr< SignalBase > signal)
Removes the given signal.
Definition: interface.cpp:183
 
std::shared_ptr< MethodBase > method(const std::string &name) const
Returns the method with the given name, or an invalid shared_ptr if not found.
Definition: interface.cpp:66
 
std::shared_ptr< Signal< T_type... > > create_signal(const std::string &member)
Creates a signal with any number of parameters.
Definition: interface.h:211
 
bool add_method(std::shared_ptr< MethodBase > method)
Adds the named method.
Definition: interface.cpp:80
 
void property_updated(DBus::PropertyBase *prop)
Definition: interface.cpp:434
 
HandlerResult handle_properties_message(std::shared_ptr< Connection > conn, std::shared_ptr< const CallMessage > message)
Handle the specified properties message.
Definition: interface.cpp:306
 
HandlerResult handle_call_message(std::shared_ptr< Connection > conn, std::shared_ptr< const CallMessage > message)
Handles the specified call message.
Definition: interface.cpp:291
 
bool has_method(const std::string &name) const
True if the interface has a method with the given name.
Definition: interface.cpp:147
 
void set_connection(std::weak_ptr< Connection > conn)
Definition: interface.cpp:454
 
std::shared_ptr< SignalBase > signal(const std::string &signal_name)
Returns the first signal found with a matching name.
Definition: interface.cpp:242
 
bool has_property(const std::string &name) const
Definition: interface.cpp:418
 
std::set< std::shared_ptr< SignalBase > > Signals
Typedef to the storage structure for signals.
Definition: interface.h:68
 
void set_path(const std::string &new_path)
Definition: interface.cpp:391
 
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
 
virtual ~Interface()
Definition: interface.cpp:50
 
static std::shared_ptr< Interface > create(const std::string &name=std::string())
Creates a named Interface.
Definition: interface.cpp:46
 
bool add_property(std::shared_ptr< PropertyBase > prop)
Definition: interface.cpp:399
 
static std::shared_ptr< Method< T_type > > create(const std::string &name)
Definition: methodbase.h:84
 
An Object represents a local object that is able to be called over the DBus.
Definition: object.h:51
 
Represents a DBus Path.
Definition: path.h:21
 
Base type of Property to allow for storage in e.g.
Definition: property.h:27
 
static std::shared_ptr< Property< T_type > > create(std::string name, PropertyAccess access, PropertyUpdateType update)
Definition: property.h:94
 
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
 
PropertyAccess
Definition: enums.h:46
 
HandlerResult
Definition: enums.h:95
 
PropertyUpdateType
Definition: enums.h:23
 
@ Updates
When this property changes, the PropertyChanged signal will be emitted with the new value.
 
static std::shared_ptr< DBus::Connection > conn
Definition: recursive-signal-test-qt.cpp:30