--- a/cadMousePro-daemon/src/CLIConfiguration.h Mon Aug 19 17:38:48 2019 +0200
+++ b/cadMousePro-daemon/src/CLIConfiguration.h Mon Aug 19 17:55:50 2019 +0200
@@ -22,7 +22,8 @@
class CLIConfiguration {
public:
-
+ bool daemon = false;
+
CadMouseConfig cadMouseConfig;
virtual ~CLIConfiguration() {
--- a/cadMousePro-daemon/src/CLIParser.h Mon Aug 19 17:38:48 2019 +0200
+++ b/cadMousePro-daemon/src/CLIParser.h Mon Aug 19 17:55:50 2019 +0200
@@ -50,7 +50,7 @@
static const std::wstring OPTION_FREQUENCY;
static const std::wstring OPTION_SMART_SCROLLING;
static const std::wstring OPTION_LIFT_OFF_DETECTION;
- static const std::wstring OPTION_KEEP_FILE;
+ static const std::wstring OPTION_DAEMON;
CLIConfiguration parse(const std::vector<std::wstring>& arguments) {
CLIConfiguration c;
@@ -64,6 +64,8 @@
c.cadMouseConfig.setSmartScrolling(parseBoolean(readNext(arguments, i)));
} else if (option == OPTION_LIFT_OFF_DETECTION) {
c.cadMouseConfig.setLiftOffDetection(parseBoolean(readNext(arguments, i)));
+ } else if (option == OPTION_DAEMON) {
+ c.daemon = parseBoolean(readNext(arguments, i));
} else throw CLIException(L"Unsupported CLI option: " + option, CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
}
@@ -78,3 +80,4 @@
const std::wstring CLIParser::OPTION_FREQUENCY = L"--frequency";
const std::wstring CLIParser::OPTION_SMART_SCROLLING = L"--smart-scrolling";
const std::wstring CLIParser::OPTION_LIFT_OFF_DETECTION = L"--lift-off-detection";
+const std::wstring CLIParser::OPTION_DAEMON = L"--daemon";
--- a/cadMousePro-daemon/src/cadMousePro.cpp Mon Aug 19 17:38:48 2019 +0200
+++ b/cadMousePro-daemon/src/cadMousePro.cpp Mon Aug 19 17:55:50 2019 +0200
@@ -27,16 +27,22 @@
CLI cli(argc, argv);
std::wcout << L"cadMousePro" << std::endl;
- HIDDevice mouse(0x256f, 0xc652, nullptr);
- std::wcout << L"mouse opened" << std::endl;
- std::wcout << L"manufacturer: " << mouse.getManufacturerName() << std::endl;
- std::wcout << L"product: " << mouse.getProductName() << std::endl;
- // std::wcout << L"serial number: " << mouse.getSerialNumber() << std::endl; // throws exception
CLIParser cliParser;
CLIConfiguration configuration = cliParser.parse(cli.arguments());
- mouse.sendFeatureReport(configuration.cadMouseConfig.serialize());
+ if (configuration.daemon) {
+ // TODO: run D-Bus service
+ std::wcout << L"will start daemon" << std::endl;
+ } else {
+ HIDDevice mouse(0x256f, 0xc652, nullptr);
+ std::wcout << L"mouse opened" << std::endl;
+ std::wcout << L"manufacturer: " << mouse.getManufacturerName() << std::endl;
+ std::wcout << L"product: " << mouse.getProductName() << std::endl;
+ // std::wcout << L"serial number: " << mouse.getSerialNumber() << std::endl; // throws exception
+
+ mouse.sendFeatureReport(configuration.cadMouseConfig.serialize());
+ }
return CLI::EXIT_CODE_SUCCESS;
} catch (const HIDException& e) {