Object attributes on the bus

John (J5) Palmieri johnp at redhat.com
Mon Jun 12 07:24:15 PDT 2006

On Mon, 2006-06-12 at 11:17 +0200, Luigi Paioro wrote:
> Hello!
> I'd like to know whether is it possible to put an object on the bus 
> enabling the access to its attributes. For example (Python):
> class HelloObject(dbus.service.Object):
>    def __init__(self, bus_name, object_path='/example/HelloObject'):
>      self.name = 'Hello Object'
>      self.version = 1.5
>    @dbus.service.method('example.HelloObjectIface')
>    def hello(self):
>      print "Hello from: ", self.name
> OK, while of such object I can use the method hello() ('cause I have an 
> interface), I cannot access to the attributes self.name and self.version 
> directly, but I must provide two methods which retrieve them (getName() 
> and getVersion() for example). I'm right? Or does it exist a way to 
> interface the attributes of an object?
> Thank you.
> Luigi

We haven't added a way to get properties though it is in the dbus spec.
For right now you need to create your own methods.  We will be thinking
about how to best implement this in the future.  Should be easy.

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

More information about the dbus mailing list