Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix non-DDS settings initialization in rs-terminal and -enumerate-devices #12567

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tools/enumerate-devices/rs-enumerate-devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,16 @@ int main(int argc, char** argv) try
}

// Obtain a list of devices currently present on the system
json settings;
json settings = json::object();
Copy link
Contributor

@OhadMeir OhadMeir Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update all occurrences of json j; to json j = json::object() or is it relevant only to the settings usage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant only to the settings

#ifdef BUILD_WITH_DDS
json dds;
if( domain_arg.isSet() )
dds["domain"] = domain_arg.getValue();
if( only_sw_arg.isSet() )
if( domain_arg.isSet() || only_sw_arg.isSet() )
{
json dds = json::object();
if( domain_arg.isSet() )
dds["domain"] = domain_arg.getValue();
dds["enabled"]; // null: remove global dds:false or dds/enabled:false, if any
settings["dds"] = std::move( dds );
settings["dds"] = std::move( dds );
}
#endif
settings["format-conversion"] = format_arg.getValue();
context ctx( settings.dump() );
Expand Down
15 changes: 9 additions & 6 deletions tools/terminal/rs-terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using namespace std;
using namespace TCLAP;
using rsutils::json;


vector<uint8_t> build_raw_command_data(const command& command, const vector<string>& params)
Expand Down Expand Up @@ -197,14 +198,16 @@ int main(int argc, char** argv)
// parse command.xml
rs2::log_to_file(RS2_LOG_SEVERITY_WARN, "librealsense.log");

rsutils::json settings;
json settings = json::object();
#ifdef BUILD_WITH_DDS
rsutils::json dds;
if( domain_arg.isSet() )
dds["domain"] = domain_arg.getValue();
if( only_sw_arg.isSet() )
if( domain_arg.isSet() || only_sw_arg.isSet() )
{
json dds = json::object();
if( domain_arg.isSet() )
dds["domain"] = domain_arg.getValue();
dds["enabled"]; // null: remove global dds:false or dds/enabled:false, if any
settings["dds"] = std::move( dds );
settings["dds"] = std::move( dds );
}
#endif
if( only_sw_arg.getValue() )
settings["device-mask"] = RS2_PRODUCT_LINE_SW_ONLY | RS2_PRODUCT_LINE_ANY;
Expand Down
Loading