aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorultramn <dchapm2@umbc.edu>2016-12-16 13:52:44 -0800
committerultramn <dchapm2@umbc.edu>2016-12-16 13:52:44 -0800
commitcc05bcaf95b80dc89cbe1f8486c0ed14dc4d956c (patch)
treedebf059c1f072e265254a5180e8fc06f74291ebf /include
parent93ad6a810479a5cc09a809f2ea23d549c7cc9c2a (diff)
parent898a9a5f242a1691e1c34062208b48cb0682b5d9 (diff)
downloadlibsurvive-cc05bcaf95b80dc89cbe1f8486c0ed14dc4d956c.tar.gz
libsurvive-cc05bcaf95b80dc89cbe1f8486c0ed14dc4d956c.tar.bz2
Merge branch 'master' of https://github.com/cnlohr/libsurvive
Diffstat (limited to 'include')
-rw-r--r--include/survive.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/include/survive.h b/include/survive.h
index 7ae1402..61a6620 100644
--- a/include/survive.h
+++ b/include/survive.h
@@ -1,16 +1,53 @@
#ifndef _SURVIVE_H
#define _SURVIVE_H
+#include <stdint.h>
+
+#define SV_FLOAT double
+
struct SurviveContext;
-struct SurviveContext * survive_init( void(*faultfunction)( struct SurviveContext * ctx, const char * fault ),
- void(*notefunction)( struct SurviveContext * ctx, const char * note ) );
+//DANGER: This structure may be redefined
+
+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;
+};
+
+typedef void (*text_feedback_fnptr)( struct SurviveContext * ctx, const char * fault );
+typedef void (*light_process_func)( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length );
+typedef void (*imu_process_func)( struct SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id );
+
+struct SurviveContext * survive_init();
+
+//For any of these, you may pass in 0 for the function pointer to use default behavior.
+void survive_install_info_fn( struct SurviveContext * ctx, text_feedback_fnptr fbp );
+void survive_install_error_fn( struct SurviveContext * ctx, text_feedback_fnptr fbp );
+void survive_install_light_fn( struct SurviveContext * ctx, light_process_func fbp );
+void survive_install_imu_fn( struct SurviveContext * ctx, imu_process_func fbp );
void survive_close( struct SurviveContext * ctx );
int survive_poll();
+
+//Utilitiy functions.
int survive_simple_inflate( struct SurviveContext * ctx, const char * input, int inlen, char * output, int outlen );
+//TODO: Need to make this do haptic responses for hands.
+int survive_usb_send_magic( struct SurviveContext * ctx, int on );
+
#endif