Permalink
Browse files

Bug 828174: Track Bluetooth discovery state in Settings app [r=ehung]

The settings app unconditionally stops Bluetooth discovery when
processing incoming events. Stopping discovery when no discovery
is actually running will make the Bluetooth daemon generate an
error.

This patch prevents this by tracking the discovery state in the
settings application and only stopping discovery if it's currently
running. We reuse the value 'discoverTimeout' for this purpose,
because it exposes the required behaviour.

Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
  • Loading branch information...
1 parent 3204365 commit 82e96a0626fa66d68e2286a24bb6763697f9ae24 @tdz tdz committed Jan 7, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 apps/settings/js/bluetooth.js
View
4 apps/settings/js/bluetooth.js
@@ -593,7 +593,7 @@ onLocalized(function bluetoothSettings() {
}
function startDiscovery() {
- if (!bluetooth.enabled || !defaultAdapter)
+ if (!bluetooth.enabled || !defaultAdapter || discoverTimeout)
return;
var req = defaultAdapter.startDiscovery();
@@ -616,7 +616,7 @@ onLocalized(function bluetoothSettings() {
}
function stopDiscovery() {
- if (!bluetooth.enabled || !defaultAdapter)
+ if (!bluetooth.enabled || !defaultAdapter || !discoverTimeout)
return;
var req = defaultAdapter.stopDiscovery();
req.onsuccess = function bt_discoveryStopped() {

0 comments on commit 82e96a0

Please sign in to comment.