From 1a2e82040df0f8c8ee0286c5e17478be5f03bc74 Mon Sep 17 00:00:00 2001 From: Thibaud Date: Wed, 23 May 2018 02:41:20 +0200 Subject: [PATCH] Update api : spnav_wait_event_timeout --- spnav.c | 8 ++++++++ spnav.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spnav.c b/spnav.c index 6fe798f..c2231f5 100644 --- a/spnav.c +++ b/spnav.c @@ -127,6 +127,14 @@ int spnav_wait_event(spnav_event *event) { return 0; } +spnav_wait_event_timeout(spnav_event *event, int milliseconds) { + if (device == NULL) { + DEBUG_PRINT("spnav_wait_event_timeout(): device not connected.\n"); + return -1; + } + read_event(device, event, milliseconds); + return 0; +} /* int spnav_wait_event(spnav_event *event); int spnav_poll_event(spnav_event *event, int timeout); */ \ No newline at end of file diff --git a/spnav.h b/spnav.h index f9c4d66..b8b08f7 100644 --- a/spnav.h +++ b/spnav.h @@ -46,8 +46,9 @@ extern "C" { int SPNAV_API_EXPORT_CALL spnav_open(void); int SPNAV_API_EXPORT_CALL spnav_close(void); +// TODO : return event type int SPNAV_API_EXPORT_CALL spnav_wait_event(spnav_event *event); -int SPNAV_API_EXPORT_CALL spnav_poll_event(spnav_event *event, int timeout); +int SPNAV_API_EXPORT_CALL spnav_wait_event_timeout(spnav_event *event, int timeout); //spnav_event SPNAV_API_EXPORT_CALL read_event(int timeout); #ifdef __cplusplus