2018-05-22 23:25:02 +00:00
|
|
|
#ifndef SPNAV_H__
|
|
|
|
#define SPNAV_H__
|
|
|
|
|
|
|
|
#define SPNAV_VENDOR_ID 0x046d
|
|
|
|
#define SPNAV_PRODUCT_ID 0xc626
|
2018-05-23 12:42:09 +00:00
|
|
|
#define SPNAV_NAXIS 6
|
2018-05-22 23:25:02 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define SPNAV_API_EXPORT __declspec(dllexport)
|
|
|
|
#define SPNAV_API_CALL
|
|
|
|
#else
|
|
|
|
#define SPNAV_API_EXPORT /**< API export macro */
|
|
|
|
#define SPNAV_API_CALL /**< API call macro */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define SPNAV_API_EXPORT_CALL SPNAV_API_EXPORT SPNAV_API_CALL /**< API export and call macro*/
|
|
|
|
|
|
|
|
enum event_type {
|
|
|
|
ANY,
|
|
|
|
MOTION,
|
|
|
|
BUTTON
|
|
|
|
};
|
|
|
|
|
|
|
|
struct event_motion {
|
|
|
|
int type;
|
|
|
|
int x, y, z;
|
|
|
|
int rx, ry, rz;
|
|
|
|
unsigned int period;
|
2018-05-23 13:06:49 +00:00
|
|
|
int *data;
|
2018-05-22 23:25:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct event_button {
|
|
|
|
int type;
|
2018-05-23 12:42:09 +00:00
|
|
|
bool press;
|
2018-05-22 23:25:02 +00:00
|
|
|
int bnum;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef union spnav_event {
|
|
|
|
int type;
|
|
|
|
struct event_motion motion;
|
|
|
|
struct event_button button;
|
|
|
|
} spnav_event;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int SPNAV_API_EXPORT_CALL spnav_open(void);
|
|
|
|
int SPNAV_API_EXPORT_CALL spnav_close(void);
|
2018-05-23 00:41:20 +00:00
|
|
|
// TODO : return event type
|
2018-05-22 23:25:02 +00:00
|
|
|
int SPNAV_API_EXPORT_CALL spnav_wait_event(spnav_event *event);
|
2018-05-23 00:41:20 +00:00
|
|
|
int SPNAV_API_EXPORT_CALL spnav_wait_event_timeout(spnav_event *event, int timeout);
|
2018-05-23 13:06:49 +00:00
|
|
|
int SPNAV_API_EXPORT_CALL spnav_sensitivity(double sens);
|
2018-05-22 23:25:02 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2018-05-23 13:06:49 +00:00
|
|
|
|
2018-05-22 23:25:02 +00:00
|
|
|
#endif /* SPNAV_H__ */
|