Added fibration feedback feature.
[situare] / src / engine / mceprivate.cpp
index 1cd3141..5befc6c 100644 (file)
@@ -50,6 +50,8 @@ MCEPrivate::MCEPrivate(QObject *parent)
     m_dBusInterface->callWithCallback(MCE_DISPLAY_STATUS_GET, QList<QVariant>(), this,
                                       SLOT(setDisplayState(QString)),
                                       SLOT(displayStateError(QDBusError)));
+
+    m_dBusInterface->call(MCE_ENABLE_VIBRATOR);
 }
 
 void MCEPrivate::displayStateChanged(const QDBusMessage &message)
@@ -89,3 +91,27 @@ void MCEPrivate::setDisplayState(const QString &state)
         }
     }
 }
+
+void MCEPrivate::stopVibration()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_dBusInterface->call(MCE_ACTIVATE_VIBRATOR_PATTERN, "PatternPowerKeyPress");
+}
+
+void MCEPrivate::vibrationFeedback()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_dBusInterface->call(MCE_ACTIVATE_VIBRATOR_PATTERN, "PatternPowerKeyPress");
+
+    const int VIBRATION_TIME = 40;  //Vibration time in milliseconds
+    QTimer::singleShot(VIBRATION_TIME, this, SLOT(stopVibration()));
+}
+
+MCEPrivate::~MCEPrivate()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_dBusInterface->call(MCE_DISABLE_VIBRATOR);
+}