summaryrefslogtreecommitdiffstats
path: root/xbmc/input/joysticks/generic/DriverReceiving.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/input/joysticks/generic/DriverReceiving.cpp')
-rw-r--r--xbmc/input/joysticks/generic/DriverReceiving.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/xbmc/input/joysticks/generic/DriverReceiving.cpp b/xbmc/input/joysticks/generic/DriverReceiving.cpp
new file mode 100644
index 0000000..bf52f4f
--- /dev/null
+++ b/xbmc/input/joysticks/generic/DriverReceiving.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "DriverReceiving.h"
+
+#include "input/joysticks/DriverPrimitive.h"
+#include "input/joysticks/interfaces/IButtonMap.h"
+#include "input/joysticks/interfaces/IDriverReceiver.h"
+
+using namespace KODI;
+using namespace JOYSTICK;
+
+CDriverReceiving::CDriverReceiving(IDriverReceiver* receiver, IButtonMap* buttonMap)
+ : m_receiver(receiver), m_buttonMap(buttonMap)
+{
+}
+
+bool CDriverReceiving::SetRumbleState(const FeatureName& feature, float magnitude)
+{
+ bool bHandled = false;
+
+ if (m_receiver != nullptr && m_buttonMap != nullptr)
+ {
+ CDriverPrimitive primitive;
+ if (m_buttonMap->GetScalar(feature, primitive))
+ {
+ if (primitive.Type() == PRIMITIVE_TYPE::MOTOR)
+ bHandled = m_receiver->SetMotorState(primitive.Index(), magnitude);
+ }
+ }
+
+ return bHandled;
+}