Module: DInstaller::DBus::Interfaces::ServiceStatus
- Included in:
- Manager, Software::Manager, Storage::Proposal, Users
- Defined in:
- lib/dinstaller/dbus/interfaces/service_status.rb
Overview
Note:
This mixin is expected to be included in a class inherited from DBus::Object and it requires a #service_status method that returns a ServiceStatus object.
Mixin to define the ServiceStatus D-Bus interface
Constant Summary collapse
- SERVICE_STATUS_INTERFACE =
"org.opensuse.DInstaller.ServiceStatus1"
- SERVICE_STATUS_IDLE =
0
- SERVICE_STATUS_BUSY =
1
Class Method Summary collapse
Instance Method Summary collapse
-
#register_service_status_callbacks ⇒ Object
Registers callbacks to be called when the value of the service status changes.
-
#service_status_all ⇒ Array<Hash>
Description of all possible service status values.
-
#service_status_current ⇒ Integer
Current value of the service status.
Class Method Details
.included(base) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/dinstaller/dbus/interfaces/service_status.rb', line 78 def self.included(base) base.class_eval do dbus_interface SERVICE_STATUS_INTERFACE do dbus_reader :service_status_all, "aa{sv}", dbus_name: "All" dbus_reader :service_status_current, "u", dbus_name: "Current" end end end |
Instance Method Details
#register_service_status_callbacks ⇒ Object
Note:
This method is expected to be called in the constructor.
Registers callbacks to be called when the value of the service status changes
71 72 73 74 75 76 |
# File 'lib/dinstaller/dbus/interfaces/service_status.rb', line 71 def register_service_status_callbacks service_status.on_change do dbus_properties_changed(SERVICE_STATUS_INTERFACE, { "Current" => service_status_current }, []) end end |
#service_status_all ⇒ Array<Hash>
Description of all possible service status values
54 55 56 57 58 59 |
# File 'lib/dinstaller/dbus/interfaces/service_status.rb', line 54 def service_status_all [ { "id" => SERVICE_STATUS_IDLE, "label" => "idle" }, { "id" => SERVICE_STATUS_BUSY, "label" => "busy" } ] end |
#service_status_current ⇒ Integer
Current value of the service status
64 65 66 |
# File 'lib/dinstaller/dbus/interfaces/service_status.rb', line 64 def service_status_current service_status.busy? ? SERVICE_STATUS_BUSY : SERVICE_STATUS_IDLE end |