* Fixed implementation of D-Bus properties

* Added an example to demonstrate implementation of D-Bus properties
* Fixed DBus::Server (should work with the tcp transport too, see related TODO item)


git-svn-id: http://dev.openwengo.org/svn/openwengo/wengophone-ng/branches/wengophone-dbus-api/libs/dbus@8158 30a43799-04e7-0310-8b2b-ea0d24f86d0e
This commit is contained in:
pdurante 2006-10-24 11:12:29 +00:00
parent 19712668b1
commit 1b84dc5abc
30 changed files with 750 additions and 121 deletions

View file

@ -38,7 +38,7 @@ class Connection;
typedef Slot<bool, const Message&> MessageSlot;
typedef std::list<Connection*> ConnectionPList;
typedef std::list<Connection> ConnectionList;
class ObjectAdaptor;
class Dispatcher;
@ -59,7 +59,7 @@ public:
Connection( Private* );
Connection( const char* address, bool priv = false );
Connection( const char* address, bool priv = true );
Connection( const Connection& c );

View file

@ -37,9 +37,10 @@ namespace DBus {
//todo: this should belong to to properties.h
struct PropertyData
{
bool read;
bool write;
Variant value;
bool read;
bool write;
std::string sig;
Variant value;
};
typedef std::map<std::string, PropertyData> PropertyTable;
@ -137,7 +138,7 @@ public:
Variant* get_property( const std::string& name );
bool set_property( const std::string& name, Variant& value );
void set_property( const std::string& name, Variant& value );
virtual IntrospectedInterface* const introspect() const
{
@ -174,9 +175,10 @@ protected:
InterfaceAdaptor::_methods[ #method ] = \
new ::DBus::Callback< interface, ::DBus::Message, const ::DBus::CallMessage& >(this, & interface :: callback );
# define bind_property(variable, can_read, can_write) \
# define bind_property(variable, type, can_read, can_write) \
InterfaceAdaptor::_properties[ #variable ].read = can_read; \
InterfaceAdaptor::_properties[ #variable ].write = can_write; \
InterfaceAdaptor::_properties[ #variable ].sig = type; \
variable.bind( InterfaceAdaptor::_properties[ #variable ] );
# define connect_signal(interface, signal, callback) \

View file

@ -45,10 +45,7 @@ public:
T operator() (void) const
{
T t;
MessageIter ri = _data->value.reader();
ri >> t;
return t;
return (T)_data->value;
}
PropertyAdaptor& operator = ( const T& t )

View file

@ -44,22 +44,23 @@ public:
Server( const char* address );
Server( const Server& s );
Dispatcher* setup( Dispatcher* );
virtual ~Server();
bool operator == ( const Server& ) const;
bool listening() const;
bool operator == ( const Server& ) const;
void disconnect();
struct Private;
protected:
Server( const Server& s )
{}
virtual void on_new_connection( Connection& c ) = 0;
private: