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