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

add dds config tool #13628

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

Noy-Zini
Copy link

Tracked on : [RSDEV-2884]

@Noy-Zini Noy-Zini force-pushed the add-dds-config-tool-to-viewer branch 2 times, most recently from 4c15cb3 to 6234882 Compare December 25, 2024 12:13
@Noy-Zini Noy-Zini force-pushed the add-dds-config-tool-to-viewer branch from 6234882 to 7e2db73 Compare December 25, 2024 13:24
@Noy-Zini Noy-Zini requested a review from Nir-Az December 25, 2024 14:55
@@ -0,0 +1,332 @@
#include "dds-model.h"
// License: Apache 2.0. See LICENSE file in root directory.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Misplaced, should be on top

@@ -9,6 +9,7 @@ file( GLOB_RECURSE RS_DDS_CONFIG_SOURCE_FILES
LIST_DIRECTORIES false
RELATIVE ${PROJECT_SOURCE_DIR}
"${CMAKE_CURRENT_LIST_DIR}/*"
"${PROJECT_SOURCE_DIR}/../../../third-party/rsutils/include/rsutils/type/*"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This path seems weird..
relative to the source dir we only need third-party/rsutils/include/rsutils/type/* no?

Copy link
Author

Choose a reason for hiding this comment

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

The source dir for the dds tool is librealsense\tools\dds\dds-config so only using part of the path won't work but I can set the THIRD_PARTY_DIR so it looks more readable:
set(THIRD_PARTY_DIR "${PROJECT_SOURCE_DIR}/../../../third-party")
"${THIRD_PARTY_DIR}/rsutils/include/rsutils/type/*"

@@ -1457,6 +1472,7 @@ namespace rs2
}

_calib_model.update(window, error_message);
_dds_model.render_dds_config_window(window , error_message);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this work id we build with DDS off?

Copy link
Author

Choose a reason for hiding this comment

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

I'll add a check to see if the device supports DDS before using this function.
But in general, yes the functionality works with DDS off because the function already checks whether the window should be open. If the device doesn't support DDS, the window is closed by default.

@@ -1435,6 +1436,20 @@ namespace rs2
}
}
}
ImGuiSelectableFlags is_streaming_flag = (is_streaming) ? ImGuiSelectableFlags_Disabled : 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the difference between 0 and ImGuiSelectableFlags_Disabled?

Copy link
Author

Choose a reason for hiding this comment

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

0 is equal to ImGuiSelectableFlags_None that will show the "DDS Configuration" option an enabled
and using the ImGuiSelectableFlags_Disabled will show this option as disabled (faded and not allowing clicks on it)

Copy link
Collaborator

Choose a reason for hiding this comment

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

So why not replace 0 with ImGuiSelectableFlags_None?

#include <set>
#include <rsutils/type/ip-address.h>
#include <rsutils/string/hexdump.h>
#include "../third-party/rsutils/include/rsutils/type/eth-config.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also use <>?
<party/rsutils/include/rsutils/type/eth-config.h>?

eth_config _current_config;
eth_config _changed_config;

bool _window_open;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not initialized but other is?

Copy link
Author

Choose a reason for hiding this comment

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

initialized _window_open to false as well

Copy link
Author

Choose a reason for hiding this comment

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

initialized in the constructor initialization list

if (ImGui::InputText(label_name.c_str(), buffer, sizeof(buffer))) {
std::string new_ip_str(buffer);
if (rsutils::type::ip_address(new_ip_str).is_valid()) {
ip = rsutils::type::ip_address(new_ip_str);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why calling it twice?
Maybe call it once and use it on both cases?

if (rsutils::type::ip_address(new_ip_str).is_valid()) {
ip = rsutils::type::ip_address(new_ip_str);
}
else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

new line please for the {

ImGui::Text("DHCP Timeout (seconds)");
ImGui::SameLine();
int tempTimeout = static_cast<int>(_changed_config.dhcp.timeout);
if (ImGui::InputInt("##DHCP Timeout (seconds)", &tempTimeout)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please place { on a new line for all uses here.
I will send you a mail about using clang format

@Nir-Az
Copy link
Collaborator

Nir-Az commented Dec 29, 2024

@Noy-Zini can you please build a version for us to play with and check?

@Noy-Zini Noy-Zini force-pushed the add-dds-config-tool-to-viewer branch from 4bead95 to 16d7803 Compare December 31, 2024 12:03
@Noy-Zini Noy-Zini requested a review from Nir-Az December 31, 2024 12:54

bool rs2::dds_model::supports_DDS()
{
return _dds_suported;
Copy link
Collaborator

Choose a reason for hiding this comment

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

supported

@Noy-Zini Noy-Zini force-pushed the add-dds-config-tool-to-viewer branch from 16d7803 to 6cb2c25 Compare December 31, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants