aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2018-03-18 02:11:20 -0400
committercnlohr <lohr85@gmail.com>2018-03-18 22:21:59 -0400
commitd21999e85f29edae7de8abdfb293da870e7fad47 (patch)
treeb28bd423ed9ae5961394ece0c479eb981418f57a /include
parent51d3954e38e01e2c327f561cc27f6d8abbc9907d (diff)
downloadlibsurvive-d21999e85f29edae7de8abdfb293da870e7fad47.tar.gz
libsurvive-d21999e85f29edae7de8abdfb293da870e7fad47.tar.bz2
trying new config mode
Diffstat (limited to 'include')
-rw-r--r--include/libsurvive/survive.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h
index ed2f8d1..ee46862 100644
--- a/include/libsurvive/survive.h
+++ b/include/libsurvive/survive.h
@@ -150,6 +150,8 @@ typedef struct
ButtonQueueEntry entry[BUTTON_QUEUE_MAX_LEN];
} ButtonQueue;
+typedef enum { SURVIVE_STOPPED = 0, SURVIVE_RUNNING, SURVIVE_CLOSING, SURVIVE_STATE_MAX } SurviveState;
+
struct SurviveContext
{
text_feedback_func faultfunction;
@@ -179,29 +181,28 @@ struct SurviveContext
DeviceDriverMagicCb * drivermagics;
int driver_ct;
- uint8_t isClosing; // flag to indicate if threads should terminate themselves
+ SurviveState state;
void* buttonservicethread;
ButtonQueue buttonQueue;
void *user_ptr;
-
};
-SurviveContext *survive_init_internal(int headless, htc_config_func cfcb);
+void survive_verify_FLT_size(uint32_t user_size); // Baked in size of FLT to verify users of the library have the correct setting.
-// Baked in size of FLT to verify users of the library have the correct setting.
-void survive_verify_FLT_size(uint32_t user_size);
-
-static inline SurviveContext * survive_init( int headless ) {
- survive_verify_FLT_size(sizeof(FLT));
- return survive_init_internal(headless, 0);
-}
-static inline SurviveContext *survive_init_with_config_cb(int headless, htc_config_func cfcb) {
+
+
+
+
+SurviveContext * survive_init_internal( int argc, char ** argv );
+static inline SurviveContext * survive_init( int argc, char ** argv )
+{
survive_verify_FLT_size(sizeof(FLT));
- return survive_init_internal(headless, cfcb);
+ return survive_init_internal(initdata);
}
+
//For any of these, you may pass in 0 for the function pointer to use default behavior.
//In general unless you are doing wacky things like recording or playing back data, you won't need to use this.
void survive_install_info_fn( SurviveContext * ctx, text_feedback_func fbp );
@@ -212,7 +213,7 @@ void survive_install_angle_fn( SurviveContext * ctx, angle_process_func fbp );
void survive_install_button_fn(SurviveContext * ctx, button_process_func fbp);
void survive_install_raw_pose_fn(SurviveContext * ctx, raw_pose_func fbp);
void survive_install_lighthouse_pose_fn(SurviveContext *ctx, lighthouse_pose_func fbp);
-
+int survive_startup( SurviveContext * ctx );
void survive_close( SurviveContext * ctx );
int survive_poll( SurviveContext * ctx );
@@ -227,7 +228,7 @@ int survive_send_magic( SurviveContext * ctx, int magic_code, void * data, int d
void survive_cal_install( SurviveContext * ctx ); //XXX This will be removed if not already done so.
// Read back a human-readable string description of the calibration status
-int survive_cal_get_status( struct SurviveContext * ctx, char * description, int description_length );
+int survive_cal_get_status( SurviveContext * ctx, char * description, int description_length );
// Induce haptic feedback
int survive_haptic(SurviveObject * so, uint8_t reserved, uint16_t pulseHigh, uint16_t pulseLow, uint16_t repeatCount);