module DBus::ObjectManager
A mixin for {DBus::Object} implementing {dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager org.freedesktop.DBus.ObjectManager}.
{Service#export} and {Service#unexport} will look for an ObjectManager
parent in the path hierarchy. If found, it will emit InterfacesAdded or InterfacesRemoved, as appropriate.
Constants
- OBJECT_MANAGER_INTERFACE
Public Class Methods
included(base)
click to toggle source
# File lib/dbus/object_manager.rb, line 45 def self.included(base) base.class_eval do dbus_interface OBJECT_MANAGER_INTERFACE do dbus_method :GetManagedObjects, "out res:a{oa{sa{sv}}}" do [managed_objects] end dbus_signal :InterfacesAdded, "object:o, interfaces_and_properties:a{sa{sv}}" dbus_signal :InterfacesRemoved, "object:o, interfaces:as" end end end
Public Instance Methods
managed_objects()
click to toggle source
@return [Hash{ObjectPath => Hash{String => Hash{String => Data::Base}}}]
object -> interface -> property -> value
# File lib/dbus/object_manager.rb, line 25 def managed_objects # FIXME: also fix the "service" concept descendant_objects = @service.descendants_for(path) descendant_objects.each_with_object({}) do |obj, hash| hash[obj.path] = obj.interfaces_and_properties end end
object_added(object)
click to toggle source
@param object [DBus::Object] @return [void]
# File lib/dbus/object_manager.rb, line 35 def object_added(object) InterfacesAdded(object.path, object.interfaces_and_properties) end
object_removed(object)
click to toggle source
@param object [DBus::Object] @return [void]
# File lib/dbus/object_manager.rb, line 41 def object_removed(object) InterfacesRemoved(object.path, object.intfs.keys) end