Skip to content

Commit

Permalink
More code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dorodnic committed Jan 23, 2020
1 parent 2264818 commit 7ab4121
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions common/metadata-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace rs2
}

static void foreach_device_path(const std::vector<device_id>& devices,
std::function<void(device_id&, /* matched device */
std::function<void(const device_id&, /* matched device */
std::wstring /* registry key of Device Parameters for that device */)> action)
{
std::map<std::string, std::vector<device_id>> guid_to_devices;
Expand Down Expand Up @@ -243,7 +243,7 @@ namespace rs2

device_id did;
if (parse_device_id(id, &did))
foreach_device_path({ did }, [&res, did](device_id&, std::wstring path) {
foreach_device_path({ did }, [&res, did](const device_id&, std::wstring path) {

HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path.c_str(), 0, KEY_READ | KEY_WOW64_64KEY, &key) == ERROR_SUCCESS)
Expand Down Expand Up @@ -307,7 +307,7 @@ namespace rs2
}

bool failure = false;
foreach_device_path(dids, [&failure](device_id& did, std::wstring path) {
foreach_device_path(dids, [&failure](const device_id& did, std::wstring path) {
HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path.c_str(), 0, KEY_WRITE | KEY_WOW64_64KEY, &key) == ERROR_SUCCESS)
{
Expand Down
2 changes: 2 additions & 0 deletions common/metadata-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ namespace rs2

// Check if metadata is enabled using Physical Port ID
// (can be retrieved with device::get_info(RS2_CAMERA_INFO_PHYSICAL_PORT))
// throws runtime_error in case of errors
virtual bool is_enabled(std::string id) const { return true; }

// Enable metadata for all connected devices
// throws runtime_error in case of errors
virtual void enable_metadata() { }

static bool can_support_metadata(const std::string& product)
Expand Down
2 changes: 1 addition & 1 deletion common/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ namespace rs2

if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", "You will be prompted to enabled metadata on the device");
ImGui::SetTooltip("%s", "Enables metadata on connected devices (you may be prompted for administrator privileges)");
}
}
}
1 change: 0 additions & 1 deletion common/windows-app-bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ int CALLBACK WinMain(
{
try
{
DebugBreak();
rs2::metadata_helper::instance().enable_metadata();
exit(0);
}
Expand Down

0 comments on commit 7ab4121

Please sign in to comment.