rscore.hpp
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 #ifndef LIBREALSENSE_RSCORE_HPP
5 #define LIBREALSENSE_RSCORE_HPP
6 
7 #include "rs.h"
8 #include <cstdint>
9 #include <cstddef>
10 #include <mutex>
11 
12 // this interface is an entry point for extending librealsense with custom devices while keeping librealsense public API
13 // the interfaces in this file are expected to be inherited from, never used directly, rs.hpp provides safer and simpler wrapper
14 // an example usage would be playback and record. this API allows to integrate custom playback&record implementation while keeping librealsense API
15 
17 {
18  virtual ~rs_stream_interface() {}
19 
20  virtual rs_extrinsics get_extrinsics_to(const rs_stream_interface & r) const = 0;
21  virtual float get_depth_scale() const = 0;
22 
23  virtual rs_intrinsics get_intrinsics() const = 0;
24  virtual rs_intrinsics get_rectified_intrinsics() const = 0;
25  virtual rs_format get_format() const = 0;
26  virtual int get_framerate() const = 0;
27 
28  virtual double get_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
29  virtual bool supports_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
30  virtual int get_frame_stride() const = 0;
31  virtual int get_frame_bpp() const = 0;
32  virtual unsigned long long get_frame_number() const = 0;
33  virtual double get_frame_timestamp() const = 0;
34  virtual long long get_frame_system_time() const = 0;
35  virtual const uint8_t * get_frame_data() const = 0;
36 
37  virtual int get_mode_count() const = 0;
38  virtual void get_mode(int mode, int * w, int * h, rs_format * f, int * fps) const = 0;
39 
40  virtual bool is_enabled() const = 0;
41  virtual rs_stream get_stream_type() const = 0;
42 };
43 
45 {
46  virtual ~rs_frame_ref() {}
47  virtual const uint8_t* get_frame_data() const = 0;
48  virtual double get_frame_timestamp() const = 0;
49  virtual rs_timestamp_domain get_frame_timestamp_domain() const = 0;
50  virtual unsigned long long get_frame_number() const = 0;
51  virtual long long get_frame_system_time() const = 0;
52  virtual int get_frame_width() const = 0;
53  virtual int get_frame_height() const = 0;
54  virtual int get_frame_framerate() const = 0;
55  virtual int get_frame_stride() const = 0;
56  virtual int get_frame_bpp() const = 0;
57  virtual rs_format get_frame_format() const = 0;
58  virtual rs_stream get_stream_type() const = 0;
59  virtual double get_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
60  virtual bool supports_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
61 };
62 
63 // realsense device public interface
64 struct rs_device
65 {
66  virtual ~rs_device() {}
67  virtual const rs_stream_interface & get_stream_interface(rs_stream stream) const = 0;
68 
69  virtual const char * get_name() const = 0;
70  virtual const char * get_serial() const = 0;
71  virtual const char * get_firmware_version() const = 0;
72  virtual const char * get_camera_info(rs_camera_info) const = 0;
73  virtual float get_depth_scale() const = 0;
74 
75  virtual void enable_stream(rs_stream stream, int width, int height, rs_format format, int fps, rs_output_buffer_format output) = 0;
76  virtual void enable_stream_preset(rs_stream stream, rs_preset preset) = 0;
77  virtual void disable_stream(rs_stream stream) = 0;
78 
79  virtual void enable_motion_tracking() = 0;
80  virtual void set_stream_callback(rs_stream stream, void(*on_frame)(rs_device * device, rs_frame_ref * frame, void * user), void * user) = 0;
81  virtual void set_stream_callback(rs_stream stream, rs_frame_callback * callback) = 0;
82  virtual void disable_motion_tracking() = 0;
83 
84  virtual rs_motion_intrinsics get_motion_intrinsics() const = 0;
85  virtual rs_extrinsics get_motion_extrinsics_from(rs_stream from) const = 0;
86  virtual void set_motion_callback(void(*on_event)(rs_device * device, rs_motion_data data, void * user), void * user) = 0;
87  virtual void set_motion_callback(rs_motion_callback * callback) = 0;
88  virtual void set_timestamp_callback(void(*on_event)(rs_device * device, rs_timestamp_data data, void * user), void * user) = 0;
89  virtual void set_timestamp_callback(rs_timestamp_callback * callback) = 0;
90 
91  virtual void start(rs_source source) = 0;
92  virtual void stop(rs_source source) = 0;
93 
94  virtual void start_fw_logger(char fw_log_op_code, int grab_rate_in_ms, std::timed_mutex& mutex) = 0;
95  virtual void stop_fw_logger() = 0;
96 
97  virtual bool is_capturing() const = 0;
98  virtual int is_motion_tracking_active() const = 0;
99 
100  virtual void wait_all_streams() = 0;
101  virtual bool poll_all_streams() = 0;
102 
103  virtual bool supports(rs_capabilities capability) const = 0;
104  virtual bool supports(rs_camera_info info_param) const = 0;
105 
106  virtual bool supports_option(rs_option option) const = 0;
107  virtual void get_option_range(rs_option option, double & min, double & max, double & step, double & def) = 0;
108  virtual void set_options(const rs_option options[], size_t count, const double values[]) = 0;
109  virtual void get_options(const rs_option options[], size_t count, double values[]) = 0;
110  virtual const char * get_option_description(rs_option option) const = 0;
111 
112  virtual void release_frame(rs_frame_ref * ref) = 0;
113  virtual rs_frame_ref * clone_frame(rs_frame_ref * frame) = 0;
114 
115  virtual const char * get_usb_port_id() const = 0;
116 };
117 
119 {
120  virtual size_t get_device_count() const = 0;
121  virtual rs_device * get_device(int index) const = 0;
122  virtual ~rs_context() {}
123 };
124 
126 {
127  virtual void on_event(rs_motion_data e) = 0;
128  virtual void release() = 0;
129  virtual ~rs_motion_callback() {}
130 };
131 
133 {
134  virtual void on_frame(rs_device * device, rs_frame_ref * f) = 0;
135  virtual void release() = 0;
136  virtual ~rs_frame_callback() {}
137 };
138 
140 {
141  virtual void on_event(rs_timestamp_data data) = 0;
142  virtual void release() = 0;
144 };
145 
147 {
148  virtual void on_event(rs_log_severity severity, const char * message) = 0;
149  virtual void release() = 0;
150  virtual ~rs_log_callback() {}
151 };
152 
153 #endif
virtual rs_extrinsics get_extrinsics_to(const rs_stream_interface &r) const =0
virtual ~rs_log_callback()
Definition: rscore.hpp:150
virtual bool supports_frame_metadata(rs_frame_metadata frame_metadata) const =0
virtual rs_intrinsics get_rectified_intrinsics() const =0
virtual rs_intrinsics get_intrinsics() const =0
rs_error * e
virtual int get_frame_stride() const =0
frame_metadata
Types of value provided from the device with each frame.
Definition: rs.hpp:160
GLint GLint GLsizei GLsizei height
Definition: glext.h:112
GLuint GLsizei const GLchar * message
Definition: glext.h:2482
virtual const uint8_t * get_frame_data() const =0
virtual long long get_frame_system_time() const =0
rs_option
Defines general configuration controls.
Definition: rs.h:128
std::string get_usb_port_id(const device &device)
GLuint GLuint stream
Definition: glext.h:1774
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:1944
rs_output_buffer_format
Output buffer format: sets how librealsense works with frame memory.
Definition: rs.h:73
rs_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs.h:292
Exposes librealsense functionality for C compilers.
GLenum GLint ref
Definition: glext.h:652
virtual ~rs_timestamp_callback()
Definition: rscore.hpp:143
virtual int get_mode_count() const =0
virtual ~rs_frame_ref()
Definition: rscore.hpp:46
GLuint index
Definition: glext.h:655
GLuint GLuint GLsizei count
Definition: glext.h:111
Motion data from gyroscope and accelerometer from the microcontroller.
Definition: rs.h:347
virtual bool is_enabled() const =0
virtual ~rs_motion_callback()
Definition: rscore.hpp:129
rs_camera_info
Read-only strings that can be queried from the device.
Definition: rs.h:237
GLfloat f
Definition: glext.h:1868
Motion module intrinsics: includes accelerometer and gyroscope intrinsics structs of type rs_motion_d...
Definition: rs.h:325
virtual unsigned long long get_frame_number() const =0
virtual rs_stream get_stream_type() const =0
virtual int get_framerate() const =0
virtual double get_frame_timestamp() const =0
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * data
Definition: glext.h:223
rs_format
Formats: defines how each stream can be encoded.
Definition: rs.h:53
Timestamp data from the motion microcontroller.
Definition: rs.h:339
GLenum mode
Definition: glext.h:1117
rs_source
Source: allows you to choose between available hardware subdevices.
Definition: rs.h:90
Video stream intrinsics.
Definition: rs.h:300
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
Definition: rs.h:332
virtual int get_frame_bpp() const =0
rs_preset
Presets: general preferences that are translated by librealsense into concrete resolution and FPS...
Definition: rs.h:81
GLenum GLsizei GLsizei GLint * values
Definition: glext.h:1484
virtual ~rs_context()
Definition: rscore.hpp:122
rs_stream
Streams are different types of data provided by RealSense devices.
Definition: rs.h:33
GLint GLint GLsizei width
Definition: glext.h:112
GLsizei GLsizei GLchar * source
Definition: glext.h:672
rs_log_severity
Severity of the librealsense logger.
Definition: rs.h:265
virtual ~rs_device()
Definition: rscore.hpp:66
void enable_stream(rs::device *dev, int stream, rs::format format, int w, int h, int fps, bool enable, std::stringstream &stream_name)
rs_capabilities
Specifies various capabilities of a RealSense device.
Definition: rs.h:213
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glext.h:112
rs_frame_metadata
Types of value provided from the device with each frame.
Definition: rs.h:203
virtual ~rs_frame_callback()
Definition: rscore.hpp:136
GLenum GLenum severity
Definition: glext.h:2478
virtual rs_format get_format() const =0
virtual void get_mode(int mode, int *w, int *h, rs_format *f, int *fps) const =0
GLdouble GLdouble GLdouble r
Definition: glext.h:247
virtual float get_depth_scale() const =0
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:726
virtual ~rs_stream_interface()
Definition: rscore.hpp:18
GLuint start
Definition: glext.h:111
preset
Presets: general preferences that are translated by librealsense into concrete resolution and FPS...
Definition: rs.hpp:68
virtual double get_frame_metadata(rs_frame_metadata frame_metadata) const =0


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