/**
* cadMousePro
* Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include "CadMouseConfig.h"
#include "CLI.h"
#include "CLIParser.h"
#include "HID.h"
int main(int argc, char** argv) {
try {
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());
return CLI::EXIT_CODE_SUCCESS;
} catch (const HIDException& e) {
std::wcout << L"HIDException: " << e.getMessage() << std::endl;
return CLI::EXIT_CODE_UNEXPECTED_ERROR;
} catch (const CLIException& e) {
std::wcout << L"CLIException: " << e.getMessge() << std::endl;
return e.getExitCode();
}
}