Skip to content

Conversation

@maloel
Copy link
Contributor

@maloel maloel commented Jan 23, 2023

SQL usage is by rs2::recording_context and rs2::mock_context, both only in use in the legacy live-tests but never actually run. These are removed, as well, and rs2_create_recording_context/_mock_context are deprecated.

Tracked on [LRS-625]

@maloel maloel requested a review from Nir-Az January 23, 2023 09:52
@Nir-Az Nir-Az requested a review from remibettan January 23, 2023 18:40

/**
* Create librealsense context that will try to record all operations over librealsense into a file
* \deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

Please explain what do you mean by deprecated? what will happen if someone calls this method? Will he get an exception? It would be great if this would be written besides the "deprecated" comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It means the function will be marked as deprecated, as the Doxygen documentation states.
If you check rs.cpp, you'll see that it now throws an exception with the text deprecated...

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

standard,
record,
playback
standard
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to let this enum, now that it has only one unique value?

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 started removing it, but kept it because of changed in the dds branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

you mean there is another value in this enum for the dds branch?

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 another value -- other constructors, one with no parameters and another one, with another parameter type.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

const char* section = nullptr,
rs2_recording_mode mode = RS2_RECORDING_MODE_COUNT,
std::string min_api_version = "0.0.0");
explicit context( backend_type type );
Copy link
Contributor

Choose a reason for hiding this comment

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

If you choose to keep this enum, maybe we should add as default value the unique value. Agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. On the 'dds` branch there's a default ctor, so this distinguishes it from another usage.

Copy link
Contributor

@remibettan remibettan Jan 24, 2023

Choose a reason for hiding this comment

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

So maybe there is an issue there, because it does not seem right that "standard" is not default, even if there are other possible values.
Let's talk about it tomorrow, please

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 want it to be explicit, just like it has been until now. You want this constructor, you specify standard.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

#include "sr300-fw-update-device.h"
#include "sr300.h"
#include "ivcam-private.h"
#include <librealsense2/h/rs_internal.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please confirm this is really needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, needed -- I removed an #include in context.h which included this one. Not that it's removed, I needed to add it elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

#include "firmware_logger_device.h"
#include "device-calibration.h"
#include "calibrated-sensor.h"
#include <librealsense2/h/rs_internal.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please confirm this is needed here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

verify_version_compatibility(api_version);

return new rs2_context{ std::make_shared<librealsense::context>(librealsense::backend_type::standard) };
return new rs2_context{ std::make_shared< librealsense::context >( librealsense::backend_type::standard ) };
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not like these spaces beside the "<>", but... your style :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's our style.
There is a .clang-format file that you should be using. See me tomorrow if you do not :)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok - feel free to send it to me

verify_version_compatibility(api_version);

return new rs2_context{ std::make_shared<librealsense::context>(librealsense::backend_type::record, filename, section, mode) };
throw not_implemented_exception( "deprecated" );
Copy link
Contributor

Choose a reason for hiding this comment

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

This answers one of my previous comments, but please add there the fact that exception is thrown when calling the deprecated api methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. A deprecated method should not be called. If someone does, he get an exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

inline bool make_context(const char* id, rs2::context* ctx, std::string min_api_version = "0.0.0")
{
rs2::log_to_file(RS2_LOG_SEVERITY_DEBUG);
min_api_version;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please confirm this line is needed, and explain why if it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To avoid "unused variable" warnings.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, but I do not agree - I prefer to get a warning than seeing this - don't you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Normally the usual way to do it is (that I have seen):
(void) min_api_version;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, but I still do not understand exactly why... there is also std::ignore. I'll fix it in the dds branch when I merge there?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

}

command_line_params::instance()._found_any_section = true;
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this method be kept if this is the only things it does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's also modified, but differently, on the dds branch. Live tests are old and we'll not invest much in improving them. For now this change you're suggesting may happen, but in a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, please open a ticket for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, Remi. We won't waste time on live-tests. I'll do it if I happen to be messing around in live-tests again. Leave it be... you're welcome to open a ticket if you insist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing I can offer is that right after we merge this I'll be merging with the dds branch, where there will be conflicts. I'll take a look then to see what can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

#include "core/streaming.h"
#include "device.h"
#include "context.h"
#include <librealsense2/h/rs_internal.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please confirm this line is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

@remibettan remibettan left a comment

Choose a reason for hiding this comment

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

Few comments added - thanks!

@maloel
Copy link
Contributor Author

maloel commented Jan 24, 2023

Few comments added - thanks!

Thank You :)

@remibettan remibettan self-requested a review January 25, 2023 08:01
Copy link
Contributor

@remibettan remibettan left a comment

Choose a reason for hiding this comment

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

LGTM

@maloel maloel removed the request for review from Nir-Az January 25, 2023 08:30
@maloel maloel merged commit c137903 into realsenseai:development Jan 25, 2023
@maloel maloel deleted the nosql branch January 25, 2023 08:31
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