sidorares/dbus-native

Service: How do I emit a org.freedesktop.DBus.Properties.PropertiesChanged signal?

Opened this issue · 6 comments

When running a service, can I emit an org.freedesktop.DBus.Properties.PropertiesChanged signal for a property of my object? If so, how? I tried something along the lines of:
myObject.emit('org.freedesktop.DBus.Properties.PropertiesChanged','my.interface.name', {MyProperty: newValue});
but that didn't work.

I can't see existing helper in object itself ( feel free to add it ), but on low level signals are just messages with type=signal. Use bus.sendSignal for that - https://github.com/sidorares/node-dbus/blob/master/lib/bus.js#L56

at the moment it's only implemented on a service side - if your interface implementation object has "emit" function, calling it result in emitting dbus signal (in addition to node event, if your handler is EventEmitter ) - https://github.com/sidorares/node-dbus/blob/master/lib/bus.js#L205-L234

oh, that's actually for service, sorry ( I thought you have a client )

Note that your signal must be declared in your interface - https://github.com/sidorares/node-dbus/blob/master/lib/bus.js#L213

Can you reduce your service to something with no dependencies - I'll try to run locally and check if signal is send with dbus-monitor or wireshark

I need to change focus temporarily, but I will get back to this in a few.

I'm having this problem now. I can't figure out a way to emit PropertiesChanged on the org.freedesktop.DBus.Properties interface for my service.