Python / C++ application D-Bus usage issues

Kip Warner kip at thevertigo.com
Mon Dec 17 21:34:45 PST 2012


On Tue, 2012-12-18 at 07:22 +0200, Tanu Kaskinen wrote:
> No. You only need proxy objects for doing method calls on remote
> objects. You *can* use proxy objects also for receiving signals, but
> as is clear from the tutorial, that is not necessary. 

Hey Tanu. Ok, I'm almost there. So I replaced the following in the
Python application to receive signals...

myProjectProxy.connect_to_signal(
    DBUS_SIGNAL_NOTIFICATION, 
    self.onDBusSignal, 
    dbus_interface=DBUS_INTERFACE)

...with this...

self._sessionBus.add_signal_receiver(
    handler_function=self.onDBusSignal,
    signal_name="SomeSignal",
    dbus_interface=DBUS_INTERFACE,
    bus_name=DBUS_SERVICE_NAME,
    path=DBUS_OBJECT_PATH)

I think that's right, with the constants as such:

DBUS_SERVICE_NAME = "com.myproject.MyProjectService"
DBUS_OBJECT_PATH = "/com/myproject/MyProjectObject"
DBUS_INTERFACE = "com.myproject.MyProjectInterface"

Does that look right? I'd test it, but I can't because the C++
application still needs to answer the Introspect message which I'm not
sure how to do yet.

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20121217/23d949a1/attachment-0001.pgp>


More information about the dbus mailing list