ds5-options.h
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 #pragma once
5 
6 #include "ds5-private.h"
7 
8 #include "algo.h"
9 #include "error-handling.h"
10 #include "../hdr-config.h"
11 
12 namespace librealsense
13 {
14  class emitter_option : public uvc_xu_option<uint8_t>
15  {
16  public:
17  const char* get_value_description(float val) const override;
18  explicit emitter_option(uvc_sensor& ep);
19  };
20 
22  {
23  public:
24  float query() const override;
25 
26  option_range get_range() const override;
27 
28  bool is_enabled() const override;
29 
30  const char* get_description() const override;
31 
33 
34  private:
37  };
38 
40  {
41  public:
42  float query() const override;
43 
44  option_range get_range() const override;
45 
46  bool is_enabled() const override;
47 
48  const char* get_description() const override;
49 
51 
52  private:
53  const std::string custom_sensor_name = "custom";
54  const std::string report_name = "data-field-custom-value_2";
56  };
57 
59  {
60  public:
61  void set(float value) override;
62 
63  float query() const override;
64 
65  bool is_enabled() const override { return true; }
66 
67  const char* get_description() const override
68  {
69  return "Enable/disable auto-exposure";
70  }
71 
72  auto_exposure_mechanism* get_auto_exposure() { return _auto_exposure.get(); }
73  bool to_add_frames() { return _to_add_frames.load(); }
74 
76  std::shared_ptr<auto_exposure_mechanism> auto_exposure,
77  std::shared_ptr<auto_exposure_state> auto_exposure_state,
78  const option_range& opt_range);
79 
80  private:
81  std::shared_ptr<auto_exposure_state> _auto_exposure_state;
82  std::atomic<bool> _to_add_frames;
83  std::shared_ptr<auto_exposure_mechanism> _auto_exposure;
84  };
85 
87  {
88  public:
89  auto_exposure_mode_option(std::shared_ptr<auto_exposure_mechanism> auto_exposure,
90  std::shared_ptr<auto_exposure_state> auto_exposure_state,
91  const option_range& opt_range,
92  const std::map<float, std::string>& description_per_value);
93 
94  void set(float value) override;
95 
96  float query() const override;
97 
98  bool is_enabled() const override { return true; }
99 
100  const char* get_description() const override
101  {
102  return "Auto-Exposure Mode";
103  }
104 
105  const char* get_value_description(float val) const override;
106 
107  private:
108  const std::map<float, std::string> _description_per_value;
109  std::shared_ptr<auto_exposure_state> _auto_exposure_state;
110  std::shared_ptr<auto_exposure_mechanism> _auto_exposure;
111  };
112 
114  {
115  public:
116  auto_exposure_step_option(std::shared_ptr<auto_exposure_mechanism> auto_exposure,
117  std::shared_ptr<auto_exposure_state> auto_exposure_state,
118  const option_range& opt_range);
119 
120  void set(float value) override;
121 
122  float query() const override;
123 
124  bool is_enabled() const override { return true; }
125 
126  const char* get_description() const override
127  {
128  return "Auto-Exposure converge step";
129  }
130 
131  private:
132  std::shared_ptr<auto_exposure_state> _auto_exposure_state;
133  std::shared_ptr<auto_exposure_mechanism> _auto_exposure;
134  };
135 
137  {
138  public:
139  auto_exposure_antiflicker_rate_option(std::shared_ptr<auto_exposure_mechanism> auto_exposure,
140  std::shared_ptr<auto_exposure_state> auto_exposure_state,
141  const option_range& opt_range,
142  const std::map<float, std::string>& description_per_value);
143 
144  void set(float value) override;
145 
146  float query() const override;
147 
148  bool is_enabled() const override { return true; }
149 
150  const char* get_description() const override
151  {
152  return "Auto-Exposure anti-flicker";
153  }
154 
155  const char* get_value_description(float val) const override;
156 
157  private:
158  const std::map<float, std::string> _description_per_value;
159  std::shared_ptr<auto_exposure_state> _auto_exposure_state;
160  std::shared_ptr<auto_exposure_mechanism> _auto_exposure;
161  };
162 
164  {
165  public:
167  virtual ~depth_scale_option() = default;
168  virtual void set(float value) override;
169  virtual float query() const override;
170  virtual option_range get_range() const override;
171  virtual bool is_enabled() const override { return true; }
172 
173  const char* get_description() const override
174  {
175  return "Number of meters represented by a single depth unit";
176  }
177  void enable_recording(std::function<void(const option &)> record_action) override
178  {
179  _record_action = record_action;
180  }
181 
182  private:
184  std::function<void(const option &)> _record_action = [](const option&) {};
187  };
188 
189  class external_sync_mode : public option
190  {
191  public:
192  external_sync_mode(hw_monitor& hwm, sensor_base* depth_ep = nullptr, int ver = 1); // ver = 1, for firmware 5.9.15.1 and later, INTERCAM_SYNC_MAX is 2 with master and slave mode only.
193  // ver = 2, for firmware 5.12.4.0 and later, INTERCAM_SYNC_MAX is 258 by adding FULL SLAVE mode and genlock with trigger frequency 1 - 255.
194  // ver = 3 for firmware 5.12.12.100 and later, INTERCAM_SYNC_MAX is 260 by adding genlock with laser on-off and Off-On two frames.
195 
196  virtual ~external_sync_mode() = default;
197  virtual void set(float value) override;
198  virtual float query() const override;
199  virtual option_range get_range() const override;
200  virtual bool is_enabled() const override { return true; }
201  virtual bool is_read_only() const { return _sensor && _sensor->is_opened(); }
202  const char* get_description() const override;
203 
204  void enable_recording(std::function<void(const option &)> record_action) override
205  {
206  _record_action = record_action;
207  }
208  private:
209  std::function<void(const option &)> _record_action = [](const option&) {};
213  int _ver;
214  };
215 
217  {
218  public:
220  virtual ~emitter_on_and_off_option() = default;
221  virtual void set(float value) override;
222  virtual float query() const override;
223  virtual option_range get_range() const override;
224  virtual bool is_enabled() const override { return true; }
225  virtual const char* get_description() const override
226  {
227  return "Emitter On/Off Mode: 0:disabled(default), 1:enabled(emitter toggles between on and off). Can only be set before streaming";
228  }
229  virtual void enable_recording(std::function<void(const option &)> record_action) override {_record_action = record_action;}
230 
231  private:
232  std::function<void(const option &)> _record_action = [](const option&) {};
236  };
237 
239  {
240  public:
241  alternating_emitter_option(hw_monitor& hwm, sensor_base* depth_ep, bool is_fw_version_using_id);
242  virtual ~alternating_emitter_option() = default;
243  virtual void set(float value) override;
244  virtual float query() const override;
245  virtual option_range get_range() const override { return *_range; }
246  virtual bool is_enabled() const override { return true; }
247  virtual const char* get_description() const override
248  {
249  return "Alternating emitter pattern, toggled on/off on per-frame basis";
250  }
251  virtual void enable_recording(std::function<void(const option &)> record_action) override { _record_action = record_action; }
252 
253  private:
254  std::function<void(const option &)> _record_action = [](const option&) {};
259  };
260 
262  {
263  public:
265  virtual ~emitter_always_on_option() = default;
266  virtual void set(float value) override;
267  virtual float query() const override;
268  virtual option_range get_range() const override;
269  virtual bool is_enabled() const override { return true; }
270  virtual const char* get_description() const override
271  {
272  return "Emitter always on mode: 0:disabled(default), 1:enabled";
273  }
274  virtual void enable_recording(std::function<void(const option &)> record_action) override { _record_action = record_action; }
275 
276  private:
277  std::function<void(const option &)> _record_action = [](const option&) {};
281  };
282 
283  class hdr_option : public option
284  {
285  public:
286  hdr_option(std::shared_ptr<hdr_config> hdr_cfg, rs2_option option, option_range range)
287  : _hdr_cfg(hdr_cfg), _option(option), _range(range) {}
288 
289  hdr_option(std::shared_ptr<hdr_config> hdr_cfg, rs2_option option, option_range range, const std::map<float, std::string>& description_per_value)
290  : _hdr_cfg(hdr_cfg), _option(option), _range(range), _description_per_value(description_per_value) {}
291 
292  virtual ~hdr_option() = default;
293  virtual void set(float value) override;
294  virtual float query() const override;
295  virtual option_range get_range() const override;
296  virtual bool is_enabled() const override { return true; }
297  virtual const char* get_description() const override { return "HDR Option"; }
298  virtual void enable_recording(std::function<void(const option&)> record_action) override { _record_action = record_action; }
299  virtual const char* get_value_description(float) const override;
300 
301  private:
302  std::function<void(const option&)> _record_action = [](const option&) {};
303  std::shared_ptr<hdr_config> _hdr_cfg;
306  const std::map<float, std::string> _description_per_value;
307  };
308 
309  // used for options that change their behavior when hdr configuration is in process
311  {
312  public:
313  hdr_conditional_option(std::shared_ptr<hdr_config> hdr_cfg,
314  std::shared_ptr<option> uvc_option,
315  std::shared_ptr<option> hdr_option):
316  _hdr_cfg(hdr_cfg),
317  _uvc_option(uvc_option),
318  _hdr_option(hdr_option) {}
319 
320  virtual ~hdr_conditional_option() = default;
321  virtual void set(float value) override;
322  virtual float query() const override;
323  virtual option_range get_range() const override;
324  virtual bool is_enabled() const override;
325  virtual const char* get_description() const override;
326  virtual void enable_recording(std::function<void(const option&)> record_action) override { _record_action = record_action; }
327 
328  private:
329  std::function<void(const option&)> _record_action = [](const option&) {};
330  std::shared_ptr<hdr_config> _hdr_cfg;
331  std::shared_ptr<option> _uvc_option;
332  std::shared_ptr<option> _hdr_option;
333  };
334 
336  {
337  public:
339  virtual ~auto_exposure_limit_option() = default;
340  virtual void set(float value) override;
341  virtual float query() const override;
342  virtual option_range get_range() const override;
343  virtual bool is_enabled() const override { return true; }
344  virtual bool is_read_only() const { return _sensor && _sensor->is_opened(); }
345  virtual const char* get_description() const override
346  {
347  return "Exposure limit is in microseconds. Default is 0 which means full exposure range. If the requested exposure limit is greater than frame time, it will be set to frame time at runtime. Setting will not take effect until next streaming session.";
348  }
349  virtual void enable_recording(std::function<void(const option&)> record_action) override { _record_action = record_action; }
350 
351  private:
352  std::function<void(const option&)> _record_action = [](const option&) {};
356  };
357 
359  {
360  public:
362  virtual ~auto_gain_limit_option() = default;
363  virtual void set(float value) override;
364  virtual float query() const override;
365  virtual option_range get_range() const override;
366  virtual bool is_enabled() const override { return true; }
367  virtual bool is_read_only() const { return _sensor && _sensor->is_opened(); }
368  virtual const char* get_description() const override
369  {
370  return "Gain limits ranges from 16 to 248. Default is 0 which means full gain. If the requested gain limit is less than 16, it will be set to 16. If the requested gain limit is greater than 248, it will be set to 248. Setting will not take effect until next streaming session.";
371  }
372  virtual void enable_recording(std::function<void(const option&)> record_action) override { _record_action = record_action; }
373 
374  private:
375  std::function<void(const option&)> _record_action = [](const option&) {};
379  };
380 
381 
382  class ds5_thermal_monitor;
384  {
385  public:
386  thermal_compensation(std::shared_ptr<ds5_thermal_monitor> monitor,
387  std::shared_ptr<option> toggle);
388 
389  void set(float value) override;
390  float query() const override;
391 
392  option_range get_range() const override { return option_range{ 0, 1, 1, 0 }; }
393  bool is_enabled() const override { return true; }
394 
395  const char* get_description() const override;
396  const char* get_value_description(float value) const override;
397  void create_snapshot(std::shared_ptr<option>& snapshot) const override;
398 
399  void enable_recording(std::function<void(const option&)> record_action) override
400  {
401  _recording_function = record_action;
402  }
403 
404  private:
405  std::shared_ptr<ds5_thermal_monitor> _thermal_monitor;
406  std::shared_ptr<option> _thermal_toggle;
407 
408  std::function<void(const option&)> _recording_function = [](const option&) {};
409  };
410 }
virtual bool is_enabled() const override
Definition: ds5-options.h:200
std::shared_ptr< auto_exposure_mechanism > _auto_exposure
Definition: ds5-options.h:160
virtual bool is_enabled() const override
Definition: ds5-options.h:224
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:298
virtual const char * get_description() const override
Definition: ds5-options.h:270
hdr_option(std::shared_ptr< hdr_config > hdr_cfg, rs2_option option, option_range range)
Definition: ds5-options.h:286
hdr_option(std::shared_ptr< hdr_config > hdr_cfg, rs2_option option, option_range range, const std::map< float, std::string > &description_per_value)
Definition: ds5-options.h:289
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:251
virtual const char * get_description() const override
Definition: ds5-options.h:345
virtual bool is_enabled() const override
Definition: ds5-options.h:343
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
lazy< option_range > _range
Definition: ds5-options.h:185
bool is_enabled() const override
Definition: ds5-options.h:393
option_range get_range() const override
Definition: option.h:357
virtual option_range get_range() const override
Definition: ds5-options.h:245
virtual const char * get_description() const override
Definition: ds5-options.h:225
std::shared_ptr< auto_exposure_mechanism > _auto_exposure
Definition: ds5-options.h:133
GLfloat value
lazy< option_range > _range
Definition: ds5-options.h:210
std::shared_ptr< option > _thermal_toggle
Definition: ds5-options.h:406
option_range get_range() const override
Definition: ds5-options.h:392
const char * get_description() const override
Definition: ds5-options.h:100
virtual void create_snapshot(std::shared_ptr< option > &snapshot) const
Definition: option.cpp:30
float query() const override
Definition: option.h:344
virtual const char * get_description() const override
Definition: ds5-options.h:368
GLsizei const GLchar *const * string
virtual bool is_read_only() const
Definition: ds5-options.h:201
const char * get_description() const override
Definition: ds5-options.h:173
virtual const char * get_description() const override
Definition: ds5-options.h:297
std::shared_ptr< auto_exposure_mechanism > _auto_exposure
Definition: ds5-options.h:83
std::shared_ptr< auto_exposure_state > _auto_exposure_state
Definition: ds5-options.h:81
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:274
GLuint GLfloat * val
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:326
GLenum mode
virtual bool is_enabled() const override
Definition: ds5-options.h:366
virtual const char * get_description() const override
Definition: ds5-options.h:247
void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:204
void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:177
virtual bool is_enabled() const override
Definition: ds5-options.h:171
std::shared_ptr< auto_exposure_mechanism > _auto_exposure
Definition: ds5-options.h:110
const char * get_description() const override
Definition: ds5-options.h:67
std::shared_ptr< auto_exposure_state > _auto_exposure_state
Definition: ds5-options.h:109
std::shared_ptr< hdr_config > _hdr_cfg
Definition: ds5-options.h:330
const char * get_value_description(float val) const override
Definition: ds5-options.cpp:10
void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:399
const char * get_description() const override
Definition: ds5-options.h:150
const std::map< float, std::string > _description_per_value
Definition: ds5-options.h:108
std::shared_ptr< auto_exposure_state > _auto_exposure_state
Definition: ds5-options.h:159
virtual bool is_read_only() const
Definition: ds5-options.h:367
const std::map< float, std::string > _description_per_value
Definition: ds5-options.h:306
auto_exposure_mechanism * get_auto_exposure()
Definition: ds5-options.h:72
virtual bool is_enabled() const override
Definition: ds5-options.h:296
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:229
emitter_option(uvc_sensor &ep)
Definition: ds5-options.cpp:35
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:349
hdr_conditional_option(std::shared_ptr< hdr_config > hdr_cfg, std::shared_ptr< option > uvc_option, std::shared_ptr< option > hdr_option)
Definition: ds5-options.h:313
const std::map< float, std::string > _description_per_value
Definition: ds5-options.h:158
virtual bool is_enabled() const override
Definition: ds5-options.h:269
std::shared_ptr< option > _hdr_option
Definition: ds5-options.h:332
virtual bool is_enabled() const override
Definition: ds5-options.h:246
std::function< void(const option &)> _recording_function
Definition: option.h:406
const char * get_description() const override
Definition: option.h:387
const std::map< float, std::string > _description_per_value
Definition: option.h:407
GLsizei range
std::shared_ptr< auto_exposure_state > _auto_exposure_state
Definition: ds5-options.h:132
std::shared_ptr< hdr_config > _hdr_cfg
Definition: ds5-options.h:303
virtual void enable_recording(std::function< void(const option &)> record_action) override
Definition: ds5-options.h:372
bool is_enabled() const override
Definition: option.h:377
std::shared_ptr< option > _uvc_option
Definition: ds5-options.h:331
std::shared_ptr< ds5_thermal_monitor > _thermal_monitor
Definition: ds5-options.h:405
const char * get_description() const override
Definition: ds5-options.h:126


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