unit-tests-offline.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #if !defined(MAKEFILE) || ( defined(OFFLINE_TEST) )
5 
6 #define CATCH_CONFIG_MAIN
7 #include "catch/catch.hpp"
8 
9 #include "unit-tests-common.h"
10 #include "../src/device.h"
11 
12 #include <sstream>
13 
14 static std::string unknown = "UNKNOWN";
15 
16 // Helper to produce a not-null pointer to a specific object type, to help validate API methods.
17 // Use with caution, the resulting pointer does not address a real object!
18 struct fake_object_pointer { template<class T> operator T * () const { return (T *)(0x100); } };
19 
20 
21 TEST_CASE("wraparound_mechanism produces correct output", "[offline] [validation]")
22 {
23  auto unsigned_short_max = std::numeric_limits<uint16_t>::max();
24  rsimpl::wraparound_mechanism<unsigned long long> wm(1, unsigned_short_max);
25 
26  unsigned long long last_number = 65532;
27  for (unsigned i = 65533; last_number < unsigned_short_max * 5; ++i)
28  {
29  if (i > unsigned_short_max)
30  i = 1;
31 
32  auto new_number = wm.fix(i);
33  REQUIRE((new_number - last_number) == 1);
34  last_number = new_number;
35  }
36 }
37 
38 TEST_CASE( "rs_create_context() validates input", "[offline] [validation]" )
39 {
40  REQUIRE(rs_create_context(RS_API_VERSION - 100, require_error("", false)) == nullptr);
41  REQUIRE(rs_create_context(RS_API_VERSION + 100, require_error("", false)) == nullptr);
42  auto ctx = rs_create_context(RS_API_VERSION + 1, require_no_error()); // make sure changes in patch do not fail context creation
43  REQUIRE(ctx != nullptr);
45 }
46 
47 TEST_CASE( "rs_delete_context() validates input", "[offline] [validation]" )
48 {
49  rs_delete_context(nullptr, require_error("null pointer passed for argument \"context\""));
50 }
51 
52 TEST_CASE( "rs_get_device_count() validates input", "[offline] [validation]" )
53 {
54  REQUIRE(rs_get_device_count(nullptr, require_error("null pointer passed for argument \"context\"")) == 0);
55 }
56 
57 TEST_CASE( "rs_get_device() validates input", "[offline] [validation]" )
58 {
59  REQUIRE(rs_get_device(nullptr, 0, require_error("null pointer passed for argument \"context\"")) == nullptr);
60 
61  REQUIRE(rs_get_device(fake_object_pointer(), -1, require_error("out of range value for argument \"index\"")) == nullptr);
62  // NOTE: Index upper bound determined by rs_get_device_count(), can't validate without a live object
63 }
64 
65 TEST_CASE( "rs_get_device_name() validates input", "[offline] [validation]" )
66 {
67  REQUIRE(rs_get_device_name(nullptr, require_error("null pointer passed for argument \"device\"")) == nullptr);
68 }
69 
70 TEST_CASE( "rs_get_device_serial() validates input", "[offline] [validation]" )
71 {
72  REQUIRE(rs_get_device_serial(nullptr, require_error("null pointer passed for argument \"device\"")) == nullptr);
73 }
74 
75 TEST_CASE( "rs_get_device_firmware_version() validates input", "[offline] [validation]" )
76 {
77  REQUIRE(rs_get_device_firmware_version(nullptr, require_error("null pointer passed for argument \"device\"")) == nullptr);
78 }
79 
80 TEST_CASE( "rs_get_device_extrinsics() validates input", "[offline] [validation]" )
81 {
82  rs_extrinsics extrin;
83  rs_get_device_extrinsics(nullptr, RS_STREAM_DEPTH, RS_STREAM_COLOR, &extrin, require_error("null pointer passed for argument \"device\""));
84 
85  rs_get_device_extrinsics(fake_object_pointer(), (rs_stream)-1, RS_STREAM_COLOR, &extrin, require_error("bad enum value for argument \"from\""));
86  rs_get_device_extrinsics(fake_object_pointer(), RS_STREAM_COUNT, RS_STREAM_COLOR, &extrin, require_error("bad enum value for argument \"from\""));
87 
88  rs_get_device_extrinsics(fake_object_pointer(), RS_STREAM_DEPTH, (rs_stream)-1, &extrin, require_error("bad enum value for argument \"to\""));
89  rs_get_device_extrinsics(fake_object_pointer(), RS_STREAM_DEPTH, RS_STREAM_COUNT, &extrin, require_error("bad enum value for argument \"to\""));
90 
91  rs_get_device_extrinsics(fake_object_pointer(), RS_STREAM_DEPTH, RS_STREAM_COLOR, nullptr, require_error("null pointer passed for argument \"extrin\""));
92 }
93 
94 TEST_CASE( "rs_get_device_depth_scale() validates input", "[offline] [validation]" )
95 {
96  REQUIRE(rs_get_device_depth_scale(nullptr, require_error("null pointer passed for argument \"device\"")) == 0.0f);
97 }
98 
99 TEST_CASE( "rs_device_supports_option() validates input", "[offline] [validation]" )
100 {
101  REQUIRE(rs_device_supports_option(nullptr, RS_OPTION_COLOR_GAIN, require_error("null pointer passed for argument \"device\"")) == 0);
102 
103  REQUIRE(rs_device_supports_option(fake_object_pointer(), (rs_option)-1, require_error("bad enum value for argument \"option\"")) == 0);
104  REQUIRE(rs_device_supports_option(fake_object_pointer(), RS_OPTION_COUNT, require_error("bad enum value for argument \"option\"")) == 0);
105 }
106 
107 TEST_CASE( "rs_get_stream_mode_count() validates input", "[offline] [validation]" )
108 {
109  REQUIRE(rs_get_stream_mode_count(nullptr, RS_STREAM_DEPTH, require_error("null pointer passed for argument \"device\"")) == 0);
110 
111  REQUIRE(rs_get_stream_mode_count(fake_object_pointer(), (rs_stream)-1, require_error("bad enum value for argument \"stream\"")) == 0);
112  REQUIRE(rs_get_stream_mode_count(fake_object_pointer(), RS_STREAM_COUNT, require_error("bad enum value for argument \"stream\"")) == 0);
113 }
114 
115 TEST_CASE( "rs_get_stream_mode() validates input", "[offline] [validation]" )
116 {
117  int width, height, framerate; rs_format format;
118  rs_get_stream_mode(nullptr, RS_STREAM_DEPTH, 0, &width, &height, &format, &framerate, require_error("null pointer passed for argument \"device\""));
119 
120  rs_get_stream_mode(fake_object_pointer(), (rs_stream)-1, 0, &width, &height, &format, &framerate, require_error("bad enum value for argument \"stream\""));
121  rs_get_stream_mode(fake_object_pointer(), RS_STREAM_COUNT, 0, &width, &height, &format, &framerate, require_error("bad enum value for argument \"stream\""));
122 
123  rs_get_stream_mode(fake_object_pointer(), RS_STREAM_DEPTH, -1, &width, &height, &format, &framerate, require_error("out of range value for argument \"index\""));
124  // NOTE: Index upper bound determined by rs_get_stream_mode_count(), can't validate without a live object
125 
126  // NOTE: width, height, format, framerate are all permitted to be null, nothing to validate
127 }
128 
129 TEST_CASE( "rs_enable_stream() validates input", "[offline] [validation]" )
130 {
131  rs_enable_stream(nullptr, RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, 60, require_error("null pointer passed for argument \"device\""));
132 
133  const auto RS_STREAM_MAX_ENUM = (rs_stream)0xFFFF;
134  const auto RS_FORMAT_MAX_ENUM = (rs_format)0xFFFF;
135  rs_enable_stream(fake_object_pointer(), (rs_stream)-1, 640, 480, RS_FORMAT_Z16, 60, require_error("bad enum value for argument \"stream\""));
136  rs_enable_stream(fake_object_pointer(), RS_STREAM_COUNT, 640, 480, RS_FORMAT_Z16, 60, require_error("bad enum value for argument \"stream\""));
137  rs_enable_stream(fake_object_pointer(), RS_STREAM_MAX_ENUM, 640, 480, RS_FORMAT_Z16, 60, require_error("bad enum value for argument \"stream\""));
138 
139  rs_enable_stream(fake_object_pointer(), RS_STREAM_DEPTH, -1, 480, RS_FORMAT_Z16, 60, require_error("out of range value for argument \"width\""));
140 
141  rs_enable_stream(fake_object_pointer(), RS_STREAM_DEPTH, 640, -1, RS_FORMAT_Z16, 60, require_error("out of range value for argument \"height\""));
142 
143  rs_enable_stream(fake_object_pointer(), RS_STREAM_DEPTH, 640, 480, (rs_format)-1, 60, require_error("bad enum value for argument \"format\""));
144  rs_enable_stream(fake_object_pointer(), RS_STREAM_DEPTH, 640, 480, RS_FORMAT_COUNT, 60, require_error("bad enum value for argument \"format\""));
145  rs_enable_stream(fake_object_pointer(), RS_STREAM_DEPTH, 640, 480, RS_FORMAT_MAX_ENUM, 60, require_error("bad enum value for argument \"format\""));
146 
147  rs_enable_stream(fake_object_pointer(), RS_STREAM_DEPTH, 640, 480, RS_FORMAT_Z16, -1, require_error("out of range value for argument \"framerate\""));
148 }
149 
150 TEST_CASE( "rs_enable_stream_preset() validates input", "[offline] [validation]" )
151 {
152  rs_enable_stream_preset(nullptr, RS_STREAM_DEPTH, RS_PRESET_BEST_QUALITY, require_error("null pointer passed for argument \"device\""));
153 
154  rs_enable_stream_preset(fake_object_pointer(), (rs_stream)-1, RS_PRESET_BEST_QUALITY, require_error("bad enum value for argument \"stream\""));
156 
157  rs_enable_stream_preset(fake_object_pointer(), RS_STREAM_DEPTH, (rs_preset)-1, require_error("bad enum value for argument \"preset\""));
158  rs_enable_stream_preset(fake_object_pointer(), RS_STREAM_DEPTH, RS_PRESET_COUNT, require_error("bad enum value for argument \"preset\""));
159 }
160 
161 TEST_CASE( "rs_disable_stream() validates input", "[offline] [validation]" )
162 {
163  rs_disable_stream(nullptr, RS_STREAM_DEPTH, require_error("null pointer passed for argument \"device\""));
164 
165  rs_disable_stream(fake_object_pointer(), (rs_stream)-1, require_error("bad enum value for argument \"stream\""));
166  rs_disable_stream(fake_object_pointer(), RS_STREAM_COUNT, require_error("bad enum value for argument \"stream\""));
167 }
168 
169 TEST_CASE( "rs_is_stream_enabled() validates input", "[offline] [validation]" )
170 {
171  REQUIRE(rs_is_stream_enabled(nullptr, RS_STREAM_DEPTH, require_error("null pointer passed for argument \"device\"")) == 0);
172 
173  REQUIRE(rs_is_stream_enabled(fake_object_pointer(), (rs_stream)-1, require_error("bad enum value for argument \"stream\"")) == 0);
174  REQUIRE(rs_is_stream_enabled(fake_object_pointer(), RS_STREAM_COUNT, require_error("bad enum value for argument \"stream\"")) == 0);
175 }
176 
177 TEST_CASE( "rs_get_stream_intrinsics() validates input", "[offline] [validation]" )
178 {
179  rs_intrinsics intrin;
180  rs_get_stream_intrinsics(nullptr, RS_STREAM_DEPTH, &intrin, require_error("null pointer passed for argument \"device\""));
181 
182  rs_get_stream_intrinsics(fake_object_pointer(), (rs_stream)-1, &intrin, require_error("bad enum value for argument \"stream\""));
183  rs_get_stream_intrinsics(fake_object_pointer(), RS_STREAM_COUNT, &intrin, require_error("bad enum value for argument \"stream\""));
184 
185  rs_get_stream_intrinsics(fake_object_pointer(), RS_STREAM_DEPTH, nullptr, require_error("null pointer passed for argument \"intrin\""));
186 }
187 
188 TEST_CASE( "rs_get_stream_format() validates input", "[offline] [validation]" )
189 {
190  REQUIRE(rs_get_stream_format(nullptr, RS_STREAM_DEPTH, require_error("null pointer passed for argument \"device\"")) == RS_FORMAT_ANY);
191 
192  REQUIRE(rs_get_stream_format(fake_object_pointer(), (rs_stream)-1, require_error("bad enum value for argument \"stream\"")) == RS_FORMAT_ANY);
193  REQUIRE(rs_get_stream_format(fake_object_pointer(), RS_STREAM_COUNT, require_error("bad enum value for argument \"stream\"")) == RS_FORMAT_ANY);
194 }
195 
196 TEST_CASE( "rs_get_stream_framerate() validates input", "[offline] [validation]" )
197 {
198  REQUIRE(rs_get_stream_framerate(nullptr, RS_STREAM_DEPTH, require_error("null pointer passed for argument \"device\"")) == 0);
199 
200  REQUIRE(rs_get_stream_framerate(fake_object_pointer(), (rs_stream)-1, require_error("bad enum value for argument \"stream\"")) == 0);
201  REQUIRE(rs_get_stream_framerate(fake_object_pointer(), RS_STREAM_COUNT, require_error("bad enum value for argument \"stream\"")) == 0);
202 }
203 
204 TEST_CASE( "rs_start_device() validates input", "[offline] [validation]" )
205 {
206  rs_start_device(nullptr, require_error("null pointer passed for argument \"device\""));
207 }
208 
209 TEST_CASE( "rs_stop_device() validates input", "[offline] [validation]" )
210 {
211  rs_stop_device(nullptr, require_error("null pointer passed for argument \"device\""));
212 }
213 
214 TEST_CASE( "rs_is_device_streaming() validates input", "[offline] [validation]" )
215 {
216  REQUIRE(rs_is_device_streaming(nullptr, require_error("null pointer passed for argument \"device\"")) == 0);
217 }
218 
219 TEST_CASE( "rs_set_device_option() validates input", "[offline] [validation]" )
220 {
221  rs_set_device_option(nullptr, RS_OPTION_COLOR_GAIN, 100, require_error("null pointer passed for argument \"device\""));
222 
223  rs_set_device_option(fake_object_pointer(), (rs_option)-1, 100, require_error("bad enum value for argument \"option\""));
224  rs_set_device_option(fake_object_pointer(), RS_OPTION_COUNT, 100, require_error("bad enum value for argument \"option\""));
225 
226  // NOTE: Currently no validation is done for valid option ranges at the API level, though specifying an invalid option may fail at the UVC level
227  // todo - Add some basic validation for parameter sanity (gain/exposure cannot be negative, depth clamping must be in uint16_t range, etc...)
228 }
229 
230 TEST_CASE( "rs_get_device_option() validates input", "[offline] [validation]" )
231 {
232  REQUIRE(rs_get_device_option(nullptr, RS_OPTION_COLOR_GAIN, require_error("null pointer passed for argument \"device\"")) == 0);
233 
234  REQUIRE(rs_get_device_option(fake_object_pointer(), (rs_option)-1, require_error("bad enum value for argument \"option\"")) == 0);
235  REQUIRE(rs_get_device_option(fake_object_pointer(), RS_OPTION_COUNT, require_error("bad enum value for argument \"option\"")) == 0);
236 }
237 
238 TEST_CASE( "rs_wait_for_frames() validates input", "[offline] [validation]" )
239 {
240  rs_wait_for_frames(nullptr, require_error("null pointer passed for argument \"device\""));
241 }
242 
243 TEST_CASE( "rs_get_frame_timestamp() validates input", "[offline] [validation]" )
244 {
245  REQUIRE(rs_get_frame_timestamp(nullptr, RS_STREAM_DEPTH, require_error("null pointer passed for argument \"device\"")) == 0);
246 
247  REQUIRE(rs_get_frame_timestamp(fake_object_pointer(), (rs_stream)-1, require_error("bad enum value for argument \"stream\"")) == 0);
248  REQUIRE(rs_get_frame_timestamp(fake_object_pointer(), RS_STREAM_COUNT, require_error("bad enum value for argument \"stream\"")) == 0);
249 }
250 
251 TEST_CASE( "rs_get_frame_data() validates input", "[offline] [validation]" )
252 {
253  REQUIRE(rs_get_frame_data(nullptr, RS_STREAM_DEPTH, require_error("null pointer passed for argument \"device\"")) == nullptr);
254 
255  REQUIRE(rs_get_frame_data(fake_object_pointer(), (rs_stream)-1, require_error("bad enum value for argument \"stream\"")) == nullptr);
256  REQUIRE(rs_get_frame_data(fake_object_pointer(), RS_STREAM_COUNT, require_error("bad enum value for argument \"stream\"")) == nullptr);
257 }
258 
259 TEST_CASE( "rs_free_error() gracefully handles invalid input", "[offline] [validation]" )
260 {
261  // Nothing to assert in this case, but calling rs_free_error() with a null pointer should not crash the program
262  rs_free_error(nullptr);
263 }
264 
265 TEST_CASE( "rs_get_failed_function() gracefully handles invalid input", "[offline] [validation]" )
266 {
267  REQUIRE(rs_get_failed_function(nullptr) == nullptr);
268 }
269 
270 TEST_CASE( "rs_get_failed_args() gracefully handles invalid input", "[offline] [validation]" )
271 {
272  REQUIRE(rs_get_failed_args(nullptr) == nullptr);
273 }
274 
275 TEST_CASE( "rs_get_error_message() gracefully handles invalid input", "[offline] [validation]" )
276 {
277  REQUIRE(rs_get_error_message(nullptr) == nullptr);
278 }
279 
280 TEST_CASE( "rs_stream_to_string() produces correct output", "[offline] [validation]" )
281 {
282  // Valid enum values should return the text that follows the type prefix
291 
292  // Invalid enum values should return nullptr
295 }
296 
297 TEST_CASE( "rs_format_to_string() produces correct output", "[offline] [validation]" )
298 {
299  // Valid enum values should return the text that follows the type prefix
311 
312  // Invalid enum values should return nullptr
315 }
316 
317 TEST_CASE( "rs_preset_to_string() produces correct output", "[offline] [validation]" )
318 {
319  // Valid enum values should return the text that follows the type prefix
323 
324  // Invalid enum values should return nullptr
327 }
328 
329 TEST_CASE( "rs_distortion_to_string() produces correct output", "[offline] [validation]" )
330 {
331  // Valid enum values should return the text that follows the type prefix
335 
336  // Invalid enum values should return nullptr
339 }
340 
341 TEST_CASE( "rs_option_to_string() produces correct output", "[offline] [validation]" )
342 {
343  // Valid enum values should return the text that follows the type prefix
355  REQUIRE(rs_option_to_string(RS_OPTION_COLOR_ENABLE_AUTO_WHITE_BALANCE) == std::string("COLOR_ENABLE_AUTO_WHITE_BALANCE"));
356 
363 
373 
374  // Invalid enum values should return nullptr
377 }
378 
379 TEST_CASE( "rs_create_context() returns a valid context", "[offline] [validation]" )
380 {
383 }
384 
385 TEST_CASE( "rs_context has singleton semantics", "[offline] [validation]" )
386 {
388  safe_context second_ctx;
389  REQUIRE(second_ctx == ctx);
390 }
391 
392 TEST_CASE("rs API version verification", "[offline] [validation]")
393 {
395  std::cout << "Librealsense API version is " << RS_API_VERSION_STR << std::endl;
396  std::cout << "Librealsense API version number is " << RS_API_VERSION << std::endl;
397 
398  std::string api_ver_str(RS_API_VERSION_STR);
399  // API version is within [10000..999999] range
400  REQUIRE(RS_API_VERSION > 0);
401  REQUIRE(RS_API_VERSION <= 999999);
402  // Version string is in ["1.0.0".. "99.99.99"] range
403  REQUIRE(api_ver_str.size() >= 5);
404  REQUIRE(api_ver_str.size() <= 8);
405 }
406 
407 #endif /* !defined(MAKEFILE) || ( defined(OFFLINE_TEST) ) */
#define RS_API_VERSION
Definition: rs.h:28
const char * rs_stream_to_string(rs_stream stream)
Definition: rs.cpp:754
int rs_get_device_count(const rs_context *context, rs_error **error)
Determines number of connected devices.
Definition: rs.cpp:113
GLint GLint GLsizei GLsizei height
Definition: glext.h:112
rs_format format
double rs_get_frame_timestamp(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves time at which the latest frame on a stream was captured.
Definition: rs.cpp:474
const void * rs_get_frame_data(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the contents of the latest frame on a stream.
Definition: rs.cpp:490
int rs_is_device_streaming(const rs_device *device, rs_error **error)
Determines if the device is currently streaming.
Definition: rs.cpp:413
GLsizei const GLchar *const * string
Definition: glext.h:683
const char * rs_distortion_to_string(rs_distortion distortion)
Definition: rs.cpp:757
TEST_CASE("wraparound_mechanism produces correct output","[offline] [validation]")
const char * rs_get_device_name(const rs_device *device, rs_error **error)
Retrieves human-readable device model string.
Definition: rs.cpp:128
rs_option
Defines general configuration controls.
Definition: rs.h:128
const char * rs_get_error_message(const rs_error *error)
Returns static pointer to error message.
Definition: rs.cpp:751
float rs_get_device_depth_scale(const rs_device *device, rs_error **error)
Retrieves mapping between the units of the depth image and meters.
Definition: rs.cpp:420
int rs_get_stream_mode_count(const rs_device *device, rs_stream stream, rs_error **error)
Determines the number of streaming modes available for a given stream.
Definition: rs.cpp:190
rs_get_stream_mode(nullptr, RS_STREAM_DEPTH, 0,&width,&height,&format,&framerate, require_error("null pointer passed for argument \"device\""))
rs_get_device_extrinsics(nullptr, RS_STREAM_DEPTH, RS_STREAM_COLOR,&extrin, require_error("null pointer passed for argument \"device\""))
const char * rs_get_failed_function(const rs_error *error)
Returns static pointer to name of a failing function in case of error.
Definition: rs.cpp:749
REQUIRE(rs_create_context(RS_API_VERSION+100, require_error("", false))==nullptr)
rs_format rs_get_stream_format(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the pixel format for a specific stream.
Definition: rs.cpp:273
rs_context * rs_create_context(int api_version, rs_error **error)
Creates RealSense context that is required for the rest of the API.
Definition: rs.cpp:75
double rs_get_device_option(rs_device *device, rs_option option, rs_error **error)
Retrieves the current value of a single option.
Definition: rs.cpp:694
GLfloat f
Definition: glext.h:1868
int rs_device_supports_option(const rs_device *device, rs_option option, rs_error **error)
Determines if the device allows a specific option to be queried and set.
Definition: rs.cpp:182
const char * rs_get_device_firmware_version(const rs_device *device, rs_error **error)
Retrieves the version of the firmware currently installed on the device.
Definition: rs.cpp:156
const char * rs_get_failed_args(const rs_error *error)
Returns static pointer to arguments of a failing function in case of error.
Definition: rs.cpp:750
rs_delete_context(ctx, require_no_error())
rs_format
Formats: defines how each stream can be encoded.
Definition: rs.h:53
rs_disable_stream(fake_object_pointer(),(rs_stream)-1, require_error("bad enum value for argument \"stream\""))
const auto RS_FORMAT_MAX_ENUM
auto ctx
void rs_free_error(rs_error *error)
Frees memory of an error object.
Definition: rs.cpp:748
rs_enable_stream_preset(fake_object_pointer(),(rs_stream)-1, RS_PRESET_BEST_QUALITY, require_error("bad enum value for argument \"stream\""))
Video stream intrinsics.
Definition: rs.h:300
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
Definition: rs.h:332
const char * rs_preset_to_string(rs_preset preset)
Definition: rs.cpp:756
rs_preset
Presets: general preferences that are translated by librealsense into concrete resolution and FPS...
Definition: rs.h:81
int rs_get_stream_framerate(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the frame rate for a specific stream.
Definition: rs.cpp:281
const char * rs_format_to_string(rs_format format)
Definition: rs.cpp:755
rs_stream
Streams are different types of data provided by RealSense devices.
Definition: rs.h:33
GLint GLint GLsizei width
Definition: glext.h:112
const char * rs_option_to_string(rs_option option)
Definition: rs.cpp:758
rs_device * rs_get_device(rs_context *context, int index, rs_error **error)
Retrieves connected device by index.
Definition: rs.cpp:120
const char * rs_get_device_serial(const rs_device *device, rs_error **error)
Retrieves unique serial number of the device.
Definition: rs.cpp:135
void rs_wait_for_frames(rs_device *device, rs_error **error)
Blocks until new frames are available.
Definition: rs.cpp:428
rs_set_device_option(fake_object_pointer(),(rs_option)-1, 100, require_error("bad enum value for argument \"option\""))
#define RS_API_VERSION_STR
Definition: rs.h:30
rs_distortion
Distortion model: defines how pixel coordinates should be mapped to sensor coordinates.
Definition: rs.h:99
void rs_start_device(rs_device *device, rs_error **error)
Begins streaming on all enabled streams for this device.
Definition: rs.cpp:383
void rs_stop_device(rs_device *device, rs_error **error)
Ends data acquisition for the specified source providers.
Definition: rs.cpp:398
int rs_is_stream_enabled(const rs_device *device, rs_stream stream, rs_error **error)
Determines if a specific stream is enabled.
Definition: rs.cpp:249
rs_get_stream_intrinsics(nullptr, RS_STREAM_DEPTH,&intrin, require_error("null pointer passed for argument \"device\""))
static std::string unknown
rs_enable_stream(fake_object_pointer(),(rs_stream)-1, 640, 480, RS_FORMAT_Z16, 60, require_error("bad enum value for argument \"stream\""))
const auto RS_STREAM_MAX_ENUM


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:18