em-ruby-dbus 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/COPYING +504 -0
  3. data/NEWS +253 -0
  4. data/README.md +93 -0
  5. data/Rakefile +58 -0
  6. data/VERSION +1 -0
  7. data/doc/Reference.md +207 -0
  8. data/doc/Tutorial.md +480 -0
  9. data/doc/ex-calling-methods.body.rb +8 -0
  10. data/doc/ex-calling-methods.rb +3 -0
  11. data/doc/ex-properties.body.rb +9 -0
  12. data/doc/ex-properties.rb +3 -0
  13. data/doc/ex-setup.rb +7 -0
  14. data/doc/ex-signal.body.rb +20 -0
  15. data/doc/ex-signal.rb +3 -0
  16. data/doc/example-helper.rb +6 -0
  17. data/em-ruby-dbus.gemspec +20 -0
  18. data/examples/gdbus/gdbus +255 -0
  19. data/examples/gdbus/gdbus.glade +184 -0
  20. data/examples/gdbus/launch.sh +4 -0
  21. data/examples/no-introspect/nm-test.rb +21 -0
  22. data/examples/no-introspect/tracker-test.rb +16 -0
  23. data/examples/rhythmbox/playpause.rb +25 -0
  24. data/examples/service/call_service.rb +25 -0
  25. data/examples/service/service_newapi.rb +51 -0
  26. data/examples/simple/call_introspect.rb +34 -0
  27. data/examples/simple/properties.rb +19 -0
  28. data/examples/utils/listnames.rb +11 -0
  29. data/examples/utils/notify.rb +19 -0
  30. data/lib/dbus.rb +82 -0
  31. data/lib/dbus/auth.rb +269 -0
  32. data/lib/dbus/bus.rb +739 -0
  33. data/lib/dbus/core_ext/array/extract_options.rb +31 -0
  34. data/lib/dbus/core_ext/class/attribute.rb +129 -0
  35. data/lib/dbus/core_ext/kernel/singleton_class.rb +8 -0
  36. data/lib/dbus/core_ext/module/remove_method.rb +14 -0
  37. data/lib/dbus/error.rb +46 -0
  38. data/lib/dbus/export.rb +128 -0
  39. data/lib/dbus/introspect.rb +219 -0
  40. data/lib/dbus/logger.rb +31 -0
  41. data/lib/dbus/loop-em.rb +19 -0
  42. data/lib/dbus/marshall.rb +434 -0
  43. data/lib/dbus/matchrule.rb +101 -0
  44. data/lib/dbus/message.rb +276 -0
  45. data/lib/dbus/message_queue.rb +166 -0
  46. data/lib/dbus/proxy_object.rb +149 -0
  47. data/lib/dbus/proxy_object_factory.rb +41 -0
  48. data/lib/dbus/proxy_object_interface.rb +128 -0
  49. data/lib/dbus/type.rb +193 -0
  50. data/lib/dbus/xml.rb +161 -0
  51. data/test/async_spec.rb +47 -0
  52. data/test/binding_spec.rb +74 -0
  53. data/test/bus_and_xml_backend_spec.rb +39 -0
  54. data/test/bus_driver_spec.rb +20 -0
  55. data/test/bus_spec.rb +20 -0
  56. data/test/byte_array_spec.rb +38 -0
  57. data/test/err_msg_spec.rb +42 -0
  58. data/test/introspect_xml_parser_spec.rb +26 -0
  59. data/test/introspection_spec.rb +32 -0
  60. data/test/main_loop_spec.rb +82 -0
  61. data/test/property_spec.rb +53 -0
  62. data/test/server_robustness_spec.rb +66 -0
  63. data/test/server_spec.rb +53 -0
  64. data/test/service_newapi.rb +217 -0
  65. data/test/session_bus_spec_manual.rb +15 -0
  66. data/test/signal_spec.rb +90 -0
  67. data/test/spec_helper.rb +33 -0
  68. data/test/thread_safety_spec.rb +31 -0
  69. data/test/tools/dbus-launch-simple +35 -0
  70. data/test/tools/dbus-limited-session.conf +28 -0
  71. data/test/tools/test_env +13 -0
  72. data/test/tools/test_server +39 -0
  73. data/test/type_spec.rb +19 -0
  74. data/test/value_spec.rb +81 -0
  75. data/test/variant_spec.rb +66 -0
  76. metadata +145 -0
data/NEWS ADDED
@@ -0,0 +1,253 @@
1
+ = Ruby D-Bus NEWS
2
+
3
+ Note about bug numbers:
4
+ Ticket#1 - https://trac.luon.net/ruby-dbus/ticket/1
5
+ Issue#1 - http://github.com/mvidner/ruby-dbus/issues#issue/1
6
+ bnc#1 - https://bugzilla.novell.com/show_bug.cgi?id=1
7
+
8
+ == Ruby D-Bus 0.11.0 - 2014-02-17
9
+
10
+ API:
11
+ * Connection: split off MessageQueue, marked other methods as private.
12
+
13
+ Requirements:
14
+ * converted tests to RSpec, rather mechanically for now
15
+
16
+ == Ruby D-Bus 0.10.0 - 2014-01-10
17
+
18
+ Bug fixes:
19
+ * fixed "Interfaces added with singleton_class.instance_eval aren't
20
+ exported" (Issue#22, by miaoufkirsh)
21
+
22
+ Requirements:
23
+ * Require ruby 1.9.3, stopped supporting 1.8.7.
24
+
25
+ == Ruby D-Bus 0.9.3 - 2014-01-02
26
+
27
+ Bug fixes:
28
+ * re-added COPYING, NEWS, README.md to the gem (Issue#47,
29
+ by Cédric Boutillier)
30
+
31
+ Packaging:
32
+ * use packaging_rake_tasks
33
+
34
+ == Ruby D-Bus 0.9.2 - 2013-05-08
35
+
36
+ Features:
37
+ * Ruby strings can be passed where byte arrays ("ay") are expected
38
+ (Issue#40, by Jesper B. Rosenkilde)
39
+
40
+ Bug fixes:
41
+ * Fixed accessing ModemManager properties (Issue#41, reported
42
+ by Ernest Bursa). MM introspection produces two elements
43
+ for a single interface; merge them.
44
+
45
+ == Ruby D-Bus 0.9.1 - 2013-04-23
46
+
47
+ Bug fixes:
48
+ * Prefer /etc/machine-id to /var/lib/dbus/machine-id
49
+ when DBUS_SESSION_BUS_ADDRESS is unset (Issue#39, by WU Jun).
50
+
51
+ == Ruby D-Bus 0.9.0 - 2012-11-06
52
+
53
+ Features:
54
+ * When calling methods, the interface can be left unspecified if unambiguous
55
+ (Damiano Stoffie)
56
+ * YARD documentation, Reference.md
57
+
58
+ Bug fixes:
59
+ * Introspection attribute "direction" can be omitted
60
+ as allowed by the specification (Noah Meyerhans).
61
+ * ProxyObjectInterface#on_signal no longer needs the "bus" parameter
62
+ (Issue#31, by Damiano Stoffie)
63
+
64
+ == Ruby D-Bus 0.8.0 - 2012-09-20
65
+
66
+ Features:
67
+ * Add Anonymous authentication (Issue#27, by Walter Brebels).
68
+ * Use Nokogiri for XML parsing when available (Issue#24, by Geoff Youngs).
69
+
70
+ Bug fixes:
71
+ * Use SCM_CREDS authentication only on FreeBSD, not on OpenBSD (Issue#21,
72
+ reported by Adde Nilsson).
73
+ * Recognize signature "h" (UNIX_FD) used eg. by Upstart (Issue#23,
74
+ by Bernd Ahlers).
75
+ * Find the session bus also via launchd, on OS X (Issue#20, reported
76
+ by Paul Sturgess).
77
+
78
+ Other:
79
+ * Now doing continuous integration with Travis:
80
+ http://travis-ci.org/#!/mvidner/ruby-dbus
81
+
82
+
83
+ == Ruby D-Bus 0.7.2 - 2012-04-05
84
+
85
+ A brown-paper-bag release.
86
+
87
+ Bug fixes:
88
+ * Fixed "undefined local variable or method `continue'" in
89
+ DBus::Main#run when a service becomes idle (by Ravil Bayramgalin)
90
+
91
+ == Ruby D-Bus 0.7.1 - 2012-04-04
92
+
93
+ Bug fixes:
94
+ * Fixed calling asynchronous methods on the default interface (Issue#13,
95
+ by Eugene Korbut).
96
+ * Fixed Main#quit to really quit the loop (by Josef Reidinger)
97
+ * Unbundled files from Active Support (by Bohuslav Kabrda)
98
+
99
+ == Ruby D-Bus 0.7.0 - 2011-07-26
100
+
101
+ Features:
102
+ * Added ASystemBus and ASessionBus, non-singletons useful in tests
103
+ and threads.
104
+
105
+ Bug fixes:
106
+ * Fixed handling of multibyte strings (Issue#8, by Takayuki YAMAGUCHI).
107
+ * Allow reopening of a dbus_interface declaration (Issue#9, by T. YAMAGUCHI).
108
+ * Fixed ruby-1.9.2 compatibility again (Issue#12).
109
+ * Fixed authentication on BSD (Issue#11, by Jonathan Walker)
110
+ * Fixed exiting a nested event loop for synchronous calls
111
+ (reported by Timo Warns).
112
+ * Fixed introspection calls leaking reply handlers.
113
+ * "rake test" now works, doing what was called "rake env:test"
114
+
115
+ == Ruby D-Bus 0.6.0 - 2010-12-11
116
+
117
+ Features:
118
+ * Clients can access properties conveniently (Ticket#28).
119
+
120
+ Bug fixes:
121
+ * Service won't crash whan handling an unknown method or interface (Ticket#31).
122
+ * Don't send an invalid error name when it originates from a NameError.
123
+
124
+ == Ruby D-Bus 0.5.0 - 2010-11-07
125
+
126
+ Features:
127
+ * Better binding of Ruby Exceptions to D-Bus Errors.
128
+ * Converted the package to a Gem (Issue#6).
129
+ * Converted the tutorial from Webgen to Markdown.
130
+
131
+ Bug fixes:
132
+ * Don't pass file descriptors to subprocesses.
133
+ * Fixed InterfaceElement::validate_name (Ticket#38, by Herwin Weststrate).
134
+ * Fixed a typo in InvalidDestinationName description (Ticket#40).
135
+
136
+ == Ruby D-Bus 0.4.0 - 2010-08-20
137
+
138
+ Features:
139
+ * TCP transport (by pangdudu)
140
+ * Enabled test code coverage report (rcov)
141
+
142
+ Bug fixes:
143
+ * Classes should not share all interfaces (Ticket#36/Issue#5)
144
+ * Ruby 1.9 compatibility (Ticket#37, by Myra Nelson)
145
+
146
+ == Ruby D-Bus 0.3.1 - 2010-07-22
147
+
148
+ Bug fixes:
149
+ * Many on_signal could cause DBus.Error.LimitsExceeded bnc#617350).
150
+ Don't add a match rule that already exists, enable removing match
151
+ rules. Now only one handler for a rule is called (but it is possible
152
+ for one signal to match more rules). This reverts the half-fix done
153
+ to fix Issue#3
154
+ * Re-added InterfaceElement#add_param for compatibility.
155
+ * Handle more ways which tell us that a bus connection has died.
156
+
157
+ == Ruby D-Bus 0.3.0 - 2010-03-28
158
+
159
+ Bug fixes:
160
+
161
+ * Fixed "undefined method `get_node' for nil:NilClass"
162
+ on Ubuntu Karmic (Ticket#34).
163
+ * Get the session bus address even if unset in ENV (Issue#4).
164
+ * Improved exceptions a bit:
165
+ UndefinedInterface, InvalidMethodName, NoMethodError, no RuntimeException
166
+
167
+ These are by Klaus Kaempf:
168
+ * Make the signal dispatcher call all handlers (Issue#3).
169
+ * Run on Ruby < 1.8.7 (Issue#2).
170
+ * Avoid needless DBus::IncompleteBufferException (Ticket#33).
171
+ * Don't ignore DBus Errors in request_service, raise them (Ticket#32).
172
+
173
+ Features:
174
+
175
+ * Automatic signature inference for variants.
176
+ * Introduced FormalParameter where a plain pair had been used.
177
+
178
+ == Ruby D-Bus 0.2.12 - 2010-01-24
179
+
180
+ Bug fixes:
181
+
182
+ * Fixed a long-standing bug where a service activated by the bus
183
+ would fail with "undefined method `get_node' for nil:NilClass"
184
+ (Tickets#25 and #29).
185
+
186
+ == Ruby D-Bus 0.2.11 - 2009-11-12
187
+
188
+ Features:
189
+
190
+ * Added DBus::Service#unexport (da1l6).
191
+
192
+ Bug fixes:
193
+
194
+ * Return org.freedesktop.DBus.Error.UnknownObject instead of crashing
195
+ (Ticket#31).
196
+ * Rescue exceptions in dbus_methods and reply with DBus errors instead of
197
+ crashing (da1l6).
198
+ * Better exception messages when sending nil, or mismatched structs.
199
+ * Call mktemp without --tmpdir, to build on older distros.
200
+
201
+ == Ruby D-Bus 0.2.10 - 2009-09-10
202
+
203
+ Bug fixes:
204
+
205
+ * DBus::Service.exists? fixed (Murat Demirten).
206
+ * Ruby 1.9 fixes (Jedediah Smith).
207
+ * Fixed an endless sleep in DBus::Main.run (bnc#537401).
208
+ * Added details to PacketMarshaller exceptions (bnc#538050).
209
+
210
+ (bnc#FOO refers to https://bugzilla.novell.com/show_bug.cgi?id=FOO )
211
+
212
+ == Ruby D-Bus "I'm not dead" 0.2.9 - 2009-08-26
213
+
214
+ Thank you to Paul and Arnaud for starting the project. I, Martin
215
+ Vidner, am continuing with it on GitHub.
216
+
217
+ * Fixed passing an array through a variant (no ticket).
218
+ * Fixed marshalling "av" (Ticket #30).
219
+ * Fixed variant alignment (Ticket #27).
220
+ * Added DBus::Main.quit.
221
+ * Mention the DBus interface in a NameError for an unknown method.
222
+ * Fixed ruby-1.9 "warning: default `to_a' will be obsolete".
223
+ * Added Rakefile and gemspec.
224
+
225
+ == Ruby D-Bus "Thanks for all the fish" 0.2.1 - 2007-12-29
226
+
227
+ More bugfixes, mostly supplied by users supplying us with patches. Thanks!
228
+
229
+ * Support for new types added:
230
+ - dict (courtesy of Drake Wilson);
231
+ - double (courtesy of Patrick Sissons);
232
+ - variant.
233
+ * Improved exception raise support (courtesy of Sjoerd Simons,
234
+ Patrick Sissons).
235
+ * Some polish (removed debug output, solved unnecessary warnings).
236
+ * Documentation updates, example fixes and updates.
237
+
238
+ == Ruby D-Bus "Almost live from DebConf 7" 0.2.0 - 2007-06-02
239
+
240
+ Again a bugfix release, also meant to be the public release
241
+ for exploratory purposes. New in 0.2.0:
242
+
243
+ * Complete tutorial revamp.
244
+ * Relicensed to the LGPL.
245
+
246
+ == Ruby D-Bus "Release Often" 0.1.1 - 2007-04-23
247
+
248
+ Bugfix release. Fixes hardcoded string for requesting bus names,
249
+ found by Rudi Cilibrasi.
250
+
251
+ == Ruby D-Bus "Happy Birthday Paul" 0.1.0 - 2007-04-17
252
+
253
+ First release. Supports most of D-Bus' features.
data/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # Ruby D-Bus (with EventMachine support)
2
+
3
+ ## Note
4
+
5
+ This fork works in the same way as [original Ruby D-Bus bindings](https://github.com/mvidner/ruby-dbus)
6
+ but it supports [EventMachine](http://rubyeventmachine.com).
7
+
8
+ You can bind it to the EM by calling `#eventmachinize`:
9
+
10
+ @connection = DBus::SessionBus.instance
11
+ @connection.eventmachinize
12
+
13
+ ## (Original README)
14
+
15
+ [D-Bus](http://dbus.freedesktop.org) is an interprocess communication
16
+ mechanism for Linux.
17
+ Ruby D-Bus is a pure Ruby library for writing clients and services for D-Bus.
18
+
19
+ [![Gem Version][GV img]][Gem Version]
20
+ [![Build Status][BS img]][Build Status]
21
+ [![Dependency Status][DS img]][Dependency Status]
22
+ [![Code Climate][CC img]][Code Climate]
23
+ [![Coverage Status][CS img]][Coverage Status]
24
+
25
+ [Gem Version]: https://rubygems.org/gems/ruby-dbus
26
+ [Build Status]: https://travis-ci.org/mvidner/ruby-dbus
27
+ [travis pull requests]: https://travis-ci.org/mvidner/ruby-dbus/pull_requests
28
+ [Dependency Status]: https://gemnasium.com/mvidner/ruby-dbus
29
+ [Code Climate]: https://codeclimate.com/github/mvidner/ruby-dbus
30
+ [Coverage Status]: https://coveralls.io/r/mvidner/ruby-dbus
31
+
32
+ [GV img]: https://badge.fury.io/rb/ruby-dbus.png
33
+ [BS img]: https://travis-ci.org/mvidner/ruby-dbus.png
34
+ [DS img]: https://gemnasium.com/mvidner/ruby-dbus.png
35
+ [CC img]: https://codeclimate.com/github/mvidner/ruby-dbus.png
36
+ [CS img]: https://coveralls.io/repos/mvidner/ruby-dbus/badge.png?branch=master
37
+
38
+ ## Example
39
+
40
+ Check whether the system is on battery power
41
+ via [UPower](http://upower.freedesktop.org/docs/UPower.html#UPower:OnBattery)
42
+
43
+ require "dbus"
44
+ sysbus = DBus.system_bus
45
+ upower_service = sysbus["org.freedesktop.UPower"]
46
+ upower_object = upower_service.object "/org/freedesktop/UPower"
47
+ upower_object.introspect
48
+ upower_interface = upower_object["org.freedesktop.UPower"]
49
+ on_battery = upower_interface["OnBattery"]
50
+ if on_battery
51
+ puts "The computer IS on battery power."
52
+ else
53
+ puts "The computer IS NOT on battery power."
54
+ end
55
+
56
+ ## Requirements
57
+
58
+ - Ruby 1.9.3 or 2.0
59
+
60
+
61
+ ## Installation
62
+
63
+ - `gem install em-ruby-dbus`
64
+
65
+ ## Features
66
+
67
+ Ruby D-Bus currently supports the following features:
68
+
69
+ * Connecting to local buses.
70
+ * Accessing remote services, objects and interfaces.
71
+ * Invoking methods on remote objects synchronously and asynchronously.
72
+ * Catch signals on remote objects and handle them via callbacks.
73
+ * Remote object introspection.
74
+ * Walking object trees.
75
+ * Creating services and registering them on the bus.
76
+ * Exporting objects with interfaces on a bus for remote use.
77
+ * Rubyish D-Bus object and interface syntax support that automatically
78
+ allows for introspection.
79
+ * Emitting signals on exported objects.
80
+
81
+ ## Usage
82
+
83
+ See some of the examples in the examples/ subdirectory of the tarball.
84
+ Also, check out the included tutorial (in Markdown format) in doc/Tutorial.md
85
+ or view it online on
86
+ <https://github.com/mvidner/ruby-dbus/blob/master/doc/Tutorial.md> .
87
+
88
+ ## License
89
+
90
+ Ruby D-Bus is free software; you can redistribute it and/or modify it
91
+ under the terms of the GNU Lesser General Public License as published by the
92
+ Free Software Foundation; either version 2.1 of the License, or (at
93
+ your option) any later version.
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ #! /usr/bin/env ruby
2
+ require 'rake'
3
+ require 'fileutils'
4
+ include FileUtils
5
+ require 'tmpdir'
6
+ require 'rspec/core/rake_task'
7
+
8
+ require "packaging"
9
+
10
+ Packaging.configuration do |conf|
11
+ conf.obs_project = "devel:languages:ruby:extensions"
12
+ conf.package_name = "rubygem-ruby-dbus"
13
+ conf.obs_sr_project = "openSUSE:Factory"
14
+ conf.skip_license_check << /^[^\/]*$/
15
+ conf.skip_license_check << /^(doc|examples|test)\/.*/
16
+ # "Ruby on Rails is released under the MIT License."
17
+ # but the files are missing copyright headers
18
+ conf.skip_license_check << /^lib\/dbus\/core_ext\//
19
+ end
20
+
21
+ desc 'Default: run specs in the proper environment'
22
+ task :default => :spec
23
+ task :test => :spec
24
+
25
+ RSpec::Core::RakeTask.new("bare:spec") do |t|
26
+ t.pattern = "**/test/**/*_spec.rb"
27
+ t.rspec_opts = "--color --format doc"
28
+ end
29
+
30
+ %w(spec).each do |tname|
31
+ desc "Run bare:#{tname} in the proper environment"
32
+ task tname do |t|
33
+ cd "test/tools" do
34
+ sh "./test_env rake bare:#{tname}"
35
+ end
36
+ end
37
+ end
38
+
39
+ if ENV["TRAVIS"]
40
+ require "coveralls/rake/task"
41
+ Coveralls::RakeTask.new
42
+ task :default => "coveralls:push"
43
+ end
44
+
45
+ #remove tarball implementation and create gem for this gemfile
46
+ Rake::Task[:tarball].clear
47
+
48
+ desc "Build a package from a clone of the local Git repo"
49
+ task :tarball do |t|
50
+ Dir.mktmpdir do |temp|
51
+ sh "git clone . #{temp}"
52
+ cd temp do
53
+ sh "gem build ruby-dbus.gemspec"
54
+ end
55
+ sh "rm -f package/*.gem"
56
+ cp Dir.glob("#{temp}/*.gem"), "package"
57
+ end
58
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.11.0
data/doc/Reference.md ADDED
@@ -0,0 +1,207 @@
1
+ Ruby D-Bus Reference
2
+ ====================
3
+
4
+ This is a reference-style documentation. It's not [a tutorial for
5
+ beginners](http://dbus.freedesktop.org/doc/dbus-tutorial.html), the
6
+ reader should have knowledge of basic DBus concepts.
7
+
8
+ Client Side
9
+ -----------
10
+
11
+ This section should be enough if you only want to consume DBus APIs.
12
+
13
+ ### Basic Concepts
14
+
15
+ #### Setting Up
16
+
17
+ The following code is assumed as a prolog to all following ones
18
+
19
+ {include:file:doc/ex-setup.rb}
20
+
21
+ #### Calling Methods
22
+
23
+ 1. {DBus.session_bus Connect to the session bus};
24
+ {DBus::Connection#[] get the screensaver service}
25
+ {DBus::Service#object and its screensaver object}.
26
+ 2. Perform {DBus::ProxyObject#introspect explicit introspection}
27
+ to define the interfaces and methods
28
+ on the {DBus::ProxyObject object proxy}
29
+ ([I#28](https://github.com/mvidner/ruby-dbus/issues/28)).
30
+ 3. Call one of its methods in a loop, solving [xkcd#196](http://xkcd.com/196).
31
+
32
+ {include:file:doc/ex-calling-methods.body.rb}
33
+
34
+ ##### Retrieving Return Values
35
+
36
+ A method proxy always returns an array of values. This is to
37
+ accomodate the rare cases of a DBus method specifying more than one
38
+ *out* parameter. For nearly all methods you should use `Method[0]` or
39
+ `Method.first`
40
+ ([I#30](https://github.com/mvidner/ruby-dbus/issues/30)).
41
+
42
+
43
+ # wrong
44
+ if upower_i.SuspendAllowed # [false] is true!
45
+ upower_i.Suspend
46
+ end
47
+
48
+ # right
49
+ if upower_i.SuspendAllowed[0]
50
+ upower_i.Suspend
51
+ end
52
+
53
+ #### Accessing Properties
54
+
55
+ To access properties, think of the {DBus::ProxyObjectInterface interface} as a
56
+ {DBus::ProxyObjectInterface#[] hash} keyed by strings,
57
+ or use {DBus::ProxyObjectInterface#all_properties} to get
58
+ an actual Hash of them.
59
+
60
+ {include:file:doc/ex-properties.body.rb}
61
+
62
+ (TODO a writable property example)
63
+
64
+ Note that unlike for methods where the interface is inferred if unambiguous,
65
+ for properties the interface must be explicitly chosen.
66
+ That is because {DBus::ProxyObject} uses the {DBus::ProxyObject Hash#[]} API
67
+ to provide the {DBus::ProxyObjectInterface interfaces}, not the properties.
68
+
69
+ #### Asynchronous Operation
70
+
71
+ If a method call has a block attached, it is asynchronous and the block
72
+ is invoked on receiving a method_return message or an error message
73
+
74
+ ##### Main Loop
75
+
76
+ For asynchronous operation an event loop is necessary. Use {DBus::Main}:
77
+
78
+ # [set up signal handlers...]
79
+ main = DBus::Main.new
80
+ main << mybus
81
+ main.run
82
+
83
+ Alternately, run the GLib main loop and add your DBus connections to it via
84
+ {DBus::Connection#glibize}.
85
+
86
+ #### Receiving Signals
87
+
88
+ To receive signals for a specific object and interface, use
89
+ {DBus::ProxyObjectInterface#on\_signal}(name, &block) or
90
+ {DBus::ProxyObject#on_signal}(name, &block), for the default interface.
91
+
92
+ {include:file:doc/ex-signal.body.rb}
93
+
94
+ ### Intermediate Concepts
95
+ #### Names
96
+ #### Types and Values, D-Bus -> Ruby
97
+
98
+ D-Bus booleans, numbers, strings, arrays and dictionaries become their straightforward Ruby counterparts.
99
+
100
+ Structs become arrays.
101
+
102
+ Object paths become strings.
103
+
104
+ Variants are simply unpacked to become their contained type.
105
+ (ISSUE: prevents proper round-tripping!)
106
+
107
+ #### Types and Values, Ruby -> D-Bus
108
+
109
+ D-Bus has stricter typing than Ruby, so the library must decide
110
+ which D-Bus type to choose. Most of the time the choice is dictated
111
+ by the D-Bus signature.
112
+
113
+ ##### Variants
114
+
115
+ If the signature expects a Variant
116
+ (which is the case for all Properties!) then an explicit mechanism is needed.
117
+
118
+ 1. A pair [{DBus::Type::Type}, value] specifies to marshall *value* as
119
+ that specified type.
120
+ The pair can be produced by {DBus.variant}(signature, value) which
121
+ gives the same result as [{DBus.type}(signature), value].
122
+
123
+ ISSUE: using something else than cryptic signatures is even more painful
124
+ than remembering the signatures!
125
+
126
+ foo_i['Bar'] = DBus.variant("au", [0, 1, 1, 2, 3, 5, 8])
127
+
128
+ 2. Other values are tried to fit one of these:
129
+ Boolean, Double, Array of Variants, Hash of String keyed Variants,
130
+ String, Int32, Int64.
131
+
132
+ 3. **Deprecated:** A pair [String, value], where String is a valid
133
+ signature of a single complete type, marshalls value as that
134
+ type. This will hit you when you rely on method (2) but happen to have
135
+ a particular string value in an array.
136
+
137
+ ##### Byte Arrays
138
+
139
+ If a byte array (`ay`) is expected you can pass a String too.
140
+ The bytes sent are according to the string's
141
+ [encoding](http://ruby-doc.org/core-1.9.3/Encoding.html).
142
+
143
+ ##### nil
144
+
145
+ `nil` is not allowed by D-Bus and attempting to send it raises an exception
146
+ (but see [I#16](https://github.com/mvidner/ruby-dbus/issues/16)).
147
+
148
+
149
+ #### Errors
150
+
151
+ D-Bus calls can reply with an error instead of a return value. An error is
152
+ translated to a Ruby exception, an instance of {DBus::Error}.
153
+
154
+ begin
155
+ network_manager.sleep
156
+ rescue DBus::Error => e
157
+ puts e unless e.name == "org.freedesktop.NetworkManager.AlreadyAsleepOrAwake"
158
+ end
159
+
160
+ #### Interfaces
161
+
162
+ Methods, properties and signals of a D-Bus object always belong to one of its interfaces.
163
+
164
+ Methods can be called without specifying their interface, as long as there is no ambiguity.
165
+ There are two ways to resolve ambiguities:
166
+
167
+ 1. assign an interface name to {DBus::ProxyObject#default_iface}.
168
+
169
+ 2. get a specific {DBus::ProxyObjectInterface interface} of the object,
170
+ with {DBus::ProxyObject#[]} and call methods from there.
171
+
172
+ Signals and properties only work with a specific interface.
173
+
174
+ #### Thread Safety
175
+ Not there. An [incomplete attempt](https://github.com/mvidner/ruby-dbus/tree/multithreading) was made.
176
+ ### Advanced Concepts
177
+ #### Bus Addresses
178
+ #### Without Introspection
179
+ #### Name Overloading
180
+
181
+ Service Side
182
+ ------------
183
+
184
+ When you want to provide a DBus API.
185
+
186
+ (check that client and service side have their counterparts)
187
+
188
+ ### Basic
189
+ #### Exporting a Method
190
+ ##### Interfaces
191
+ ##### Methods
192
+ ##### Bus Names
193
+ ##### Errors
194
+ #### Exporting Properties
195
+ ### Advanced
196
+ #### Inheritance
197
+ #### Names
198
+
199
+ Specification Conformance
200
+ -------------------------
201
+
202
+ This section lists the known deviations from version 0.19 of
203
+ [the specification][spec].
204
+
205
+ [spec]: http://dbus.freedesktop.org/doc/dbus-specification.html
206
+
207
+ 1. Properties support is basic.