ruby-dbus 0.22.1 → 0.23.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +38 -0
- data/VERSION +1 -1
- data/doc/Reference.md +5 -5
- data/examples/no-bus/pulseaudio.rb +50 -0
- data/examples/service/complex-property.rb +2 -2
- data/examples/service/service_newapi.rb +2 -2
- data/lib/dbus/bus.rb +48 -694
- data/lib/dbus/connection.rb +350 -0
- data/lib/dbus/logger.rb +3 -2
- data/lib/dbus/main.rb +66 -0
- data/lib/dbus/message.rb +6 -8
- data/lib/dbus/node_tree.rb +105 -0
- data/lib/dbus/object.rb +28 -9
- data/lib/dbus/object_manager.rb +6 -3
- data/lib/dbus/object_server.rb +149 -0
- data/lib/dbus/org.freedesktop.DBus.xml +97 -0
- data/lib/dbus/proxy_object.rb +4 -4
- data/lib/dbus/proxy_service.rb +107 -0
- data/lib/dbus.rb +10 -8
- data/ruby-dbus.gemspec +1 -1
- data/spec/bus_connection_spec.rb +80 -0
- data/spec/connection_spec.rb +37 -0
- data/spec/coverage_helper.rb +39 -0
- data/spec/dbus_spec.rb +22 -0
- data/spec/main_loop_spec.rb +14 -0
- data/spec/message_spec.rb +21 -0
- data/spec/mock-service/cockpit-dbustests.rb +29 -0
- data/spec/mock-service/com.redhat.Cockpit.DBusTests.xml +180 -0
- data/spec/mock-service/org.ruby.service.service +4 -0
- data/spec/mock-service/org.rubygems.ruby_dbus.DBusTests.service +4 -0
- data/spec/{service_newapi.rb → mock-service/spaghetti-monster.rb} +21 -10
- data/spec/node_spec.rb +1 -5
- data/spec/object_server_spec.rb +138 -0
- data/spec/object_spec.rb +46 -0
- data/spec/{bus_driver_spec.rb → proxy_service_spec.rb} +13 -8
- data/spec/spec_helper.rb +9 -45
- data/spec/thread_safety_spec.rb +9 -11
- data/spec/tools/dbus-launch-simple +4 -1
- data/spec/tools/dbus-limited-session.conf +3 -0
- data/spec/tools/test_env +26 -6
- metadata +24 -10
- data/spec/server_spec.rb +0 -55
- data/spec/service_spec.rb +0 -18
- data/spec/tools/test_server +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c671b06e04452129a899cd4b7877cf43f9c05b8e7bc6597e75bc460e250c97e7
|
4
|
+
data.tar.gz: 18f660c6e5804fd133cf8351d801f8e0d4e332f1473cc390bedf77341d71845d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cff2ab01f4db3d069a73b28f46cf861dcc81302ed239a7fc4332f46a7583b2394d679d5d73ab13f080b674e46f8961c89fa3fccc58ce9043d0bd33c4c2d02c4
|
7
|
+
data.tar.gz: 495c060e5161c2c5267b723598d3185b14d4c6517e41504f5b49971d3c355acec1ee3ab6285b7796bb7aa8cb61dfb5bd24535a2613a9f22cfb80f65ec8a1cf49
|
data/NEWS.md
CHANGED
@@ -2,6 +2,44 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## Ruby D-Bus 0.23.0.beta2 - 2023-06-23
|
6
|
+
|
7
|
+
License:
|
8
|
+
* clarified to be LGPL-2.1-or-later
|
9
|
+
|
10
|
+
API:
|
11
|
+
* DBus::Object#object_server replaces @service (which still works) and the short-lived
|
12
|
+
@connection
|
13
|
+
* ObjectServer#export will raise if the path is already taken by an object
|
14
|
+
* ObjectServer#unexport now also accepts an object path
|
15
|
+
* Connection#object_server can export objects even without requesting any
|
16
|
+
service name ([#49][], in beta1 already).
|
17
|
+
* Add PeerConnection for connections without a bus, useful for PulseAudio.
|
18
|
+
Fix listening for signals there ([#44][]).
|
19
|
+
* Moved from Connection to BusConnection: #unique_name, #proxy, #service.
|
20
|
+
Call send_hello in BusConnection#initialize already.
|
21
|
+
|
22
|
+
Bug fixes:
|
23
|
+
* Fixed a refactoring crasher bug in ProxyService#introspect (oops).
|
24
|
+
* Fix crash on #unexport of /child_of_root or even /
|
25
|
+
|
26
|
+
[#44]: https://github.com/mvidner/ruby-dbus/issues/44
|
27
|
+
[#49]: https://github.com/mvidner/ruby-dbus/issues/49
|
28
|
+
|
29
|
+
## Ruby D-Bus 0.23.0.beta1 - 2023-06-05
|
30
|
+
|
31
|
+
Bug fixes:
|
32
|
+
* A service can now have more than one name ([#69][]).
|
33
|
+
Connection#request_service is deprecated in favor of Connection#object_server
|
34
|
+
and BusConnection#request_name
|
35
|
+
|
36
|
+
[#69]: https://github.com/mvidner/ruby-dbus/issues/69
|
37
|
+
|
38
|
+
API:
|
39
|
+
* Remove Service, splitting it into ProxyService and ObjectServer
|
40
|
+
* Split off BusConnection from Connection
|
41
|
+
* DBus::Object @service replaced by @connection
|
42
|
+
|
5
43
|
## Ruby D-Bus 0.22.1 - 2023-05-17
|
6
44
|
|
7
45
|
Bug fixes:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.23.0.beta2
|
data/doc/Reference.md
CHANGED
@@ -23,8 +23,8 @@ is simply "dbus"
|
|
23
23
|
#### Calling Methods
|
24
24
|
|
25
25
|
1. {DBus.session_bus Connect to the session bus};
|
26
|
-
2. {DBus::
|
27
|
-
3. {DBus::
|
26
|
+
2. {DBus::BusConnection#[] get the screensaver service}
|
27
|
+
3. {DBus::ProxyService#[] and its screensaver object}.
|
28
28
|
4. Call one of its methods in a loop, solving [xkcd#196](http://xkcd.com/196).
|
29
29
|
|
30
30
|
|
@@ -58,7 +58,7 @@ a method proxy always returned an array of values. This was to
|
|
58
58
|
accomodate the rare cases of a DBus method specifying more than one
|
59
59
|
*out* parameter. For compatibility, the behavior is preserved if you
|
60
60
|
construct a {DBus::ProxyObject} with {DBus::ApiOptions::A0},
|
61
|
-
which is what {DBus::
|
61
|
+
which is what {DBus::ProxyService#object} does.
|
62
62
|
|
63
63
|
For nearly all methods you used `Method[0]` or
|
64
64
|
`Method.first`
|
@@ -340,8 +340,8 @@ for overriding this.
|
|
340
340
|
obj = Note.new("/net/vidner/Example/Properties")
|
341
341
|
|
342
342
|
bus = DBus::SessionBus.instance
|
343
|
-
|
344
|
-
|
343
|
+
bus.object_server.export(obj)
|
344
|
+
bus.request_name("net.vidner.Example")
|
345
345
|
|
346
346
|
main = DBus::Main.new
|
347
347
|
main << bus
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# find the library without external help
|
5
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
|
6
|
+
|
7
|
+
require "dbus"
|
8
|
+
|
9
|
+
def peer_address
|
10
|
+
bus = DBus::SessionBus.instance
|
11
|
+
svc = bus["org.PulseAudio1"]
|
12
|
+
obj = svc["/org/pulseaudio/server_lookup1"]
|
13
|
+
ifc = obj["org.PulseAudio.ServerLookup1"]
|
14
|
+
adr = ifc["Address"]
|
15
|
+
puts "PA address: #{adr}"
|
16
|
+
adr
|
17
|
+
end
|
18
|
+
|
19
|
+
address = peer_address
|
20
|
+
begin
|
21
|
+
conn = DBus::PeerConnection.new(address)
|
22
|
+
rescue Errno::ENOENT
|
23
|
+
puts "Address exists but could not connect; telling PA to load the protocol"
|
24
|
+
system "pactl load-module module-dbus-protocol"
|
25
|
+
conn = DBus::PeerConnection.new(address)
|
26
|
+
end
|
27
|
+
no_svc = conn.peer_service
|
28
|
+
obj = no_svc["/org/pulseaudio/core1"]
|
29
|
+
ifc = obj["org.PulseAudio.Core1"]
|
30
|
+
puts "PA version: #{ifc["Version"]}"
|
31
|
+
|
32
|
+
puts "Waiting for volume changes, try adjusting it. Ctrl-C to exit."
|
33
|
+
|
34
|
+
vol_ifc = "org.PulseAudio.Core1.Device"
|
35
|
+
vol_member = "VolumeUpdated"
|
36
|
+
# PA needs explicit enabling of signals
|
37
|
+
ifc.ListenForSignal("#{vol_ifc}.#{vol_member}", [])
|
38
|
+
|
39
|
+
match_rule = DBus::MatchRule.new
|
40
|
+
match_rule.interface = vol_ifc
|
41
|
+
match_rule.member = vol_member
|
42
|
+
conn.add_match(match_rule) do |msg|
|
43
|
+
# a single argument that is an array
|
44
|
+
volumes = msg.params[0]
|
45
|
+
puts "VolumeUpdated: #{volumes.join(", ")}"
|
46
|
+
end
|
47
|
+
|
48
|
+
loop = DBus::Main.new
|
49
|
+
loop << conn
|
50
|
+
loop.run
|
@@ -16,6 +16,6 @@ class Test < DBus::Object
|
|
16
16
|
end
|
17
17
|
|
18
18
|
bus = DBus::SessionBus.instance
|
19
|
-
|
20
|
-
|
19
|
+
bus.object_server.export(Test.new("/net/vidner/Scratch"))
|
20
|
+
bus.request_name("net.vidner.Scratch")
|
21
21
|
DBus::Main.new.tap { |m| m << bus }.run
|
@@ -31,9 +31,9 @@ class Test < DBus::Object
|
|
31
31
|
end
|
32
32
|
|
33
33
|
bus = DBus::SessionBus.instance
|
34
|
-
service = bus.request_service("org.ruby.service")
|
35
34
|
myobj = Test.new("/org/ruby/MyInstance")
|
36
|
-
|
35
|
+
bus.object_server.export(myobj)
|
36
|
+
bus.request_name("org.ruby.service")
|
37
37
|
|
38
38
|
Thread.new do
|
39
39
|
i = 0
|