Merge lp:~robert-ancell/indicator-bluetooth/bluez5 into lp:indicator-bluetooth/15.04
- bluez5
- Merge into trunk.15.04
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Sebastien Bacher | ||||
Approved revision: | 89 | ||||
Merged at revision: | 88 | ||||
Proposed branch: | lp:~robert-ancell/indicator-bluetooth/bluez5 | ||||
Merge into: | lp:indicator-bluetooth/15.04 | ||||
Diff against target: |
952 lines (+192/-561) 6 files modified
debian/control (+1/-1) po/POTFILES.in (+0/-1) src/Makefile.am (+0/-1) src/bluez.vala (+191/-253) src/desktop.vala (+0/-12) src/org-bluez.vala (+0/-293) |
||||
To merge this branch: | bzr merge lp:~robert-ancell/indicator-bluetooth/bluez5 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Mathieu Trudel-Lapierre | Approve | ||
Didier Roche-Tolomelli | Approve | ||
Review via email: mp+244375@code.launchpad.net |
Commit message
Support Bluez 5
When enabling/disabling and setting discoverability we now do this for all
adapters.
This requires us to remove the "Set Up New Device" item since gnome-bluetooth no
longer has a bluetooth wizard stand alone application. Instead we rely on the
unity-control-
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Didier Roche-Tolomelli (didrocks) wrote : | # |
Code looks good to me. I would prefer another review though (like from Mathieu) as my bluetooth is quite flaky and it only worked once (but it was already the case with bluez4).
Maybe you can as well package it and push to the ppa as ~ppa1 so that we can get broader testing?
Thanks!
Mathieu Trudel-Lapierre (cyphermox) wrote : | # |
Looks good to me; but I agree it would be best to package it and make it available in the transitions PPA for further testing.
Robert Ancell (robert-ancell) wrote : | # |
This is already in the transitions PPA as indicator-bluetooth 0.0.6+14.
Charles Kerr (charlesk) wrote : | # |
The code changes look reasonable and the transitions build of indicator-bluetooth works for me when I test it on a fresh installation of the March 6 Vivid iso. In that setup, both the on/off and visible/invisible toggles work as advertised.
Some problems:
* On desktop, "Set Up New Device..." is a feature specified in https:/
* After installing [bluez, indicator-
* The transitions repository doesn't have unity-control-
* The visible/invisible toggle in gnome-control-
Amr Ibrahim (amribrahim1987) wrote : | # |
Any news for packaging this for wily? I think bluez 5 needs broad testing in 15.10 before 16.04 LTS.
- 89. By Robert Ancell
-
Remove unused argument in DBus interface
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:89
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2014-01-14 04:39:09 +0000 | |||
3 | +++ debian/control 2015-08-07 02:52:49 +0000 | |||
4 | @@ -21,7 +21,7 @@ | |||
5 | 21 | Architecture: any | 21 | Architecture: any |
6 | 22 | Depends: ${misc:Depends}, | 22 | Depends: ${misc:Depends}, |
7 | 23 | ${shlibs:Depends}, | 23 | ${shlibs:Depends}, |
9 | 24 | bluez (>= 4.36), | 24 | bluez (>= 5), |
10 | 25 | unity-control-center | gnome-control-center | ubuntu-system-settings, | 25 | unity-control-center | gnome-control-center | ubuntu-system-settings, |
11 | 26 | gnome-bluetooth | ubuntu-system-settings, | 26 | gnome-bluetooth | ubuntu-system-settings, |
12 | 27 | Replaces: gnome-bluetooth (<< 3.6.1-0ubuntu2) | 27 | Replaces: gnome-bluetooth (<< 3.6.1-0ubuntu2) |
13 | 28 | 28 | ||
14 | === modified file 'po/POTFILES.in' | |||
15 | --- po/POTFILES.in 2013-10-01 11:06:27 +0000 | |||
16 | +++ po/POTFILES.in 2015-08-07 02:52:49 +0000 | |||
17 | @@ -8,7 +8,6 @@ | |||
18 | 8 | src/device.vala | 8 | src/device.vala |
19 | 9 | src/killswitch.vala | 9 | src/killswitch.vala |
20 | 10 | src/main.vala | 10 | src/main.vala |
21 | 11 | src/org-bluez.vala | ||
22 | 12 | src/phone.vala | 11 | src/phone.vala |
23 | 13 | src/profile.vala | 12 | src/profile.vala |
24 | 14 | src/service.vala | 13 | src/service.vala |
25 | 15 | 14 | ||
26 | === modified file 'src/Makefile.am' | |||
27 | --- src/Makefile.am 2013-09-25 20:06:30 +0000 | |||
28 | +++ src/Makefile.am 2015-08-07 02:52:49 +0000 | |||
29 | @@ -1,7 +1,6 @@ | |||
30 | 1 | pkglibexec_PROGRAMS = indicator-bluetooth-service | 1 | pkglibexec_PROGRAMS = indicator-bluetooth-service |
31 | 2 | 2 | ||
32 | 3 | indicator_bluetooth_service_SOURCES = \ | 3 | indicator_bluetooth_service_SOURCES = \ |
33 | 4 | org-bluez.vala \ | ||
34 | 5 | bluetooth.vala \ | 4 | bluetooth.vala \ |
35 | 6 | bluez.vala \ | 5 | bluez.vala \ |
36 | 7 | desktop.vala \ | 6 | desktop.vala \ |
37 | 8 | 7 | ||
38 | === modified file 'src/bluez.vala' | |||
39 | --- src/bluez.vala 2014-09-22 13:54:50 +0000 | |||
40 | +++ src/bluez.vala 2015-08-07 02:52:49 +0000 | |||
41 | @@ -25,8 +25,7 @@ | |||
42 | 25 | public class Bluez: Bluetooth, Object | 25 | public class Bluez: Bluetooth, Object |
43 | 26 | { | 26 | { |
44 | 27 | uint next_device_id = 1; | 27 | uint next_device_id = 1; |
47 | 28 | org.bluez.Manager manager; | 28 | ObjectManager manager; |
46 | 29 | org.bluez.Adapter default_adapter; | ||
48 | 30 | 29 | ||
49 | 31 | private bool _powered = false; | 30 | private bool _powered = false; |
50 | 32 | 31 | ||
51 | @@ -37,21 +36,22 @@ | |||
52 | 37 | 36 | ||
53 | 38 | private KillSwitch killswitch = new RfKillSwitch (); | 37 | private KillSwitch killswitch = new RfKillSwitch (); |
54 | 39 | 38 | ||
55 | 40 | private string adapter_path = null; | ||
56 | 41 | |||
57 | 42 | private DBusConnection bus = null; | 39 | private DBusConnection bus = null; |
58 | 43 | 40 | ||
64 | 44 | /* maps an org.bluez.Device's object_path to the org.bluez.Device proxy */ | 41 | /* maps an org.bluez.Adapter1's object_path to the BluezAdapter proxy */ |
65 | 45 | HashTable<string,org.bluez.Device> path_to_proxy; | 42 | private HashTable<ObjectPath,BluezAdapter> path_to_adapter_proxy; |
66 | 46 | 43 | ||
67 | 47 | /* maps an org.bluez.Device's object_path to our arbitrary unique id */ | 44 | /* maps an org.bluez.Device1's object_path to the BluezDevice proxy */ |
68 | 48 | HashTable<string,uint> path_to_id; | 45 | private HashTable<ObjectPath,BluezDevice> path_to_device_proxy; |
69 | 46 | |||
70 | 47 | /* maps an org.bluez.Device1's object_path to our arbitrary unique id */ | ||
71 | 48 | private HashTable<ObjectPath,uint> path_to_id; | ||
72 | 49 | 49 | ||
73 | 50 | /* maps our arbitrary unique id to an org.bluez.Device's object path */ | 50 | /* maps our arbitrary unique id to an org.bluez.Device's object path */ |
75 | 51 | HashTable<uint,string> id_to_path; | 51 | private HashTable<uint,ObjectPath> id_to_path; |
76 | 52 | 52 | ||
77 | 53 | /* maps our arbitrary unique id to a Bluetooth.Device struct for public consumption */ | 53 | /* maps our arbitrary unique id to a Bluetooth.Device struct for public consumption */ |
79 | 54 | HashTable<uint,Device> id_to_device; | 54 | private HashTable<uint,Device> id_to_device; |
80 | 55 | 55 | ||
81 | 56 | public Bluez (KillSwitch? killswitch) | 56 | public Bluez (KillSwitch? killswitch) |
82 | 57 | { | 57 | { |
83 | @@ -71,121 +71,116 @@ | |||
84 | 71 | update_enabled (); | 71 | update_enabled (); |
85 | 72 | } | 72 | } |
86 | 73 | 73 | ||
87 | 74 | id_to_path = new HashTable<uint,string> (direct_hash, direct_equal); | ||
88 | 75 | id_to_device = new HashTable<uint,Device> (direct_hash, direct_equal); | ||
89 | 76 | path_to_id = new HashTable<string,uint> (str_hash, str_equal); | ||
90 | 77 | path_to_proxy = new HashTable<string,org.bluez.Device> (str_hash, str_equal); | ||
91 | 78 | |||
92 | 79 | reset_manager (); | 74 | reset_manager (); |
93 | 80 | } | 75 | } |
94 | 81 | 76 | ||
95 | 82 | private void reset_manager () | 77 | private void reset_manager () |
96 | 83 | { | 78 | { |
98 | 84 | string new_adapter_path = null; | 79 | id_to_path = new HashTable<uint,ObjectPath> (direct_hash, direct_equal); |
99 | 80 | id_to_device = new HashTable<uint,Device> (direct_hash, direct_equal); | ||
100 | 81 | path_to_id = new HashTable<ObjectPath,uint> (str_hash, str_equal); | ||
101 | 82 | path_to_adapter_proxy = new HashTable<ObjectPath,BluezAdapter> (str_hash, str_equal); | ||
102 | 83 | path_to_device_proxy = new HashTable<ObjectPath,BluezDevice> (str_hash, str_equal); | ||
103 | 84 | |||
104 | 85 | try | 85 | try |
105 | 86 | { | 86 | { |
106 | 87 | manager = bus.get_proxy_sync ("org.bluez", "/"); | 87 | manager = bus.get_proxy_sync ("org.bluez", "/"); |
107 | 88 | 88 | ||
120 | 89 | // if the default adapter changes, update our connections | 89 | // Find the adapters and watch for changes |
121 | 90 | manager.default_adapter_changed.connect ((object_path) | 90 | manager.interfaces_added.connect ((object_path, interfaces_and_properties) => { |
122 | 91 | => on_default_adapter_changed (object_path)); | 91 | var iter = HashTableIter<string, HashTable<string, Variant>> (interfaces_and_properties); |
123 | 92 | 92 | string name; | |
124 | 93 | // if the current adapter disappears, call clear_adapter() | 93 | while (iter.next (out name, null)) |
125 | 94 | manager.adapter_removed.connect ((object_path) => { | 94 | { |
126 | 95 | if (object_path == adapter_path) | 95 | if (name == "org.bluez.Adapter1") |
127 | 96 | clear_adapter (); | 96 | update_adapter (object_path); |
128 | 97 | }); | 97 | if (name == "org.bluez.Device1") |
129 | 98 | 98 | update_device (object_path); | |
130 | 99 | // get the current default adapter & watch for future default adapters | 99 | } |
131 | 100 | new_adapter_path = manager.default_adapter (); | 100 | }); |
132 | 101 | manager.interfaces_removed.connect ((object_path, interfaces) => { | ||
133 | 102 | foreach (var interface in interfaces) { | ||
134 | 103 | if (interface == "org.bluez.Adapter1") | ||
135 | 104 | adapter_removed (object_path); | ||
136 | 105 | if (interface == "org.bluez.Device1") | ||
137 | 106 | device_removed (object_path); | ||
138 | 107 | } | ||
139 | 108 | }); | ||
140 | 109 | var objects = manager.get_managed_objects (); | ||
141 | 110 | var object_iter = HashTableIter<ObjectPath, HashTable<string, HashTable<string, Variant>>> (objects); | ||
142 | 111 | ObjectPath object_path; | ||
143 | 112 | HashTable<string, HashTable<string, Variant>> interfaces_and_properties; | ||
144 | 113 | while (object_iter.next (out object_path, out interfaces_and_properties)) | ||
145 | 114 | { | ||
146 | 115 | var iter = HashTableIter<string, HashTable<string, Variant>> (interfaces_and_properties); | ||
147 | 116 | string name; | ||
148 | 117 | while (iter.next (out name, null)) { | ||
149 | 118 | if (name == "org.bluez.Adapter1") | ||
150 | 119 | update_adapter (object_path); | ||
151 | 120 | if (name == "org.bluez.Device1") | ||
152 | 121 | update_device (object_path); | ||
153 | 122 | } | ||
154 | 123 | } | ||
155 | 101 | } | 124 | } |
156 | 102 | catch (Error e) | 125 | catch (Error e) |
157 | 103 | { | 126 | { |
158 | 104 | critical (@"$(e.message)"); | 127 | critical (@"$(e.message)"); |
159 | 105 | } | 128 | } |
241 | 106 | 129 | } | |
242 | 107 | on_default_adapter_changed (new_adapter_path); | 130 | |
243 | 108 | } | 131 | //// |
244 | 109 | 132 | //// Adapter Upkeep | |
245 | 110 | private void clear_adapter () | 133 | //// |
246 | 111 | { | 134 | |
247 | 112 | if (adapter_path != null) | 135 | private void update_adapter (ObjectPath object_path) |
248 | 113 | debug (@"clearing adapter; was using $adapter_path"); | 136 | { |
249 | 114 | 137 | // Create a proxy if we don't have one | |
250 | 115 | path_to_proxy.remove_all (); | 138 | var adapter_proxy = path_to_adapter_proxy.lookup (object_path); |
251 | 116 | path_to_id.remove_all (); | 139 | if (adapter_proxy == null) |
252 | 117 | id_to_path.remove_all (); | 140 | { |
253 | 118 | id_to_device.remove_all (); | 141 | try { |
254 | 119 | 142 | adapter_proxy = bus.get_proxy_sync ("org.bluez", object_path); | |
255 | 120 | default_adapter = null; | 143 | } catch (Error e) { |
256 | 121 | adapter_path = null; | 144 | critical (@"$(e.message)"); |
257 | 122 | 145 | return; | |
258 | 123 | discoverable = false; | 146 | } |
259 | 124 | powered = false; | 147 | path_to_adapter_proxy.insert (object_path, adapter_proxy); |
260 | 125 | } | 148 | adapter_proxy.g_properties_changed.connect(() => update_adapter (object_path)); |
261 | 126 | 149 | } | |
262 | 127 | void on_default_adapter_changed (string? object_path) | 150 | |
263 | 128 | { | 151 | update_combined_adapter_state (); |
264 | 129 | clear_adapter (); | 152 | } |
265 | 130 | 153 | ||
266 | 131 | if (object_path != null) try | 154 | private void adapter_removed (ObjectPath object_path) |
267 | 132 | { | 155 | { |
268 | 133 | adapter_path = object_path; | 156 | path_to_adapter_proxy.remove (object_path); |
269 | 134 | default_adapter = Bus.get_proxy_sync (BusType.SYSTEM, | 157 | update_combined_adapter_state (); |
270 | 135 | "org.bluez", | 158 | } |
271 | 136 | adapter_path); | 159 | |
272 | 137 | 160 | private void update_combined_adapter_state () | |
273 | 138 | default_adapter.property_changed.connect (() | 161 | { |
274 | 139 | => on_default_adapter_properties_changed ()); | 162 | var is_discoverable = false; |
275 | 140 | 163 | var is_powered = false; | |
276 | 141 | default_adapter.device_removed.connect ((adapter, path) => { | 164 | var is_supported = false; |
277 | 142 | var id = path_to_id.lookup (path); | 165 | |
278 | 143 | path_to_id.remove (path); | 166 | var iter = HashTableIter<ObjectPath,BluezAdapter> (path_to_adapter_proxy); |
279 | 144 | id_to_path.remove (id); | 167 | BluezAdapter adapter_proxy; |
280 | 145 | id_to_device.remove (id); | 168 | while (iter.next (null, out adapter_proxy)) |
281 | 146 | devices_changed (); | 169 | { |
282 | 147 | }); | 170 | var v = adapter_proxy.get_cached_property ("Discoverable"); |
283 | 148 | 171 | if (!is_discoverable) | |
284 | 149 | default_adapter.device_created.connect ((adapter, path) | 172 | is_discoverable = (v != null) && v.get_boolean (); |
285 | 150 | => add_device (path)); | 173 | |
286 | 151 | 174 | v = adapter_proxy.get_cached_property ("Powered"); | |
287 | 152 | foreach (var device_path in default_adapter.list_devices ()) | 175 | if (!is_powered) |
288 | 153 | add_device (device_path); | 176 | is_powered = (v != null) && v.get_boolean (); |
289 | 154 | } | 177 | |
290 | 155 | catch (Error e) | 178 | is_supported = true; |
291 | 156 | { | 179 | } |
292 | 157 | critical (@"$(e.message)"); | 180 | |
293 | 158 | } | 181 | discoverable = is_discoverable; |
213 | 159 | |||
214 | 160 | supported = object_path != null; | ||
215 | 161 | |||
216 | 162 | on_default_adapter_properties_changed (); | ||
217 | 163 | } | ||
218 | 164 | |||
219 | 165 | /* When the default adapter's properties change, | ||
220 | 166 | update our own properties "powered" and "discoverable" */ | ||
221 | 167 | private void on_default_adapter_properties_changed () | ||
222 | 168 | { | ||
223 | 169 | bool is_discoverable = false; | ||
224 | 170 | bool is_powered = false; | ||
225 | 171 | |||
226 | 172 | if (default_adapter != null) try | ||
227 | 173 | { | ||
228 | 174 | var properties = default_adapter.get_properties (); | ||
229 | 175 | |||
230 | 176 | var v = properties.lookup ("Discoverable"); | ||
231 | 177 | is_discoverable = (v != null) && v.get_boolean (); | ||
232 | 178 | |||
233 | 179 | v = properties.lookup ("Powered"); | ||
234 | 180 | is_powered = (v != null) && v.get_boolean (); | ||
235 | 181 | } | ||
236 | 182 | catch (Error e) | ||
237 | 183 | { | ||
238 | 184 | critical (@"$(e.message)"); | ||
239 | 185 | } | ||
240 | 186 | |||
294 | 187 | powered = is_powered; | 182 | powered = is_powered; |
296 | 188 | discoverable = is_discoverable; | 183 | supported = is_supported; |
297 | 189 | } | 184 | } |
298 | 190 | 185 | ||
299 | 191 | //// | 186 | //// |
300 | @@ -226,138 +221,34 @@ | |||
301 | 226 | } | 221 | } |
302 | 227 | 222 | ||
303 | 228 | //// | 223 | //// |
304 | 229 | //// Connectable Interfaces | ||
305 | 230 | //// | ||
306 | 231 | |||
307 | 232 | /* Headsets, Audio Sinks, and Input devices are connectable. | ||
308 | 233 | * | ||
309 | 234 | * This continues the behavior of the old gnome-bluetooth indicator. | ||
310 | 235 | * But are there other interfaces we care about? */ | ||
311 | 236 | private DBusInterfaceInfo[] get_connectable_interfaces (DBusProxy device) | ||
312 | 237 | { | ||
313 | 238 | DBusInterfaceInfo[] connectable_interfaces = {}; | ||
314 | 239 | |||
315 | 240 | try | ||
316 | 241 | { | ||
317 | 242 | var iname = "org.freedesktop.DBus.Introspectable.Introspect"; | ||
318 | 243 | var intro = device.call_sync (iname, null, DBusCallFlags.NONE, -1); | ||
319 | 244 | |||
320 | 245 | if ((intro != null) && (intro.n_children() > 0)) | ||
321 | 246 | { | ||
322 | 247 | var xml = intro.get_child_value(0).get_string(); | ||
323 | 248 | var info = new DBusNodeInfo.for_xml (xml); | ||
324 | 249 | if (info != null) | ||
325 | 250 | { | ||
326 | 251 | foreach (var i in info.interfaces) | ||
327 | 252 | { | ||
328 | 253 | if ((i.name == "org.bluez.AudioSink") || | ||
329 | 254 | (i.name == "org.bluez.Headset") || | ||
330 | 255 | (i.name == "org.bluez.Input")) | ||
331 | 256 | { | ||
332 | 257 | connectable_interfaces += i; | ||
333 | 258 | } | ||
334 | 259 | } | ||
335 | 260 | } | ||
336 | 261 | } | ||
337 | 262 | } | ||
338 | 263 | catch (Error e) | ||
339 | 264 | { | ||
340 | 265 | critical (@"$(e.message)"); | ||
341 | 266 | } | ||
342 | 267 | |||
343 | 268 | return connectable_interfaces; | ||
344 | 269 | } | ||
345 | 270 | |||
346 | 271 | private bool device_is_connectable (DBusProxy device) | ||
347 | 272 | { | ||
348 | 273 | return get_connectable_interfaces (device).length > 0; | ||
349 | 274 | } | ||
350 | 275 | |||
351 | 276 | // call "Connect" on the specified interface | ||
352 | 277 | private void device_connect_on_interface (DBusProxy proxy, | ||
353 | 278 | string interface_name) | ||
354 | 279 | { | ||
355 | 280 | var object_path = proxy.get_object_path (); | ||
356 | 281 | |||
357 | 282 | debug (@"trying to connect to $object_path: $(interface_name)"); | ||
358 | 283 | |||
359 | 284 | try | ||
360 | 285 | { | ||
361 | 286 | bus.call_sync ("org.bluez", object_path, interface_name, | ||
362 | 287 | "Connect", null, null, DBusCallFlags.NONE, -1); | ||
363 | 288 | } | ||
364 | 289 | catch (Error e) | ||
365 | 290 | { | ||
366 | 291 | debug (@"$object_path $interface_name.Connect() failed: $(e.message)"); | ||
367 | 292 | } | ||
368 | 293 | } | ||
369 | 294 | |||
370 | 295 | private void device_connect (org.bluez.Device device) | ||
371 | 296 | { | ||
372 | 297 | DBusProxy proxy = device as DBusProxy; | ||
373 | 298 | |||
374 | 299 | // call "Connect" on all the interfaces that support it | ||
375 | 300 | foreach (var i in get_connectable_interfaces (proxy)) | ||
376 | 301 | device_connect_on_interface (proxy, i.name); | ||
377 | 302 | } | ||
378 | 303 | |||
379 | 304 | private void device_disconnect (org.bluez.Device device) | ||
380 | 305 | { | ||
381 | 306 | try | ||
382 | 307 | { | ||
383 | 308 | device.disconnect (); | ||
384 | 309 | } | ||
385 | 310 | catch (Error e) | ||
386 | 311 | { | ||
387 | 312 | var object_path = (device as DBusProxy).get_object_path (); | ||
388 | 313 | critical (@"Unable to disconnect $object_path: $(e.message)"); | ||
389 | 314 | } | ||
390 | 315 | } | ||
391 | 316 | |||
392 | 317 | //// | ||
393 | 318 | //// Device Upkeep | 224 | //// Device Upkeep |
394 | 319 | //// | 225 | //// |
395 | 320 | 226 | ||
396 | 321 | private void add_device (string object_path) | ||
397 | 322 | { | ||
398 | 323 | if (!path_to_proxy.contains (object_path)) | ||
399 | 324 | { | ||
400 | 325 | try | ||
401 | 326 | { | ||
402 | 327 | org.bluez.Device device = Bus.get_proxy_sync (BusType.SYSTEM, | ||
403 | 328 | "org.bluez", | ||
404 | 329 | object_path); | ||
405 | 330 | path_to_proxy.insert (object_path, device); | ||
406 | 331 | device.property_changed.connect(() => update_device (device)); | ||
407 | 332 | update_device (device); | ||
408 | 333 | } | ||
409 | 334 | catch (Error e) | ||
410 | 335 | { | ||
411 | 336 | critical (@"$(e.message)"); | ||
412 | 337 | } | ||
413 | 338 | } | ||
414 | 339 | } | ||
415 | 340 | |||
416 | 341 | /* Update our public Device struct from the org.bluez.Device's properties. | 227 | /* Update our public Device struct from the org.bluez.Device's properties. |
417 | 342 | * | 228 | * |
418 | 343 | * This is called when we first walk through bluez' Devices on startup, | 229 | * This is called when we first walk through bluez' Devices on startup, |
419 | 344 | * when the org.bluez.Adapter gets a new device, | 230 | * when the org.bluez.Adapter gets a new device, |
420 | 345 | * and when a device's properties change s.t. we need to rebuild the proxy. | 231 | * and when a device's properties change s.t. we need to rebuild the proxy. |
421 | 346 | */ | 232 | */ |
423 | 347 | private void update_device (org.bluez.Device device_proxy) | 233 | private void update_device (ObjectPath object_path) |
424 | 348 | { | 234 | { |
426 | 349 | HashTable<string, GLib.Variant> properties; | 235 | // Create a proxy if we don't have one |
427 | 236 | var device_proxy = path_to_device_proxy.lookup (object_path); | ||
428 | 237 | if (device_proxy == null) | ||
429 | 238 | { | ||
430 | 239 | try { | ||
431 | 240 | device_proxy = bus.get_proxy_sync ("org.bluez", object_path); | ||
432 | 241 | } catch (Error e) { | ||
433 | 242 | critical (@"$(e.message)"); | ||
434 | 243 | return; | ||
435 | 244 | } | ||
436 | 350 | 245 | ||
443 | 351 | try { | 246 | path_to_device_proxy.insert (object_path, device_proxy); |
444 | 352 | properties = device_proxy.get_properties (); | 247 | device_proxy.g_properties_changed.connect(() => update_device (object_path)); |
445 | 353 | } catch (Error e) { | 248 | } |
440 | 354 | critical (@"$(e.message)"); | ||
441 | 355 | return; | ||
442 | 356 | } | ||
446 | 357 | 249 | ||
447 | 358 | // look up our id for this device. | 250 | // look up our id for this device. |
448 | 359 | // if we don't have one yet, create one. | 251 | // if we don't have one yet, create one. |
449 | 360 | var object_path = (device_proxy as DBusProxy).get_object_path(); | ||
450 | 361 | var id = path_to_id.lookup (object_path); | 252 | var id = path_to_id.lookup (object_path); |
451 | 362 | if (id == 0) | 253 | if (id == 0) |
452 | 363 | { | 254 | { |
453 | @@ -368,35 +259,32 @@ | |||
454 | 368 | 259 | ||
455 | 369 | // look up the device's type | 260 | // look up the device's type |
456 | 370 | Device.Type type; | 261 | Device.Type type; |
458 | 371 | var v = properties.lookup ("Class"); | 262 | var v = device_proxy.get_cached_property ("Class"); |
459 | 372 | if (v == null) | 263 | if (v == null) |
460 | 373 | type = Device.Type.OTHER; | 264 | type = Device.Type.OTHER; |
461 | 374 | else | 265 | else |
462 | 375 | type = Device.class_to_device_type (v.get_uint32()); | 266 | type = Device.class_to_device_type (v.get_uint32()); |
463 | 376 | 267 | ||
464 | 377 | // look up the device's human-readable name | 268 | // look up the device's human-readable name |
466 | 378 | v = properties.lookup ("Alias"); | 269 | v = device_proxy.get_cached_property ("Alias"); |
467 | 379 | if (v == null) | 270 | if (v == null) |
469 | 380 | v = properties.lookup ("Name"); | 271 | v = device_proxy.get_cached_property ("Name"); |
470 | 381 | var name = v == null ? _("Unknown") : v.get_string (); | 272 | var name = v == null ? _("Unknown") : v.get_string (); |
471 | 382 | 273 | ||
472 | 383 | // look up the device's bus address | 274 | // look up the device's bus address |
474 | 384 | v = properties.lookup ("Address"); | 275 | v = device_proxy.get_cached_property ("Address"); |
475 | 385 | var address = v.get_string (); | 276 | var address = v.get_string (); |
476 | 386 | 277 | ||
477 | 387 | // look up the device's bus address | 278 | // look up the device's bus address |
479 | 388 | v = properties.lookup ("Icon"); | 279 | v = device_proxy.get_cached_property ("Icon"); |
480 | 389 | var icon = new ThemedIcon (v != null ? v.get_string() : "unknown"); | 280 | var icon = new ThemedIcon (v != null ? v.get_string() : "unknown"); |
481 | 390 | 281 | ||
482 | 391 | // derive a Connectable flag for this device | ||
483 | 392 | var is_connectable = device_is_connectable (device_proxy as DBusProxy); | ||
484 | 393 | |||
485 | 394 | // look up the device's Connected flag | 282 | // look up the device's Connected flag |
487 | 395 | v = properties.lookup ("Connected"); | 283 | v = device_proxy.get_cached_property ("Connected"); |
488 | 396 | var is_connected = (v != null) && v.get_boolean (); | 284 | var is_connected = (v != null) && v.get_boolean (); |
489 | 397 | 285 | ||
490 | 398 | // derive the uuid-related attributes we care about | 286 | // derive the uuid-related attributes we care about |
492 | 399 | v = properties.lookup ("UUIDs"); | 287 | v = device_proxy.get_cached_property ("UUIDs"); |
493 | 400 | string[] uuid_strings = v.dup_strv (); | 288 | string[] uuid_strings = v.dup_strv (); |
494 | 401 | uint16[] uuids = {}; | 289 | uint16[] uuids = {}; |
495 | 402 | foreach (var s in uuid_strings) | 290 | foreach (var s in uuid_strings) |
496 | @@ -404,13 +292,12 @@ | |||
497 | 404 | var supports_browsing = device_supports_browsing (uuids); | 292 | var supports_browsing = device_supports_browsing (uuids); |
498 | 405 | var supports_file_transfer = device_supports_file_transfer (uuids); | 293 | var supports_file_transfer = device_supports_file_transfer (uuids); |
499 | 406 | 294 | ||
500 | 407 | // update our lookup table with these new attributes | ||
501 | 408 | id_to_device.insert (id, new Device (id, | 295 | id_to_device.insert (id, new Device (id, |
502 | 409 | type, | 296 | type, |
503 | 410 | name, | 297 | name, |
504 | 411 | address, | 298 | address, |
505 | 412 | icon, | 299 | icon, |
507 | 413 | is_connectable, | 300 | true, |
508 | 414 | is_connected, | 301 | is_connected, |
509 | 415 | supports_browsing, | 302 | supports_browsing, |
510 | 416 | supports_file_transfer)); | 303 | supports_file_transfer)); |
511 | @@ -419,6 +306,16 @@ | |||
512 | 419 | update_connected (); | 306 | update_connected (); |
513 | 420 | } | 307 | } |
514 | 421 | 308 | ||
515 | 309 | private void device_removed (ObjectPath path) | ||
516 | 310 | { | ||
517 | 311 | var id = path_to_id.lookup (path); | ||
518 | 312 | path_to_id.remove (path); | ||
519 | 313 | id_to_path.remove (id); | ||
520 | 314 | id_to_device.remove (id); | ||
521 | 315 | |||
522 | 316 | devices_changed (); | ||
523 | 317 | } | ||
524 | 318 | |||
525 | 422 | /* update the 'enabled' property by looking at the killswitch state | 319 | /* update the 'enabled' property by looking at the killswitch state |
526 | 423 | and the 'powered' property state */ | 320 | and the 'powered' property state */ |
527 | 424 | void update_enabled () | 321 | void update_enabled () |
528 | @@ -452,16 +349,22 @@ | |||
529 | 452 | { | 349 | { |
530 | 453 | var device = id_to_device.lookup (id); | 350 | var device = id_to_device.lookup (id); |
531 | 454 | var path = id_to_path.lookup (id); | 351 | var path = id_to_path.lookup (id); |
533 | 455 | var proxy = (path != null) ? path_to_proxy.lookup (path) : null; | 352 | var proxy = (path != null) ? path_to_device_proxy.lookup (path) : null; |
534 | 456 | 353 | ||
537 | 457 | if ((proxy != null) | 354 | if ((device != null) |
536 | 458 | && (device != null) | ||
538 | 459 | && (device.is_connected != connected)) | 355 | && (device.is_connected != connected)) |
539 | 460 | { | 356 | { |
544 | 461 | if (connected) | 357 | try |
545 | 462 | device_connect (proxy); | 358 | { |
546 | 463 | else | 359 | if (connected) |
547 | 464 | device_disconnect (proxy); | 360 | proxy.connect_ (); |
548 | 361 | else | ||
549 | 362 | proxy.disconnect_ (); | ||
550 | 363 | } | ||
551 | 364 | catch (Error e) | ||
552 | 365 | { | ||
553 | 366 | debug (@"$path org.bluez.Device1 connect/disconnect failed: $(e.message)"); | ||
554 | 367 | } | ||
555 | 465 | 368 | ||
556 | 466 | update_connected (); | 369 | update_connected (); |
557 | 467 | } | 370 | } |
558 | @@ -471,7 +374,13 @@ | |||
559 | 471 | { | 374 | { |
560 | 472 | if (discoverable != b) | 375 | if (discoverable != b) |
561 | 473 | { | 376 | { |
563 | 474 | default_adapter.set_property.begin ("Discoverable", new Variant.boolean (b)); | 377 | var iter = HashTableIter<ObjectPath,BluezAdapter> (path_to_adapter_proxy); |
564 | 378 | ObjectPath object_path; | ||
565 | 379 | BluezAdapter adapter_proxy; | ||
566 | 380 | while (iter.next (out object_path, out adapter_proxy)) | ||
567 | 381 | adapter_proxy.call.begin ("org.freedesktop.DBus.Properties.Set", | ||
568 | 382 | new Variant ("(ssv)", "org.bluez.Adapter1", "Discoverable", new Variant.boolean (b)), | ||
569 | 383 | DBusCallFlags.NONE, -1); | ||
570 | 475 | } | 384 | } |
571 | 476 | } | 385 | } |
572 | 477 | 386 | ||
573 | @@ -492,11 +401,40 @@ | |||
574 | 492 | debug (@"setting killswitch blocked to $(!b)"); | 401 | debug (@"setting killswitch blocked to $(!b)"); |
575 | 493 | killswitch.try_set_blocked (!b); | 402 | killswitch.try_set_blocked (!b); |
576 | 494 | } | 403 | } |
578 | 495 | else if (default_adapter != null) | 404 | else |
579 | 496 | { | 405 | { |
583 | 497 | debug (@"setting bluez Adapter's Powered property to $b"); | 406 | var iter = HashTableIter<ObjectPath,BluezAdapter> (path_to_adapter_proxy); |
584 | 498 | default_adapter.set_property.begin ("Powered", new Variant.boolean (b)); | 407 | ObjectPath object_path; |
585 | 499 | powered = b; | 408 | BluezAdapter adapter_proxy; |
586 | 409 | while (iter.next (out object_path, out adapter_proxy)) | ||
587 | 410 | adapter_proxy.call.begin ("org.freedesktop.DBus.Properties.Set", | ||
588 | 411 | new Variant ("(ssv)", "org.bluez.Adapter1", "Powered", new Variant.boolean (b)), | ||
589 | 412 | DBusCallFlags.NONE, -1); | ||
590 | 500 | } | 413 | } |
591 | 501 | } | 414 | } |
592 | 502 | } | 415 | } |
593 | 416 | |||
594 | 417 | [DBus (name = "org.freedesktop.DBus.ObjectManager")] | ||
595 | 418 | private interface ObjectManager : Object { | ||
596 | 419 | [DBus (name = "GetManagedObjects")] | ||
597 | 420 | public abstract HashTable<ObjectPath, HashTable<string, HashTable<string, Variant>>> get_managed_objects() throws DBusError, IOError; | ||
598 | 421 | |||
599 | 422 | [DBus (name = "InterfacesAdded")] | ||
600 | 423 | public signal void interfaces_added(ObjectPath object_path, HashTable<string, HashTable<string, Variant>> interfaces_and_properties); | ||
601 | 424 | |||
602 | 425 | [DBus (name = "InterfacesRemoved")] | ||
603 | 426 | public signal void interfaces_removed(ObjectPath object_path, string[] interfaces); | ||
604 | 427 | } | ||
605 | 428 | |||
606 | 429 | [DBus (name = "org.bluez.Adapter1")] | ||
607 | 430 | private interface BluezAdapter : DBusProxy { | ||
608 | 431 | } | ||
609 | 432 | |||
610 | 433 | [DBus (name = "org.bluez.Device1")] | ||
611 | 434 | private interface BluezDevice : DBusProxy { | ||
612 | 435 | [DBus (name = "Connect")] | ||
613 | 436 | public abstract void connect_() throws DBusError, IOError; | ||
614 | 437 | |||
615 | 438 | [DBus (name = "Disconnect")] | ||
616 | 439 | public abstract void disconnect_() throws DBusError, IOError; | ||
617 | 440 | } | ||
618 | 503 | 441 | ||
619 | === modified file 'src/desktop.vala' | |||
620 | --- src/desktop.vala 2014-01-21 21:29:37 +0000 | |||
621 | +++ src/desktop.vala 2015-08-07 02:52:49 +0000 | |||
622 | @@ -55,7 +55,6 @@ | |||
623 | 55 | actions += create_supported_action (bluetooth); | 55 | actions += create_supported_action (bluetooth); |
624 | 56 | actions += create_enabled_action (bluetooth); | 56 | actions += create_enabled_action (bluetooth); |
625 | 57 | actions += create_discoverable_action (bluetooth); | 57 | actions += create_discoverable_action (bluetooth); |
626 | 58 | actions += create_wizard_action (); | ||
627 | 59 | actions += create_browse_files_action (); | 58 | actions += create_browse_files_action (); |
628 | 60 | actions += create_send_file_action (); | 59 | actions += create_send_file_action (); |
629 | 61 | actions += create_show_settings_action (); | 60 | actions += create_show_settings_action (); |
630 | @@ -198,8 +197,6 @@ | |||
631 | 198 | 197 | ||
632 | 199 | // settings section | 198 | // settings section |
633 | 200 | section = new Menu (); | 199 | section = new Menu (); |
634 | 201 | section.append (_("Set Up New Device…"), | ||
635 | 202 | "indicator.desktop-wizard"); | ||
636 | 203 | section.append (_("Bluetooth Settings…"), | 200 | section.append (_("Bluetooth Settings…"), |
637 | 204 | "indicator.desktop-show-settings::bluetooth"); | 201 | "indicator.desktop-show-settings::bluetooth"); |
638 | 205 | menu.append_section (null, section); | 202 | menu.append_section (null, section); |
639 | @@ -235,15 +232,6 @@ | |||
640 | 235 | return action; | 232 | return action; |
641 | 236 | } | 233 | } |
642 | 237 | 234 | ||
643 | 238 | Action create_wizard_action () | ||
644 | 239 | { | ||
645 | 240 | var action = new SimpleAction ("desktop-wizard", null); | ||
646 | 241 | |||
647 | 242 | action.activate.connect (() | ||
648 | 243 | => spawn_command_line_async ("bluetooth-wizard")); | ||
649 | 244 | return action; | ||
650 | 245 | } | ||
651 | 246 | |||
652 | 247 | Action create_browse_files_action () | 235 | Action create_browse_files_action () |
653 | 248 | { | 236 | { |
654 | 249 | var action = new SimpleAction ("desktop-browse-files", VariantType.STRING); | 237 | var action = new SimpleAction ("desktop-browse-files", VariantType.STRING); |
655 | 250 | 238 | ||
656 | === removed file 'src/org-bluez.vala' | |||
657 | --- src/org-bluez.vala 2013-10-14 23:33:59 +0000 | |||
658 | +++ src/org-bluez.vala 1970-01-01 00:00:00 +0000 | |||
659 | @@ -1,293 +0,0 @@ | |||
660 | 1 | /* Generated by vala-dbus-binding-tool 0.4.0. Do not modify! */ | ||
661 | 2 | /* Generated with: vala-dbus-binding-tool --gdbus --directory=. */ | ||
662 | 3 | using GLib; | ||
663 | 4 | |||
664 | 5 | namespace org { | ||
665 | 6 | |||
666 | 7 | namespace bluez { | ||
667 | 8 | |||
668 | 9 | [DBus (name = "org.bluez.Manager", timeout = 120000)] | ||
669 | 10 | public interface Manager : GLib.Object { | ||
670 | 11 | |||
671 | 12 | [DBus (name = "GetProperties")] | ||
672 | 13 | public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError; | ||
673 | 14 | |||
674 | 15 | [DBus (name = "DefaultAdapter")] | ||
675 | 16 | public abstract GLib.ObjectPath default_adapter() throws DBusError, IOError; | ||
676 | 17 | |||
677 | 18 | [DBus (name = "FindAdapter")] | ||
678 | 19 | public abstract GLib.ObjectPath find_adapter(string pattern) throws DBusError, IOError; | ||
679 | 20 | |||
680 | 21 | [DBus (name = "ListAdapters")] | ||
681 | 22 | public abstract GLib.ObjectPath[] list_adapters() throws DBusError, IOError; | ||
682 | 23 | |||
683 | 24 | [DBus (name = "PropertyChanged")] | ||
684 | 25 | public signal void property_changed(string name, GLib.Variant value); | ||
685 | 26 | |||
686 | 27 | [DBus (name = "AdapterAdded")] | ||
687 | 28 | public signal void adapter_added(GLib.ObjectPath adapter); | ||
688 | 29 | |||
689 | 30 | [DBus (name = "AdapterRemoved")] | ||
690 | 31 | public signal void adapter_removed(GLib.ObjectPath adapter); | ||
691 | 32 | |||
692 | 33 | [DBus (name = "DefaultAdapterChanged")] | ||
693 | 34 | public signal void default_adapter_changed(GLib.ObjectPath adapter); | ||
694 | 35 | } | ||
695 | 36 | |||
696 | 37 | [DBus (name = "org.bluez.Manager", timeout = 120000)] | ||
697 | 38 | public interface ManagerSync : GLib.Object { | ||
698 | 39 | |||
699 | 40 | [DBus (name = "GetProperties")] | ||
700 | 41 | public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError; | ||
701 | 42 | |||
702 | 43 | [DBus (name = "DefaultAdapter")] | ||
703 | 44 | public abstract GLib.ObjectPath default_adapter() throws DBusError, IOError; | ||
704 | 45 | |||
705 | 46 | [DBus (name = "FindAdapter")] | ||
706 | 47 | public abstract GLib.ObjectPath find_adapter(string pattern) throws DBusError, IOError; | ||
707 | 48 | |||
708 | 49 | [DBus (name = "ListAdapters")] | ||
709 | 50 | public abstract GLib.ObjectPath[] list_adapters() throws DBusError, IOError; | ||
710 | 51 | |||
711 | 52 | [DBus (name = "PropertyChanged")] | ||
712 | 53 | public signal void property_changed(string name, GLib.Variant value); | ||
713 | 54 | |||
714 | 55 | [DBus (name = "AdapterAdded")] | ||
715 | 56 | public signal void adapter_added(GLib.ObjectPath adapter); | ||
716 | 57 | |||
717 | 58 | [DBus (name = "AdapterRemoved")] | ||
718 | 59 | public signal void adapter_removed(GLib.ObjectPath adapter); | ||
719 | 60 | |||
720 | 61 | [DBus (name = "DefaultAdapterChanged")] | ||
721 | 62 | public signal void default_adapter_changed(GLib.ObjectPath adapter); | ||
722 | 63 | } | ||
723 | 64 | |||
724 | 65 | [DBus (name = "org.bluez.Adapter", timeout = 120000)] | ||
725 | 66 | public interface Adapter : GLib.Object { | ||
726 | 67 | |||
727 | 68 | [DBus (name = "GetProperties")] | ||
728 | 69 | public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError; | ||
729 | 70 | |||
730 | 71 | [DBus (name = "SetProperty")] | ||
731 | 72 | public abstract async void set_property(string name, GLib.Variant value) throws DBusError, IOError; | ||
732 | 73 | |||
733 | 74 | [DBus (name = "RequestSession")] | ||
734 | 75 | public abstract void request_session() throws DBusError, IOError; | ||
735 | 76 | |||
736 | 77 | [DBus (name = "ReleaseSession")] | ||
737 | 78 | public abstract void release_session() throws DBusError, IOError; | ||
738 | 79 | |||
739 | 80 | [DBus (name = "StartDiscovery")] | ||
740 | 81 | public abstract void start_discovery() throws DBusError, IOError; | ||
741 | 82 | |||
742 | 83 | [DBus (name = "StopDiscovery")] | ||
743 | 84 | public abstract void stop_discovery() throws DBusError, IOError; | ||
744 | 85 | |||
745 | 86 | [DBus (name = "ListDevices")] | ||
746 | 87 | public abstract GLib.ObjectPath[] list_devices() throws DBusError, IOError; | ||
747 | 88 | |||
748 | 89 | [DBus (name = "CreateDevice")] | ||
749 | 90 | public abstract GLib.ObjectPath create_device(string address) throws DBusError, IOError; | ||
750 | 91 | |||
751 | 92 | [DBus (name = "CreatePairedDevice")] | ||
752 | 93 | public abstract GLib.ObjectPath create_paired_device(string address, GLib.ObjectPath agent, string capability) throws DBusError, IOError; | ||
753 | 94 | |||
754 | 95 | [DBus (name = "CancelDeviceCreation")] | ||
755 | 96 | public abstract void cancel_device_creation(string address) throws DBusError, IOError; | ||
756 | 97 | |||
757 | 98 | [DBus (name = "RemoveDevice")] | ||
758 | 99 | public abstract void remove_device(GLib.ObjectPath device) throws DBusError, IOError; | ||
759 | 100 | |||
760 | 101 | [DBus (name = "FindDevice")] | ||
761 | 102 | public abstract GLib.ObjectPath find_device(string address) throws DBusError, IOError; | ||
762 | 103 | |||
763 | 104 | [DBus (name = "RegisterAgent")] | ||
764 | 105 | public abstract void register_agent(GLib.ObjectPath agent, string capability) throws DBusError, IOError; | ||
765 | 106 | |||
766 | 107 | [DBus (name = "UnregisterAgent")] | ||
767 | 108 | public abstract void unregister_agent(GLib.ObjectPath agent) throws DBusError, IOError; | ||
768 | 109 | |||
769 | 110 | [DBus (name = "PropertyChanged")] | ||
770 | 111 | public signal void property_changed(string name, GLib.Variant value); | ||
771 | 112 | |||
772 | 113 | [DBus (name = "DeviceCreated")] | ||
773 | 114 | public signal void device_created(GLib.ObjectPath device); | ||
774 | 115 | |||
775 | 116 | [DBus (name = "DeviceRemoved")] | ||
776 | 117 | public signal void device_removed(GLib.ObjectPath device); | ||
777 | 118 | |||
778 | 119 | [DBus (name = "DeviceFound")] | ||
779 | 120 | public signal void device_found(string address, GLib.HashTable<string, GLib.Variant> values); | ||
780 | 121 | |||
781 | 122 | [DBus (name = "DeviceDisappeared")] | ||
782 | 123 | public signal void device_disappeared(string address); | ||
783 | 124 | } | ||
784 | 125 | |||
785 | 126 | [DBus (name = "org.bluez.Adapter", timeout = 120000)] | ||
786 | 127 | public interface AdapterSync : GLib.Object { | ||
787 | 128 | |||
788 | 129 | [DBus (name = "GetProperties")] | ||
789 | 130 | public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError; | ||
790 | 131 | |||
791 | 132 | [DBus (name = "SetProperty")] | ||
792 | 133 | public abstract void set_property(string name, GLib.Variant value) throws DBusError, IOError; | ||
793 | 134 | |||
794 | 135 | [DBus (name = "RequestSession")] | ||
795 | 136 | public abstract void request_session() throws DBusError, IOError; | ||
796 | 137 | |||
797 | 138 | [DBus (name = "ReleaseSession")] | ||
798 | 139 | public abstract void release_session() throws DBusError, IOError; | ||
799 | 140 | |||
800 | 141 | [DBus (name = "StartDiscovery")] | ||
801 | 142 | public abstract void start_discovery() throws DBusError, IOError; | ||
802 | 143 | |||
803 | 144 | [DBus (name = "StopDiscovery")] | ||
804 | 145 | public abstract void stop_discovery() throws DBusError, IOError; | ||
805 | 146 | |||
806 | 147 | [DBus (name = "ListDevices")] | ||
807 | 148 | public abstract GLib.ObjectPath[] list_devices() throws DBusError, IOError; | ||
808 | 149 | |||
809 | 150 | [DBus (name = "CreateDevice")] | ||
810 | 151 | public abstract GLib.ObjectPath create_device(string address) throws DBusError, IOError; | ||
811 | 152 | |||
812 | 153 | [DBus (name = "CreatePairedDevice")] | ||
813 | 154 | public abstract GLib.ObjectPath create_paired_device(string address, GLib.ObjectPath agent, string capability) throws DBusError, IOError; | ||
814 | 155 | |||
815 | 156 | [DBus (name = "CancelDeviceCreation")] | ||
816 | 157 | public abstract void cancel_device_creation(string address) throws DBusError, IOError; | ||
817 | 158 | |||
818 | 159 | [DBus (name = "RemoveDevice")] | ||
819 | 160 | public abstract void remove_device(GLib.ObjectPath device) throws DBusError, IOError; | ||
820 | 161 | |||
821 | 162 | [DBus (name = "FindDevice")] | ||
822 | 163 | public abstract GLib.ObjectPath find_device(string address) throws DBusError, IOError; | ||
823 | 164 | |||
824 | 165 | [DBus (name = "RegisterAgent")] | ||
825 | 166 | public abstract void register_agent(GLib.ObjectPath agent, string capability) throws DBusError, IOError; | ||
826 | 167 | |||
827 | 168 | [DBus (name = "UnregisterAgent")] | ||
828 | 169 | public abstract void unregister_agent(GLib.ObjectPath agent) throws DBusError, IOError; | ||
829 | 170 | |||
830 | 171 | [DBus (name = "PropertyChanged")] | ||
831 | 172 | public signal void property_changed(string name, GLib.Variant value); | ||
832 | 173 | |||
833 | 174 | [DBus (name = "DeviceCreated")] | ||
834 | 175 | public signal void device_created(GLib.ObjectPath device); | ||
835 | 176 | |||
836 | 177 | [DBus (name = "DeviceRemoved")] | ||
837 | 178 | public signal void device_removed(GLib.ObjectPath device); | ||
838 | 179 | |||
839 | 180 | [DBus (name = "DeviceFound")] | ||
840 | 181 | public signal void device_found(string address, GLib.HashTable<string, GLib.Variant> values); | ||
841 | 182 | |||
842 | 183 | [DBus (name = "DeviceDisappeared")] | ||
843 | 184 | public signal void device_disappeared(string address); | ||
844 | 185 | } | ||
845 | 186 | |||
846 | 187 | [DBus (name = "org.bluez.Agent", timeout = 120000)] | ||
847 | 188 | public interface Agent : GLib.Object { | ||
848 | 189 | |||
849 | 190 | [DBus (name = "Authorize")] | ||
850 | 191 | public abstract void authorize(GLib.ObjectPath device, string uuid) throws DBusError, IOError; | ||
851 | 192 | |||
852 | 193 | [DBus (name = "RequestPinCode")] | ||
853 | 194 | public abstract string request_pin_code(GLib.ObjectPath device) throws DBusError, IOError; | ||
854 | 195 | |||
855 | 196 | [DBus (name = "DisplayPasskey")] | ||
856 | 197 | public abstract void display_passkey(GLib.ObjectPath device, uint passkey) throws DBusError, IOError; | ||
857 | 198 | |||
858 | 199 | [DBus (name = "Release")] | ||
859 | 200 | public abstract void release() throws DBusError, IOError; | ||
860 | 201 | |||
861 | 202 | [DBus (name = "Cancel")] | ||
862 | 203 | public abstract void cancel() throws DBusError, IOError; | ||
863 | 204 | |||
864 | 205 | [DBus (name = "RequestConfirmation")] | ||
865 | 206 | public abstract void request_confirmation(GLib.ObjectPath device, uint passkey) throws DBusError, IOError; | ||
866 | 207 | |||
867 | 208 | [DBus (name = "ConfirmModeChange")] | ||
868 | 209 | public abstract void confirm_mode_change(string mode) throws DBusError, IOError; | ||
869 | 210 | |||
870 | 211 | [DBus (name = "RequestPasskey")] | ||
871 | 212 | public abstract uint request_passkey(GLib.ObjectPath device) throws DBusError, IOError; | ||
872 | 213 | } | ||
873 | 214 | |||
874 | 215 | [DBus (name = "org.bluez.Agent", timeout = 120000)] | ||
875 | 216 | public interface AgentSync : GLib.Object { | ||
876 | 217 | |||
877 | 218 | [DBus (name = "Authorize")] | ||
878 | 219 | public abstract void authorize(GLib.ObjectPath device, string uuid) throws DBusError, IOError; | ||
879 | 220 | |||
880 | 221 | [DBus (name = "RequestPinCode")] | ||
881 | 222 | public abstract string request_pin_code(GLib.ObjectPath device) throws DBusError, IOError; | ||
882 | 223 | |||
883 | 224 | [DBus (name = "DisplayPasskey")] | ||
884 | 225 | public abstract void display_passkey(GLib.ObjectPath device, uint passkey) throws DBusError, IOError; | ||
885 | 226 | |||
886 | 227 | [DBus (name = "Release")] | ||
887 | 228 | public abstract void release() throws DBusError, IOError; | ||
888 | 229 | |||
889 | 230 | [DBus (name = "Cancel")] | ||
890 | 231 | public abstract void cancel() throws DBusError, IOError; | ||
891 | 232 | |||
892 | 233 | [DBus (name = "RequestConfirmation")] | ||
893 | 234 | public abstract void request_confirmation(GLib.ObjectPath device, uint passkey) throws DBusError, IOError; | ||
894 | 235 | |||
895 | 236 | [DBus (name = "ConfirmModeChange")] | ||
896 | 237 | public abstract void confirm_mode_change(string mode) throws DBusError, IOError; | ||
897 | 238 | |||
898 | 239 | [DBus (name = "RequestPasskey")] | ||
899 | 240 | public abstract uint request_passkey(GLib.ObjectPath device) throws DBusError, IOError; | ||
900 | 241 | } | ||
901 | 242 | |||
902 | 243 | [DBus (name = "org.bluez.Device", timeout = 120000)] | ||
903 | 244 | public interface Device : GLib.Object { | ||
904 | 245 | |||
905 | 246 | [DBus (name = "GetProperties")] | ||
906 | 247 | public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError; | ||
907 | 248 | |||
908 | 249 | [DBus (name = "SetProperty")] | ||
909 | 250 | public abstract void set_property(string name, GLib.Variant value) throws DBusError, IOError; | ||
910 | 251 | |||
911 | 252 | [DBus (name = "DiscoverServices")] | ||
912 | 253 | public abstract GLib.HashTable<uint, string> discover_services(string pattern) throws DBusError, IOError; | ||
913 | 254 | |||
914 | 255 | [DBus (name = "CancelDiscovery")] | ||
915 | 256 | public abstract void cancel_discovery() throws DBusError, IOError; | ||
916 | 257 | |||
917 | 258 | [DBus (name = "Disconnect")] | ||
918 | 259 | public abstract void disconnect() throws DBusError, IOError; | ||
919 | 260 | |||
920 | 261 | [DBus (name = "PropertyChanged")] | ||
921 | 262 | public signal void property_changed(string name, GLib.Variant value); | ||
922 | 263 | |||
923 | 264 | [DBus (name = "DisconnectRequested")] | ||
924 | 265 | public signal void disconnect_requested(); | ||
925 | 266 | } | ||
926 | 267 | |||
927 | 268 | [DBus (name = "org.bluez.Device", timeout = 120000)] | ||
928 | 269 | public interface DeviceSync : GLib.Object { | ||
929 | 270 | |||
930 | 271 | [DBus (name = "GetProperties")] | ||
931 | 272 | public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError; | ||
932 | 273 | |||
933 | 274 | [DBus (name = "SetProperty")] | ||
934 | 275 | public abstract void set_property(string name, GLib.Variant value) throws DBusError, IOError; | ||
935 | 276 | |||
936 | 277 | [DBus (name = "DiscoverServices")] | ||
937 | 278 | public abstract GLib.HashTable<uint, string> discover_services(string pattern) throws DBusError, IOError; | ||
938 | 279 | |||
939 | 280 | [DBus (name = "CancelDiscovery")] | ||
940 | 281 | public abstract void cancel_discovery() throws DBusError, IOError; | ||
941 | 282 | |||
942 | 283 | [DBus (name = "Disconnect")] | ||
943 | 284 | public abstract void disconnect() throws DBusError, IOError; | ||
944 | 285 | |||
945 | 286 | [DBus (name = "PropertyChanged")] | ||
946 | 287 | public signal void property_changed(string name, GLib.Variant value); | ||
947 | 288 | |||
948 | 289 | [DBus (name = "DisconnectRequested")] | ||
949 | 290 | public signal void disconnect_requested(); | ||
950 | 291 | } | ||
951 | 292 | } | ||
952 | 293 | } |
PASSED: Continuous integration, rev:88 jenkins. qa.ubuntu. com/job/ indicator- bluetooth- ci/38/ jenkins. qa.ubuntu. com/job/ indicator- bluetooth- vivid-amd64- ci/1 jenkins. qa.ubuntu. com/job/ indicator- bluetooth- vivid-armhf- ci/1 jenkins. qa.ubuntu. com/job/ indicator- bluetooth- vivid-armhf- ci/1/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/indicator- bluetooth- ci/38/rebuild
http://