Update api : spnav_wait_event_timeout

This commit is contained in:
Thibaud Gasser 2018-05-23 02:41:20 +02:00
parent 2feb735f5b
commit 1a2e82040d
2 changed files with 10 additions and 1 deletions

View File

@ -127,6 +127,14 @@ int spnav_wait_event(spnav_event *event) {
return 0; 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_wait_event(spnav_event *event);
int spnav_poll_event(spnav_event *event, int timeout); */ int spnav_poll_event(spnav_event *event, int timeout); */

View File

@ -46,8 +46,9 @@ extern "C" {
int SPNAV_API_EXPORT_CALL spnav_open(void); int SPNAV_API_EXPORT_CALL spnav_open(void);
int SPNAV_API_EXPORT_CALL spnav_close(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_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); //spnav_event SPNAV_API_EXPORT_CALL read_event(int timeout);
#ifdef __cplusplus #ifdef __cplusplus