blob: 4b771742447b398a2df2dbbb01b3a6273aed4d44 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#pragma once
#include <rawaccel-io.hpp>
#include "wrapper_io.hpp"
auto with_managed_ex = [](auto fn) {
try
{
fn();
}
catch (const install_error&)
{
throw gcnew DriverNotInstalledException();
}
catch (const std::system_error& e)
{
throw gcnew DriverIOException(gcnew String(e.what()));
}
};
void wrapper_io::writeToDriver(const settings& args)
{
with_managed_ex([&] {
write(args);
});
}
void wrapper_io::readFromDriver(settings& args)
{
with_managed_ex([&] {
args = read();
});
}
void wrapper_io::getDriverVersion(version_t& ver)
{
with_managed_ex([&] {
ver = get_version();
});
}
|