robertalab-ev3dev icon indicating copy to clipboard operation
robertalab-ev3dev copied to clipboard

D-Bus service event "status" should be a property

Open dlech opened this issue 10 years ago • 1 comments

When this is implemented as an event. We cannot know the initial state of the service. It should be a property instead so the we can read the state at any time.

You still need an event when the property changes of course. For this, I suggest using org.freedesktop.DBus.Properties.PropertiesChanged.

See http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties.

dlech avatar Dec 08 '15 01:12 dlech

I seem to have found an example for python dbus and properties: https://github.com/bkircher/dbus-python/blob/master/examples/example-service.py#L72-L81 This is completely undocumented in the python-dbus docs though and I am not sure it is even part of the official release (see https://bugs.freedesktop.org/show_bug.cgi?id=26903).

Right now I work around the issue by emitting the current-status whenever a client connects. So if dbus properties actually work on the ev3 a transition plan would be:

  1. add the property and keep the signal
  2. after a release cycle drop the annotation from the signal

ensonic avatar Jan 27 '16 13:01 ensonic