src/cadMousePro.cpp
author František Kučera <franta-hg@frantovo.cz>
Sun, 18 Aug 2019 23:30:01 +0200
branchv_0
changeset 5 6799cec5c2f8
parent 4 405aa9de65d2
child 6 975f38eb1e12
permissions -rw-r--r--
refactoring: separate into several files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
#include <iostream>
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
5
6799cec5c2f8 refactoring: separate into several files
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
     3
#include "CadMouseConfig.h"
6799cec5c2f8 refactoring: separate into several files
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
     4
#include "HID.h"
4
405aa9de65d2 CadMouseConfig class, frequency, lift-off detection, smart scrolling
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
     5
0
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
int main(int argc, char** argv) {
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
	try {
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
		std::wcout << L"cadMousePro" << std::endl;
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
		HIDDevice mouse(0x256f, 0xc652, nullptr);
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
		std::wcout << L"mouse opened" << std::endl;
1
29cbe171cd43 first working version: disables „free wheel“ a.k.a. „smart scrolling“ feature
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    12
		std::wcout << L"manufacturer:  " << mouse.getManufacturerName() << std::endl;
29cbe171cd43 first working version: disables „free wheel“ a.k.a. „smart scrolling“ feature
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    13
		std::wcout << L"product:       " << mouse.getProductName() << std::endl;
29cbe171cd43 first working version: disables „free wheel“ a.k.a. „smart scrolling“ feature
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    14
		// std::wcout << L"serial number: " << mouse.getSerialNumber() << std::endl; // throws exception
29cbe171cd43 first working version: disables „free wheel“ a.k.a. „smart scrolling“ feature
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    15
4
405aa9de65d2 CadMouseConfig class, frequency, lift-off detection, smart scrolling
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    16
		CadMouseConfig config;
1
29cbe171cd43 first working version: disables „free wheel“ a.k.a. „smart scrolling“ feature
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    17
4
405aa9de65d2 CadMouseConfig class, frequency, lift-off detection, smart scrolling
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    18
		mouse.sendFeatureReport(config.serialize());
1
29cbe171cd43 first working version: disables „free wheel“ a.k.a. „smart scrolling“ feature
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    19
4
405aa9de65d2 CadMouseConfig class, frequency, lift-off detection, smart scrolling
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    20
		return 0;
0
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
	} catch (const HIDException& e) {
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
		std::wcout << L"HIDException: " << e.getMessage() << std::endl;
4
405aa9de65d2 CadMouseConfig class, frequency, lift-off detection, smart scrolling
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    23
		return 1;
0
6ff501639c23 project skeleton, open USB HID device
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
	}
4
405aa9de65d2 CadMouseConfig class, frequency, lift-off detection, smart scrolling
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    25
}