diff --git a/dbus/gattlib.c b/dbus/gattlib.c index d7fb8841..44236828 100644 --- a/dbus/gattlib.c +++ b/dbus/gattlib.c @@ -228,11 +228,14 @@ int gattlib_connect(void *adapter, const char *dst, // pairing information about the targetted device. GATTLIB_LOG(GATTLIB_ERROR, "Device '%s' cannot be found (%d, %d)", dst, error->domain, error->code); ret = GATTLIB_NOT_FOUND; - } else { + } else if ((error->domain == 238) && (error->code == 60952)) { + GATTLIB_LOG(GATTLIB_ERROR, "Device '%s': %s", dst, error->message); + ret = GATTLIB_ERROR_TIMEOUT; + } else { GATTLIB_LOG(GATTLIB_ERROR, "Device connected error (device:%s): %s", conn_context->device_object_path, error->message); - ret = GATTLIB_ERROR_DBUS_WITH_ERROR(error);; + ret = GATTLIB_ERROR_DBUS_WITH_ERROR(error); } g_error_free(error); diff --git a/gattlib-py/gattlib/exception.py b/gattlib-py/gattlib/exception.py index 57771992..c3c29c69 100644 --- a/gattlib-py/gattlib/exception.py +++ b/gattlib-py/gattlib/exception.py @@ -60,6 +60,8 @@ def __init__(self, domain: int, code: int) -> None: def __str__(self) -> str: if self.domain == 238 and self.code == 60964: return f"DBus Error: le-connection-abort-by-local" + elif self.domain == 238 and self.code == 60952: + return f"DBus Error: Timeout was reached" elif self.domain == 238 and self.code == 60964: return f"DBus Error: Timeout was reached" else: