aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-04-05 07:56:01 -0600
committerJustin Berger <j.david.berger@gmail.com>2018-04-05 07:56:01 -0600
commit9e1883922de980c01e60bde10c1e67261752afa6 (patch)
tree0732dbbc7817644e1f03cea7c8432284af98bd04
parent4b045e61ed6f3812cbf273ae279bfd7bc1ce029c (diff)
downloadlibsurvive-9e1883922de980c01e60bde10c1e67261752afa6.tar.gz
libsurvive-9e1883922de980c01e60bde10c1e67261752afa6.tar.bz2
Fixed typo; naming suggestions
-rw-r--r--api_example.c3
-rw-r--r--include/libsurvive/survive_api.h10
-rw-r--r--src/survive_api.c11
3 files changed, 13 insertions, 11 deletions
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]);
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
diff --git a/src/survive_api.c b/src/survive_api.c
index bb1f090..e2c3d54 100644
--- a/src/survive_api.c
+++ b/src/survive_api.c
@@ -12,7 +12,7 @@ struct SurviveAsyncObject {
} type;
union {
- int lighthosue;
+ int lighthouse;
struct SurviveObject* so;
} data;
@@ -67,7 +67,7 @@ struct SurviveAsyncContext *survive_async_init(int argc, char *const *argv) {
int i = 0;
for (i = 0; i < ctx->activeLighthouses; i++) {
struct SurviveAsyncObject* obj = &actx->objects[i];
- obj->data.lighthosue = i;
+ obj->data.lighthouse = i;
obj->type = SurviveAsyncObject_LIGHTHOUSE;
obj->actx = actx;
obj->has_update = ctx->bsd[i].PositionSet;
@@ -122,14 +122,15 @@ int survive_async_stop_thread(struct SurviveAsyncContext* actx) {
return error;
}
-const struct SurviveAsyncObject* survive_async_get_next_tracked(struct SurviveAsyncContext* actx, const struct SurviveAsyncObject* curr) {
+const struct SurviveAsyncObject *survive_async_get_next_object(struct SurviveAsyncContext *actx,
+ const struct SurviveAsyncObject *curr) {
const struct SurviveAsyncObject* next = curr + 1;
if (next >= actx->objects + actx->object_ct)
return 0;
return next;
}
-const struct SurviveAsyncObject* survive_async_get_first_tracked(struct SurviveAsyncContext* actx) {
+const struct SurviveAsyncObject *survive_async_get_first_object(struct SurviveAsyncContext *actx) {
return actx->objects;
}
@@ -150,7 +151,7 @@ uint32_t survive_async_object_get_latest_pose(const struct SurviveAsyncObject* s
switch (sao->type) {
case SurviveAsyncObject_LIGHTHOUSE: {
if(pose)
- *pose = sao->actx->ctx->bsd[sao->data.lighthosue].Pose;
+ *pose = sao->actx->ctx->bsd[sao->data.lighthouse].Pose;
break;
}
case SurviveAsyncObject_OBJECT: