From 08784031f5939de331de86cc27ac5f040affa605 Mon Sep 17 00:00:00 2001 From: antoine loriette Date: Thu, 20 Jul 2017 17:10:53 +0100 Subject: [PATCH] reorder functions in DeviceBase --- pyrealsense/core.py | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/pyrealsense/core.py b/pyrealsense/core.py index b2a0629..9b37d25 100644 --- a/pyrealsense/core.py +++ b/pyrealsense/core.py @@ -420,24 +420,6 @@ def set_device_options(self, options, values): lrs.rs_set_device_options(self.dev, c_options, count, c_values, ctypes.byref(e)) _check_error(e) - def reset_device_options_to_default(self, options): - """Reset device options to default. - - Args: - option (:obj:`list` of int): taken from :class:`pyrealsense.constants.rs_option`. - """ - e = ctypes.POINTER(rs_error)() - count = len(options) - option_array_type = ctypes.c_int * count - lrs.rs_reset_device_options_to_default.argtypes = [ctypes.POINTER(rs_device), - option_array_type, - ctypes.c_int, - ctypes.POINTER(ctypes.POINTER(rs_error))] - lrs.rs_reset_device_options_to_default.restype = None - c_options = option_array_type(*options) - lrs.rs_reset_device_options_to_default(self.dev, c_options, count, ctypes.byref(e)) - _check_error(e) - def get_device_option(self, option): """Get device option. @@ -451,6 +433,17 @@ def get_device_option(self, option): e = ctypes.POINTER(rs_error)() return lrs.rs_get_device_option(self.dev, option, ctypes.byref(e)) + def set_device_option(self, option, value): + """Set device option. + + Args: + option (int): taken from :class:`pyrealsense.constants.rs_option`. + value (double): value to be set for the option. + """ + e = ctypes.POINTER(rs_error)() + lrs.rs_set_device_option(self.dev, ctypes.c_uint(option), ctypes.c_double(value), ctypes.byref(e)) + _check_error(e) + def get_device_option_range_ex(self, option): """Get device option range. @@ -483,15 +476,22 @@ def get_device_option_description(self, option): e = ctypes.POINTER(rs_error)() return pp(lrs.rs_get_device_option_description, self.dev, ctypes.c_uint(option), ctypes.byref(e)) - def set_device_option(self, option, value): - """Set device option. + def reset_device_options_to_default(self, options): + """Reset device options to default. Args: - option (int): taken from :class:`pyrealsense.constants.rs_option`. - value (double): value to be set for the option. + option (:obj:`list` of int): taken from :class:`pyrealsense.constants.rs_option`. """ e = ctypes.POINTER(rs_error)() - lrs.rs_set_device_option(self.dev, ctypes.c_uint(option), ctypes.c_double(value), ctypes.byref(e)) + count = len(options) + option_array_type = ctypes.c_int * count + lrs.rs_reset_device_options_to_default.argtypes = [ctypes.POINTER(rs_device), + option_array_type, + ctypes.c_int, + ctypes.POINTER(ctypes.POINTER(rs_error))] + lrs.rs_reset_device_options_to_default.restype = None + c_options = option_array_type(*options) + lrs.rs_reset_device_options_to_default(self.dev, c_options, count, ctypes.byref(e)) _check_error(e) def _get_stream_intrinsics(self, stream):