diff options
| author | JacobPalecki <[email protected]> | 2020-08-31 23:03:46 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-08-31 23:03:46 -0700 |
| commit | 471fe599bab6ba0632ddd1dacd20c7fc42db0eee (patch) | |
| tree | 90a82ee14dbb112621657efbd2523ed35f59d154 /wrapper/wrapper_io.cpp | |
| parent | Merge pull request #16 from JacobPalecki/Misc (diff) | |
| parent | add independent xy accel to driver (diff) | |
| download | rawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.tar.xz rawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.zip | |
Merge pull request #17 from a1xd/indep
Indep
Diffstat (limited to 'wrapper/wrapper_io.cpp')
| -rw-r--r-- | wrapper/wrapper_io.cpp | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/wrapper/wrapper_io.cpp b/wrapper/wrapper_io.cpp index 4284d60..3f5673a 100644 --- a/wrapper/wrapper_io.cpp +++ b/wrapper/wrapper_io.cpp @@ -3,16 +3,38 @@ #include <rawaccel-io.hpp> #include "wrapper_io.hpp" -void wrapper_io::writeToDriver(rawaccel::mouse_modifier* modifier) +void wrapper_io::writeToDriver(const settings& args) { - rawaccel::write(*modifier); + 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())); + } } -rawaccel::mouse_modifier* wrapper_io::readFromDriver() +void wrapper_io::readFromDriver(settings& args) { - rawaccel::mouse_modifier modifier = rawaccel::read(); - rawaccel::mouse_modifier* mod_pnt = (rawaccel::mouse_modifier*)malloc(sizeof(rawaccel::mouse_modifier)); - memcpy(mod_pnt, &modifier, sizeof(rawaccel::mouse_modifier)); - - return mod_pnt; + try + { + args = read(); + } + catch (const install_error&) + { + throw gcnew DriverNotInstalledException(); + } + catch (const std::system_error& e) + { + throw gcnew DriverIOException(gcnew String(e.what())); + } } |