-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Can update options automatically, get notification of value change #12483
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ff66099
Add options_updater class
OhadMeir 3f8a59d
Add option_value_update callback to the API, syntethic_sensor uses op…
OhadMeir efddef6
Handle PR#12483 comments. Rename to options_watcher, better use of su…
OhadMeir ad468ab
More PR#12483 comments. Callback registration at sensor_interface lev…
OhadMeir 8f5c4a9
Set options_watcher interval from settings
OhadMeir 01511e0
Fix includes
OhadMeir 5370268
Register all options to option-watcher
OhadMeir ec27297
Fix cppcheck issue
OhadMeir 7117f5d
Catch options-watcher query exceptions
OhadMeir 0f75400
Fix unit-tests compilation errors
OhadMeir ad5658e
Catch options-watcher initialization query exception
OhadMeir 2c650b1
options-watcher using one map. API callbacks function renamed
OhadMeir 5fa97e6
Fix cpp unit tests. options-watcher thread stops as soon as possible
OhadMeir 6730ac6
options-watcher queries option before starting thread
OhadMeir 3af987f
Powering on UVC before updating options. Using condition variable to …
OhadMeir a128169
Fix typo. Thread loop waits first because update happens right before…
OhadMeir cd0b14e
Adding destruction flag to stop queries as soon as possible
OhadMeir 08f25fb
options-watcher catching join exception in stop. viewer catches excep…
OhadMeir 9bbe102
Add on option changed to python wrapper. Add options-watcher unit test
OhadMeir 649bffe
Add test cases to the options-wathcer unit test
OhadMeir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // License: Apache 2.0. See LICENSE file in root directory. | ||
| // Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
|
||
|
|
||
| #include <src/syntethic-options-watcher.h> | ||
| #include <src/sensor.h> | ||
|
|
||
|
|
||
| namespace librealsense { | ||
|
|
||
|
|
||
| syntethic_options_watcher::syntethic_options_watcher( const std::shared_ptr< raw_sensor_base > & raw_sensor ) | ||
| : _raw_sensor( raw_sensor ) | ||
| { | ||
| } | ||
|
|
||
| std::map< rs2_option, std::shared_ptr< option > > syntethic_options_watcher::update_options() | ||
| { | ||
| std::map< rs2_option, std::shared_ptr< option > > updated_options; | ||
|
|
||
| std::shared_ptr< raw_sensor_base > strong = _raw_sensor.lock(); | ||
| if( ! strong ) | ||
| return updated_options; | ||
|
|
||
| strong->prepare_for_bulk_operation(); | ||
| updated_options = options_watcher::update_options(); | ||
| strong->finished_bulk_operation(); | ||
|
|
||
| return updated_options; | ||
| } | ||
|
|
||
| } // namespace librealsense |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // License: Apache 2.0. See LICENSE file in root directory. | ||
| // Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
| #pragma once | ||
|
|
||
|
|
||
| #include <src/core/options-watcher.h> | ||
|
|
||
|
|
||
| namespace librealsense { | ||
|
|
||
| class raw_sensor_base; | ||
|
|
||
| // Used by syntethic sensor and uses the raw_sensor bulk operations. | ||
| class syntethic_options_watcher : public options_watcher | ||
| { | ||
| public: | ||
| syntethic_options_watcher( const std::shared_ptr< raw_sensor_base > & raw_sensor ); | ||
|
|
||
| protected: | ||
| std::map< rs2_option, std::shared_ptr< option > > update_options() override; | ||
|
|
||
| std::weak_ptr< raw_sensor_base > _raw_sensor; | ||
| }; | ||
|
|
||
|
|
||
| } // namespace librealsense |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.