15 _depth_sensor(depth_sensor),
16 _color_sensor(nullptr)
21 return results[4] > 0;
23 _preset_opt = std::make_shared<advanced_mode_preset_option>(*
this,
31 auto&
dev = _depth_sensor.get_device();
32 for (
size_t i = 0;
i <
dev.get_sensors_count(); ++
i)
34 if (
auto s = dynamic_cast<const ds5_color_sensor*>(&(
dev.get_sensor(
i))))
67 auto res =
get_res_type(configuration.front().width, configuration.front().height);
98 std::hex << device_pid <<
")");
150 if (fw_version < remove_ir_pattern_fw_ver)
152 fw_version <<
" ; required_fw_ver=" << remove_ir_pattern_fw_ver <<
")");
167 std::hex << device_pid <<
")");
790 throw std::runtime_error(
"Advanced mode write failed!");
797 return (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
802 if (results.size() <
sizeof(
uint32_t))
throw std::runtime_error(
"Incomplete operation result!");
803 auto opCodeAsUint32 =
pack(results[3], results[2], results[1], results[0]);
804 if (opCodeAsUint32 != static_cast<uint32_t>(opcode))
806 std::stringstream ss;
807 ss <<
"Operation failed with error code=" <<
static_cast<int>(opCodeAsUint32);
808 throw std::runtime_error(ss.str());
810 std::vector<uint8_t>
result;
811 result.resize(results.size() -
sizeof(
uint32_t));
813 results.data() + results.size(), result.data());
822 std::vector<uint8_t>
data)
const 824 std::vector<uint8_t> raw_data;
825 auto cmd_op_code =
static_cast<uint32_t>(opcode);
827 const uint16_t pre_header_data = 0xcdab;
829 auto write_ptr = raw_data.data();
830 auto header_size = 4;
832 size_t cur_index = 2;
833 *
reinterpret_cast<uint16_t *
>(write_ptr + cur_index) = pre_header_data;
835 *
reinterpret_cast<unsigned int *
>(write_ptr + cur_index) = cmd_op_code;
836 cur_index +=
sizeof(
unsigned int);
839 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p1;
840 cur_index +=
sizeof(unsigned);
841 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p2;
842 cur_index +=
sizeof(unsigned);
843 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p3;
844 cur_index +=
sizeof(unsigned);
845 *
reinterpret_cast<unsigned*
>(write_ptr + cur_index) = p4;
846 cur_index +=
sizeof(unsigned);
849 std::copy(data.begin(), data.end(),
reinterpret_cast<uint8_t*
>(write_ptr + cur_index));
850 cur_index += data.size();
852 *
reinterpret_cast<uint16_t*
>(raw_data.data()) = static_cast<uint16_t>(cur_index - header_size);
853 raw_data.resize(cur_index);
865 std::lock_guard<std::mutex>
lock(
_mtx);
874 return (static_cast<rs2_rs400_visual_preset>((
int)x));
879 std::lock_guard<std::mutex>
lock(
_mtx);
912 return "Advanced-Mode Preset";
920 catch (std::out_of_range)
930 std::stringstream ss;
931 ss << std::hex << str_pid;
void get_depth_table_control(STDepthTableControl *ptr, int mode=0) const override
void set_color_saturation(const saturation_control &val)
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_depth_gain(gain_control *ptr) const
void set_laser_state(const laser_state_control &val)
static const uint16_t HW_MONITOR_BUFFER_SIZE
void get_depth_exposure(exposure_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_saturation(saturation_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_slo_penalty_control(STSloPenaltyControl *ptr, int mode=0) const override
virtual void set(float value)=0
laser_power_control laser_power
void high_res_high_accuracy(preset &p)
const char * get_value_description(float val) const override
void get_depth_auto_white_balance(auto_white_balance_control *ptr) const
void get_laser_state(laser_state_control *ptr) const
std::shared_ptr< sensor_base > get_raw_sensor() const
ds5_advanced_mode_base & _advanced
void load_json(const std::string &json_content) override
const char * get_description() const override
std::vector< uint8_t > generate_json(const preset &in_preset)
STSloColorThresholdsControl sctc
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_color_hue(hue_control *ptr) const
const uint16_t RS435_RGB_PID
lazy< bool > _rgb_exposure_gain_bind
bool is_enabled() const override
void get_depth_auto_exposure(auto_exposure_control *ptr) const
void get_color_sharpness(sharpness_control *ptr) const
bool supports_option(rs2_option id) const override
GLsizei const GLchar *const * string
void mid_res_high_density(preset &p)
void set_amp_factor(const STAFactor &val) override
void set_census_radius(const STCensusRadius &val) override
std::shared_ptr< advanced_mode_preset_option > _preset_opt
void get_exposure(synthetic_sensor &sensor, exposure_control *ptr) const
option & get_option(rs2_option id) override
virtual float query() const =0
void set_depth_gain(const gain_control &val)
void set_laser_power(const laser_power_control &val)
void set_auto_exposure(synthetic_sensor &sensor, const auto_exposure_control &val)
void high_res_mid_density(preset &p)
void get_auto_exposure(synthetic_sensor &sensor, auto_exposure_control *ptr) const
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)
void low_res_mid_density(preset &p)
const uint16_t RS405U_PID
void set_depth_exposure(const exposure_control &val)
void update_structs(const std::string &content, preset &in_preset)
laser_state_control laser_state
void get_laser_power(laser_power_control *ptr) const
void set_slo_penalty_control(const STSloPenaltyControl &val) override
void d415_remove_ir(preset &p)
sharpness_control color_sharpness
brightness_control color_brightness
void low_res_high_density(preset &p)
void get_color_auto_white_balance(auto_white_balance_control *ptr) const
void get_color_gamma(gamma_control *ptr) const
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 set_hdad(const STHdad &val) override
auto_exposure_control depth_auto_exposure
white_balance_control color_white_balance
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 high_res_high_density(preset &p)
void set_color_gamma(const gamma_control &val)
STRauSupportVectorControl rsvc
void get_color_backlight_compensation(backlight_compensation_control *ptr) const
void set_depth_auto_exposure(const auto_exposure_control &val)
void get_color_white_balance(white_balance_control *ptr) const
void set_color_gain(const gain_control &val)
void get_color_exposure(exposure_control *ptr) const
void get_color_brightness(brightness_control *ptr) const
void get_amp_factor(STAFactor *ptr, int mode=0) const override
gamma_control color_gamma
void default_410(preset &p)
void set_rau_support_vector_control(const STRauSupportVectorControl &val) override
bool is_streaming() const override
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
void get_color_power_line_frequency(power_line_frequency_control *ptr) const
std::function< void(const option &)> _recording_function
void get_color_contrast(contrast_control *ptr) const
void get_color_correction(STColorCorrection *ptr, int mode=0) const override
firmware_version get_firmware_version(const uvc_sensor &sensor) const
advanced_mode_preset_option(ds5_advanced_mode_base &advanced, synthetic_sensor &ep, const option_range &opt_range)
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
std::vector< uint8_t > send_receive(const std::vector< uint8_t > &input) const
void set(float value) override
void set_rsm(const STRsm &val) override
STDepthTableControl depth_table
GLenum GLenum GLenum input
void toggle_advanced_mode(bool enable) override
bool supports_option(const synthetic_sensor &sensor, rs2_option opt) const
contrast_control color_contrast
void register_on_open(on_open callback)
void mid_res_high_accuracy(preset &p)
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
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 set_color_contrast(const contrast_control &val)
backlight_compensation_control color_backlight_compensation
bool is_enabled() const override
lazy< bool > _amplitude_factor_support
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 mid_res_mid_density(preset &p)
void get_slo_color_thresholds_control(STSloColorThresholdsControl *ptr, int mode=0) const override
void low_res_high_accuracy(preset &p)
power_line_frequency_control color_power_line_frequency
bool is_valid(float value) const
void set_rau_color_thresholds_control(const STRauColorThresholdsControl &val) override
void set_color_auto_white_balance(const auto_white_balance_control &val)
int backlight_compensation
void get_color_auto_exposure(auto_exposure_control *ptr) const
const uint16_t RS430I_PID
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
uint16_t get_device_pid(const uvc_sensor &sensor) const
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