* 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

@ -0,0 +1,46 @@
#include "props-server.h"
#include <signal.h>
static const char* PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties";
static const char* PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties";
PropsServer::PropsServer( DBus::Connection& connection )
: DBus::ObjectAdaptor(connection, PROPS_SERVER_PATH)
{
Version = 1;
Message = "default message";
}
void PropsServer::on_set_property
( DBus::InterfaceAdaptor& interface, const DBus::String& property, const DBus::Variant& value )
{
if(property == "Message")
{
DBus::String msg = value;
this->MessageChanged(msg);
}
}
DBus::BusDispatcher dispatcher;
void niam( int sig )
{
dispatcher.leave();
}
int main()
{
signal(SIGTERM, niam);
signal(SIGINT, niam);
DBus::default_dispatcher = &dispatcher;
DBus::Connection conn = DBus::Connection::SessionBus();
conn.request_name(PROPS_SERVER_NAME);
PropsServer server(conn);
dispatcher.enter();
return 0;
}