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 --- api_example.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 api_example.c (limited to 'api_example.c') diff --git a/api_example.c b/api_example.c new file mode 100644 index 0000000..f2d9bd6 --- /dev/null +++ b/api_example.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) { + SurviveAsyncContext *actx = survive_asyc_init(argc, argv); + if (actx == 0) // implies -help or similiar + return 0; + + survive_async_start_thread(actx); + + while (survive_async_is_running(actx)) { + OGUSleep(30000); + + SurvivePose pose; + + for (const SurviveAsyncObject* it = survive_async_get_first_tracked(actx); it != 0; it = survive_async_get_next_tracked(actx, it)) { + uint32_t timecode = survive_async_object_get_latest_pose(it, &pose); + printf("%s (%u): %f %f %f %f %f %f %f\n", survive_async_object_name(it), timecode, + pose.Pos[0], pose.Pos[1], pose.Pos[2], pose.Rot[0], pose.Rot[1], pose.Rot[2], pose.Rot[3]); + } + + OGUSleep(30000); + for (const SurviveAsyncObject* it = survive_async_get_next_updated(actx); it != 0; it = survive_async_get_next_updated(actx)) { + printf("%s changed since last checked\n", survive_async_object_name(it)); + } + + } + + survive_async_close(actx); + return 0; +} -- cgit v1.2.3 From d438c5b16f42700c8ff541269759d6c585959729 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Wed, 4 Apr 2018 09:37:18 -0600 Subject: Fixed api demo --- api_example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api_example.c') diff --git a/api_example.c b/api_example.c index f2d9bd6..515c4e6 100644 --- a/api_example.c +++ b/api_example.c @@ -4,7 +4,7 @@ #include int main(int argc, char **argv) { - SurviveAsyncContext *actx = survive_asyc_init(argc, argv); + SurviveAsyncContext *actx = survive_async_init(argc, argv); if (actx == 0) // implies -help or similiar return 0; -- 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 --- api_example.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'api_example.c') diff --git a/api_example.c b/api_example.c index 515c4e6..b0c9e4c 100644 --- a/api_example.c +++ b/api_example.c @@ -15,7 +15,8 @@ int main(int argc, char **argv) { SurvivePose pose; - for (const SurviveAsyncObject* it = survive_async_get_first_tracked(actx); it != 0; it = survive_async_get_next_tracked(actx, it)) { + for (const SurviveAsyncObject *it = survive_async_get_first_object(actx); it != 0; + it = survive_async_get_next_object(actx, it)) { uint32_t timecode = survive_async_object_get_latest_pose(it, &pose); printf("%s (%u): %f %f %f %f %f %f %f\n", survive_async_object_name(it), timecode, pose.Pos[0], pose.Pos[1], pose.Pos[2], pose.Rot[0], pose.Rot[1], pose.Rot[2], pose.Rot[3]); -- 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 --- api_example.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'api_example.c') diff --git a/api_example.c b/api_example.c index b0c9e4c..1f06740 100644 --- a/api_example.c +++ b/api_example.c @@ -4,31 +4,32 @@ #include int main(int argc, char **argv) { - SurviveAsyncContext *actx = survive_async_init(argc, argv); + SurviveSimpleContext *actx = survive_simple_init(argc, argv); if (actx == 0) // implies -help or similiar return 0; - survive_async_start_thread(actx); + survive_simple_start_thread(actx); - while (survive_async_is_running(actx)) { + while (survive_simple_is_running(actx)) { OGUSleep(30000); SurvivePose pose; - for (const SurviveAsyncObject *it = survive_async_get_first_object(actx); it != 0; - it = survive_async_get_next_object(actx, it)) { - uint32_t timecode = survive_async_object_get_latest_pose(it, &pose); - printf("%s (%u): %f %f %f %f %f %f %f\n", survive_async_object_name(it), timecode, - pose.Pos[0], pose.Pos[1], pose.Pos[2], pose.Rot[0], pose.Rot[1], pose.Rot[2], pose.Rot[3]); + for (const SurviveSimpleObject *it = survive_simple_get_first_object(actx); it != 0; + it = survive_simple_get_next_object(actx, it)) { + uint32_t timecode = survive_simple_object_get_latest_pose(it, &pose); + printf("%s (%u): %f %f %f %f %f %f %f\n", survive_simple_object_name(it), timecode, pose.Pos[0], + pose.Pos[1], pose.Pos[2], pose.Rot[0], pose.Rot[1], pose.Rot[2], pose.Rot[3]); } OGUSleep(30000); - for (const SurviveAsyncObject* it = survive_async_get_next_updated(actx); it != 0; it = survive_async_get_next_updated(actx)) { - printf("%s changed since last checked\n", survive_async_object_name(it)); + for (const SurviveSimpleObject *it = survive_simple_get_next_updated(actx); it != 0; + it = survive_simple_get_next_updated(actx)) { + printf("%s changed since last checked\n", survive_simple_object_name(it)); } } - - survive_async_close(actx); + + survive_simple_close(actx); return 0; } -- cgit v1.2.3