Remote DBus continued (using your own program)

November 7, 2014 by
Filed under: Communications, Development, Linux 

Continuing the previous thought on running DBus remotely using d-feet to check how it looks etc, this time, I wanted to call the DBus from my own program. Just write the DBus code as you would to query the DBus interface locally.

#!/usr/bin/env python

import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop

BUS_NAME="org.freedesktop.DBus"
OPATH="/"

bus = dbus.SessionBus()
obj = bus.get_object(BUS_NAME, OPATH)
iface = dbus.Interface(obj, BUS_NAME)
lala = iface.GetId()
print lala

Then the magic comes in running the application.

DBUS_SESSION_BUS_ADDRESS="tcp:host=192.168.X.Y,port=Z" ./dbus-hello.py

Comments

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.