[PATCH] Add DBusServer wrapper for dbus-python

Huang Peng phuang at redhat.com
Wed Jul 2 18:47:56 PDT 2008

Hi Simon,

Thanks for your reply. I have my comments embedded.

On Wed, 2008-07-02 at 11:59 +0100, Simon McVittie wrote:

> Sorry, I haven't had a chance to review your patch in detail (I've been
> working on redesigning the Telepathy APIs for several weeks). I think
> exposing this functionality through dbus.lowlevel would be a good idea.
> I'll try to find time to do some review soon.
> I don't think it should get a high-level (object-model) API yet, if at all
> (disagreeing with J5 here...) since anything that needs a DBusServer is
> necessarily fairly specialized, and probably ought to be using the
> low-level (message passing) interfaces (or at least have the opportunity
> to use them).

After investigating the dbus_server_* APIs, I think the DBusServer is
just like a listen socket. It listens on a socket, and create a new
connection object, when a client connects to it. And developers can use
the new created connection object as they want (could use it with both
high-level or low-level API). Like, call dbus_connection_add_filter on
it to filter incoming messages, register dbus.service.Object with this
connection for handler messages or  use it send customized message to
client. (but some low-level API of DBusConnection is unsupported. like:
dbus_connection_{dispatch, pop_message, ...})

> In particular, I don't think it's reasonable to assume that every
> DBusServer exports exactly one (equivalent of a) dbus.service.Object.

In the server example code, I use one dbus.service.Object to do some
services. But it doesn't assume every DBusServer must export one
dbus.service.Object. It could export none, one or many

> Multiple dbus.service.Object instances can be attached to any
> dbus.connection.Connection, so providing a dbus.connection.Connection
> (or even a DBusServer-user-defined subclass of Connection) per client
> connected to the server is probably the way forward. That Connection could
> also be used with the low-level message-passing APIs from dbus.lowlevel.

I implemented server.set_new_connection_function (callback,
UserDefinedConnectionSubClass). When a new client connects to the
server, Server will create a new instance
of  UserDefinedConnectionSubClass, and pass it to callback function. Is
it like your idea?

Best Regards,
Huang Peng

More information about the dbus mailing list