From 3c9b0eaa1cb5e32183ae7cdc31f6a4078ff0c917 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Sat, 10 Feb 2024 23:55:53 +0100 Subject: [PATCH] Introduce 'GATTLIB_ERROR_TIMEOUT' error --- gattlib-py/gattlib/exception.py | 13 +++++++++---- include/gattlib.h | 13 +++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gattlib-py/gattlib/exception.py b/gattlib-py/gattlib/exception.py index cf1bb27..7054567 100644 --- a/gattlib-py/gattlib/exception.py +++ b/gattlib-py/gattlib/exception.py @@ -7,10 +7,13 @@ GATTLIB_SUCCESS = 0 GATTLIB_INVALID_PARAMETER = 1 GATTLIB_NOT_FOUND = 2 -GATTLIB_OUT_OF_MEMORY = 3 -GATTLIB_NOT_SUPPORTED = 4 -GATTLIB_DEVICE_ERROR = 5 -GATTLIB_ERROR_DBUS = 6 +GATTLIB_ERROR_TIMEOUT = 3 +GATTLIB_OUT_OF_MEMORY = 4 +GATTLIB_NOT_SUPPORTED = 5 +GATTLIB_DEVICE_ERROR = 6 +GATTLIB_ERROR_DBUS = 7 +GATTLIB_ERROR_BLUEZ = 8 +GATTLIB_ERROR_INTERNAL = 9 class GattlibException(Exception): @@ -56,6 +59,8 @@ def handle_return(ret): raise NotFound() elif ret == GATTLIB_OUT_OF_MEMORY: raise OutOfMemory() + elif ret == GATTLIB_ERROR_TIMEOUT: + raise TimeoutError() elif ret == GATTLIB_NOT_SUPPORTED: raise NotSupported() elif ret == GATTLIB_DEVICE_ERROR: diff --git a/include/gattlib.h b/include/gattlib.h index 557d712..f4ff3a2 100644 --- a/include/gattlib.h +++ b/include/gattlib.h @@ -38,12 +38,13 @@ extern "C" { #define GATTLIB_SUCCESS 0 #define GATTLIB_INVALID_PARAMETER 1 #define GATTLIB_NOT_FOUND 2 -#define GATTLIB_OUT_OF_MEMORY 3 -#define GATTLIB_NOT_SUPPORTED 4 -#define GATTLIB_DEVICE_ERROR 5 -#define GATTLIB_ERROR_DBUS 6 -#define GATTLIB_ERROR_BLUEZ 7 -#define GATTLIB_ERROR_INTERNAL 8 +#define GATTLIB_ERROR_TIMEOUT 3 +#define GATTLIB_OUT_OF_MEMORY 4 +#define GATTLIB_NOT_SUPPORTED 5 +#define GATTLIB_DEVICE_ERROR 6 +#define GATTLIB_ERROR_DBUS 7 +#define GATTLIB_ERROR_BLUEZ 8 +#define GATTLIB_ERROR_INTERNAL 9 //@} /**