From 5f429662488533ff4f4384b678ae738244972cc6 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Tue, 10 Apr 2018 23:48:36 -0600 Subject: Updated naming of python binding --- bindings/python/example.py | 2 +- bindings/python/libsurvive.py | 56 +++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 29 deletions(-) (limited to 'bindings') diff --git a/bindings/python/example.py b/bindings/python/example.py index 5454fbc..32d58de 100644 --- a/bindings/python/example.py +++ b/bindings/python/example.py @@ -1,7 +1,7 @@ import libsurvive import sys -actx = libsurvive.AsyncContext(sys.argv) +actx = libsurvive.SimpleContext(sys.argv) for obj in actx.Objects(): print(obj.Name()) diff --git a/bindings/python/libsurvive.py b/bindings/python/libsurvive.py index e88657a..653eb60 100644 --- a/bindings/python/libsurvive.py +++ b/bindings/python/libsurvive.py @@ -4,26 +4,26 @@ _libsurvive = ctypes.CDLL('./_libsurvive.so') LP_c_char = ctypes.POINTER(ctypes.c_char) LP_LP_c_char = ctypes.POINTER(LP_c_char) -_libsurvive.survive_async_init.argtypes = (ctypes.c_int, LP_LP_c_char) # argc, argv -_libsurvive.survive_async_init.restype = ctypes.c_void_p +_libsurvive.survive_simple_init.argtypes = (ctypes.c_int, LP_LP_c_char) # argc, argv +_libsurvive.survive_simple_init.restype = ctypes.c_void_p -_libsurvive.survive_async_get_next_object.argtypes = [ctypes.c_void_p, ctypes.c_void_p] -_libsurvive.survive_async_get_next_object.restype = ctypes.c_void_p +_libsurvive.survive_simple_get_next_object.argtypes = [ctypes.c_void_p, ctypes.c_void_p] +_libsurvive.survive_simple_get_next_object.restype = ctypes.c_void_p -_libsurvive.survive_async_get_first_object.argtypes = [ctypes.c_void_p] -_libsurvive.survive_async_get_first_object.restype = ctypes.c_void_p +_libsurvive.survive_simple_get_first_object.argtypes = [ctypes.c_void_p] +_libsurvive.survive_simple_get_first_object.restype = ctypes.c_void_p -_libsurvive.survive_async_get_next_updated.argtypes = [ctypes.c_void_p] -_libsurvive.survive_async_get_next_updated.restype = ctypes.c_void_p +_libsurvive.survive_simple_get_next_updated.argtypes = [ctypes.c_void_p] +_libsurvive.survive_simple_get_next_updated.restype = ctypes.c_void_p -_libsurvive.survive_async_object_name.argtypes = [ ctypes.c_void_p ] -_libsurvive.survive_async_object_name.restype = ctypes.c_char_p +_libsurvive.survive_simple_object_name.argtypes = [ ctypes.c_void_p ] +_libsurvive.survive_simple_object_name.restype = ctypes.c_char_p -_libsurvive.survive_async_is_running.argtypes = [ctypes.c_void_p] -_libsurvive.survive_async_is_running.restype = ctypes.c_bool +_libsurvive.survive_simple_is_running.argtypes = [ctypes.c_void_p] +_libsurvive.survive_simple_is_running.restype = ctypes.c_bool -_libsurvive.survive_async_start_thread.argtypes = [ctypes.c_void_p] -_libsurvive.survive_async_start_thread.restype = None +_libsurvive.survive_simple_start_thread.argtypes = [ctypes.c_void_p] +_libsurvive.survive_simple_start_thread.restype = None class SurvivePose(ctypes.Structure): _fields_ = [ @@ -34,23 +34,23 @@ class SurvivePose(ctypes.Structure): return '[{0} {1} {2}], [{3} {4} {5} {6}]'.format(self.Pos[0],self.Pos[1],self.Pos[2],self.Rot[0],self.Rot[1],self.Rot[2],self.Rot[3]) -_libsurvive.survive_async_object_get_latest_pose.argtypes = [ctypes.c_void_p, ctypes.POINTER(SurvivePose)] -_libsurvive.survive_async_object_get_latest_pose.restype = ctypes.c_uint +_libsurvive.survive_simple_object_get_latest_pose.argtypes = [ctypes.c_void_p, ctypes.POINTER(SurvivePose)] +_libsurvive.survive_simple_object_get_latest_pose.restype = ctypes.c_uint -class AsyncObject: +class SimpleObject: ptr = 0 def __init__(self, ptr): self.ptr = ptr def Name(self): - return _libsurvive.survive_async_object_name(self.ptr) + return _libsurvive.survive_simple_object_name(self.ptr) def Pose(self): pose = SurvivePose() - time = _libsurvive.survive_async_object_get_latest_pose(self.ptr, pose) + time = _libsurvive.survive_simple_object_get_latest_pose(self.ptr, pose) return (pose, time) -class AsyncContext: +class SimpleContext: ptr = 0 objects = [] @@ -60,24 +60,24 @@ class AsyncContext: for i, arg in enumerate(args): enc_arg = arg.encode('utf-8') argv[i] = ctypes.create_string_buffer(enc_arg) - self.ptr = _libsurvive.survive_async_init(argc, argv) + self.ptr = _libsurvive.survive_simple_init(argc, argv) self.objects = [] - curr = _libsurvive.survive_async_get_first_object(self.ptr); + curr = _libsurvive.survive_simple_get_first_object(self.ptr); while curr: - self.objects.append(AsyncObject(curr)) - curr = _libsurvive.survive_async_get_next_object(self.ptr, curr); - _libsurvive.survive_async_start_thread(self.ptr) + self.objects.append(SimpleObject(curr)) + curr = _libsurvive.survive_simple_get_next_object(self.ptr, curr); + _libsurvive.survive_simple_start_thread(self.ptr) def Objects(self): return self.objects def Running(self): - return _libsurvive.survive_async_is_running(self.ptr) + return _libsurvive.survive_simple_is_running(self.ptr) def NextUpdated(self): - ptr = _libsurvive.survive_async_get_next_updated(self.ptr) + ptr = _libsurvive.survive_simple_get_next_updated(self.ptr) if ptr: - return AsyncObject(ptr) + return SimpleObject(ptr) return None -- cgit v1.2.3