Skip to content
Snippets Groups Projects
Commit d0420155 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Packaging of dbus c++ bindings

Removal of the /libs/dbus directory
parent 88c20e22
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1066 deletions
#include "echo-client.h"
#include <iostream>
#include <pthread.h>
#include <signal.h>
#ifdef HAVE_CONFIG_H
#include <dbus-c++/config.h>
#endif
using namespace std;
static const char* ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
static const char* ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
EchoClient::EchoClient( DBus::Connection& connection, const char* path, const char* name )
: DBus::ObjectProxy(connection, path, name)
{
}
void EchoClient::Echoed( const DBus::Variant& value )
{
cout << "!";
}
/*
* For some strange reason, libdbus frequently dies with an OOM
*/
static const int THREADS = 16;
static bool spin = true;
void* greeter_thread( void* arg )
{
DBus::Connection* conn = reinterpret_cast<DBus::Connection*>(arg);
EchoClient client(*conn, ECHO_SERVER_PATH, ECHO_SERVER_NAME);
char idstr[16];
snprintf(idstr, sizeof(idstr), "%lu", pthread_self());
for(int i = 0; i < 100 && spin; ++i)
{
cout << client.Hello(idstr) << endl;
}
cout << idstr << " done " << endl;
return NULL;
}
DBus::BusDispatcher dispatcher;
void niam( int sig )
{
spin = false;
dispatcher.leave();
}
int main()
{
signal(SIGTERM, niam);
signal(SIGINT, niam);
#ifdef DBUS_HAS_THREADS_INIT_DEFAULT
DBus::_init_threading();
#else
cerr << "Thread support is not enabled! your D-Bus version is too old" << endl;
#endif
DBus::default_dispatcher = &dispatcher;
DBus::Connection conn = DBus::Connection::SessionBus();
pthread_t threads[THREADS];
for(int i = 0; i < THREADS; ++i)
{
pthread_create(threads+i, NULL, greeter_thread, &conn);
}
dispatcher.enter();
cout << "terminating" << endl;
for(int i = 0; i < THREADS; ++i)
{
pthread_join(threads[i], NULL);
}
return 0;
}
#ifndef __DEMO_ECHO_CLIENT_H
#define __DEMO_ECHO_CLIENT_H
#include <dbus-c++/dbus.h>
#include "echo-client-glue.h"
class EchoClient
: public org::freedesktop::DBus::EchoDemo,
public DBus::IntrospectableProxy,
public DBus::ObjectProxy
{
public:
EchoClient( DBus::Connection& connection, const char* path, const char* name );
void Echoed( const DBus::Variant& value );
};
#endif//__DEMO_ECHO_CLIENT_H
<?xml version="1.0" ?>
<node name="/org/freedesktop/DBus/Examples/Echo">
<interface name="org.freedesktop.DBus.EchoDemo">
<method name="Random">
<arg type="i" name="version" direction="out"/>
</method>
<method name="Hello">
<arg type="s" name="name" direction="in"/>
<arg type="s" name="greeting" direction="out"/>
</method>
<method name="Echo">
<arg type="v" name="input" direction="in"/>
<arg type="v" name="output" direction="out"/>
</method>
<method name="Cat">
<arg type="s" name="file" direction="in"/>
<arg type="ay" name="stream" direction="out"/>
</method>
<method name="Sum">
<arg type="ai" name="ints" direction="in"/>
<arg type="i" names="sum" direction="out"/>
</method>
<signal name="Echoed">
<arg type="v" name="value"/>
</signal>
<method name="Info">
<arg type="a{ss}" name="info" direction="out"/>
</method>
</interface>
</node>
#include "echo-server.h"
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
static const char* ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
static const char* ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
EchoServer::EchoServer( DBus::Connection& connection )
: DBus::ObjectAdaptor(connection, ECHO_SERVER_PATH)
{
}
DBus::Int32 EchoServer::Random()
{
return rand();
}
DBus::String EchoServer::Hello( const DBus::String& name )
{
return "Hello " + name + "!";
}
DBus::Variant EchoServer::Echo( const DBus::Variant& value )
{
this->Echoed(value);
return value;
}
std::vector< DBus::Byte > EchoServer::Cat( const DBus::String & file )
{
FILE* handle = fopen(file.c_str(), "rb");
if(!handle) throw DBus::Error("org.freedesktop.DBus.EchoDemo.ErrorFileNotFound", "file not found");
DBus::Byte buff[1024];
size_t nread = fread(buff, 1, sizeof(buff), handle);
fclose(handle);
return std::vector< DBus::Byte > (buff, buff + nread);
}
DBus::Int32 EchoServer::Sum( const std::vector<DBus::Int32>& ints )
{
DBus::Int32 sum = 0;
for(size_t i = 0; i < ints.size(); ++i) sum += ints[i];
return sum;
}
std::map< DBus::String, DBus::String > EchoServer::Info()
{
std::map< DBus::String, DBus::String > info;
char hostname[HOST_NAME_MAX];
gethostname(hostname, sizeof(hostname));
info["hostname"] = hostname;
info["username"] = getlogin();
return info;
}
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(ECHO_SERVER_NAME);
EchoServer server(conn);
dispatcher.enter();
return 0;
}
#ifndef __DEMO_ECHO_SERVER_H
#define __DEMO_ECHO_SERVER_H
#include <dbus-c++/dbus.h>
#include "echo-server-glue.h"
class EchoServer
: public org::freedesktop::DBus::EchoDemo,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
public:
EchoServer( DBus::Connection& connection );
DBus::Int32 Random();
DBus::String Hello( const DBus::String & name );
DBus::Variant Echo( const DBus::Variant & value );
std::vector< DBus::Byte > Cat( const DBus::String & file );
DBus::Int32 Sum( const std::vector<DBus::Int32> & ints );
std::map< DBus::String, DBus::String > Info();
};
#endif//__DEMO_ECHO_SERVER_H
EXTRA_DIST =
AM_CPPFLAGS = -I$(top_srcdir)/include $(gtkmm_CFLAGS) -I$(top_srcdir)/tools
if HAVE_GTKMM
noinst_PROGRAMS = dbus-browser
endif
dbus_browser_SOURCES = dbus-glue.h dbus-browser.h dbus-browser.cpp $(top_srcdir)/tools/xml.cpp
dbus_browser_LDADD = $(top_builddir)/src/libdbus-c++-1.la $(gtkmm_LIBS)
dbus-glue.h: $(top_srcdir)/data/org.freedesktop.DBus.xml
$(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@
BUILT_SOURCES = dbus-glue.h
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
MAINTAINERCLEANFILES = \
Makefile.in
#include "dbus-browser.h"
#include <xml.h>
#include <iostream>
using namespace std;
static const char* DBUS_SERVER_NAME = "org.freedesktop.DBus";
static const char* DBUS_SERVER_PATH = "/org/freedesktop/DBus";
DBusBrowser::DBusBrowser( ::DBus::Connection& conn )
: ::DBus::ObjectProxy(conn, DBUS_SERVER_PATH, DBUS_SERVER_NAME)
{
set_title("D-Bus Browser");
set_border_width(5);
set_default_size(400, 500);
typedef std::vector< ::DBus::String > Names;
Names names = ListNames();
for(Names::iterator it = names.begin(); it != names.end(); ++it)
{
_cb_busnames.append_text(*it);
}
_cb_busnames.signal_changed().connect( sigc::mem_fun(*this, &DBusBrowser::on_select_busname) );
_tm_inspect = Gtk::TreeStore::create(_records);
_tv_inspect.set_model(_tm_inspect);
_tv_inspect.append_column("Node", _records.name);
_sc_tree.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
_sc_tree.add(_tv_inspect);
_vbox.pack_start(_cb_busnames, Gtk::PACK_SHRINK);
_vbox.pack_start(_sc_tree);
add(_vbox);
show_all_children();
}
void DBusBrowser::NameOwnerChanged(
const ::DBus::String& name, const ::DBus::String& old_owner, const ::DBus::String& new_owner )
{
cout << name << ": " << old_owner << " -> " << new_owner << endl;
}
void DBusBrowser::NameLost( const ::DBus::String& name )
{
cout << name << " lost" << endl;
}
void DBusBrowser::NameAcquired( const ::DBus::String& name )
{
cout << name << " acquired" << endl;
}
void DBusBrowser::on_select_busname()
{
Glib::ustring busname = _cb_busnames.get_active_text();
if(busname.empty()) return;
_tm_inspect->clear();
_inspect_append(NULL, "", busname);
}
void DBusBrowser::_inspect_append( Gtk::TreeModel::Row* row, const std::string& buspath, const std::string& busname )
{
DBusInspector inspector(conn(), buspath.empty() ? "/" : buspath.c_str(), busname.c_str());
::DBus::Xml::Document doc(inspector.Introspect());
::DBus::Xml::Node& root = *(doc.root);
::DBus::Xml::Nodes ifaces = root["interface"];
for(::DBus::Xml::Nodes::iterator ii = ifaces.begin(); ii != ifaces.end(); ++ii)
{
::DBus::Xml::Node& iface = **ii;
Gtk::TreeModel::Row i_row = row
? *(_tm_inspect->append(row->children()))
: *(_tm_inspect->append());
i_row[_records.name] = "interface: " + iface.get("name");
::DBus::Xml::Nodes methods = iface["method"];
for(::DBus::Xml::Nodes::iterator im = methods.begin(); im != methods.end(); ++im)
{
Gtk::TreeModel::Row m_row = *(_tm_inspect->append(i_row.children()));
m_row[_records.name] = "method: " + (*im)->get("name");
}
::DBus::Xml::Nodes signals = iface["signal"];
for(::DBus::Xml::Nodes::iterator is = signals.begin(); is != signals.end(); ++is)
{
Gtk::TreeModel::Row s_row = *(_tm_inspect->append(i_row.children()));
s_row[_records.name] = "signal: " + (*is)->get("name");
}
}
::DBus::Xml::Nodes nodes = root["node"];
for(::DBus::Xml::Nodes::iterator in = nodes.begin(); in != nodes.end(); ++in)
{
std::string name = (*in)->get("name");
Gtk::TreeModel::Row n_row = row
? *(_tm_inspect->append(row->children()))
: *(_tm_inspect->append());
n_row[_records.name] = name;
_inspect_append(&n_row, buspath + "/" + name, busname);
}
}
DBus::Glib::BusDispatcher dispatcher;
int main(int argc, char* argv[])
{
Gtk::Main kit(argc, argv);
DBus::default_dispatcher = &dispatcher;
dispatcher.attach(NULL);
DBus::Connection conn = DBus::Connection::SessionBus();
DBusBrowser browser(conn);
Gtk::Main::run(browser);
return 0;
}
#ifndef __DEMO_DBUS_BROWSER_H
#define __DEMO_DBUS_BROWSER_H
#include <dbus-c++/dbus.h>
#include <dbus-c++/glib-integration.h>
#include <gtkmm.h>
#include "dbus-glue.h"
class DBusInspector
: public DBus::IntrospectableProxy,
public DBus::ObjectProxy
{
public:
DBusInspector( DBus::Connection& conn, const char* path, const char* service )
: DBus::ObjectProxy(conn, path, service)
{}
};
class DBusBrowser
: public org::freedesktop::DBus,
public DBus::IntrospectableProxy,
public DBus::ObjectProxy,
public Gtk::Window
{
public:
DBusBrowser( ::DBus::Connection& );
private:
void NameOwnerChanged( const ::DBus::String&, const ::DBus::String&, const ::DBus::String& );
void NameLost( const ::DBus::String& );
void NameAcquired( const ::DBus::String& );
void on_select_busname();
void _inspect_append( Gtk::TreeModel::Row*, const std::string&, const std::string& );
private:
class InspectRecord : public Gtk::TreeModel::ColumnRecord
{
public:
InspectRecord() { add(name); }
Gtk::TreeModelColumn<Glib::ustring> name;
};
Gtk::VBox _vbox;
Gtk::ScrolledWindow _sc_tree;
Gtk::ComboBoxText _cb_busnames;
Gtk::TreeView _tv_inspect;
Glib::RefPtr<Gtk::TreeStore> _tm_inspect;
InspectRecord _records;
};
#endif//__DEMO_DBUS_BROWSER_H
AM_CPPFLAGS = -I$(top_srcdir)/include
noinst_PROGRAMS = hal-listen
hal_listen_SOURCES = hal-listen.h hal-listen.cpp
hal_listen_LDADD = $(top_builddir)/src/libdbus-c++-1.la
MAINTAINERCLEANFILES = \
Makefile.in
#include "hal-listen.h"
#include <signal.h>
#include <iostream>
HalManagerProxy::HalManagerProxy( DBus::Connection& connection )
: DBus::InterfaceProxy("org.freedesktop.Hal.Manager"),
DBus::ObjectProxy(connection, "/org/freedesktop/Hal/Manager", "org.freedesktop.Hal")
{
connect_signal(HalManagerProxy, DeviceAdded, DeviceAddedCb);
connect_signal(HalManagerProxy, DeviceRemoved, DeviceRemovedCb);
std::vector< DBus::String > devices = GetAllDevices();
std::vector< DBus::String >::iterator it;
for(it = devices.begin(); it != devices.end(); ++it)
{
DBus::Path udi = *it;
std::cout << "found device " << udi << std::endl;
_devices[udi] = new HalDeviceProxy(connection, udi);
}
}
std::vector< DBus::String > HalManagerProxy::GetAllDevices()
{
std::vector< DBus::String > udis;
DBus::CallMessage call;
call.member("GetAllDevices");
DBus::Message reply = invoke_method(call);
DBus::MessageIter it = reply.reader();
it >> udis;
return udis;
}
void HalManagerProxy::DeviceAddedCb( const DBus::SignalMessage& sig )
{
DBus::MessageIter it = sig.reader();
DBus::String devname;
it >> devname;
DBus::Path udi(devname);
_devices[devname] = new HalDeviceProxy(conn(), udi);
std::cout << "added device " << udi << std::endl;
}
void HalManagerProxy::DeviceRemovedCb( const DBus::SignalMessage& sig )
{
DBus::MessageIter it = sig.reader();
DBus::String devname;
it >> devname;
std::cout << "removed device " << devname << std::endl;
_devices.erase(devname);
}
HalDeviceProxy::HalDeviceProxy( DBus::Connection& connection, DBus::Path& udi )
: DBus::InterfaceProxy("org.freedesktop.Hal.Device"),
DBus::ObjectProxy(connection, udi, "org.freedesktop.Hal")
{
connect_signal(HalDeviceProxy, PropertyModified, PropertyModifiedCb);
connect_signal(HalDeviceProxy, Condition, ConditionCb);
}
void HalDeviceProxy::PropertyModifiedCb( const DBus::SignalMessage& sig )
{
typedef DBus::Struct< DBus::String, DBus::Bool, DBus::Bool > HalProperty;
DBus::MessageIter it = sig.reader();
DBus::Int32 number;
it >> number;
DBus::MessageIter arr = it.recurse();
for(int i = 0; i < number; ++i, ++arr)
{
HalProperty hp;
arr >> hp;
std::cout << "modified property " << hp._1 << " in " << path() << std::endl;
}
}
void HalDeviceProxy::ConditionCb( const DBus::SignalMessage& sig )
{
DBus::MessageIter it = sig.reader();
DBus::String condition;
it >> condition;
std::cout << "encountered condition " << condition << " in " << path() << std::endl;
}
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::SystemBus();
HalManagerProxy hal(conn);
dispatcher.enter();
return 0;
}
#ifndef __DEMO_HAL_LISTEN_H
#define __DEMO_HAL_LISTEN_H
#include <dbus-c++/dbus.h>
#include <vector>
#include <map>
class HalDeviceProxy;
class HalManagerProxy
: public DBus::InterfaceProxy,
public DBus::ObjectProxy
{
public:
HalManagerProxy( DBus::Connection& connection );
std::vector< DBus::String > GetAllDevices();
private:
void DeviceAddedCb( const DBus::SignalMessage& sig );
void DeviceRemovedCb( const DBus::SignalMessage& sig );
std::map< DBus::String, DBus::RefPtr< HalDeviceProxy > > _devices;
};
class HalDeviceProxy
: public DBus::InterfaceProxy,
public DBus::ObjectProxy
{
public:
HalDeviceProxy( DBus::Connection& connection, DBus::Path& udi );
private:
void PropertyModifiedCb( const DBus::SignalMessage& sig );
void ConditionCb( const DBus::SignalMessage& sig );
};
#endif//__DEMO_HAL_LISTEN_H
EXTRA_DIST = README props-introspect.xml
AM_CPPFLAGS = -I$(top_srcdir)/include
noinst_PROGRAMS = props-server
props_server_SOURCES = props-glue.h props-server.h props-server.cpp
props_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
props-glue.h: props-introspect.xml
$(top_builddir)/tools/dbusxx-xml2cpp $^ --adaptor=$@
BUILT_SOURCES = props-glue.h
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
MAINTAINERCLEANFILES = \
Makefile.in
This very simple example shows how to export properties (from objects implementing the org.freedesktop.DBus.Properties interface)
To test, run `DBUSXX_VERBOSE=1 ./props-server` and try the following commands:
dbus-send --dest=org.freedesktop.DBus.Examples.Properties --type=method_call --print-reply /org/freedesktop/DBus/Examples/Properties org.freedesktop.DBus.Properties.Get string:"org.freedesktop.DBus.PropsDemo" string:"Version"
dbus-send --dest=org.freedesktop.DBus.Examples.Properties --type=method_call --print-reply /org/freedesktop/DBus/Examples/Properties org.freedesktop.DBus.Properties.Set string:"org.freedesktop.DBus.PropsDemo" string:"Version" int32:2
dbus-send --dest=org.freedesktop.DBus.Examples.Properties --type=method_call --print-reply /org/freedesktop/DBus/Examples/Properties org.freedesktop.DBus.Properties.Set string:"org.freedesktop.DBus.PropsDemo" string:"Message" variant:string:"Hello D-Bus"
dbus-send --dest=org.freedesktop.DBus.Examples.Properties --type=method_call --print-reply /org/freedesktop/DBus/Examples/Properties org.freedesktop.DBus.Properties.Set string:"org.freedesktop.DBus.PropsDemo" string:"Message" variant:int32:200
dbus-send --dest=org.freedesktop.DBus.Examples.Properties --type=method_call --print-reply /org/freedesktop/DBus/Examples/Properties org.freedesktop.DBus.Properties.Get string:"org.freedesktop.DBus.PropsDemo" string:"Message"
dbus-send --dest=org.freedesktop.DBus.Examples.Properties --type=method_call --print-reply /org/freedesktop/DBus/Examples/Properties org.freedesktop.DBus.Properties.Get string:"org.freedesktop.DBus.PropsDemo" string:"Something"
dbus-send --dest=org.freedesktop.DBus.Examples.Properties --type=method_call --print-reply /org/freedesktop/DBus/Examples/Properties org.freedesktop.DBus.Properties.Get string:"org.freedesktop.DBus.PropsDemo" int32:100
<?xml version="1.0" ?>
<node name="/org/freedesktop/DBus/Examples/Properties">
<interface name="org.freedesktop.DBus.PropsDemo">
<property name="Version" type="i" access="read"/>
<property name="Message" type="s" access="readwrite"/>
<signal name="MessageChanged">
<arg name="message" type="s"/>
</signal>
</interface>
</node>
#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;
}
#ifndef __DEMO_PROPS_SERVER_H
#define __DEMO_PROPS_SERVER_H
#include <dbus-c++/dbus.h>
#include "props-glue.h"
class PropsServer
: public org::freedesktop::DBus::PropsDemo,
public DBus::IntrospectableAdaptor,
public DBus::PropertiesAdaptor,
public DBus::ObjectAdaptor
{
public:
PropsServer( DBus::Connection& connection );
void on_set_property
( DBus::InterfaceAdaptor& interface, const DBus::String& property, const DBus::Variant& value );
};
#endif//__DEMO_PROPS_SERVER_H
/*
*
* D-Bus++ - C++ bindings for D-Bus
*
* Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __DBUSXX_API_H
#define __DBUSXX_API_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef GCC_HASCLASSVISIBILITY
# define DXXAPILOCAL __attribute__ ((visibility("hidden")))
# define DXXAPIPUBLIC __attribute__ ((visibility("default")))
#else
# define DXXAPILOCAL
# define DXXAPIPUBLIC
#endif
#define DXXAPI DXXAPIPUBLIC
#endif//__DBUSXX_API_H
/* include/dbus-c++/config.h.in. Generated from configure.ac by autoheader. */
/* unstable DBus */
#undef DBUS_API_SUBJECT_TO_CHANGE
/* DBus supports recursive mutexes (needs DBus >= 0.95) */
#undef DBUS_HAS_RECURSIVE_MUTEX
/* dbus_threads_init_default (needs DBus >= 0.93) */
#undef DBUS_HAS_THREADS_INIT_DEFAULT
/* to enable hidden symbols */
#undef GCC_HASCLASSVISIBILITY
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <expat.h> header file. */
#undef HAVE_EXPAT_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/*
*
* D-Bus++ - C++ bindings for D-Bus
*
* Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __DBUSXX_CONNECTION_H
#define __DBUSXX_CONNECTION_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <list>
#include "api.h"
#include "types.h"
#include "util.h"
#include "message.h"
#include "pendingcall.h"
namespace DBus {
class Connection;
typedef Slot<bool, const Message&> MessageSlot;
typedef std::list<Connection> ConnectionList;
class ObjectAdaptor;
class Dispatcher;
class DXXAPI Connection
{
public:
static Connection SystemBus();
static Connection SessionBus();
static Connection ActivationBus();
struct Private;
typedef std::list<Private*> PrivatePList;
Connection( Private* );
Connection( const char* address, bool priv = true );
Connection( const Connection& c );
virtual ~Connection();
Dispatcher* setup( Dispatcher* );
bool operator == ( const Connection& ) const;
void add_match( const char* rule );
void remove_match( const char* rule );
bool add_filter( MessageSlot& );
void remove_filter( MessageSlot& );
bool unique_name( const char* n );
const char* unique_name() const;
bool register_bus();
bool connected() const;
void disconnect();
void exit_on_disconnect( bool exit );
void flush();
bool send( const Message&, unsigned int* serial = NULL );
Message send_blocking( Message& msg, int timeout );
PendingCall send_async( Message& msg, int timeout );
void request_name( const char* name, int flags = 0 );
bool has_name( const char* name );
bool start_service( const char* name, unsigned long flags );
const std::vector<std::string>& names();
private:
DXXAPILOCAL void init();
private:
RefPtrI<Private> _pvt;
friend class ObjectAdaptor; // needed in order to register object paths for a connection
};
} /* namespace DBus */
#endif//__DBUSXX_CONNECTION_H
/*
*
* D-Bus++ - C++ bindings for D-Bus
*
* Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __DBUSXX_DBUS_H
#define __DBUSXX_DBUS_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "types.h"
#include "interface.h"
#include "object.h"
#include "property.h"
#include "connection.h"
#include "server.h"
#include "error.h"
#include "message.h"
#include "debug.h"
#include "pendingcall.h"
#include "server.h"
#include "util.h"
#include "dispatcher.h"
#include "eventloop.h"
#include "eventloop-integration.h"
#include "introspection.h"
#endif//__DBUSXX_DBUS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment