l500-options.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 #include "hw-monitor.h"
6 #include "l500-device.h"
7 
8 namespace librealsense
9 {
11  {
16  apd = 4,
21  };
22 
24  {
26  get_min = 1,
27  get_max = 2,
28  get_step = 3,
30  };
31 
32  class l500_options;
33 
35 
36  class digital_gain_option : public super
37  {
38  public:
41  uint8_t id,
42  std::string description,
43  const std::map< float, std::string > & description_per_value,
44  firmware_version fw_version,
45  l500_options * owner )
46  : super( ep, xu, id, description, description_per_value )
47  , _fw_version( fw_version )
48  , _owner( owner )
49  {
50  }
51  void set( float value ) override;
52  void set_by_preset( float value );
53  option_range get_range() const override;
54 
55  private:
57 
60  };
61 
62  class l500_hw_options : public option
63  {
64  public:
65  float query() const override;
66 
67  void set(float value) override;
68 
69  option_range get_range() const override;
70 
71  bool is_enabled() const override { return true; }
72 
73  const char * get_description() const override { return _description.c_str(); }
74 
75  void enable_recording(std::function<void(const option&)> recording_action) override;
76 
77  l500_hw_options( l500_device* l500_dev,
81  const std::string & description,
82  firmware_version fw_version,
83  std::shared_ptr< digital_gain_option > digital_gain);
84 
85  void set_default( float def );
86 
87  // on new FW version query default can fail when we are on 'auto gain' mode
88  float query_new_fw_default( bool & success ) const;
89  float query_old_fw_default() const;
90 
91  float query_current( rs2_sensor_mode mode ) const;
92 
93  bool is_read_only() const override { return _is_read_only; }
94  void set_read_only( bool read_only );
95  void set_manually( bool set );
96 
97  private:
98  float query_default( bool & success ) const;
99 
100 
103  hw_monitor* _hw_monitor;
110  std::shared_ptr< digital_gain_option > _digital_gain;
113  };
114 
116  {
117  public:
118  max_usable_range_option(l500_device *l500_depth_dev) : bool_option( false ), _l500_depth_dev(l500_depth_dev){};
119 
120  void set(float value) override;
121 
122  const char * get_description() const override;
123 
124  private:
126  };
127 
129  : public float_option_with_description< rs2_sensor_mode >
130  , public observable_option
131  {
132  public:
133  sensor_mode_option(l500_device *l500_depth_dev, option_range range, std::string description) : float_option_with_description<rs2_sensor_mode>(range, description), _l500_depth_dev(l500_depth_dev) {};
134  void set(float value) override;
135 
136  private:
138  };
139 
141  {
142  public:
143  ir_reflectivity_option(l500_device *l500_depth_dev) : bool_option(false), _l500_depth_dev(l500_depth_dev), _max_usable_range_forced_on(false){};
144 
145  void set(float value) override;
146 
147  const char * get_description() const override;
148 
149  private:
152  };
153 
154  class l500_options;
155 
156  class l500_preset_option : public float_option_with_description< rs2_l500_visual_preset >
157  {
158  public:
160  void set( float value ) override;
161  void set_value( float value );
162 
163  private:
164  void verify_max_usable_range_restrictions( rs2_option opt, float value );
166  };
167 
168  class l500_options : public virtual l500_device
169  {
170  public:
171  l500_options(std::shared_ptr<context> ctx,
173 
174  std::vector<rs2_option> get_advanced_controls();
175  void change_preset( rs2_l500_visual_preset preset );
176  void set_preset_value( rs2_l500_visual_preset preset );
177  void reset_hw_controls();
178  rs2_l500_visual_preset calc_preset_from_controls() const;
179  void update_defaults();
180  void move_to_custom();
181  private:
182  void on_set_option(rs2_option opt, float value);
183 
184  void set_preset_controls_to_defaults();
185 
186 
187  void set_max_laser();
188 
189  void change_gain( rs2_l500_visual_preset preset );
190  void change_alt_ir( rs2_l500_visual_preset preset );
191  void change_laser_power( rs2_l500_visual_preset preset );
192  std::map<rs2_option, std::shared_ptr<cascade_option<l500_hw_options>>> _hw_options;
193  std::shared_ptr< digital_gain_option > _digital_gain;
194  std::shared_ptr< l500_hw_options > _alt_ir;
195  std::shared_ptr< l500_preset_option > _preset;
196 
197  template<typename T, class ... Args>
198  std::shared_ptr<cascade_option<T>> register_option(rs2_option opt, Args... args)
199  {
200  auto& depth_sensor = get_synthetic_depth_sensor();
201 
202  auto signaled_opt = std::make_shared <cascade_option<T>>(std::forward<Args>(args)...);
203  signaled_opt->add_observer([opt, this](float val) {on_set_option(opt, val);});
204  depth_sensor.register_option(opt, std::dynamic_pointer_cast<option>(signaled_opt));
205 
206  return signaled_opt;
207  }
208  };
209 
210 } // namespace librealsense
digital_gain_option(uvc_sensor &ep, platform::extension_unit xu, uint8_t id, std::string description, const std::map< float, std::string > &description_per_value, firmware_version fw_version, l500_options *owner)
Definition: l500-options.h:39
max_usable_range_option(l500_device *l500_depth_dev)
Definition: l500-options.h:118
uvc_xu_option< int > super
Definition: l500-options.h:32
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
GLfloat value
float query() const override
Definition: option.h:344
std::shared_ptr< digital_gain_option > _digital_gain
Definition: l500-options.h:110
GLsizei const GLchar *const * string
ir_reflectivity_option(l500_device *l500_depth_dev)
Definition: l500-options.h:143
sensor_mode_option(l500_device *l500_depth_dev, option_range range, std::string description)
Definition: l500-options.h:133
unsigned char uint8_t
Definition: stdint.h:78
GLuint GLfloat * val
GLenum mode
unsigned int uint32_t
Definition: stdint.h:80
GLboolean GLuint group
Definition: glext.h:5688
firmware_version _fw_version
Definition: l500-options.h:109
std::shared_ptr< cascade_option< T > > register_option(rs2_option opt, Args...args)
Definition: l500-options.h:198
void reset_hw_controls(rs2::device &dev)
rs2_sensor_mode
For setting the camera_mode option.
Definition: rs_option.h:165
std::shared_ptr< l500_hw_options > _alt_ir
Definition: l500-options.h:194
std::shared_ptr< digital_gain_option > _digital_gain
Definition: l500-options.h:193
GLenum type
bool is_read_only() const override
Definition: l500-options.h:93
std::map< rs2_option, std::shared_ptr< cascade_option< l500_hw_options > > > _hw_options
Definition: l500-options.h:192
const char * get_description() const override
Definition: option.h:387
GLsizei range
std::shared_ptr< l500_preset_option > _preset
Definition: l500-options.h:195
bool is_enabled() const override
Definition: l500-options.h:71
option_range get_range() const override
const char * get_description() const override
Definition: l500-options.h:73
rs2_l500_visual_preset
For L500 devices: provides optimized settings (presets) for specific types of usage.
Definition: rs_option.h:151
void enable_recording(std::function< void(const option &)> record_action) override
Definition: option.h:391


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