15 _depth_sensor(depth_sensor),
16 _color_sensor(nullptr)
21 return results[4] > 0;
25 _preset_opt = std::make_shared<advanced_mode_preset_option>(*
this,
33 auto&
dev = _depth_sensor.get_device();
34 for (
size_t i = 0;
i <
dev.get_sensors_count(); ++
i)
36 if (
auto s = dynamic_cast<const ds5_color_sensor*>(&(
dev.get_sensor(
i))))
71 if (configuration.empty())
74 res =
get_res_type(configuration.front().width, configuration.front().height);
106 std::hex << device_pid <<
")");
123 std::hex << device_pid <<
")");
131 p.depth_table.depthUnits = 100;
145 if (fw_version < remove_ir_pattern_fw_ver)
147 fw_version <<
" ; required_fw_ver=" << remove_ir_pattern_fw_ver <<
")");
162 std::hex << device_pid <<
")");
785 throw std::runtime_error(
"Advanced mode write failed!");
792 return (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
797 if (results.size() <
sizeof(
uint32_t))
throw std::runtime_error(
"Incomplete operation result!");
798 auto opCodeAsUint32 =
pack(results[3], results[2], results[1], results[0]);
799 if (opCodeAsUint32 != static_cast<uint32_t>(opcode))
801 std::stringstream ss;
802 ss <<
"Operation failed with error code=" <<
static_cast<int>(opCodeAsUint32);
803 throw std::runtime_error(ss.str());
805 std::vector<uint8_t> result;
806 result.resize(results.size() -
sizeof(
uint32_t));
808 results.data() + results.size(), result.data());
817 std::vector<uint8_t>
data)
const 819 std::vector<uint8_t> raw_data;
820 auto cmd_op_code =
static_cast<uint32_t>(opcode);
822 const uint16_t pre_header_data = 0xcdab;
824 auto write_ptr = raw_data.data();
825 auto header_size = 4;
827 size_t cur_index = 2;
828 *
reinterpret_cast<uint16_t *
>(write_ptr + cur_index) = pre_header_data;
830 *
reinterpret_cast<unsigned int *
>(write_ptr + cur_index) = cmd_op_code;
831 cur_index +=
sizeof(
unsigned int);
834 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p1;
835 cur_index +=
sizeof(unsigned);
836 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p2;
837 cur_index +=
sizeof(unsigned);
838 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p3;
839 cur_index +=
sizeof(unsigned);
840 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p4;
841 cur_index +=
sizeof(unsigned);
844 std::copy(data.begin(), data.end(),
reinterpret_cast<uint8_t*
>(write_ptr + cur_index));
845 cur_index += data.size();
847 *
reinterpret_cast<uint16_t*
>(raw_data.data()) = static_cast<uint16_t>(cur_index - header_size);
848 raw_data.resize(cur_index);
860 std::lock_guard<std::mutex>
lock(
_mtx);
869 return (static_cast<rs2_rs400_visual_preset>((
int)x));
874 std::lock_guard<std::mutex>
lock(
_mtx);
907 return "Advanced-Mode Preset";
915 catch (std::out_of_range)
925 std::stringstream ss;
926 ss << std::hex << str_pid;
void get_depth_table_control(STDepthTableControl *ptr, int mode=0) const override
void high_accuracy(preset &p)
void set_color_saturation(const saturation_control &val)
void get_depth_exposure(exposure_control *ptr) const
static const textual_icon lock
void set_color_hue(const hue_control &val)
void default_400(preset &p)
void set_depth_table_control(const STDepthTableControl &val) override
void d460_remove_ir(preset &p)
void default_430(preset &p)
synthetic_sensor & _depth_sensor
void set_color_correction(const STColorCorrection &val) override
void get_auto_exposure(synthetic_sensor &sensor, auto_exposure_control *ptr) const
void set_laser_state(const laser_state_control &val)
static const uint16_t HW_MONITOR_BUFFER_SIZE
void default_405u(preset &p)
void get_depth_auto_white_balance(auto_white_balance_control *ptr) const
ds5_advanced_mode_base(std::shared_ptr< hw_monitor > hwm, synthetic_sensor &depth_sensor)
std::vector< uint8_t > serialize_json() const override
void get_color_power_line_frequency(power_line_frequency_control *ptr) const
exposure_control color_exposure
static std::vector< uint8_t > assert_no_error(ds::fw_cmd opcode, const std::vector< uint8_t > &results)
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
STColorControl color_control
void get_color_gamma(gamma_control *ptr) const
void get_slo_penalty_control(STSloPenaltyControl *ptr, int mode=0) const override
virtual void set(float value)=0
laser_power_control laser_power
const char * get_value_description(float val) const override
ds5_advanced_mode_base & _advanced
void load_json(const std::string &json_content) override
const char * get_description() const override
firmware_version get_firmware_version(const uvc_sensor &sensor) const
virtual float get_preset_max_value() const
STSloColorThresholdsControl sctc
void default_450_mid_low_res(preset &p)
void get_depth_control_group(STDepthControlGroup *ptr, int mode=0) const override
auto_white_balance_control depth_auto_white_balance
auto_exposure_control color_auto_exposure
std::shared_ptr< hw_monitor > _hw_monitor
STDepthControlGroup depth_controls
lazy< ds5_color_sensor * > _color_sensor
void get_laser_state(laser_state_control *ptr) const
const uint16_t RS435_RGB_PID
lazy< bool > _rgb_exposure_gain_bind
bool is_enabled() const override
bool supports_option(rs2_option id) const override
std::vector< uint8_t > generate_json(const device_interface &dev, const preset &in_preset)
void get_color_brightness(brightness_control *ptr) const
void set_amp_factor(const STAFactor &val) override
void get_color_backlight_compensation(backlight_compensation_control *ptr) const
void set_census_radius(const STCensusRadius &val) override
std::shared_ptr< advanced_mode_preset_option > _preset_opt
option & get_option(rs2_option id) override
virtual float query() const =0
void set_depth_gain(const gain_control &val)
void update_structs(const device_interface &dev, const std::string &content, preset &in_preset)
std::vector< uint8_t > send_receive(const std::vector< uint8_t > &input) const
void get_color_hue(hue_control *ptr) const
void set_laser_power(const laser_power_control &val)
void set_auto_exposure(synthetic_sensor &sensor, const auto_exposure_control &val)
void set_color_control(const STColorControl &val) override
void hand_gesture(preset &p)
void get_ae_control(STAEControl *ptr, int mode=0) const override
static rs2_rs400_visual_preset to_preset(float x)
const uint16_t RS405U_PID
void get_depth_gain(gain_control *ptr) const
void set_depth_exposure(const exposure_control &val)
laser_state_control laser_state
void set_slo_penalty_control(const STSloPenaltyControl &val) override
void d415_remove_ir(preset &p)
uint16_t get_device_pid(const uvc_sensor &sensor) const
sharpness_control color_sharpness
brightness_control color_brightness
void set_hdad(const STHdad &val) override
auto_exposure_control depth_auto_exposure
white_balance_control color_white_balance
void get_exposure(synthetic_sensor &sensor, exposure_control *ptr) const
STAFactor amplitude_factor
void set_color_brightness(const brightness_control &val)
const std::string & get_info(rs2_camera_info info) const override
void set_exposure(synthetic_sensor &sensor, const exposure_control &val)
void set_color_gamma(const gamma_control &val)
bool supports_option(const synthetic_sensor &sensor, rs2_option opt) const
STRauSupportVectorControl rsvc
void set_depth_auto_exposure(const auto_exposure_control &val)
void set_color_gain(const gain_control &val)
void get_amp_factor(STAFactor *ptr, int mode=0) const override
gamma_control color_gamma
void high_density(preset &p)
void default_410(preset &p)
void set_rau_support_vector_control(const STRauSupportVectorControl &val) override
std::vector< uint8_t > encode_command(ds::fw_cmd opcode, uint32_t p1=0, uint32_t p2=0, uint32_t p3=0, uint32_t p4=0, std::vector< uint8_t > data=std::vector< uint8_t >()) const
void get_color_sharpness(sharpness_control *ptr) const
auto_white_balance_control color_auto_white_balance
float query() const override
void set_ae_control(const STAEControl &val) override
void get_rau_support_vector_control(STRauSupportVectorControl *ptr, int mode=0) const override
std::function< void(const option &)> _recording_function
void get_color_correction(STColorCorrection *ptr, int mode=0) const override
advanced_mode_preset_option(ds5_advanced_mode_base &advanced, synthetic_sensor &ep, const option_range &opt_range)
device_interface & get_device() override
void set_color_white_balance(const white_balance_control &val)
static uint32_t pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
void set_depth_control_group(const STDepthControlGroup &val) override
const uint16_t RS435I_PID
void get_census_radius(STCensusRadius *ptr, int mode=0) const override
void set(float value) override
void set_rsm(const STRsm &val) override
STDepthTableControl depth_table
void mid_density(preset &p)
void get_depth_auto_exposure(auto_exposure_control *ptr) const
void toggle_advanced_mode(bool enable) override
void get_color_exposure(exposure_control *ptr) const
contrast_control color_contrast
void get_laser_power(laser_power_control *ptr) const
std::shared_ptr< sensor_base > get_raw_sensor() const
void register_on_open(on_open callback)
rs2_rs400_visual_preset
For RS400 devices: provides optimized settings (presets) for specific types of usage.
void get_hdad(STHdad *ptr, int mode=0) const override
bool is_valid(float value) const
void set_color_power_line_frequency(const power_line_frequency_control &val)
void default_420(preset &p)
exposure_control depth_exposure
saturation_control color_saturation
void set_color_exposure(const exposure_control &val)
void get_color_auto_exposure(auto_exposure_control *ptr) const
void set_color_contrast(const contrast_control &val)
backlight_compensation_control color_backlight_compensation
void get_color_white_balance(white_balance_control *ptr) const
bool is_enabled() const override
lazy< bool > _amplitude_factor_support
void get_color_saturation(saturation_control *ptr) const
void set_depth_auto_white_balance(const auto_white_balance_control &val)
void set_color_auto_exposure(const auto_exposure_control &val)
void get_color_gain(gain_control *ptr) const
void get_rsm(STRsm *ptr, int mode=0) const override
const char * rs2_rs400_visual_preset_to_string(rs2_rs400_visual_preset preset)
void default_405(preset &p)
void get_slo_color_thresholds_control(STSloColorThresholdsControl *ptr, int mode=0) const override
power_line_frequency_control color_power_line_frequency
void set_rau_color_thresholds_control(const STRauColorThresholdsControl &val) override
void get_color_contrast(contrast_control *ptr) const
void default_450_high_res(preset &p)
void set_color_auto_white_balance(const auto_white_balance_control &val)
int backlight_compensation
const uint16_t RS430I_PID
void get_color_auto_white_balance(auto_white_balance_control *ptr) const
void get_color_control(STColorControl *ptr, int mode=0) const override
void set_slo_color_thresholds_control(const STSloColorThresholdsControl &val) override
void set_color_sharpness(const sharpness_control &val)
STRauColorThresholdsControl rctc
void set_all(const preset &p)
void set_color_backlight_compensation(const backlight_compensation_control &val)
void copy(void *dst, void const *src, size_t size)
res_type get_res_type(uint32_t width, uint32_t height)
rs2_rs400_visual_preset _last_preset
void apply_preset(const std::vector< platform::stream_profile > &configuration, rs2_rs400_visual_preset preset, uint16_t device_pid, const firmware_version &fw_version) override
std::string to_string(T value)
void get_rau_color_thresholds_control(STRauColorThresholdsControl *ptr, int mode=0) const override