-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Make uvc sensor weak pointer #12484
Make uvc sensor weak pointer #12484
Conversation
src/ds/d400/d400-device.cpp
Outdated
@@ -584,6 +584,8 @@ namespace librealsense | |||
auto& depth_sensor = get_depth_sensor(); | |||
auto& raw_depth_sensor = get_raw_depth_sensor(); | |||
|
|||
//_raw_depth_sensor2 = dynamic_cast<>.get_raw_sensor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment deleted
src/ds/d400/d400-device.cpp
Outdated
@@ -681,7 +683,7 @@ namespace librealsense | |||
"Generate trigger from the camera to external device once per frame")); | |||
|
|||
depth_sensor.register_option(RS2_OPTION_ASIC_TEMPERATURE, | |||
std::make_shared<asic_and_projector_temperature_options>(raw_depth_sensor, | |||
std::make_shared<asic_and_projector_temperature_options>(std::dynamic_pointer_cast<uvc_sensor>(raw_depth_sensor.shared_from_this()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverity will yell here,
You know how to solve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null checking added.
src/ds/d400/d400-device.cpp
Outdated
@@ -1298,7 +1300,7 @@ namespace librealsense | |||
std::vector<float>{0.f, 2.f}, 1.f)); | |||
|
|||
depth_ep.register_option(RS2_OPTION_PROJECTOR_TEMPERATURE, | |||
std::make_shared<asic_and_projector_temperature_options>(depth_ep, | |||
std::make_shared<asic_and_projector_temperature_options>(std::dynamic_pointer_cast<uvc_sensor>(depth_ep.shared_from_this()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null checking added.
src/ds/ds-active-common.cpp
Outdated
@@ -73,7 +73,7 @@ namespace librealsense | |||
else | |||
{ | |||
_depth_ep.register_option(RS2_OPTION_PROJECTOR_TEMPERATURE, | |||
std::make_shared<asic_and_projector_temperature_options>(_raw_depth_ep, | |||
std::make_shared<asic_and_projector_temperature_options>(std::dynamic_pointer_cast<uvc_sensor>(_raw_depth_ep.shared_from_this()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null checking added.
src/ds/ds-options.cpp
Outdated
auto temperature_data = static_cast<temperature>(_ep.invoke_powered( | ||
auto strong_ep = _ep.lock(); | ||
if (!strong_ep) | ||
throw invalid_value_exception(rsutils::string::from() << "EP is not exists"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who will catch this exception?
BTW
EP does not exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During our previous conversation, we agreed to leave the use of the throw
.
The string has been renamed.
src/ds/ds-options.cpp
Outdated
return _ep.is_streaming(); | ||
auto strong_ep = _ep.lock(); | ||
if (!strong_ep) | ||
throw invalid_value_exception(rsutils::string::from() << "Can not retriev temperature as no valid EP"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of throw, maybe we should return false and log_warning this issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During our previous conversation, we agreed to leave the use of the throw
.
Checking dynamic casts Exception type changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tracked on [RSDSO-19355]