Make uvc sensor weak pointer - #12484
Merged
Nir-Az merged 3 commits intoDec 10, 2023
Merged
Conversation
Nir-Az
reviewed
Dec 6, 2023
| auto& depth_sensor = get_depth_sensor(); | ||
| auto& raw_depth_sensor = get_raw_depth_sensor(); | ||
|
|
||
| //_raw_depth_sensor2 = dynamic_cast<>.get_raw_sensor(); |
Nir-Az
reviewed
Dec 6, 2023
|
|
||
| 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()), |
Collaborator
There was a problem hiding this comment.
Coverity will yell here,
You know how to solve it.
Contributor
Author
There was a problem hiding this comment.
Null checking added.
Nir-Az
reviewed
Dec 6, 2023
|
|
||
| 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()), |
Contributor
Author
There was a problem hiding this comment.
Null checking added.
Nir-Az
reviewed
Dec 6, 2023
| { | ||
| _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()), |
Contributor
Author
There was a problem hiding this comment.
Null checking added.
Nir-Az
reviewed
Dec 6, 2023
| 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"); |
Collaborator
There was a problem hiding this comment.
Who will catch this exception?
BTW
EP does not exists
Contributor
Author
There was a problem hiding this comment.
During our previous conversation, we agreed to leave the use of the throw.
The string has been renamed.
Nir-Az
reviewed
Dec 6, 2023
| 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"); |
Collaborator
There was a problem hiding this comment.
Instead of throw, maybe we should return false and log_warning this issue
Contributor
Author
There was a problem hiding this comment.
During our previous conversation, we agreed to leave the use of the throw.
Nir-Az
reviewed
Dec 6, 2023
Nir-Az
reviewed
Dec 6, 2023
Checking dynamic casts Exception type changed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracked on [RSDSO-19355]