ble: catch and ignore the InProgress error when we're already listening
This commit is contained in:
parent
d4405cc1ef
commit
5f9766cb71
10
tuhi/ble.py
10
tuhi/ble.py
|
@ -320,8 +320,14 @@ class BlueZDeviceManager(GObject.Object):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
objpath = obj.get_object_path()
|
objpath = obj.get_object_path()
|
||||||
i.StartDiscovery()
|
try:
|
||||||
logger.debug('{}: Discovery started (timeout {})'.format(objpath, timeout))
|
i.StartDiscovery()
|
||||||
|
logger.debug('{}: Discovery started (timeout {})'.format(objpath, timeout))
|
||||||
|
except GLib.Error as e:
|
||||||
|
if (e.domain == 'g-io-error-quark' and
|
||||||
|
e.code == Gio.IOErrorEnum.DBUS_ERROR and
|
||||||
|
Gio.dbus_error_get_remote_error(e) == 'org.bluez.Error.InProgress'):
|
||||||
|
logger.debug('{}: Already listening'.format(objpath))
|
||||||
|
|
||||||
if timeout > 0:
|
if timeout > 0:
|
||||||
GObject.timeout_add_seconds(timeout, self._discovery_timeout_expired)
|
GObject.timeout_add_seconds(timeout, self._discovery_timeout_expired)
|
||||||
|
|
Loading…
Reference in New Issue