summaryrefslogtreecommitdiffhomepage
path: root/proto-iokit-foohid/iokitprotocol.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-12-03 22:23:08 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-12-04 12:19:26 +0100
commitb256886a5cb9f2ae3ebda70a2045b19ed9f4233e (patch)
tree4fa1e46de224cf834a05824dc1eb86001bdb3300 /proto-iokit-foohid/iokitprotocol.cpp
parente89709a801e7874bc02c66848c638c6a0ccc85c1 (diff)
api: add status check for modules
Diffstat (limited to 'proto-iokit-foohid/iokitprotocol.cpp')
-rw-r--r--proto-iokit-foohid/iokitprotocol.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/proto-iokit-foohid/iokitprotocol.cpp b/proto-iokit-foohid/iokitprotocol.cpp
index 4af6ad5b..693ce31e 100644
--- a/proto-iokit-foohid/iokitprotocol.cpp
+++ b/proto-iokit-foohid/iokitprotocol.cpp
@@ -20,9 +20,22 @@ IOKitProtocol::IOKitProtocol()
qWarning("%s\n", qPrintable(joystick->errorMessage()));
}
-bool IOKitProtocol::correct()
+module_status IOKitProtocol::check_status()
{
- return joystick && !joystick->hasError();
+ if (!joystick)
+ return QCoreApplication::translate("foohid", "Load failure");
+
+ if (joystick->hasError())
+ {
+ QString msg = joystick->errorMessage();
+
+ if (msg.isEmpty())
+ msg = QCoreApplication::translate("foohid", "Unknown error");
+
+ return error(msg);
+ }
+
+ return status_ok();
}
static uint8_t valueToStick(FooHIDJoystick *stick, double min, double value, double max)