ds5-active.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2016 Intel Corporation. All Rights Reserved.
3 
4 #include <mutex>
5 #include <chrono>
6 #include <vector>
7 #include <iterator>
8 #include <cstddef>
9 
10 #include "device.h"
11 #include "context.h"
12 #include "image.h"
13 #include "metadata-parser.h"
14 
15 #include "ds5-active.h"
16 #include "ds5-private.h"
17 #include "ds5-options.h"
18 #include "ds5-timestamp.h"
19 
20 namespace librealsense
21 {
22  ds5_active::ds5_active(std::shared_ptr<context> ctx,
24  : device(ctx, group), ds5_device(ctx, group)
25  {
26  using namespace ds;
27 
28  //Projector's capacity is established based on actual HW capabilities
29  auto pid = group.uvc_devices.front().pid;
30  if ((pid != RS_USB2_PID) && ((_device_capabilities & d400_caps::CAP_ACTIVE_PROJECTOR) == d400_caps::CAP_ACTIVE_PROJECTOR))
31  {
32  auto&& depth_ep = get_depth_sensor();
33  auto&& raw_depth_ep = get_raw_depth_sensor();
34 
35  //EMITTER ENABLED OPTION
36  auto emitter_enabled = std::make_shared<emitter_option>(raw_depth_ep);
37 
38  //LASER POWER OPTION
39  auto laser_power = std::make_shared<uvc_xu_option<uint16_t>>(raw_depth_ep,
40  depth_xu,
42  "Manual laser power in mw. applicable only when laser power mode is set to Manual");
43 
44  auto laser_power_auto_disabling = std::make_shared<auto_disabling_control>(
46  emitter_enabled,
47  std::vector<float>{0.f, 2.f}, 1.f);
48 
49  if (auto hdr_enabled_option = depth_ep.get_option_handler(RS2_OPTION_HDR_ENABLED))
50  {
51  std::vector<std::pair<std::shared_ptr<option>, std::string>> emitter_options_and_reasons = { std::make_pair(hdr_enabled_option,
52  "Emitter status cannot be set while HDR is enabled")};
53  depth_ep.register_option(RS2_OPTION_EMITTER_ENABLED,
54  std::make_shared<gated_option>(
55  emitter_enabled,
56  emitter_options_and_reasons));
57 
58  std::vector<std::pair<std::shared_ptr<option>, std::string>> laser_options_and_reasons = { std::make_pair(hdr_enabled_option,
59  "Laser Power status cannot be set while HDR is enabled") };
60  depth_ep.register_option(RS2_OPTION_LASER_POWER,
61  std::make_shared<gated_option>(
62  laser_power_auto_disabling,
63  laser_options_and_reasons));
64  }
65  else
66  {
67  depth_ep.register_option(RS2_OPTION_EMITTER_ENABLED, emitter_enabled);
68  depth_ep.register_option(RS2_OPTION_LASER_POWER, laser_power_auto_disabling);
69  }
70 
71  //PROJECTOR TEMPERATURE OPTION
72  depth_ep.register_option(RS2_OPTION_PROJECTOR_TEMPERATURE,
73  std::make_shared<asic_and_projector_temperature_options>(raw_depth_ep,
75  }
76  else
77  {
78  LOG_WARNING("Projector capacity is overrided and disabled by FW\nDevice PID = 0x" << std::hex << pid
79  << std::dec << ", Capabilities Vector = [" << _device_capabilities << "]");
80  }
81  }
82 }
const uint8_t DS5_LASER_POWER
Definition: ds5-private.h:54
#define LOG_WARNING(...)
Definition: src/types.h:241
synthetic_sensor & get_depth_sensor()
Definition: ds5-device.h:41
GLsizei const GLchar *const * string
GLboolean GLuint group
Definition: glext.h:5688
ds5_active(std::shared_ptr< context > ctx, const platform::backend_device_group &group)
Definition: ds5-active.cpp:22
const uint16_t RS_USB2_PID
Definition: ds5-private.h:30
ds::d400_caps _device_capabilities
Definition: ds5-device.h:90
const platform::extension_unit depth_xu
Definition: ds5-private.h:159
uvc_sensor & get_raw_depth_sensor()
Definition: ds5-device.h:46
std::vector< uvc_device_info > uvc_devices
Definition: backend.h:525


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