Merge lp:~robert-ancell/indicator-bluetooth/bluez5 into lp:indicator-bluetooth/15.04

Proposed by Robert Ancell
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
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-center panel for device setup.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
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!

review: Approve
Revision history for this message
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.

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

This is already in the transitions PPA as indicator-bluetooth 0.0.6+14.10.20141006-0ubuntu1+bluezfive

Revision history for this message
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://wiki.ubuntu.com/Bluetooth#Indicator_and_menu but is removed here. Can it be salvaged?

* After installing [bluez, indicator-bluetooth, libbluetooth3] on mako running vivid r136. The indicator's bluetooth on/off toggle had no effect. (This might be user error; I don't know if this PPA is supposed to work on the phone...)

* The transitions repository doesn't have unity-control-center in it, so I don't know how far we are for landing this in Vivid?

* The visible/invisible toggle in gnome-control-center didn't show the same state as the indicator. The indicator seemed to hold the correct state.

Revision history for this message
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-01-14 04:39:09 +0000
+++ debian/control 2015-08-07 02:52:49 +0000
@@ -21,7 +21,7 @@
21Architecture: any21Architecture: any
22Depends: ${misc:Depends},22Depends: ${misc:Depends},
23 ${shlibs:Depends},23 ${shlibs:Depends},
24 bluez (>= 4.36),24 bluez (>= 5),
25 unity-control-center | gnome-control-center | ubuntu-system-settings,25 unity-control-center | gnome-control-center | ubuntu-system-settings,
26 gnome-bluetooth | ubuntu-system-settings,26 gnome-bluetooth | ubuntu-system-settings,
27Replaces: gnome-bluetooth (<< 3.6.1-0ubuntu2)27Replaces: gnome-bluetooth (<< 3.6.1-0ubuntu2)
2828
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2013-10-01 11:06:27 +0000
+++ po/POTFILES.in 2015-08-07 02:52:49 +0000
@@ -8,7 +8,6 @@
8src/device.vala8src/device.vala
9src/killswitch.vala9src/killswitch.vala
10src/main.vala10src/main.vala
11src/org-bluez.vala
12src/phone.vala11src/phone.vala
13src/profile.vala12src/profile.vala
14src/service.vala13src/service.vala
1514
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2013-09-25 20:06:30 +0000
+++ src/Makefile.am 2015-08-07 02:52:49 +0000
@@ -1,7 +1,6 @@
1pkglibexec_PROGRAMS = indicator-bluetooth-service1pkglibexec_PROGRAMS = indicator-bluetooth-service
22
3indicator_bluetooth_service_SOURCES = \3indicator_bluetooth_service_SOURCES = \
4 org-bluez.vala \
5 bluetooth.vala \4 bluetooth.vala \
6 bluez.vala \5 bluez.vala \
7 desktop.vala \6 desktop.vala \
87
=== modified file 'src/bluez.vala'
--- src/bluez.vala 2014-09-22 13:54:50 +0000
+++ src/bluez.vala 2015-08-07 02:52:49 +0000
@@ -25,8 +25,7 @@
25public class Bluez: Bluetooth, Object25public class Bluez: Bluetooth, Object
26{26{
27 uint next_device_id = 1;27 uint next_device_id = 1;
28 org.bluez.Manager manager;28 ObjectManager manager;
29 org.bluez.Adapter default_adapter;
3029
31 private bool _powered = false;30 private bool _powered = false;
3231
@@ -37,21 +36,22 @@
3736
38 private KillSwitch killswitch = new RfKillSwitch ();37 private KillSwitch killswitch = new RfKillSwitch ();
3938
40 private string adapter_path = null;
41
42 private DBusConnection bus = null;39 private DBusConnection bus = null;
4340
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 */
45 HashTable<string,org.bluez.Device> path_to_proxy;42 private HashTable<ObjectPath,BluezAdapter> path_to_adapter_proxy;
4643
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 */
48 HashTable<string,uint> path_to_id;45 private HashTable<ObjectPath,BluezDevice> path_to_device_proxy;
46
47 /* maps an org.bluez.Device1's object_path to our arbitrary unique id */
48 private HashTable<ObjectPath,uint> path_to_id;
4949
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 */
51 HashTable<uint,string> id_to_path;51 private HashTable<uint,ObjectPath> id_to_path;
5252
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 */
54 HashTable<uint,Device> id_to_device;54 private HashTable<uint,Device> id_to_device;
5555
56 public Bluez (KillSwitch? killswitch)56 public Bluez (KillSwitch? killswitch)
57 {57 {
@@ -71,121 +71,116 @@
71 update_enabled ();71 update_enabled ();
72 }72 }
7373
74 id_to_path = new HashTable<uint,string> (direct_hash, direct_equal);
75 id_to_device = new HashTable<uint,Device> (direct_hash, direct_equal);
76 path_to_id = new HashTable<string,uint> (str_hash, str_equal);
77 path_to_proxy = new HashTable<string,org.bluez.Device> (str_hash, str_equal);
78
79 reset_manager ();74 reset_manager ();
80 }75 }
8176
82 private void reset_manager ()77 private void reset_manager ()
83 {78 {
84 string new_adapter_path = null;79 id_to_path = new HashTable<uint,ObjectPath> (direct_hash, direct_equal);
80 id_to_device = new HashTable<uint,Device> (direct_hash, direct_equal);
81 path_to_id = new HashTable<ObjectPath,uint> (str_hash, str_equal);
82 path_to_adapter_proxy = new HashTable<ObjectPath,BluezAdapter> (str_hash, str_equal);
83 path_to_device_proxy = new HashTable<ObjectPath,BluezDevice> (str_hash, str_equal);
84
85 try85 try
86 {86 {
87 manager = bus.get_proxy_sync ("org.bluez", "/");87 manager = bus.get_proxy_sync ("org.bluez", "/");
8888
89 // if the default adapter changes, update our connections89 // Find the adapters and watch for changes
90 manager.default_adapter_changed.connect ((object_path)90 manager.interfaces_added.connect ((object_path, interfaces_and_properties) => {
91 => on_default_adapter_changed (object_path));91 var iter = HashTableIter<string, HashTable<string, Variant>> (interfaces_and_properties);
9292 string name;
93 // if the current adapter disappears, call clear_adapter()93 while (iter.next (out name, null))
94 manager.adapter_removed.connect ((object_path) => { 94 {
95 if (object_path == adapter_path)95 if (name == "org.bluez.Adapter1")
96 clear_adapter ();96 update_adapter (object_path);
97 });97 if (name == "org.bluez.Device1")
9898 update_device (object_path);
99 // get the current default adapter & watch for future default adapters99 }
100 new_adapter_path = manager.default_adapter ();100 });
101 manager.interfaces_removed.connect ((object_path, interfaces) => {
102 foreach (var interface in interfaces) {
103 if (interface == "org.bluez.Adapter1")
104 adapter_removed (object_path);
105 if (interface == "org.bluez.Device1")
106 device_removed (object_path);
107 }
108 });
109 var objects = manager.get_managed_objects ();
110 var object_iter = HashTableIter<ObjectPath, HashTable<string, HashTable<string, Variant>>> (objects);
111 ObjectPath object_path;
112 HashTable<string, HashTable<string, Variant>> interfaces_and_properties;
113 while (object_iter.next (out object_path, out interfaces_and_properties))
114 {
115 var iter = HashTableIter<string, HashTable<string, Variant>> (interfaces_and_properties);
116 string name;
117 while (iter.next (out name, null)) {
118 if (name == "org.bluez.Adapter1")
119 update_adapter (object_path);
120 if (name == "org.bluez.Device1")
121 update_device (object_path);
122 }
123 }
101 }124 }
102 catch (Error e)125 catch (Error e)
103 {126 {
104 critical (@"$(e.message)");127 critical (@"$(e.message)");
105 }128 }
106129 }
107 on_default_adapter_changed (new_adapter_path);130
108 }131 ////
109132 //// Adapter Upkeep
110 private void clear_adapter ()133 ////
111 {134
112 if (adapter_path != null)135 private void update_adapter (ObjectPath object_path)
113 debug (@"clearing adapter; was using $adapter_path");136 {
114137 // Create a proxy if we don't have one
115 path_to_proxy.remove_all ();138 var adapter_proxy = path_to_adapter_proxy.lookup (object_path);
116 path_to_id.remove_all ();139 if (adapter_proxy == null)
117 id_to_path.remove_all ();140 {
118 id_to_device.remove_all ();141 try {
119142 adapter_proxy = bus.get_proxy_sync ("org.bluez", object_path);
120 default_adapter = null;143 } catch (Error e) {
121 adapter_path = null;144 critical (@"$(e.message)");
122145 return;
123 discoverable = false;146 }
124 powered = false;147 path_to_adapter_proxy.insert (object_path, adapter_proxy);
125 }148 adapter_proxy.g_properties_changed.connect(() => update_adapter (object_path));
126149 }
127 void on_default_adapter_changed (string? object_path)150
128 {151 update_combined_adapter_state ();
129 clear_adapter ();152 }
130153
131 if (object_path != null) try154 private void adapter_removed (ObjectPath object_path)
132 {155 {
133 adapter_path = object_path;156 path_to_adapter_proxy.remove (object_path);
134 default_adapter = Bus.get_proxy_sync (BusType.SYSTEM,157 update_combined_adapter_state ();
135 "org.bluez",158 }
136 adapter_path);159
137160 private void update_combined_adapter_state ()
138 default_adapter.property_changed.connect (()161 {
139 => on_default_adapter_properties_changed ());162 var is_discoverable = false;
140163 var is_powered = false;
141 default_adapter.device_removed.connect ((adapter, path) => {164 var is_supported = false;
142 var id = path_to_id.lookup (path);165
143 path_to_id.remove (path);166 var iter = HashTableIter<ObjectPath,BluezAdapter> (path_to_adapter_proxy);
144 id_to_path.remove (id);167 BluezAdapter adapter_proxy;
145 id_to_device.remove (id);168 while (iter.next (null, out adapter_proxy))
146 devices_changed ();169 {
147 });170 var v = adapter_proxy.get_cached_property ("Discoverable");
148171 if (!is_discoverable)
149 default_adapter.device_created.connect ((adapter, path)172 is_discoverable = (v != null) && v.get_boolean ();
150 => add_device (path));173
151174 v = adapter_proxy.get_cached_property ("Powered");
152 foreach (var device_path in default_adapter.list_devices ())175 if (!is_powered)
153 add_device (device_path);176 is_powered = (v != null) && v.get_boolean ();
154 }177
155 catch (Error e)178 is_supported = true;
156 {179 }
157 critical (@"$(e.message)");180
158 }181 discoverable = is_discoverable;
159
160 supported = object_path != null;
161
162 on_default_adapter_properties_changed ();
163 }
164
165 /* When the default adapter's properties change,
166 update our own properties "powered" and "discoverable" */
167 private void on_default_adapter_properties_changed ()
168 {
169 bool is_discoverable = false;
170 bool is_powered = false;
171
172 if (default_adapter != null) try
173 {
174 var properties = default_adapter.get_properties ();
175
176 var v = properties.lookup ("Discoverable");
177 is_discoverable = (v != null) && v.get_boolean ();
178
179 v = properties.lookup ("Powered");
180 is_powered = (v != null) && v.get_boolean ();
181 }
182 catch (Error e)
183 {
184 critical (@"$(e.message)");
185 }
186
187 powered = is_powered;182 powered = is_powered;
188 discoverable = is_discoverable;183 supported = is_supported;
189 }184 }
190185
191 ////186 ////
@@ -226,138 +221,34 @@
226 }221 }
227222
228 ////223 ////
229 //// Connectable Interfaces
230 ////
231
232 /* Headsets, Audio Sinks, and Input devices are connectable.
233 *
234 * This continues the behavior of the old gnome-bluetooth indicator.
235 * But are there other interfaces we care about? */
236 private DBusInterfaceInfo[] get_connectable_interfaces (DBusProxy device)
237 {
238 DBusInterfaceInfo[] connectable_interfaces = {};
239
240 try
241 {
242 var iname = "org.freedesktop.DBus.Introspectable.Introspect";
243 var intro = device.call_sync (iname, null, DBusCallFlags.NONE, -1);
244
245 if ((intro != null) && (intro.n_children() > 0))
246 {
247 var xml = intro.get_child_value(0).get_string();
248 var info = new DBusNodeInfo.for_xml (xml);
249 if (info != null)
250 {
251 foreach (var i in info.interfaces)
252 {
253 if ((i.name == "org.bluez.AudioSink") ||
254 (i.name == "org.bluez.Headset") ||
255 (i.name == "org.bluez.Input"))
256 {
257 connectable_interfaces += i;
258 }
259 }
260 }
261 }
262 }
263 catch (Error e)
264 {
265 critical (@"$(e.message)");
266 }
267
268 return connectable_interfaces;
269 }
270
271 private bool device_is_connectable (DBusProxy device)
272 {
273 return get_connectable_interfaces (device).length > 0;
274 }
275
276 // call "Connect" on the specified interface
277 private void device_connect_on_interface (DBusProxy proxy,
278 string interface_name)
279 {
280 var object_path = proxy.get_object_path ();
281
282 debug (@"trying to connect to $object_path: $(interface_name)");
283
284 try
285 {
286 bus.call_sync ("org.bluez", object_path, interface_name,
287 "Connect", null, null, DBusCallFlags.NONE, -1);
288 }
289 catch (Error e)
290 {
291 debug (@"$object_path $interface_name.Connect() failed: $(e.message)");
292 }
293 }
294
295 private void device_connect (org.bluez.Device device)
296 {
297 DBusProxy proxy = device as DBusProxy;
298
299 // call "Connect" on all the interfaces that support it
300 foreach (var i in get_connectable_interfaces (proxy))
301 device_connect_on_interface (proxy, i.name);
302 }
303
304 private void device_disconnect (org.bluez.Device device)
305 {
306 try
307 {
308 device.disconnect ();
309 }
310 catch (Error e)
311 {
312 var object_path = (device as DBusProxy).get_object_path ();
313 critical (@"Unable to disconnect $object_path: $(e.message)");
314 }
315 }
316
317 ////
318 //// Device Upkeep224 //// Device Upkeep
319 ////225 ////
320226
321 private void add_device (string object_path)
322 {
323 if (!path_to_proxy.contains (object_path))
324 {
325 try
326 {
327 org.bluez.Device device = Bus.get_proxy_sync (BusType.SYSTEM,
328 "org.bluez",
329 object_path);
330 path_to_proxy.insert (object_path, device);
331 device.property_changed.connect(() => update_device (device));
332 update_device (device);
333 }
334 catch (Error e)
335 {
336 critical (@"$(e.message)");
337 }
338 }
339 }
340
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.
342 *228 *
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,
344 * when the org.bluez.Adapter gets a new device,230 * when the org.bluez.Adapter gets a new device,
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.
346 */232 */
347 private void update_device (org.bluez.Device device_proxy)233 private void update_device (ObjectPath object_path)
348 {234 {
349 HashTable<string, GLib.Variant> properties;235 // Create a proxy if we don't have one
236 var device_proxy = path_to_device_proxy.lookup (object_path);
237 if (device_proxy == null)
238 {
239 try {
240 device_proxy = bus.get_proxy_sync ("org.bluez", object_path);
241 } catch (Error e) {
242 critical (@"$(e.message)");
243 return;
244 }
350245
351 try {246 path_to_device_proxy.insert (object_path, device_proxy);
352 properties = device_proxy.get_properties ();247 device_proxy.g_properties_changed.connect(() => update_device (object_path));
353 } catch (Error e) {248 }
354 critical (@"$(e.message)");
355 return;
356 }
357249
358 // look up our id for this device.250 // look up our id for this device.
359 // if we don't have one yet, create one.251 // if we don't have one yet, create one.
360 var object_path = (device_proxy as DBusProxy).get_object_path();
361 var id = path_to_id.lookup (object_path);252 var id = path_to_id.lookup (object_path);
362 if (id == 0)253 if (id == 0)
363 {254 {
@@ -368,35 +259,32 @@
368259
369 // look up the device's type260 // look up the device's type
370 Device.Type type;261 Device.Type type;
371 var v = properties.lookup ("Class");262 var v = device_proxy.get_cached_property ("Class");
372 if (v == null)263 if (v == null)
373 type = Device.Type.OTHER;264 type = Device.Type.OTHER;
374 else 265 else
375 type = Device.class_to_device_type (v.get_uint32());266 type = Device.class_to_device_type (v.get_uint32());
376267
377 // look up the device's human-readable name268 // look up the device's human-readable name
378 v = properties.lookup ("Alias");269 v = device_proxy.get_cached_property ("Alias");
379 if (v == null)270 if (v == null)
380 v = properties.lookup ("Name");271 v = device_proxy.get_cached_property ("Name");
381 var name = v == null ? _("Unknown") : v.get_string ();272 var name = v == null ? _("Unknown") : v.get_string ();
382273
383 // look up the device's bus address274 // look up the device's bus address
384 v = properties.lookup ("Address");275 v = device_proxy.get_cached_property ("Address");
385 var address = v.get_string ();276 var address = v.get_string ();
386277
387 // look up the device's bus address278 // look up the device's bus address
388 v = properties.lookup ("Icon");279 v = device_proxy.get_cached_property ("Icon");
389 var icon = new ThemedIcon (v != null ? v.get_string() : "unknown");280 var icon = new ThemedIcon (v != null ? v.get_string() : "unknown");
390281
391 // derive a Connectable flag for this device
392 var is_connectable = device_is_connectable (device_proxy as DBusProxy);
393
394 // look up the device's Connected flag282 // look up the device's Connected flag
395 v = properties.lookup ("Connected");283 v = device_proxy.get_cached_property ("Connected");
396 var is_connected = (v != null) && v.get_boolean ();284 var is_connected = (v != null) && v.get_boolean ();
397285
398 // derive the uuid-related attributes we care about286 // derive the uuid-related attributes we care about
399 v = properties.lookup ("UUIDs");287 v = device_proxy.get_cached_property ("UUIDs");
400 string[] uuid_strings = v.dup_strv ();288 string[] uuid_strings = v.dup_strv ();
401 uint16[] uuids = {};289 uint16[] uuids = {};
402 foreach (var s in uuid_strings)290 foreach (var s in uuid_strings)
@@ -404,13 +292,12 @@
404 var supports_browsing = device_supports_browsing (uuids);292 var supports_browsing = device_supports_browsing (uuids);
405 var supports_file_transfer = device_supports_file_transfer (uuids);293 var supports_file_transfer = device_supports_file_transfer (uuids);
406294
407 // update our lookup table with these new attributes
408 id_to_device.insert (id, new Device (id,295 id_to_device.insert (id, new Device (id,
409 type,296 type,
410 name,297 name,
411 address,298 address,
412 icon,299 icon,
413 is_connectable,300 true,
414 is_connected,301 is_connected,
415 supports_browsing,302 supports_browsing,
416 supports_file_transfer));303 supports_file_transfer));
@@ -419,6 +306,16 @@
419 update_connected ();306 update_connected ();
420 }307 }
421308
309 private void device_removed (ObjectPath path)
310 {
311 var id = path_to_id.lookup (path);
312 path_to_id.remove (path);
313 id_to_path.remove (id);
314 id_to_device.remove (id);
315
316 devices_changed ();
317 }
318
422 /* update the 'enabled' property by looking at the killswitch state319 /* update the 'enabled' property by looking at the killswitch state
423 and the 'powered' property state */320 and the 'powered' property state */
424 void update_enabled ()321 void update_enabled ()
@@ -452,16 +349,22 @@
452 {349 {
453 var device = id_to_device.lookup (id);350 var device = id_to_device.lookup (id);
454 var path = id_to_path.lookup (id);351 var path = id_to_path.lookup (id);
455 var proxy = (path != null) ? path_to_proxy.lookup (path) : null;352 var proxy = (path != null) ? path_to_device_proxy.lookup (path) : null;
456353
457 if ((proxy != null)354 if ((device != null)
458 && (device != null)
459 && (device.is_connected != connected))355 && (device.is_connected != connected))
460 {356 {
461 if (connected)357 try
462 device_connect (proxy);358 {
463 else359 if (connected)
464 device_disconnect (proxy);360 proxy.connect_ ();
361 else
362 proxy.disconnect_ ();
363 }
364 catch (Error e)
365 {
366 debug (@"$path org.bluez.Device1 connect/disconnect failed: $(e.message)");
367 }
465368
466 update_connected ();369 update_connected ();
467 }370 }
@@ -471,7 +374,13 @@
471 {374 {
472 if (discoverable != b)375 if (discoverable != b)
473 {376 {
474 default_adapter.set_property.begin ("Discoverable", new Variant.boolean (b));377 var iter = HashTableIter<ObjectPath,BluezAdapter> (path_to_adapter_proxy);
378 ObjectPath object_path;
379 BluezAdapter adapter_proxy;
380 while (iter.next (out object_path, out adapter_proxy))
381 adapter_proxy.call.begin ("org.freedesktop.DBus.Properties.Set",
382 new Variant ("(ssv)", "org.bluez.Adapter1", "Discoverable", new Variant.boolean (b)),
383 DBusCallFlags.NONE, -1);
475 }384 }
476 }385 }
477386
@@ -492,11 +401,40 @@
492 debug (@"setting killswitch blocked to $(!b)");401 debug (@"setting killswitch blocked to $(!b)");
493 killswitch.try_set_blocked (!b);402 killswitch.try_set_blocked (!b);
494 }403 }
495 else if (default_adapter != null)404 else
496 {405 {
497 debug (@"setting bluez Adapter's Powered property to $b");406 var iter = HashTableIter<ObjectPath,BluezAdapter> (path_to_adapter_proxy);
498 default_adapter.set_property.begin ("Powered", new Variant.boolean (b));407 ObjectPath object_path;
499 powered = b;408 BluezAdapter adapter_proxy;
409 while (iter.next (out object_path, out adapter_proxy))
410 adapter_proxy.call.begin ("org.freedesktop.DBus.Properties.Set",
411 new Variant ("(ssv)", "org.bluez.Adapter1", "Powered", new Variant.boolean (b)),
412 DBusCallFlags.NONE, -1);
500 }413 }
501 }414 }
502}415}
416
417[DBus (name = "org.freedesktop.DBus.ObjectManager")]
418private interface ObjectManager : Object {
419 [DBus (name = "GetManagedObjects")]
420 public abstract HashTable<ObjectPath, HashTable<string, HashTable<string, Variant>>> get_managed_objects() throws DBusError, IOError;
421
422 [DBus (name = "InterfacesAdded")]
423 public signal void interfaces_added(ObjectPath object_path, HashTable<string, HashTable<string, Variant>> interfaces_and_properties);
424
425 [DBus (name = "InterfacesRemoved")]
426 public signal void interfaces_removed(ObjectPath object_path, string[] interfaces);
427}
428
429[DBus (name = "org.bluez.Adapter1")]
430private interface BluezAdapter : DBusProxy {
431}
432
433[DBus (name = "org.bluez.Device1")]
434private interface BluezDevice : DBusProxy {
435 [DBus (name = "Connect")]
436 public abstract void connect_() throws DBusError, IOError;
437
438 [DBus (name = "Disconnect")]
439 public abstract void disconnect_() throws DBusError, IOError;
440}
503441
=== modified file 'src/desktop.vala'
--- src/desktop.vala 2014-01-21 21:29:37 +0000
+++ src/desktop.vala 2015-08-07 02:52:49 +0000
@@ -55,7 +55,6 @@
55 actions += create_supported_action (bluetooth);55 actions += create_supported_action (bluetooth);
56 actions += create_enabled_action (bluetooth);56 actions += create_enabled_action (bluetooth);
57 actions += create_discoverable_action (bluetooth);57 actions += create_discoverable_action (bluetooth);
58 actions += create_wizard_action ();
59 actions += create_browse_files_action ();58 actions += create_browse_files_action ();
60 actions += create_send_file_action ();59 actions += create_send_file_action ();
61 actions += create_show_settings_action ();60 actions += create_show_settings_action ();
@@ -198,8 +197,6 @@
198197
199 // settings section198 // settings section
200 section = new Menu ();199 section = new Menu ();
201 section.append (_("Set Up New Device…"),
202 "indicator.desktop-wizard");
203 section.append (_("Bluetooth Settings…"),200 section.append (_("Bluetooth Settings…"),
204 "indicator.desktop-show-settings::bluetooth");201 "indicator.desktop-show-settings::bluetooth");
205 menu.append_section (null, section);202 menu.append_section (null, section);
@@ -235,15 +232,6 @@
235 return action;232 return action;
236 }233 }
237234
238 Action create_wizard_action ()
239 {
240 var action = new SimpleAction ("desktop-wizard", null);
241
242 action.activate.connect (()
243 => spawn_command_line_async ("bluetooth-wizard"));
244 return action;
245 }
246
247 Action create_browse_files_action ()235 Action create_browse_files_action ()
248 {236 {
249 var action = new SimpleAction ("desktop-browse-files", VariantType.STRING);237 var action = new SimpleAction ("desktop-browse-files", VariantType.STRING);
250238
=== removed file 'src/org-bluez.vala'
--- src/org-bluez.vala 2013-10-14 23:33:59 +0000
+++ src/org-bluez.vala 1970-01-01 00:00:00 +0000
@@ -1,293 +0,0 @@
1/* Generated by vala-dbus-binding-tool 0.4.0. Do not modify! */
2/* Generated with: vala-dbus-binding-tool --gdbus --directory=. */
3using GLib;
4
5namespace org {
6
7 namespace bluez {
8
9 [DBus (name = "org.bluez.Manager", timeout = 120000)]
10 public interface Manager : GLib.Object {
11
12 [DBus (name = "GetProperties")]
13 public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError;
14
15 [DBus (name = "DefaultAdapter")]
16 public abstract GLib.ObjectPath default_adapter() throws DBusError, IOError;
17
18 [DBus (name = "FindAdapter")]
19 public abstract GLib.ObjectPath find_adapter(string pattern) throws DBusError, IOError;
20
21 [DBus (name = "ListAdapters")]
22 public abstract GLib.ObjectPath[] list_adapters() throws DBusError, IOError;
23
24 [DBus (name = "PropertyChanged")]
25 public signal void property_changed(string name, GLib.Variant value);
26
27 [DBus (name = "AdapterAdded")]
28 public signal void adapter_added(GLib.ObjectPath adapter);
29
30 [DBus (name = "AdapterRemoved")]
31 public signal void adapter_removed(GLib.ObjectPath adapter);
32
33 [DBus (name = "DefaultAdapterChanged")]
34 public signal void default_adapter_changed(GLib.ObjectPath adapter);
35 }
36
37 [DBus (name = "org.bluez.Manager", timeout = 120000)]
38 public interface ManagerSync : GLib.Object {
39
40 [DBus (name = "GetProperties")]
41 public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError;
42
43 [DBus (name = "DefaultAdapter")]
44 public abstract GLib.ObjectPath default_adapter() throws DBusError, IOError;
45
46 [DBus (name = "FindAdapter")]
47 public abstract GLib.ObjectPath find_adapter(string pattern) throws DBusError, IOError;
48
49 [DBus (name = "ListAdapters")]
50 public abstract GLib.ObjectPath[] list_adapters() throws DBusError, IOError;
51
52 [DBus (name = "PropertyChanged")]
53 public signal void property_changed(string name, GLib.Variant value);
54
55 [DBus (name = "AdapterAdded")]
56 public signal void adapter_added(GLib.ObjectPath adapter);
57
58 [DBus (name = "AdapterRemoved")]
59 public signal void adapter_removed(GLib.ObjectPath adapter);
60
61 [DBus (name = "DefaultAdapterChanged")]
62 public signal void default_adapter_changed(GLib.ObjectPath adapter);
63 }
64
65 [DBus (name = "org.bluez.Adapter", timeout = 120000)]
66 public interface Adapter : GLib.Object {
67
68 [DBus (name = "GetProperties")]
69 public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError;
70
71 [DBus (name = "SetProperty")]
72 public abstract async void set_property(string name, GLib.Variant value) throws DBusError, IOError;
73
74 [DBus (name = "RequestSession")]
75 public abstract void request_session() throws DBusError, IOError;
76
77 [DBus (name = "ReleaseSession")]
78 public abstract void release_session() throws DBusError, IOError;
79
80 [DBus (name = "StartDiscovery")]
81 public abstract void start_discovery() throws DBusError, IOError;
82
83 [DBus (name = "StopDiscovery")]
84 public abstract void stop_discovery() throws DBusError, IOError;
85
86 [DBus (name = "ListDevices")]
87 public abstract GLib.ObjectPath[] list_devices() throws DBusError, IOError;
88
89 [DBus (name = "CreateDevice")]
90 public abstract GLib.ObjectPath create_device(string address) throws DBusError, IOError;
91
92 [DBus (name = "CreatePairedDevice")]
93 public abstract GLib.ObjectPath create_paired_device(string address, GLib.ObjectPath agent, string capability) throws DBusError, IOError;
94
95 [DBus (name = "CancelDeviceCreation")]
96 public abstract void cancel_device_creation(string address) throws DBusError, IOError;
97
98 [DBus (name = "RemoveDevice")]
99 public abstract void remove_device(GLib.ObjectPath device) throws DBusError, IOError;
100
101 [DBus (name = "FindDevice")]
102 public abstract GLib.ObjectPath find_device(string address) throws DBusError, IOError;
103
104 [DBus (name = "RegisterAgent")]
105 public abstract void register_agent(GLib.ObjectPath agent, string capability) throws DBusError, IOError;
106
107 [DBus (name = "UnregisterAgent")]
108 public abstract void unregister_agent(GLib.ObjectPath agent) throws DBusError, IOError;
109
110 [DBus (name = "PropertyChanged")]
111 public signal void property_changed(string name, GLib.Variant value);
112
113 [DBus (name = "DeviceCreated")]
114 public signal void device_created(GLib.ObjectPath device);
115
116 [DBus (name = "DeviceRemoved")]
117 public signal void device_removed(GLib.ObjectPath device);
118
119 [DBus (name = "DeviceFound")]
120 public signal void device_found(string address, GLib.HashTable<string, GLib.Variant> values);
121
122 [DBus (name = "DeviceDisappeared")]
123 public signal void device_disappeared(string address);
124 }
125
126 [DBus (name = "org.bluez.Adapter", timeout = 120000)]
127 public interface AdapterSync : GLib.Object {
128
129 [DBus (name = "GetProperties")]
130 public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError;
131
132 [DBus (name = "SetProperty")]
133 public abstract void set_property(string name, GLib.Variant value) throws DBusError, IOError;
134
135 [DBus (name = "RequestSession")]
136 public abstract void request_session() throws DBusError, IOError;
137
138 [DBus (name = "ReleaseSession")]
139 public abstract void release_session() throws DBusError, IOError;
140
141 [DBus (name = "StartDiscovery")]
142 public abstract void start_discovery() throws DBusError, IOError;
143
144 [DBus (name = "StopDiscovery")]
145 public abstract void stop_discovery() throws DBusError, IOError;
146
147 [DBus (name = "ListDevices")]
148 public abstract GLib.ObjectPath[] list_devices() throws DBusError, IOError;
149
150 [DBus (name = "CreateDevice")]
151 public abstract GLib.ObjectPath create_device(string address) throws DBusError, IOError;
152
153 [DBus (name = "CreatePairedDevice")]
154 public abstract GLib.ObjectPath create_paired_device(string address, GLib.ObjectPath agent, string capability) throws DBusError, IOError;
155
156 [DBus (name = "CancelDeviceCreation")]
157 public abstract void cancel_device_creation(string address) throws DBusError, IOError;
158
159 [DBus (name = "RemoveDevice")]
160 public abstract void remove_device(GLib.ObjectPath device) throws DBusError, IOError;
161
162 [DBus (name = "FindDevice")]
163 public abstract GLib.ObjectPath find_device(string address) throws DBusError, IOError;
164
165 [DBus (name = "RegisterAgent")]
166 public abstract void register_agent(GLib.ObjectPath agent, string capability) throws DBusError, IOError;
167
168 [DBus (name = "UnregisterAgent")]
169 public abstract void unregister_agent(GLib.ObjectPath agent) throws DBusError, IOError;
170
171 [DBus (name = "PropertyChanged")]
172 public signal void property_changed(string name, GLib.Variant value);
173
174 [DBus (name = "DeviceCreated")]
175 public signal void device_created(GLib.ObjectPath device);
176
177 [DBus (name = "DeviceRemoved")]
178 public signal void device_removed(GLib.ObjectPath device);
179
180 [DBus (name = "DeviceFound")]
181 public signal void device_found(string address, GLib.HashTable<string, GLib.Variant> values);
182
183 [DBus (name = "DeviceDisappeared")]
184 public signal void device_disappeared(string address);
185 }
186
187 [DBus (name = "org.bluez.Agent", timeout = 120000)]
188 public interface Agent : GLib.Object {
189
190 [DBus (name = "Authorize")]
191 public abstract void authorize(GLib.ObjectPath device, string uuid) throws DBusError, IOError;
192
193 [DBus (name = "RequestPinCode")]
194 public abstract string request_pin_code(GLib.ObjectPath device) throws DBusError, IOError;
195
196 [DBus (name = "DisplayPasskey")]
197 public abstract void display_passkey(GLib.ObjectPath device, uint passkey) throws DBusError, IOError;
198
199 [DBus (name = "Release")]
200 public abstract void release() throws DBusError, IOError;
201
202 [DBus (name = "Cancel")]
203 public abstract void cancel() throws DBusError, IOError;
204
205 [DBus (name = "RequestConfirmation")]
206 public abstract void request_confirmation(GLib.ObjectPath device, uint passkey) throws DBusError, IOError;
207
208 [DBus (name = "ConfirmModeChange")]
209 public abstract void confirm_mode_change(string mode) throws DBusError, IOError;
210
211 [DBus (name = "RequestPasskey")]
212 public abstract uint request_passkey(GLib.ObjectPath device) throws DBusError, IOError;
213 }
214
215 [DBus (name = "org.bluez.Agent", timeout = 120000)]
216 public interface AgentSync : GLib.Object {
217
218 [DBus (name = "Authorize")]
219 public abstract void authorize(GLib.ObjectPath device, string uuid) throws DBusError, IOError;
220
221 [DBus (name = "RequestPinCode")]
222 public abstract string request_pin_code(GLib.ObjectPath device) throws DBusError, IOError;
223
224 [DBus (name = "DisplayPasskey")]
225 public abstract void display_passkey(GLib.ObjectPath device, uint passkey) throws DBusError, IOError;
226
227 [DBus (name = "Release")]
228 public abstract void release() throws DBusError, IOError;
229
230 [DBus (name = "Cancel")]
231 public abstract void cancel() throws DBusError, IOError;
232
233 [DBus (name = "RequestConfirmation")]
234 public abstract void request_confirmation(GLib.ObjectPath device, uint passkey) throws DBusError, IOError;
235
236 [DBus (name = "ConfirmModeChange")]
237 public abstract void confirm_mode_change(string mode) throws DBusError, IOError;
238
239 [DBus (name = "RequestPasskey")]
240 public abstract uint request_passkey(GLib.ObjectPath device) throws DBusError, IOError;
241 }
242
243 [DBus (name = "org.bluez.Device", timeout = 120000)]
244 public interface Device : GLib.Object {
245
246 [DBus (name = "GetProperties")]
247 public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError;
248
249 [DBus (name = "SetProperty")]
250 public abstract void set_property(string name, GLib.Variant value) throws DBusError, IOError;
251
252 [DBus (name = "DiscoverServices")]
253 public abstract GLib.HashTable<uint, string> discover_services(string pattern) throws DBusError, IOError;
254
255 [DBus (name = "CancelDiscovery")]
256 public abstract void cancel_discovery() throws DBusError, IOError;
257
258 [DBus (name = "Disconnect")]
259 public abstract void disconnect() throws DBusError, IOError;
260
261 [DBus (name = "PropertyChanged")]
262 public signal void property_changed(string name, GLib.Variant value);
263
264 [DBus (name = "DisconnectRequested")]
265 public signal void disconnect_requested();
266 }
267
268 [DBus (name = "org.bluez.Device", timeout = 120000)]
269 public interface DeviceSync : GLib.Object {
270
271 [DBus (name = "GetProperties")]
272 public abstract GLib.HashTable<string, GLib.Variant> get_properties() throws DBusError, IOError;
273
274 [DBus (name = "SetProperty")]
275 public abstract void set_property(string name, GLib.Variant value) throws DBusError, IOError;
276
277 [DBus (name = "DiscoverServices")]
278 public abstract GLib.HashTable<uint, string> discover_services(string pattern) throws DBusError, IOError;
279
280 [DBus (name = "CancelDiscovery")]
281 public abstract void cancel_discovery() throws DBusError, IOError;
282
283 [DBus (name = "Disconnect")]
284 public abstract void disconnect() throws DBusError, IOError;
285
286 [DBus (name = "PropertyChanged")]
287 public signal void property_changed(string name, GLib.Variant value);
288
289 [DBus (name = "DisconnectRequested")]
290 public signal void disconnect_requested();
291 }
292 }
293}

Subscribers

People subscribed via source and target branches