feat: use name-based color preset API

This commit is contained in:
ob-yalian
2026-06-25 16:10:45 +08:00
parent c5c2cafbdd
commit b81dd8df6a
6 changed files with 65 additions and 42 deletions
+5 -15
View File
@@ -62,17 +62,6 @@ std::string alignTargetStreamToString(OBStreamType stream_type) {
}
}
std::string colorPresetToString(int value) {
switch (value) {
case 0:
return "Default";
case 1:
return "Warm Biased AWB";
default:
return "";
}
}
std::string disparityToDepthModeToString(bool hardware_enabled, bool software_enabled) {
if (hardware_enabled) {
return "HW";
@@ -1373,10 +1362,11 @@ void OBCameraNode::getDeviceConfigCallback(const std::shared_ptr<GetDeviceConfig
}
try {
const auto color_preset = device_->getIntProperty(OB_PROP_COLOR_PRESET_PRIORITY_INT);
const auto color_preset_name = colorPresetToString(color_preset);
if (!color_preset_name.empty()) {
response->color_preset = color_preset_name;
if (device_->isColorPresetSupported()) {
const char* color_preset_name = device_->getCurrentColorPresetName();
if (color_preset_name != nullptr && color_preset_name[0] != '\0') {
response->color_preset = color_preset_name;
}
}
} catch (const ob::Error& e) {
RCLCPP_DEBUG_STREAM(