[-]
[+]
|
Changed |
_service:tar_git:gestured.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/kimmoli/gesture-daemon.git</param>
<param name="branch">master</param>
- <param name="revision"/>
+ <param name="revision">0d50e345f106dc8c2f1d0c4303551dc702d5058c</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:gestured-0.0.2.tar.bz2/src/gesture-actions.cpp
^
|
@@ -7,6 +7,8 @@
#include <stdio.h>
#include "gesture-actions.h"
+#include "mce/dbus-names.h"
+#include "mce/mode-names.h"
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
@@ -25,4 +27,96 @@
QList<QVariant> args = msg.arguments();
printf("MCE signal gesture_event_ind says: %s\n", qPrintable(args.at(0).toString()));
+
+ QString gestureEvent = args.at(0).toString();
+
+ if (gestureEvent.compare(MCE_GESTURE_EVENT_FLASHLIGHT) == 0)
+ {
+ if (!toggleFlashlight())
+ printf("Flashlight toggle failed.");
+ }
+ else if (gestureEvent.compare(MCE_GESTURE_EVENT_CAMERA) == 0)
+ {
+ showCameraViewfinder();
+ }
+ else if (gestureEvent.compare(MCE_GESTURE_EVENT_VOICECALL) == 0)
+ {
+ showVoicecallUi();
+ }
+ else if (gestureEvent.compare(MCE_GESTURE_EVENT_MUSIC_PLAY_PAUSE) == 0)
+ {
+ sendMpris2("PlayPause");
+ }
+ else if (gestureEvent.compare(MCE_GESTURE_EVENT_MUSIC_NEXT_TRACK) == 0)
+ {
+ sendMpris2("Next");
+ }
+ else if (gestureEvent.compare(MCE_GESTURE_EVENT_MUSIC_PREV_TRACK) == 0)
+ {
+ sendMpris2("Previous");
+ }
+}
+
+bool Gestures::toggleFlashlight()
+{
+ int fd;
+ char buf[5];
+ bool ret = false;
+ int brightness = 0;
+
+ fd = open("/sys/class/leds/led:flash_torch/brightness", O_RDONLY);
+ if (fd < 0)
+ goto EXIT;
+
+ if (!(read(fd, buf, sizeof(buf)) > 0))
+ {
+ close(fd);
+ goto EXIT;
+ }
+
+ close(fd);
+
+ brightness = atoi(buf);
+
+ if (brightness == 0)
+ brightness = 255;
+ else
+ brightness = 0;
+
+ fd = open("/sys/class/leds/led:flash_torch/brightness", O_WRONLY);
+ if (fd < 0)
+ goto EXIT;
+
+ sprintf(buf, "%d", brightness);
+ if (!(write(fd, buf, strlen(buf)) > 0))
+ {
+ close(fd);
+ goto EXIT;
+ }
+
+ close(fd);
+
+ ret = true;
+EXIT:
+ return ret;
+}
+
+void Gestures::sendMpris2(const QString &methodName)
+{
+ Q_UNUSED(methodName)
+}
+
+void Gestures::showCameraViewfinder()
+{
+
+}
+
+void Gestures::showVoicecallUi()
+{
+
+}
+
+QString Gestures::getMpris2Interface()
+{
+ return QString("org.mpris.MediaPlayer2.jolla-mediaplayer");
}
|
[-]
[+]
|
Changed |
_service:tar_git:gestured-0.0.2.tar.bz2/src/gesture-actions.h
^
|
@@ -24,6 +24,13 @@
public slots:
void handleGestureEvent(const QDBusMessage&);
+private:
+ bool toggleFlashlight();
+ void sendMpris2(const QString &methodName);
+ void showCameraViewfinder();
+ void showVoicecallUi();
+ QString getMpris2Interface();
+
};
#endif // GESTURE_ACTIONS_H
|