15 #ifndef VISIONTRANSFER_DEVICEPARAMETERS_H
16 #define VISIONTRANSFER_DEVICEPARAMETERS_H
18 #include "visiontransfer/common.h"
19 #include "visiontransfer/types.h"
20 #include "visiontransfer/deviceinfo.h"
21 #include "visiontransfer/parameterinfo.h"
22 #if VISIONTRANSFER_CPLUSPLUS_VERSION >= 201103L
23 #include "visiontransfer/parameter.h"
24 #include "visiontransfer/parameterset.h"
31 namespace visiontransfer {
52 class VT_EXPORT DeviceParameters {
67 DeviceParameters(
const DeviceInfo& device);
78 DeviceParameters(
const char* address,
const char* service =
"7683");
90 bool isConnected()
const;
114 OperationMode getOperationMode() {
115 return static_cast<OperationMode
>(readIntParameter(
"operation_mode"));
124 void setOperationMode(OperationMode mode) {
125 writeIntParameter(
"operation_mode",
static_cast<int>(mode));
131 int getDisparityOffset() {
132 return readIntParameter(
"disparity_offset");
140 void setDisparityOffset(
int offset) {
141 writeIntParameter(
"disparity_offset", offset);
149 int getStereoMatchingP1Edge() {
150 return readIntParameter(
"sgm_p1_edge");
158 void setStereoMatchingP1Edge(
int p1) {
159 writeIntParameter(
"sgm_p1_edge", p1);
165 int getStereoMatchingP1NoEdge() {
166 return readIntParameter(
"sgm_p1_no_edge");
174 void setStereoMatchingP1NoEdge(
int p1) {
175 writeIntParameter(
"sgm_p1_no_edge", p1);
181 int getStereoMatchingP2Edge() {
182 return readIntParameter(
"sgm_p2_edge");
190 void setStereoMatchingP2Edge(
int p2) {
191 writeIntParameter(
"sgm_p2_edge", p2);
197 int getStereoMatchingP2NoEdge() {
198 return readIntParameter(
"sgm_p2_no_edge");
206 void setStereoMatchingP2NoEdge(
int p2) {
207 writeIntParameter(
"sgm_p2_no_edge", p2);
213 int getStereoMatchingEdgeSensitivity() {
214 return readIntParameter(
"sgm_edge_sensitivity");
222 void setStereoMatchingEdgeSensitivity(
int sensitivity) {
223 writeIntParameter(
"sgm_edge_sensitivity", sensitivity);
230 bool getMaskBorderPixelsEnabled() {
231 return readBoolParameter(
"mask_border_pixels_enabled");
238 void setMaskBorderPixelsEnabled(
bool enabled) {
239 writeBoolParameter(
"mask_border_pixels_enabled", enabled);
245 bool getConsistencyCheckEnabled() {
246 return readBoolParameter(
"consistency_check_enabled");
252 void setConsistencyCheckEnabled(
bool enabled) {
253 writeBoolParameter(
"consistency_check_enabled", enabled);
259 int getConsistencyCheckSensitivity() {
260 return readIntParameter(
"consistency_check_sensitivity");
268 void setConsistencyCheckSensitivity(
int sensitivity) {
269 writeIntParameter(
"consistency_check_sensitivity", sensitivity);
275 bool getUniquenessCheckEnabled() {
276 return readBoolParameter(
"uniqueness_check_enabled");
282 void setUniquenessCheckEnabled(
bool enabled) {
283 writeBoolParameter(
"uniqueness_check_enabled", enabled);
289 int getUniquenessCheckSensitivity() {
290 return readIntParameter(
"uniqueness_check_sensitivity");
298 void setUniquenessCheckSensitivity(
int sensitivity) {
299 writeIntParameter(
"uniqueness_check_sensitivity", sensitivity);
305 bool getTextureFilterEnabled() {
306 return readBoolParameter(
"texture_filter_enabled");
312 void setTextureFilterEnabled(
bool enabled) {
313 writeBoolParameter(
"texture_filter_enabled", enabled);
319 int getTextureFilterSensitivity() {
320 return readIntParameter(
"texture_filter_sensitivity");
328 void setTextureFilterSensitivity(
int sensitivity) {
329 writeIntParameter(
"texture_filter_sensitivity", sensitivity);
335 bool getGapInterpolationEnabled() {
336 return readBoolParameter(
"gap_interpolation_enabled");
342 void setGapInterpolationEnabled(
bool enabled) {
343 writeBoolParameter(
"gap_interpolation_enabled", enabled);
349 bool getNoiseReductionEnabled() {
350 return readBoolParameter(
"noise_reduction_enabled");
356 void setNoiseReductionEnabled(
bool enabled) {
357 writeBoolParameter(
"noise_reduction_enabled", enabled);
363 int getSpeckleFilterIterations() {
364 return readIntParameter(
"speckle_filter_iterations");
370 void setSpeckleFilterIterations(
int iter) {
371 writeIntParameter(
"speckle_filter_iterations", iter);
381 AUTO_EXPOSURE_AND_GAIN = 0,
384 AUTO_EXPOSURE_MANUAL_GAIN = 1,
387 MANUAL_EXPOSURE_AUTO_GAIN = 2,
390 MANUAL_EXPOSURE_MANUAL_GAIN = 3
397 AutoMode getAutoMode() {
398 return static_cast<AutoMode
>(readIntParameter(
"auto_exposure_mode"));
406 writeIntParameter(
"auto_exposure_mode",
static_cast<int>(mode));
416 double getAutoTargetIntensity() {
417 return readDoubleParameter(
"auto_target_intensity");
427 void setAutoTargetIntensity(
double intensity) {
428 writeDoubleParameter(
"auto_target_intensity", intensity);
438 double getAutoTargetIntensityThirdCamera() {
439 return readDoubleParameter(
"auto_target_intensity_color");
449 void setAutoTargetIntensityThirdCamera(
double intensity) {
450 writeDoubleParameter(
"auto_target_intensity_color", intensity);
460 double getAutoIntensityDelta() {
461 return readDoubleParameter(
"auto_intensity_delta");
471 void setAutoIntensityDelta(
double delta) {
472 writeDoubleParameter(
"auto_intensity_delta", delta);
494 TargetFrame getAutoTargetFrame() {
495 return static_cast<TargetFrame>(readIntParameter(
"auto_target_frame"));
502 void setAutoTargetFrame(TargetFrame target) {
503 writeIntParameter(
"auto_target_frame",
static_cast<int>(target));
513 int getAutoSkippedFrames() {
514 return readIntParameter(
"auto_skipped_frames");
524 void setAutoSkippedFrames(
int skipped) {
525 writeIntParameter(
"auto_skipped_frames", skipped);
532 double getAutoMaxExposureTime() {
533 return readDoubleParameter(
"auto_maximum_exposure_time");
540 void setAutoMaxExposureTime(
double time) {
541 writeDoubleParameter(
"auto_maximum_exposure_time", time);
548 double getAutoMaxGain() {
549 return readDoubleParameter(
"auto_maximum_gain");
556 void setAutoMaxGain(
double gain) {
557 writeDoubleParameter(
"auto_maximum_gain", gain);
564 double getAutoMaxGainThirdCamera() {
565 return readDoubleParameter(
"auto_maximum_gain_color");
572 void setAutoMaxGainThirdCamera(
double gain) {
573 writeDoubleParameter(
"auto_maximum_gain_color", gain);
585 double getManualExposureTime() {
586 return readDoubleParameter(
"manual_exposure_time");
598 void setManualExposureTime(
double time) {
599 writeDoubleParameter(
"manual_exposure_time", time);
611 double getManualExposureTimeThirdCamera() {
612 return readDoubleParameter(
"manual_exposure_time_color");
624 void setManualExposureTimeThirdCamera(
double time) {
625 writeDoubleParameter(
"manual_exposure_time_color", time);
637 double getManualGain() {
638 return readDoubleParameter(
"manual_gain");
650 void setManualGain(
double gain) {
651 writeDoubleParameter(
"manual_gain", gain);
663 double getManualGainThirdCamera() {
664 return readDoubleParameter(
"manual_gain_color");
676 void setManualGainThirdCamera(
double gain) {
677 writeDoubleParameter(
"manual_gain_color", gain);
683 bool getAutoROIEnabled() {
684 return readBoolParameter(
"auto_exposure_roi_enabled");
690 void setAutoROIEnabled(
bool enabled) {
691 writeBoolParameter(
"auto_exposure_roi_enabled", enabled);
707 void getAutoROI(
int& x,
int& y,
int& width,
int& height) {
708 x = readIntParameter(
"auto_exposure_roi_x");
709 y = readIntParameter(
"auto_exposure_roi_y");
710 width = readIntParameter(
"auto_exposure_roi_width");
711 height = readIntParameter(
"auto_exposure_roi_height");
727 void setAutoROI(
int x,
int y,
int width,
int height) {
728 writeIntParameter(
"auto_exposure_roi_x", x);
729 writeIntParameter(
"auto_exposure_roi_y", y);
730 writeIntParameter(
"auto_exposure_roi_width", width);
731 writeIntParameter(
"auto_exposure_roi_height", height);
742 return readDoubleParameter(
"gamma");
750 void setGamma(
double gamma) {
751 writeDoubleParameter(
"gamma", gamma);
759 double getGammaThirdCamera() {
760 return readDoubleParameter(
"gamma_color");
768 void setGammaThirdCamera(
double gamma) {
769 writeDoubleParameter(
"gamma_color", gamma);
782 int getMaxFrameTimeDifference() {
783 return readIntParameter(
"max_frame_time_difference_ms");
792 void setMaxFrameTimeDifference(
int diffMs) {
793 writeIntParameter(
"max_frame_time_difference_ms", diffMs);
800 double getTriggerFrequency() {
801 return readDoubleParameter(
"trigger_frequency");
808 void setTriggerFrequency(
double freq) {
809 writeDoubleParameter(
"trigger_frequency", freq);
815 bool getTrigger0Enabled() {
816 return readBoolParameter(
"trigger_0_enabled");
822 void setTrigger0Enabled(
bool enabled) {
823 writeBoolParameter(
"trigger_0_enabled", enabled);
829 bool getTrigger0Constant() {
830 return readBoolParameter(
"trigger_0_constant");
836 void setTrigger0Constant(
bool on) {
837 writeBoolParameter(
"trigger_0_constant", on);
844 bool getTrigger0Polarity() {
845 return readBoolParameter(
"trigger_0_polarity");
852 void setTrigger0Polarity(
bool invert) {
853 writeBoolParameter(
"trigger_0_polarity", invert);
859 bool getTrigger1Enabled() {
860 return readBoolParameter(
"trigger_1_enabled");
866 void setTrigger1Enabled(
bool enabled) {
867 writeBoolParameter(
"trigger_1_enabled", enabled);
873 bool getTrigger1Constant() {
874 return readBoolParameter(
"trigger_1_constant");
880 void setTrigger1Constant(
bool on) {
881 writeBoolParameter(
"trigger_1_constant", on);
888 bool getTrigger1Polarity() {
889 return readBoolParameter(
"trigger_1_polarity");
896 void setTrigger1Polarity(
bool invert) {
897 writeBoolParameter(
"trigger_1_polarity", invert);
907 double getTrigger0PulseWidth(
int pulse=0) {
909 case 0:
return readDoubleParameter(
"trigger_0_pulse_width");
910 case 1:
return readDoubleParameter(
"trigger_0b_pulse_width");
911 case 2:
return readDoubleParameter(
"trigger_0c_pulse_width");
912 case 3:
return readDoubleParameter(
"trigger_0d_pulse_width");
913 case 4:
return readDoubleParameter(
"trigger_0e_pulse_width");
914 case 5:
return readDoubleParameter(
"trigger_0f_pulse_width");
915 case 6:
return readDoubleParameter(
"trigger_0g_pulse_width");
916 case 7:
return readDoubleParameter(
"trigger_0h_pulse_width");
928 void setTrigger0PulseWidth(
double width,
int pulse=0) {
930 case 0: writeDoubleParameter(
"trigger_0_pulse_width", width);
break;
931 case 1: writeDoubleParameter(
"trigger_0b_pulse_width", width);
break;
932 case 2: writeDoubleParameter(
"trigger_0c_pulse_width", width);
break;
933 case 3: writeDoubleParameter(
"trigger_0d_pulse_width", width);
break;
934 case 4: writeDoubleParameter(
"trigger_0e_pulse_width", width);
break;
935 case 5: writeDoubleParameter(
"trigger_0f_pulse_width", width);
break;
936 case 6: writeDoubleParameter(
"trigger_0g_pulse_width", width);
break;
937 case 7: writeDoubleParameter(
"trigger_0h_pulse_width", width);
break;
949 double getTrigger1PulseWidth(
int pulse=0) {
951 case 0:
return readDoubleParameter(
"trigger_1_pulse_width");
952 case 1:
return readDoubleParameter(
"trigger_1b_pulse_width");
953 case 2:
return readDoubleParameter(
"trigger_1c_pulse_width");
954 case 3:
return readDoubleParameter(
"trigger_1d_pulse_width");
955 case 4:
return readDoubleParameter(
"trigger_1e_pulse_width");
956 case 5:
return readDoubleParameter(
"trigger_1f_pulse_width");
957 case 6:
return readDoubleParameter(
"trigger_1g_pulse_width");
958 case 7:
return readDoubleParameter(
"trigger_1h_pulse_width");
970 void setTrigger1PulseWidth(
double width,
int pulse=0) {
972 case 0: writeDoubleParameter(
"trigger_1_pulse_width", width);
break;
973 case 1: writeDoubleParameter(
"trigger_1b_pulse_width", width);
break;
974 case 2: writeDoubleParameter(
"trigger_1c_pulse_width", width);
break;
975 case 3: writeDoubleParameter(
"trigger_1d_pulse_width", width);
break;
976 case 4: writeDoubleParameter(
"trigger_1e_pulse_width", width);
break;
977 case 5: writeDoubleParameter(
"trigger_1f_pulse_width", width);
break;
978 case 6: writeDoubleParameter(
"trigger_1g_pulse_width", width);
break;
979 case 7: writeDoubleParameter(
"trigger_1h_pulse_width", width);
break;
988 double getTrigger1Offset() {
989 return readDoubleParameter(
"trigger_1_offset");
996 void setTrigger1Offset(
double offset) {
997 writeDoubleParameter(
"trigger_1_offset", offset);
1003 enum TriggerInputMode {
1017 TriggerInputMode getTriggerInputMode() {
1018 return static_cast<TriggerInputMode
>(readIntParameter(
"trigger_input"));
1029 writeIntParameter(
"trigger_input",
static_cast<int>(mode));
1045 int getSkippedTriggerCount() {
1046 return readIntParameter(
"RT_skipped_trigger_count");
1054 bool getAutoRecalibrationEnabled() {
1055 return readBoolParameter(
"auto_recalibration_enabled");
1061 void setAutoRecalibrationEnabled(
bool enabled) {
1062 writeBoolParameter(
"auto_recalibration_enabled", enabled);
1068 bool getSaveAutoRecalibration() {
1069 return readBoolParameter(
"auto_recalibration_permanent");
1075 void setSaveAutoRecalibration(
bool save) {
1076 writeBoolParameter(
"auto_recalibration_permanent", save);
1083 bool getSubpixelOptimizationROIEnabled() {
1084 return readBoolParameter(
"subpixel_optimization_roi_enabled");
1091 void setSubpixelOptimizationROIEnabled(
bool enabled) {
1092 writeBoolParameter(
"subpixel_optimization_roi_enabled", enabled);
1108 void getSubpixelOptimizationROI(
int& x,
int& y,
int& width,
int& height) {
1109 x = readIntParameter(
"subpixel_optimization_roi_x");
1110 y = readIntParameter(
"subpixel_optimization_roi_y");
1111 width = readIntParameter(
"subpixel_optimization_roi_width");
1112 height = readIntParameter(
"subpixel_optimization_roi_height");
1128 void setSubpixelOptimizationROI(
int x,
int y,
int width,
int height) {
1129 writeIntParameter(
"subpixel_optimization_roi_x", x);
1130 writeIntParameter(
"subpixel_optimization_roi_y", y);
1131 writeIntParameter(
"subpixel_optimization_roi_width", width);
1132 writeIntParameter(
"subpixel_optimization_roi_height", height);
1139 writeBoolParameterUnguarded(
"reboot",
true);
1147 writeBoolParameterUnguarded(
"trigger_now",
true);
1159 DEPRECATED(
"Use getParameterSet() instead")
1160 std::map<std::
string, ParameterInfo> getAllParameters();
1169 template<typename T>
1170 DEPRECATED("Use setParameter() instead")
1171 void setNamedParameter(const std::
string& name, T value);
1176 template<typename T>
1177 void setParameter(const std::
string& name, T value);
1187 template<typename T>
1188 DEPRECATED("Use getParameter() instead")
1189 T getNamedParameter(const std::
string& name);
1210 void saveParameter(const
char* uid,
bool blockingCall=true);
1212 #if VISIONTRANSFER_CPLUSPLUS_VERSION >= 201103L
1217 bool hasParameter(
const std::string& name)
const;
1285 void setParameterUpdateCallback(std::function<
void(
const std::string& uid)> callback,
bool threaded=
true);
1296 void setConnectionStateChangeCallback(std::function<
void(visiontransfer::ConnectionState)> callback);
1341 void commitAndWait(
int maxWaitMilliseconds=1000);
1343 friend class TransactionLock;
1346 std::unique_ptr<TransactionLock> transactionLock();
1351 void saveParameter(
const std::string& uid,
bool blockingCall=
true);
1363 void saveParameters(
const std::vector<std::string>& uids,
bool blockingCall=
true);
1370 void saveParameters(
const std::set<std::string>& uids,
bool blockingCall=
true);
1377 void saveParameters(std::initializer_list<std::string> uids,
bool blockingCall=
true);
1387 int readIntParameter(
const char*
id);
1388 double readDoubleParameter(
const char*
id);
1389 bool readBoolParameter(
const char*
id);
1392 void writeIntParameter(
const char*
id,
int value);
1393 void writeDoubleParameter(
const char*
id,
double value);
1394 void writeBoolParameter(
const char*
id,
bool value);
1396 void writeBoolParameterUnguarded(
const char*
id,
bool value);
1400 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1402 DEPRECATED(
"Use DeviceParameters instead.")
1403 typedef DeviceParameters SceneScanParameters;