Connecting a service to an own bus

John (J5) Palmieri johnp at redhat.com
Tue Mar 18 07:06:23 PDT 2008


On Tue, 2008-03-18 at 10:54 +0100, thomas wrote:
> 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

Are you wrapping your call in the introspectable interface? 

iface = dbus.service.Interface(object,
"org.freedesktop.DBus.Introspectable")

or

object.Introspect(dbus_interface="org.freedesktop.DBus.Introspectable")


-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list