### Home Classes Methods

### In Files

- lib/dbus/introspect.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #has_iface?
- #interfaces
- #introspect
- #on_signal

### Files

- README

### Class/Module Index

Quicksearch

- DBus
- DBus::ASessionBus
- DBus::ASystemBus
- DBus::AuthenticationFailed
- DBus::Authenticator
- DBus::Client
- DBus::Connection
- DBus::Connection::NameRequestError
- DBus::DBusCookieSHA1
- DBus::Error
- DBus::ErrorMessage
- DBus::External
- DBus::FormalParameter
- DBus::IncompleteBufferException
- DBus::Interface
- DBus::InterfaceElement
- DBus::IntrospectXMLParser
- DBus::InvalidClassDefinition
- DBus::InvalidDestinationName
- DBus::InvalidIntrospectionData
- DBus::InvalidMethodName
- DBus::InvalidPacketException
- DBus::InvalidParameters
- DBus::Main
- DBus::MatchRule
- DBus::MatchRuleException
- DBus::Message
- DBus::Method
- DBus::MethodNotImplemented
- DBus::MethodReturnMessage
- DBus::Node
- DBus::Object
- DBus::Object::UndefinedInterface
- DBus::PacketMarshaller
- DBus::PacketUnmarshaller
- DBus::ProxyObject
- DBus::ProxyObjectFactory
- DBus::ProxyObjectInterface
- DBus::RemoteBus
- DBus::Service
- DBus::SessionBus
- DBus::Signal
- DBus::SystemBus
- DBus::Type
- DBus::Type::Parser
- DBus::Type::SignatureException
- DBus::Type::Type
- DBus::TypeException
- DBus::UnknownSignal
- Integer

No matching classes.

# DBus::ProxyObject

D-Bus proxy object class

Class representing a remote object in an external application. Typically, calling a method on an instance of a ProxyObject sends a message over the bus so that the method is executed remotely on the correctponding object.

### Attributes

bus[R]

The bus the object is reachable via.

default_iface[RW]

The default interface of the object, as String.

destination[R]

The (remote) destination of the object.

introspected[RW]

Flag determining whether the object has been introspected.

path[R]

The path to the object.

subnodes[RW]

The names of direct subnodes of the object in the tree.

### Public Class Methods

new(bus, dest, path) click to toggle source

Creates a new proxy object living on the given bus at destination dest on the given path.

    # File lib/dbus/introspect.rb, line 448
    def initialize(bus, dest, path)
      @bus, @destination, @path = bus, dest, path
      @interfaces = Hash.new
      @subnodes = Array.new
    end

### Public Instance Methods

[](intfname) click to toggle source

Retrieves an interface of the proxy object (ProxyObjectInterface instance).

    # File lib/dbus/introspect.rb, line 460
    def [](intfname)
      @interfaces[intfname]
    end

[]=(intfname, intf) click to toggle source

Maps the given interface name intfname to the given interface _intf.

    # File lib/dbus/introspect.rb, line 465
    def []=(intfname, intf)
      @interfaces[intfname] = intf
    end

has_iface?(name) click to toggle source

Returns whether the object has an interface with the given name.

    # File lib/dbus/introspect.rb, line 479
    def has_iface?(name)
      raise "Cannot call has_iface? if not introspected" if not @introspected
      @interfaces.member?(name)
    end

interfaces() click to toggle source

Returns the interfaces of the object.

    # File lib/dbus/introspect.rb, line 455
    def interfaces
      @interfaces.keys
    end

introspect() click to toggle source

Introspects the remote object. Allows you to find and select interfaces on the object.

    # File lib/dbus/introspect.rb, line 471
    def introspect
      # Synchronous call here.
      xml = @bus.introspect_data(@destination, @path)
      ProxyObjectFactory.introspect_into(self, xml)
      xml
    end

on_signal(name, &block) click to toggle source

Registers a handler, the code block, for a signal with the given name. It uses default_iface which must have been set.

    # File lib/dbus/introspect.rb, line 486
    def on_signal(name, &block)
      if @default_iface and has_iface?(@default_iface)
        @interfaces[@default_iface].on_signal(@bus, name, &block)
      else
        # TODO improve
        raise NoMethodError
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.