Connecting a service to an own bus

thomas dbus at phmali.de
Tue Mar 18 02:54:17 PDT 2008


Hi,
I connect a new Bus to the dbus deamon simply with the command:

    dbus-daemon --config-file=$config --nofork --print-address | head -1 
 > ~/.remotebus.address

where $config is my own config file and I save the address in a file 
named ".remotebus.address" to connect a service to this bus

I use python and try to connect a service with the commands:

    remotebus = dbus.Bus(address)
    name = dbus.service.BusName("com.example.CalculatorService", remotebus)
    object = CalculatorObject(remotebus, '/CalculatorObject')

"address" is the busaddress I stored in the "~/.remotebus.address" file
and "/CalculatorObject" is my Service class
one Method is in that class:

    @dbus.service.method("com.example.CalculatorInterface",
                             in_signature='ii', out_signature='ai')
        def GetAdd(self, add1, add2):
            sum=add1+add2
            print(str(sum))
            return [sum]

but if I want to Introspect or connect with a client to this bus it 
shows only the CalculatorObject but no methods or anything else.
Introspection only shows:

    <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object 
Introspection 1.0//EN"
    "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
    <node>
      <node name="CalculatorObject"/>
    </node>

Why?
I tryed the same with the session bus and it was perfect.

Thanks for help

Thomas


More information about the dbus mailing list