software-device.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2018 Intel Corporation. All Rights Reserved.
3 #pragma once
4 
5 #include "core/streaming.h"
6 #include "device.h"
7 #include "context.h"
8 
9 namespace librealsense
10 {
11  class software_sensor;
12  class software_device_info;
13 
14  class software_device : public device
15  {
16  public:
18  virtual ~software_device();
19 
21 
23 
25 
26  std::shared_ptr<software_device_info> get_info();
27 
28  std::shared_ptr<matcher> create_matcher(const frame_holder& frame) const override;
29 
30  std::vector<tagged_profile> get_profiles_tags() const override
31  {
32  std::vector<tagged_profile> markers;
33  return markers;
34  };
36 
38 
39  private:
40  std::vector<std::shared_ptr<software_sensor>> _software_sensors;
43  std::shared_ptr<software_device_info> _info;
44  };
45 
47  {
48  std::weak_ptr<software_device> _dev;
49  public:
50  explicit software_device_info(std::shared_ptr<software_device> dev)
51  : device_info(nullptr), _dev(dev)
52  {
53  }
54 
55  std::shared_ptr<device_interface> create_device(bool) const override
56  {
57  return _dev.lock();
58  }
60  {
61  std::stringstream address;
62  address << "software-device://";
63  if (auto dev = _dev.lock())
64  {
65  auto ptr = dev.get();
66  address << (unsigned long long)ptr;
67  }
69  }
70 
71  std::shared_ptr<device_interface> create(std::shared_ptr<context>, bool) const override
72  {
73  return _dev.lock();
74  }
75  };
76 
78  {
79  public:
81  return _blocks;
82  }
84 
85  private:
87  };
88 
90  {
91  public:
93 
94  std::shared_ptr<stream_profile_interface> add_video_stream(rs2_video_stream video_stream, bool is_default=false);
95  std::shared_ptr<stream_profile_interface> add_motion_stream(rs2_motion_stream motion_stream, bool is_default = false);
96  std::shared_ptr<stream_profile_interface> add_pose_stream(rs2_pose_stream pose_stream, bool is_default = false);
97 
98  bool extend_to(rs2_extension extension_type, void** ptr) override;
99 
101 
102  void open(const stream_profiles& requests) override;
103  void close() override;
104 
105  void start(frame_callback_ptr callback) override;
106  void stop() override;
107 
108  void on_video_frame(rs2_software_video_frame frame);
109  void on_motion_frame(rs2_software_motion_frame frame);
110  void on_pose_frame(rs2_software_pose_frame frame);
111  void on_notification(rs2_software_notification notif);
112  void add_read_only_option(rs2_option option, float val);
113  void update_read_only_option(rs2_option option, float val);
114  void add_option(rs2_option option, option_range range, bool is_writable);
116  private:
117  friend class software_device;
119  std::map<rs2_frame_metadata_value, rs2_metadata_type> _metadata_map;
121 
123  {
124  public:
125  stereo_extension(software_sensor* owner) : _owner(owner) {}
126 
127  float get_depth_scale() const override {
128  return _owner->get_option(RS2_OPTION_DEPTH_UNITS).query();
129  }
130 
131  float get_stereo_baseline_mm() const override {
132  return _owner->get_option(RS2_OPTION_STEREO_BASELINE).query();
133  }
134 
135  void create_snapshot(std::shared_ptr<depth_stereo_sensor>& snapshot) const override {}
136  void enable_recording(std::function<void(const depth_stereo_sensor&)> recording_function) override {}
137 
138  void create_snapshot(std::shared_ptr<depth_sensor>& snapshot) const override {}
139  void enable_recording(std::function<void(const depth_sensor&)> recording_function) override {}
140  private:
142  };
143 
145  {
146  public:
147  depth_extension(software_sensor* owner) : _owner(owner) {}
148 
149  float get_depth_scale() const override {
150  return _owner->get_option(RS2_OPTION_DEPTH_UNITS).query();
151  }
152 
153  void create_snapshot(std::shared_ptr<depth_sensor>& snapshot) const override {}
154  void enable_recording(std::function<void(const depth_sensor&)> recording_function) override {}
155  private:
157  };
158 
161 
163 
164  std::shared_ptr<stream_profile_interface> find_profile_by_uid(int uid);
165  };
168 }
void create_snapshot(std::shared_ptr< depth_sensor > &snapshot) const override
platform::backend_device_group get_device_data() const override
GLuint const GLchar * name
void create_snapshot(std::shared_ptr< depth_stereo_sensor > &snapshot) const override
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
Definition: src/types.h:1071
std::shared_ptr< software_device_info > _info
GLfloat value
lazy< depth_extension > _depth_extension
All the parameters required to define a video stream.
Definition: rs_internal.h:41
All the parameters required to define a pose frame.
Definition: rs_internal.h:100
std::map< rs2_frame_metadata_value, rs2_metadata_type > _metadata_map
void create_snapshot(std::shared_ptr< depth_sensor > &snapshot) const override
GLsizei const GLchar *const * string
static const textual_icon stop
Definition: model-views.h:225
std::shared_ptr< device_interface > create(std::shared_ptr< context >, bool) const override
void register_destruction_callback(software_device_destruction_callback_ptr)
GLuint index
GLuint GLfloat * val
GLuint64 key
Definition: glext.h:8966
lazy< stereo_extension > _stereo_extension
void register_extrinsic(const stream_interface &stream)
std::vector< rs2::stream_profile > init_stream_profiles(sw_context &sctx, std::shared_ptr< rs2::software_sensor > ss, std::string sensor_name, rs2::video_stream_profile c, rs2::video_stream_profile d)
All the parameters required to define a pose stream.
Definition: rs_internal.h:66
rs2_matchers
Specifies types of different matchers.
Definition: rs_types.h:230
software_recommended_proccesing_blocks _pbs
def callback(frame)
Definition: t265_stereo.py:91
GLuint start
All the parameters required to define a motion stream.
Definition: rs_internal.h:55
software_sensor & add_software_sensor(const std::string &name)
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
Definition: streaming.h:165
std::shared_ptr< software_device_info > get_info()
std::vector< tagged_profile > get_profiles_tags() const override
void enable_recording(std::function< void(const depth_sensor &)> recording_function) override
All the parameters required to define a sensor notification.
Definition: rs_internal.h:122
software_device_info(std::shared_ptr< software_device > dev)
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:166
long long rs2_metadata_type
Definition: rs_types.h:301
librealsense::software_device_destruction_callback_ptr _user_destruction_callback
All the parameters required to define a motion frame.
Definition: rs_internal.h:89
void enable_recording(std::function< void(const depth_stereo_sensor &)> recording_function) override
GLuint GLuint64EXT address
Definition: glext.h:11417
std::vector< std::shared_ptr< software_sensor > > _software_sensors
std::shared_ptr< matcher > create_matcher(const frame_holder &frame) const override
GLsizei range
software_sensor & get_software_sensor(int index)
All the parameters required to define a video frame.
Definition: rs_internal.h:76
std::shared_ptr< device_interface > create_device(bool) const override
std::shared_ptr< rs2_software_device_destruction_callback > software_device_destruction_callback_ptr
Definition: src/types.h:1075
std::weak_ptr< software_device > _dev
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:29
void set_matcher_type(rs2_matchers matcher)
MAP_EXTENSION(RS2_EXTENSION_POINTS, librealsense::points)
void enable_recording(std::function< void(const depth_sensor &)> recording_function) override


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:41