From d85b5ad68fa4198fc15cc385c363f49a1edaf999 Mon Sep 17 00:00:00 2001 From: Marios Fanourakis Date: Thu, 3 Sep 2020 10:13:27 +0200 Subject: [PATCH] added command line argument for specifying participant id --- win_keyboard.cpp | 6 +++++- win_mouse.cpp | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/win_keyboard.cpp b/win_keyboard.cpp index 96a78bc..52c43ec 100644 --- a/win_keyboard.cpp +++ b/win_keyboard.cpp @@ -80,7 +80,11 @@ int main(int argc, char *argv[]) { "permission to grab the Windows keyboard events."); std::cout << "Keyboard successfully hooked" << std::endl; // create streaminfo and outlet - lsl::stream_info info("Keyboard", "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string); + std::string streamname = "Keyboard"; + if (argc > 1){ + streamname = streamname + "-" + argv[1]; + } + lsl::stream_info info(streamname, "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string); outlet = new lsl::stream_outlet(info); std::cout << "Outlet created. Close this window to stop streaming." << std::endl; } catch (std::exception &e) { std::cerr << "Error: " << e.what() << std::endl; } diff --git a/win_mouse.cpp b/win_mouse.cpp index 2fc1236..7ea8b9d 100755 --- a/win_mouse.cpp +++ b/win_mouse.cpp @@ -60,12 +60,18 @@ int main(int argc, char *argv[]) { "to grab the Windows mouse events."); std::cout << "Mouse successfully hooked" << std::endl; // create streaminfo and outlet for buttons + std::string streamnameButtons = "MouseButtons"; + std::string streamnamePosition = "MousePosition"; + if (argc > 1) { + streamnameButtons = streamnameButtons + "-" + argv[1]; + streamnamePosition = streamnamePosition + "-" + argv[1]; + } lsl::stream_info infoButtons( - "MouseButtons", "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string); + streamnameButtons, "Markers", 1, lsl::IRREGULAR_RATE, lsl::cf_string); outletButtons = new lsl::stream_outlet(infoButtons); // create streaminfo and outlet for the position lsl::stream_info infoPosition( - "MousePosition", "Position", 2, lsl::IRREGULAR_RATE, lsl::cf_int32); + streamnamePosition, "Position", 2, lsl::IRREGULAR_RATE, lsl::cf_int32); lsl::xml_element setup = infoPosition.desc().append_child("setup"); lsl::xml_element display = setup.append_child("display"); display.append_child_value("monitors", std::to_string(GetSystemMetrics(SM_CMONITORS)));