Signal filtering
John (J5) Palmieri
johnp at redhat.com
Mon Aug 29 12:02:13 PDT 2005
On Mon, 2005-08-29 at 20:52 +0200, Philip Van Hoof wrote:
> On Mon, 2005-08-29 at 13:36 -0400, John (J5) Palmieri wrote:
> > With the latest releases 0.36.x you can add arg keys. So arg0, arg1,
> > arg2 ... argn. They will match on arguments sent by the signal or
> > method.
>
> I think this is the part that I'm interested in. Where can I find more
> information about this specific (new) feature?
>
> > > And when making a specification (like dbus-specification.html) what
> > > would be the preferred notation for this feature?
> > >
> > > Like:
> > >
> > > org.freedesktop.DBus.NameOwnerChanged
> > > This is a signal:
> > > NameOwnerChanged (STRING name, STRING old_owner, STRING new_owner)
> > >
>
> > Filters shouldn't be noted in a specification. They are optimizations
> > so that every program is not spammed by every signal that goes over the
> > bus. In fact if you use the bindings filters are hidden from the user.
>
> And the arguments (the new feature of 0.36.x)?
>
>
> Thanks a lot for the answer
There isn't much documentation. Like I said it is on the TODO list.
But lets take NameOwnerChanged for instance. You can only match on
strings with arg matches which makes this signal perfect. Say you want
to receive signals from only org.freedesktop.Foo you would do this:
dbus_bus_add_match (dbus_connection,
"type='signal',"
"interface='org.freedesktop.DBus',"
"memeber='NameOwnerChanged',"
"arg0='org.freedesktop.Foo'", &error);
if you knew the bus name of the org.freedesktop.Foo service you could do
this:
dbus_bus_add_match (dbus_connection,
"type='signal',"
"interface='org.freedesktop.DBus',"
"memeber='NameOwnerChanged',"
"arg1=':1.23'", &error);
--
John (J5) Palmieri <johnp at redhat.com>
More information about the dbus
mailing list