Skip to content

Conversation

@OhadMeir
Copy link
Contributor

@OhadMeir OhadMeir commented Dec 5, 2023

Added option_updater class that handles auto query of registered options.
Added C and CPP API to register a value change notification callback .

Added Python API and unit test

Also fixed bug in cpp unit tests - on restart_first_device_and_return_depth_sensor old device was used after HW reset instead of new device.

@OhadMeir OhadMeir requested review from Nir-Az and maloel December 5, 2023 12:22

options_watcher::~options_watcher()
{
_alive = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need to clear _options inside a mutex any more; don't need the try-catch, either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not locking before clear. try-catch needed because clear and join might throw.

Copy link
Contributor

Choose a reason for hiding this comment

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

But you don't need the clear()...

Copy link
Contributor

@maloel maloel Dec 26, 2023

Choose a reason for hiding this comment

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

And if join() might throw, please catch it inside stop()...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer to clear explicitly, but locking is not needed.
Also found out clear has a noexcept overload. Catching join errors in stop.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry, I don't agree - if you clear, then a lock is necessary.
You don't need to clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

rsutils::subscription register_options_changed_callback( options_watcher::callback && cb ) override
{
throw not_implemented_exception( "Registering options value changed callback is not implemented for this sensor" );
LOG_ERROR( "Registering options value changed callback is not implemented for this sensor" );
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? I don't think this is good...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we throw then the viewer cannot play recorded files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted change. Viewer handling the exception

@maloel maloel merged commit ee5b8cb into IntelRealSense:development Jan 2, 2024
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.

3 participants