Skip to content
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

add API function unload_tracking_module. #3339

Merged
merged 2 commits into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/librealsense2/h/rs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ rs2_device* rs2_context_add_device(rs2_context* ctx, const char* file, rs2_error
*/
void rs2_context_remove_device(rs2_context* ctx, const char* file, rs2_error** error);

/**
* Removes tracking module.
* function query_devices() locks the tracking module in the tm_context object.
* If the tracking module device is not used it should be removed using this function, so that other applications could find it.
* This function can be used both before the call to query_device() to prevent enabling tracking modules or afterwards to
* release them.
*/
void rs2_context_unload_tracking_module(rs2_context* ctx, rs2_error** error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to add function name to realsense.def file


/**
* create a static snapshot of all connected devices at the time of the call
* \param context Object representing librealsense session
Expand Down
7 changes: 7 additions & 0 deletions include/librealsense2/hpp/rs_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ namespace rs2
rs2::error::handle(e);
}

void unload_tracking_module()
{
rs2_error* e = nullptr;
rs2_context_unload_tracking_module(_context.get(), &e);
rs2::error::handle(e);
}

context(std::shared_ptr<rs2_context> ctx)
: _context(ctx)
{}
Expand Down
4 changes: 4 additions & 0 deletions src/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ namespace librealsense

std::shared_ptr<device_interface> add_device(const std::string& file);
void remove_device(const std::string& file);
#if WITH_TRACKING
void unload_tracking_module() {_tm2_context.reset();};
#endif


private:
void on_device_changed(platform::backend_device_group old,
Expand Down
1 change: 1 addition & 0 deletions src/realsense.def
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ EXPORTS

rs2_context_add_device
rs2_context_remove_device
rs2_context_unload_tracking_module

rs2_playback_device_get_file_path
rs2_playback_get_duration
Expand Down
9 changes: 9 additions & 0 deletions src/rs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,15 @@ void rs2_context_remove_device(rs2_context* ctx, const char* file, rs2_error** e
}
HANDLE_EXCEPTIONS_AND_RETURN(, ctx, file)

void rs2_context_unload_tracking_module(rs2_context* ctx, rs2_error** error) BEGIN_API_CALL
{
#if WITH_TRACKING
VALIDATE_NOT_NULL(ctx);
ctx->ctx->unload_tracking_module();
#endif
}
HANDLE_EXCEPTIONS_AND_RETURN(, ctx)

const char* rs2_playback_device_get_file_path(const rs2_device* device, rs2_error** error) BEGIN_API_CALL
{
VALIDATE_NOT_NULL(device);
Expand Down