summaryrefslogtreecommitdiff
path: root/wrapper/wrapper_io.cpp
blob: 0f257bfad0eeb02dff94cfff7234c32531312fcb (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
#pragma once

#include <rawaccel-io.hpp>
#include "wrapper_io.hpp"

void wrapper_io::writeToDriver(const settings& args)
{
	try 
	{
		write(args);
	}
	catch (const install_error&)
	{
		throw gcnew DriverNotInstalledException();
	}
	catch (const std::system_error& e)
	{
		throw gcnew DriverIOException(gcnew String(e.what()));
	}
}

void wrapper_io::readFromDriver(settings& args)
{
	try
	{
		args = read();
	}
	catch (const install_error&)
	{
		throw gcnew DriverNotInstalledException();
	}
	catch (const std::system_error& e)
	{
		throw gcnew DriverIOException(gcnew String(e.what()));
	}
}