From 7d1d930dcb99559eee95fc8a94cc68d12a968353 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Tue, 3 Apr 2018 16:08:00 -0600 Subject: Added simple API --- include/libsurvive/survive_api.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/libsurvive/survive_api.h (limited to 'include/libsurvive/survive_api.h') diff --git a/include/libsurvive/survive_api.h b/include/libsurvive/survive_api.h new file mode 100644 index 0000000..30e30ac --- /dev/null +++ b/include/libsurvive/survive_api.h @@ -0,0 +1,30 @@ +#include "survive_types.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + + struct SurviveAsyncContext; + typedef struct SurviveAsyncContext SurviveAsyncContext; + + SURVIVE_EXPORT SurviveAsyncContext *survive_asyc_init(int argc, char *const *argv); + SURVIVE_EXPORT void survive_async_close(SurviveAsyncContext* actx); + + SURVIVE_EXPORT void survive_async_start_thread(SurviveAsyncContext* actx); + SURVIVE_EXPORT int survive_async_stop_thread(SurviveAsyncContext* actx); + SURVIVE_EXPORT bool survive_async_is_running(SurviveAsyncContext* actx); + + struct SurviveAsyncObject; + typedef struct SurviveAsyncObject SurviveAsyncObject; + + SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_first_tracked(SurviveAsyncContext* actx); + SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_next_tracked(SurviveAsyncContext* actx, const SurviveAsyncObject* curr); + SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_next_updated(SurviveAsyncContext* actx); + + SURVIVE_EXPORT survive_timecode survive_async_object_get_latest_pose(const SurviveAsyncObject* sao, SurvivePose* pose); + SURVIVE_EXPORT const char* survive_async_object_name(SurviveAsyncObject* sao); + +#ifdef __cplusplus +} +#endif -- cgit v1.2.3 From be7593dc945ed4025f81c6876760807310a67319 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Tue, 3 Apr 2018 22:56:40 -0600 Subject: Minor cleanup --- include/libsurvive/survive_api.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/libsurvive/survive_api.h') diff --git a/include/libsurvive/survive_api.h b/include/libsurvive/survive_api.h index 30e30ac..aacd47a 100644 --- a/include/libsurvive/survive_api.h +++ b/include/libsurvive/survive_api.h @@ -8,7 +8,7 @@ extern "C" { struct SurviveAsyncContext; typedef struct SurviveAsyncContext SurviveAsyncContext; - SURVIVE_EXPORT SurviveAsyncContext *survive_asyc_init(int argc, char *const *argv); + SURVIVE_EXPORT SurviveAsyncContext *survive_async_init(int argc, char *const *argv); SURVIVE_EXPORT void survive_async_close(SurviveAsyncContext* actx); SURVIVE_EXPORT void survive_async_start_thread(SurviveAsyncContext* actx); @@ -22,8 +22,9 @@ extern "C" { SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_next_tracked(SurviveAsyncContext* actx, const SurviveAsyncObject* curr); SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_next_updated(SurviveAsyncContext* actx); - SURVIVE_EXPORT survive_timecode survive_async_object_get_latest_pose(const SurviveAsyncObject* sao, SurvivePose* pose); - SURVIVE_EXPORT const char* survive_async_object_name(SurviveAsyncObject* sao); + SURVIVE_EXPORT survive_timecode survive_async_object_get_latest_pose(const SurviveAsyncObject *sao, + SurvivePose *OUTPUT); + SURVIVE_EXPORT const char *survive_async_object_name(const SurviveAsyncObject *sao); #ifdef __cplusplus } -- cgit v1.2.3 From 8992810b626e58e1dd1ed61b3b41f20db60dddf4 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Wed, 4 Apr 2018 00:50:05 -0600 Subject: Added basic documentation --- include/libsurvive/survive_api.h | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'include/libsurvive/survive_api.h') diff --git a/include/libsurvive/survive_api.h b/include/libsurvive/survive_api.h index aacd47a..52eca8d 100644 --- a/include/libsurvive/survive_api.h +++ b/include/libsurvive/survive_api.h @@ -8,22 +8,54 @@ extern "C" { struct SurviveAsyncContext; typedef struct SurviveAsyncContext SurviveAsyncContext; + /*** + * Initialize a new instance of an async context -- mirrors survive_init + * @return Pointer to the async context + */ SURVIVE_EXPORT SurviveAsyncContext *survive_async_init(int argc, char *const *argv); + + /** + * Close all devices and free all memory associated with the given context + */ SURVIVE_EXPORT void survive_async_close(SurviveAsyncContext* actx); + /** + * Start the background thread which processes images. + */ SURVIVE_EXPORT void survive_async_start_thread(SurviveAsyncContext* actx); - SURVIVE_EXPORT int survive_async_stop_thread(SurviveAsyncContext* actx); - SURVIVE_EXPORT bool survive_async_is_running(SurviveAsyncContext* actx); + + /** + * @return true iff the background thread is still running + */ + SURVIVE_EXPORT bool survive_async_is_running(SurviveAsyncContext *actx); struct SurviveAsyncObject; typedef struct SurviveAsyncObject SurviveAsyncObject; + /** + * Get the first known object. Note that the first n objects are the lighthouses; for however many you are + * configured for. + */ SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_first_tracked(SurviveAsyncContext* actx); + /** + * Get the next known object from a current one. + */ SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_next_tracked(SurviveAsyncContext* actx, const SurviveAsyncObject* curr); - SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_next_updated(SurviveAsyncContext* actx); + /** + * Gets the next object which has been updated since we last looked at it with this function + */ + SURVIVE_EXPORT const SurviveAsyncObject *survive_async_get_next_updated(SurviveAsyncContext *actx); + + /** + * Gets the pose of a given object + */ SURVIVE_EXPORT survive_timecode survive_async_object_get_latest_pose(const SurviveAsyncObject *sao, - SurvivePose *OUTPUT); + SurvivePose *pose); + + /** + * Gets the null terminated name of the object. + */ SURVIVE_EXPORT const char *survive_async_object_name(const SurviveAsyncObject *sao); #ifdef __cplusplus -- cgit v1.2.3 From 9e1883922de980c01e60bde10c1e67261752afa6 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Thu, 5 Apr 2018 07:56:01 -0600 Subject: Fixed typo; naming suggestions --- include/libsurvive/survive_api.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/libsurvive/survive_api.h') diff --git a/include/libsurvive/survive_api.h b/include/libsurvive/survive_api.h index 52eca8d..fc4ce2c 100644 --- a/include/libsurvive/survive_api.h +++ b/include/libsurvive/survive_api.h @@ -20,7 +20,7 @@ extern "C" { SURVIVE_EXPORT void survive_async_close(SurviveAsyncContext* actx); /** - * Start the background thread which processes images. + * Start the background thread which processes various inputs and produces deliverable data like position. */ SURVIVE_EXPORT void survive_async_start_thread(SurviveAsyncContext* actx); @@ -33,14 +33,14 @@ extern "C" { typedef struct SurviveAsyncObject SurviveAsyncObject; /** - * Get the first known object. Note that the first n objects are the lighthouses; for however many you are - * configured for. + * Get the first known object. Note that this also includes lighthouses */ - SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_first_tracked(SurviveAsyncContext* actx); + SURVIVE_EXPORT const SurviveAsyncObject *survive_async_get_first_object(SurviveAsyncContext *actx); /** * Get the next known object from a current one. */ - SURVIVE_EXPORT const SurviveAsyncObject* survive_async_get_next_tracked(SurviveAsyncContext* actx, const SurviveAsyncObject* curr); + SURVIVE_EXPORT const SurviveAsyncObject *survive_async_get_next_object(SurviveAsyncContext *actx, + const SurviveAsyncObject *curr); /** * Gets the next object which has been updated since we last looked at it with this function -- cgit v1.2.3 From 30cfb87ec0d95e0cb8a671cf8f2327b4204927ed Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Tue, 10 Apr 2018 23:44:36 -0600 Subject: Renamed api; fixed various warnings --- include/libsurvive/survive_api.h | 104 +++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'include/libsurvive/survive_api.h') diff --git a/include/libsurvive/survive_api.h b/include/libsurvive/survive_api.h index fc4ce2c..64d1271 100644 --- a/include/libsurvive/survive_api.h +++ b/include/libsurvive/survive_api.h @@ -5,58 +5,58 @@ extern "C" { #endif - struct SurviveAsyncContext; - typedef struct SurviveAsyncContext SurviveAsyncContext; - - /*** - * Initialize a new instance of an async context -- mirrors survive_init - * @return Pointer to the async context - */ - SURVIVE_EXPORT SurviveAsyncContext *survive_async_init(int argc, char *const *argv); - - /** - * Close all devices and free all memory associated with the given context - */ - SURVIVE_EXPORT void survive_async_close(SurviveAsyncContext* actx); - - /** - * Start the background thread which processes various inputs and produces deliverable data like position. - */ - SURVIVE_EXPORT void survive_async_start_thread(SurviveAsyncContext* actx); - - /** - * @return true iff the background thread is still running - */ - SURVIVE_EXPORT bool survive_async_is_running(SurviveAsyncContext *actx); - - struct SurviveAsyncObject; - typedef struct SurviveAsyncObject SurviveAsyncObject; - - /** - * Get the first known object. Note that this also includes lighthouses - */ - SURVIVE_EXPORT const SurviveAsyncObject *survive_async_get_first_object(SurviveAsyncContext *actx); - /** - * Get the next known object from a current one. - */ - SURVIVE_EXPORT const SurviveAsyncObject *survive_async_get_next_object(SurviveAsyncContext *actx, - const SurviveAsyncObject *curr); - - /** - * Gets the next object which has been updated since we last looked at it with this function - */ - SURVIVE_EXPORT const SurviveAsyncObject *survive_async_get_next_updated(SurviveAsyncContext *actx); - - /** - * Gets the pose of a given object - */ - SURVIVE_EXPORT survive_timecode survive_async_object_get_latest_pose(const SurviveAsyncObject *sao, - SurvivePose *pose); - - /** - * Gets the null terminated name of the object. - */ - SURVIVE_EXPORT const char *survive_async_object_name(const SurviveAsyncObject *sao); +struct SurviveSimpleContext; +typedef struct SurviveSimpleContext SurviveSimpleContext; + +/*** + * Initialize a new instance of an simple context -- mirrors survive_init + * @return Pointer to the simple context + */ +SURVIVE_EXPORT SurviveSimpleContext *survive_simple_init(int argc, char *const *argv); + +/** + * Close all devices and free all memory associated with the given context + */ +SURVIVE_EXPORT void survive_simple_close(SurviveSimpleContext *actx); + +/** + * Start the background thread which processes various inputs and produces deliverable data like position. + */ +SURVIVE_EXPORT void survive_simple_start_thread(SurviveSimpleContext *actx); + +/** + * @return true iff the background thread is still running + */ +SURVIVE_EXPORT bool survive_simple_is_running(SurviveSimpleContext *actx); + +struct SurviveSimpleObject; +typedef struct SurviveSimpleObject SurviveSimpleObject; + +/** + * Get the first known object. Note that this also includes lighthouses + */ +SURVIVE_EXPORT const SurviveSimpleObject *survive_simple_get_first_object(SurviveSimpleContext *actx); +/** + * Get the next known object from a current one. + */ +SURVIVE_EXPORT const SurviveSimpleObject *survive_simple_get_next_object(SurviveSimpleContext *actx, + const SurviveSimpleObject *curr); + +/** + * Gets the next object which has been updated since we last looked at it with this function + */ +SURVIVE_EXPORT const SurviveSimpleObject *survive_simple_get_next_updated(SurviveSimpleContext *actx); + +/** + * Gets the pose of a given object + */ +SURVIVE_EXPORT survive_timecode survive_simple_object_get_latest_pose(const SurviveSimpleObject *sao, + SurvivePose *pose); + +/** + * Gets the null terminated name of the object. + */ +SURVIVE_EXPORT const char *survive_simple_object_name(const SurviveSimpleObject *sao); #ifdef __cplusplus } -- cgit v1.2.3