Connecting a service to an own bus

thomas dbus at phmali.de
Wed Mar 19 02:23:54 PDT 2008


hi,

I try with a client to get the Introspection by wrapping it using the 

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

do you mean this?

I think the problem is at the service. Maybe python-dbus has a problem 
to export methods to a bus that isn't session or system bus.
I'll send you my service. Maybe you see the mistake

thomas

John (J5) Palmieri schrieb:
> 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")
>
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rechner.py
Type: text/x-python
Size: 1469 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080319/fc8b5116/attachment.py 


More information about the dbus mailing list