rscore.hpp
Go to the documentation of this file.
00001 // License: Apache 2.0. See LICENSE file in root directory.
00002 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
00003 
00004 #ifndef LIBREALSENSE_RSCORE_HPP
00005 #define LIBREALSENSE_RSCORE_HPP
00006 
00007 #include "rs.h"
00008 #include <cstdint>
00009 #include <cstddef>
00010 #include <mutex>
00011 
00012 // this interface is an entry point for extending librealsense with custom devices while keeping librealsense public API
00013 // the interfaces in this file are expected to be inherited from, never used directly, rs.hpp provides safer and simpler wrapper
00014 // an example usage would be playback and record. this API allows to integrate custom playback&record implementation while keeping librealsense API
00015 
00016 struct rs_stream_interface
00017 {
00018     virtual                                 ~rs_stream_interface() {}
00019 
00020     virtual rs_extrinsics                   get_extrinsics_to(const rs_stream_interface & r) const = 0;
00021     virtual float                           get_depth_scale() const = 0;
00022     
00023     virtual rs_intrinsics                   get_intrinsics() const = 0;
00024     virtual rs_intrinsics                   get_rectified_intrinsics() const = 0;
00025     virtual rs_format                       get_format() const = 0;
00026     virtual int                             get_framerate() const = 0;
00027 
00028     virtual double                          get_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
00029     virtual bool                            supports_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
00030     virtual int                             get_frame_stride() const = 0;
00031     virtual int                             get_frame_bpp() const = 0;
00032     virtual unsigned long long              get_frame_number() const = 0;
00033     virtual double                          get_frame_timestamp() const = 0;
00034     virtual long long                       get_frame_system_time() const = 0;
00035     virtual const uint8_t *                 get_frame_data() const = 0;
00036 
00037     virtual int                             get_mode_count() const = 0;
00038     virtual void                            get_mode(int mode, int * w, int * h, rs_format * f, int * fps) const = 0;
00039 
00040     virtual bool                            is_enabled() const = 0;
00041     virtual rs_stream                       get_stream_type() const = 0;
00042 };
00043 
00044 struct rs_frame_ref
00045 {
00046     virtual                                 ~rs_frame_ref() {}
00047     virtual const uint8_t*                  get_frame_data() const = 0;
00048     virtual double                          get_frame_timestamp() const = 0;
00049     virtual rs_timestamp_domain             get_frame_timestamp_domain() const = 0;
00050     virtual unsigned long long              get_frame_number() const = 0;
00051     virtual long long                       get_frame_system_time() const = 0;
00052     virtual int                             get_frame_width() const = 0;
00053     virtual int                             get_frame_height() const = 0;
00054     virtual int                             get_frame_framerate() const = 0;
00055     virtual int                             get_frame_stride() const = 0;
00056     virtual int                             get_frame_bpp() const = 0;
00057     virtual rs_format                       get_frame_format() const = 0;
00058     virtual rs_stream                       get_stream_type() const = 0;
00059     virtual double                          get_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
00060     virtual bool                            supports_frame_metadata(rs_frame_metadata frame_metadata) const = 0;
00061 };
00062 
00063 // realsense device public interface
00064 struct rs_device
00065 {
00066     virtual                                 ~rs_device() {}
00067     virtual const rs_stream_interface &     get_stream_interface(rs_stream stream) const = 0;
00068 
00069     virtual const char *                    get_name() const = 0;
00070     virtual const char *                    get_serial() const = 0;
00071     virtual const char *                    get_firmware_version() const = 0;
00072     virtual const char *                    get_camera_info(rs_camera_info) const = 0;
00073     virtual float                           get_depth_scale() const = 0;
00074                                             
00075     virtual void                            enable_stream(rs_stream stream, int width, int height, rs_format format, int fps, rs_output_buffer_format output) = 0;
00076     virtual void                            enable_stream_preset(rs_stream stream, rs_preset preset) = 0;
00077     virtual void                            disable_stream(rs_stream stream) = 0;
00078                                             
00079     virtual void                            enable_motion_tracking() = 0;
00080     virtual void                            set_stream_callback(rs_stream stream, void(*on_frame)(rs_device * device, rs_frame_ref * frame, void * user), void * user) = 0;
00081     virtual void                            set_stream_callback(rs_stream stream, rs_frame_callback * callback) = 0;
00082     virtual void                            disable_motion_tracking() = 0;
00083 
00084     virtual rs_motion_intrinsics            get_motion_intrinsics() const = 0;
00085     virtual rs_extrinsics                   get_motion_extrinsics_from(rs_stream from) const = 0;
00086     virtual void                            set_motion_callback(void(*on_event)(rs_device * device, rs_motion_data data, void * user), void * user) = 0;
00087     virtual void                            set_motion_callback(rs_motion_callback * callback) = 0;
00088     virtual void                            set_timestamp_callback(void(*on_event)(rs_device * device, rs_timestamp_data data, void * user), void * user) = 0;
00089     virtual void                            set_timestamp_callback(rs_timestamp_callback * callback) = 0;
00090                                             
00091     virtual void                            start(rs_source source) = 0;
00092     virtual void                            stop(rs_source source) = 0;
00093 
00094     virtual void                            start_fw_logger(char fw_log_op_code, int grab_rate_in_ms, std::timed_mutex& mutex) = 0;
00095     virtual void                            stop_fw_logger() = 0;
00096 
00097     virtual bool                            is_capturing() const = 0;
00098     virtual int                             is_motion_tracking_active() const = 0;
00099                                             
00100     virtual void                            wait_all_streams() = 0;
00101     virtual bool                            poll_all_streams() = 0;
00102                                             
00103     virtual bool                            supports(rs_capabilities capability) const = 0;
00104     virtual bool                            supports(rs_camera_info info_param) const = 0;
00105 
00106     virtual bool                            supports_option(rs_option option) const = 0;
00107     virtual void                            get_option_range(rs_option option, double & min, double & max, double & step, double & def) = 0;
00108     virtual void                            set_options(const rs_option options[], size_t count, const double values[]) = 0;
00109     virtual void                            get_options(const rs_option options[], size_t count, double values[]) = 0;
00110     virtual const char *                    get_option_description(rs_option option) const = 0;
00111 
00112     virtual void                            release_frame(rs_frame_ref * ref) = 0;
00113     virtual rs_frame_ref *                  clone_frame(rs_frame_ref * frame) = 0;
00114 
00115     virtual const char *                    get_usb_port_id() const = 0;
00116 };
00117 
00118 struct rs_context
00119 {
00120     virtual size_t                          get_device_count() const = 0;
00121     virtual rs_device *                     get_device(int index) const = 0;
00122     virtual                                 ~rs_context() {}
00123 };
00124 
00125 struct rs_motion_callback
00126 {
00127     virtual void                            on_event(rs_motion_data e) = 0;
00128     virtual void                            release() = 0;
00129     virtual                                 ~rs_motion_callback() {}
00130 };
00131 
00132 struct rs_frame_callback
00133 {
00134     virtual void                            on_frame(rs_device * device, rs_frame_ref * f) = 0;
00135     virtual void                            release() = 0;
00136     virtual                                 ~rs_frame_callback() {}
00137 };
00138 
00139 struct rs_timestamp_callback
00140 {
00141     virtual void                            on_event(rs_timestamp_data data) = 0;
00142     virtual void                            release() = 0;
00143     virtual                                 ~rs_timestamp_callback() {}
00144 };
00145 
00146 struct rs_log_callback
00147 {
00148     virtual void                            on_event(rs_log_severity severity, const char * message) = 0;
00149     virtual void                            release() = 0;
00150     virtual                                 ~rs_log_callback() {}
00151 };
00152 
00153 #endif


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Tue Jun 25 2019 19:54:39