dbus-python and exposing properties

Andy Grover agrover at redhat.com
Wed Oct 22 11:57:21 PDT 2014


Hi all,

I would like to expose properties for an object, using dbus-python.

I've implemented org.freedesktop.DBus.Properties as described here:

http://stackoverflow.com/questions/4277814/how-to-handle-properties-of-a-dbus-interface-with-python

with GetAll implemented like:

@service.method(dbus.PROPERTIES_IFACE, in_signature='s', 
out_signature='a{sv}')
def GetAll(self, interface):
     return dict(foo=1, bar="hello", baz="sup")

because I'm assuming calling GetAll is how the introspection is finding 
what properties are supported, and thus the above would register three 
properties named foo, bar, and baz.

But this isn't evidently how it works, because there are no properties:

[agrover at work ~]$ gdbus introspect --session --dest 
org.kernel.ScsiTarget1 --object-path 
/org/kernel/target1/target/iqn_2e2003_2d01_2eorg_2elinux_2discsi_2ework_2ex8664_3asn_2e826331bd561a 
--recurse
node 
/org/kernel/target1/target/iqn_2e2003_2d01_2eorg_2elinux_2discsi_2ework_2ex8664_3asn_2e826331bd561a 
{
   interface org.freedesktop.DBus.Introspectable {
     methods:
       Introspect(out s arg_0);
     signals:
     properties:
   };
   interface org.freedesktop.DBus.Properties {
     methods:
       Set(in  s interface,
           in  s prop,
           in  v value);
       GetAll(in  s interface,
              out a{sv} arg_1);
       Get(in  s interface,
           in  s prop,
           out v arg_2);
     signals:
     properties:
   };
   interface org.kernel.TargetInterface1 {
     methods:
       GetWWN(out s arg_0);
     signals:
     properties:
   };

So, how is the list of supported properties obtained and how do I 
support properties with dbus-python?

Thanks in advance -- Regards -- Andy


More information about the dbus mailing list