From 898a9a5f242a1691e1c34062208b48cb0682b5d9 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Fri, 16 Dec 2016 00:41:28 -0500 Subject: Remove dependency on Xinerama Improve camfinder a little Add data_recorder.c Closes #1 making libsurvive much more pluggable. --- src/survive_internal.h | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) (limited to 'src/survive_internal.h') diff --git a/src/survive_internal.h b/src/survive_internal.h index 40659e8..ac378a2 100644 --- a/src/survive_internal.h +++ b/src/survive_internal.h @@ -19,6 +19,7 @@ #include #include #include +#include #define SV_INFO( x... ) { char stbuff[1024]; sprintf( stbuff, x ); ctx->notefunction( ctx, stbuff ); } #define SV_ERROR( x... ) { char stbuff[1024]; sprintf( stbuff, x ); ctx->faultfunction( ctx, stbuff ); } @@ -26,8 +27,6 @@ //XXX TODO This one needs to be rewritten. #define SV_KILL() exit(0) -#define SV_FLOAT double - #define USB_DEV_HMD 0 #define USB_DEV_LIGHTHOUSE 1 #define USB_DEV_WATCHMAN1 2 @@ -61,33 +60,20 @@ struct SurviveUSBInterface const char * hname; //human-readable names }; - -struct SurviveObject -{ - struct SurviveContext * ctx; - char codename[4]; - int16_t buttonmask; - int16_t axis1; - int16_t axis2; - int16_t axis3; - int8_t charge; - int8_t charging:1; - int8_t ison:1; - int sensors; - - int nr_locations; - SV_FLOAT * sensor_locations; -}; +//This is defined in survive.h +struct SurviveObject; struct SurviveContext { //USB Subsystem struct libusb_context* usbctx; - void(*faultfunction)( struct SurviveContext * ctx, const char * fault ); - void(*notefunction)( struct SurviveContext * ctx, const char * fault ); struct libusb_device_handle * udev[MAX_USB_DEVS]; struct SurviveUSBInterface uiface[MAX_INTERFACES]; + text_feedback_fnptr faultfunction; + text_feedback_fnptr notefunction; + light_process_func lightproc; + imu_process_func imuproc; //Flood info, for calculating which laser is currently sweeping. int8_t oldcode; @@ -113,13 +99,8 @@ int survive_get_config( char ** config, struct SurviveContext * ctx, int devno, void survive_data_cb( struct SurviveUSBInterface * si ); //Accept higher-level data. -void survive_light_process( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); -void survive_imu_process( struct SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id ); - - -//Util -int survive_simple_inflate( struct SurviveContext * ctx, const char * input, int inlen, char * output, int outlen ); - +void survive_default_light_process( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); +void survive_default_imu_process( struct SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id ); #endif -- cgit v1.2.3