Class: DInstaller::DBus::SoftwareService
- Inherits:
-
Object
- Object
- DInstaller::DBus::SoftwareService
- Defined in:
- lib/dinstaller/dbus/software_service.rb
Overview
D-Bus service (org.opensuse.DInstaller.Software)
It connects to the system D-Bus and answers requests on objects below ‘/org/opensuse/DInstaller/Software`.
Instance Attribute Summary collapse
-
#bus ⇒ ::DBus::Connection
readonly
D-Bus connection.
Instance Method Summary collapse
-
#dispatch ⇒ Object
Call this from some main loop to dispatch the D-Bus messages.
-
#export ⇒ Object
Exports the software object through the D-Bus service.
-
#initialize(config, logger = nil) ⇒ SoftwareService
constructor
A new instance of SoftwareService.
Constructor Details
#initialize(config, logger = nil) ⇒ SoftwareService
Returns a new instance of SoftwareService.
43 44 45 46 47 48 |
# File 'lib/dinstaller/dbus/software_service.rb', line 43 def initialize(config, logger = nil) @logger = logger || Logger.new($stdout) @bus = ::DBus::SystemBus.instance @backend = DInstaller::Software.new(config, logger) @backend.on_progress_change { dispatch } end |
Instance Attribute Details
#bus ⇒ ::DBus::Connection (readonly)
D-Bus connection
39 40 41 |
# File 'lib/dinstaller/dbus/software_service.rb', line 39 def bus @bus end |
Instance Method Details
#dispatch ⇒ Object
Call this from some main loop to dispatch the D-Bus messages
58 59 60 |
# File 'lib/dinstaller/dbus/software_service.rb', line 58 def dispatch bus. end |
#export ⇒ Object
Exports the software object through the D-Bus service
51 52 53 54 55 |
# File 'lib/dinstaller/dbus/software_service.rb', line 51 def export dbus_objects.each { |o| service.export(o) } paths = dbus_objects.map(&:path).join(", ") logger.info "Exported #{paths} objects" end |