Skip to content

Commit 3c9b0ea

Browse files
committed
Introduce 'GATTLIB_ERROR_TIMEOUT' error
1 parent 028dfef commit 3c9b0ea

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

gattlib-py/gattlib/exception.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
GATTLIB_SUCCESS = 0
88
GATTLIB_INVALID_PARAMETER = 1
99
GATTLIB_NOT_FOUND = 2
10-
GATTLIB_OUT_OF_MEMORY = 3
11-
GATTLIB_NOT_SUPPORTED = 4
12-
GATTLIB_DEVICE_ERROR = 5
13-
GATTLIB_ERROR_DBUS = 6
10+
GATTLIB_ERROR_TIMEOUT = 3
11+
GATTLIB_OUT_OF_MEMORY = 4
12+
GATTLIB_NOT_SUPPORTED = 5
13+
GATTLIB_DEVICE_ERROR = 6
14+
GATTLIB_ERROR_DBUS = 7
15+
GATTLIB_ERROR_BLUEZ = 8
16+
GATTLIB_ERROR_INTERNAL = 9
1417

1518

1619
class GattlibException(Exception):
@@ -56,6 +59,8 @@ def handle_return(ret):
5659
raise NotFound()
5760
elif ret == GATTLIB_OUT_OF_MEMORY:
5861
raise OutOfMemory()
62+
elif ret == GATTLIB_ERROR_TIMEOUT:
63+
raise TimeoutError()
5964
elif ret == GATTLIB_NOT_SUPPORTED:
6065
raise NotSupported()
6166
elif ret == GATTLIB_DEVICE_ERROR:

include/gattlib.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ extern "C" {
3838
#define GATTLIB_SUCCESS 0
3939
#define GATTLIB_INVALID_PARAMETER 1
4040
#define GATTLIB_NOT_FOUND 2
41-
#define GATTLIB_OUT_OF_MEMORY 3
42-
#define GATTLIB_NOT_SUPPORTED 4
43-
#define GATTLIB_DEVICE_ERROR 5
44-
#define GATTLIB_ERROR_DBUS 6
45-
#define GATTLIB_ERROR_BLUEZ 7
46-
#define GATTLIB_ERROR_INTERNAL 8
41+
#define GATTLIB_ERROR_TIMEOUT 3
42+
#define GATTLIB_OUT_OF_MEMORY 4
43+
#define GATTLIB_NOT_SUPPORTED 5
44+
#define GATTLIB_DEVICE_ERROR 6
45+
#define GATTLIB_ERROR_DBUS 7
46+
#define GATTLIB_ERROR_BLUEZ 8
47+
#define GATTLIB_ERROR_INTERNAL 9
4748
//@}
4849

4950
/**

0 commit comments

Comments
 (0)