summaryrefslogtreecommitdiff
path: root/wrapper/wrapper_io.cpp
blob: 3f5673a7df67bf4536ff6fbb27bdd5bcaf430129 (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"

void wrapper_io::writeToDriver(const settings& args)
{
	try 
	{
		write(args);
	}
	catch (const cooldown_error&)
	{
		throw gcnew DriverWriteCDException();
	}
	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()));
	}
}