aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2017-03-08 00:53:28 -0500
committercnlohr <lohr85@gmail.com>2017-03-08 00:53:28 -0500
commita087915c5dd8c356911453a019723ebaa9904a36 (patch)
treed1bdf78c0204ac0b7e995a8aae46d6c59bb2d435 /src
parentb960e4d04b49bee0f60a5b1d1199c256cfbc17d6 (diff)
downloadlibsurvive-a087915c5dd8c356911453a019723ebaa9904a36.tar.gz
libsurvive-a087915c5dd8c356911453a019723ebaa9904a36.tar.bz2
Move most of the libsurvive stuff into a common area.
Diffstat (limited to 'src')
-rw-r--r--src/survive_driverman.h24
-rw-r--r--src/survive_internal.h75
2 files changed, 4 insertions, 95 deletions
diff --git a/src/survive_driverman.h b/src/survive_driverman.h
index 5e13caf..216333a 100644
--- a/src/survive_driverman.h
+++ b/src/survive_driverman.h
@@ -10,29 +10,13 @@
#ifndef SURVIVE_DRIVERMAN_H
#define SURVIVE_DRIVERMAN_H
-//Driver registration
-#define MAX_DRIVERS 32
-
-void RegisterDriver( const char * name, void * data );
-void * GetDriver( const char * name );
-const char * GetDriverNameMatching( const char * prefix, int place );
-void ListDrivers();
-
-#define REGISTER_LINKTIME( func ) \
- void __attribute__((constructor)) Register##func() { RegisterDriver( #func, &func ); }
-
+#include "survive.h"
-//
-// Specific types of drivers.
-//
-
-struct SurviveContext;
+//Very little here. Mostly included in survive.h.
-//Device drivers (prefix your drivers with "DriverReg") i.e.
-// REGISTER_LINKTIME( DriverRegHTCVive );
-typedef int (*DeviceDriver)( struct SurviveContext * ctx );
+//Driver registration
+#define MAX_DRIVERS 32
-//more driver types here? i.e. posefinders, etc.
#endif
diff --git a/src/survive_internal.h b/src/survive_internal.h
index 83a429c..ff156ad 100644
--- a/src/survive_internal.h
+++ b/src/survive_internal.h
@@ -1,15 +1,5 @@
//<>< (C) 2016-2017 C. N. Lohr, MOSTLY Under MIT/x11 License.
//
-//Based off of https://github.com/collabora/OSVR-Vive-Libre
-// Originally Copyright 2016 Philipp Zabel
-// Originally Copyright 2016 Lubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>
-// Originally Copyright (C) 2013 Fredrik Hultin
-// Originally Copyright (C) 2013 Jakob Bornecrantz
-//
-//But, re-written as best as I can to get it put under an open souce license instead of a forced-source license.
-//If there are portions of the code too similar to the original, I would like to know so they can be re-written.
-//All MIT/x11 Licensed Code in this file may be relicensed freely under the GPL or LGPL licenses.
-
#ifndef _SURVIVE_INTERNAL_H
#define _SURVIVE_INTERNAL_H
@@ -28,71 +18,6 @@
#define SV_KILL() exit(0)
-struct SurviveContext;
-struct SurvivecalData;
-
-typedef int (*DeviceDriverCb)( struct SurviveContext * ctx, void * driver );
-typedef int (*DeviceDriverMagicCb)( struct SurviveContext * ctx, void * driver, int magic_code, void * data, int datalen );
-
-//This is defined in survive.h
-typedef struct SurviveObject SurviveObject;
-typedef struct SurviveCalData SurviveCalData;
-
-typedef struct
-{
- uint8_t PositionSet:1;
-
- SurvivePose Pose;
-
- uint8_t OOTXSet:1;
- uint32_t BaseStationID;
- FLT fcalphase[2];
- FLT fcaltilt[2];
- FLT fcalcurve[2];
- FLT fcalgibpha[2];
- FLT fcalgibmag[2];
-} BaseStationData;
-
-struct SurviveContext
-{
- text_feedback_func faultfunction;
- text_feedback_func notefunction;
- light_process_func lightproc;
- imu_process_func imuproc;
- angle_process_func angleproc;
-
- //Calibration data:
- BaseStationData bsd[NUM_LIGHTHOUSES];
-
- SurviveCalData * calptr; //If and only if the calibration subsystem is attached.
-
- SurviveObject ** objs;
- int objs_ct;
-
- void ** drivers;
- DeviceDriverCb * driverpolls;
- DeviceDriverCb * drivercloses;
- DeviceDriverMagicCb * drivermagics;
- int driver_ct;
-};
-
-int survive_add_object( SurviveContext * ctx, SurviveObject * obj );
-
-void survive_add_driver( SurviveContext * ctx, void * payload, DeviceDriverCb poll, DeviceDriverCb close, DeviceDriverMagicCb magic );
-
-//For lightcap, etc. Don't change this structure at all. Regular vive is dependent on it being exactly as-is.
-typedef struct
-{
- uint8_t sensor_id;
- uint8_t type;
- uint16_t length;
- uint32_t timestamp;
-} __attribute__((packed)) LightcapElement;
-
-//This is the disambiguator function, for taking light timing and figuring out place-in-sweep for a given photodiode.
-void handle_lightcap( SurviveObject * so, LightcapElement * le );
-
-
#endif