Class: DBus::Object
- Inherits:
-
DBusCallable
- Object
- DBusCallable
- DBus::Object
- Defined in:
- lib/dbus.rb
Overview
Base class for exporting your own Objects across the Bus
Just inherit from Object and provide a list of the symbol names for methods to share across the bus. These will appear as member functions of your Service object.
Instance Method Summary collapse
-
#emit_signal(interface, signal_name, *args) ⇒ Object
Emit the signal
signal_name
for interfaceinterface
, and includeargs
in the signal message. -
#initialize(object_path, service, dbus_methods = []) ⇒ Object
constructor
A new instance of Object.
Methods inherited from DBusCallable
#dispatch, #dispatch_message, #new_error_reply, #on_message, #on_unregister
Constructor Details
#initialize(object_path, service, dbus_methods = []) ⇒ Object
Returns a new instance of Object.
273 274 275 276 277 278 279 |
# File 'lib/dbus.rb', line 273 def initialize(object_path, service, dbus_methods=[]) @connection = service.get_bus.get_connection super(@connection, dbus_methods) @object_path = object_path @service = service @connection.register_object_path(@object_path, method(:on_unregister), method(:on_message)) end |
Instance Method Details
#emit_signal(interface, signal_name, *args) ⇒ Object
Emit the signal signal_name
for interface interface
, and include args
in the signal message.
283 284 285 286 287 288 |
# File 'lib/dbus.rb', line 283 def emit_signal(interface, signal_name, *args) = DBus::Binding::DBusMessage.new_signal(@object_path, interface, signal_name) iter = .get_iter args.each{|a| iter.append(a)} @connection.send() end |