[-]
[+]
|
Changed |
_service:tar_git:qt5-feedback-haptics-droid-vibrator.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-feedback-haptics-droid-vibrator.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-feedback-haptics-droid-vibrator-0.0.5.tar.bz2/droid-vibrator.ini
^
|
(renamed from droid-vibrator-device.ini.example)
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-feedback-haptics-droid-vibrator-0.0.5.tar.bz2/droid-vibrator.pro
^
|
@@ -6,19 +6,17 @@
TARGET = $$qtLibraryTarget(qtfeedback_droid-vibrator)
PLUGIN_TYPE = feedback
-HEADERS += qfeedback.h vibratorimplementation.h
+HEADERS += qfeedback.h
SOURCES += qfeedback.cpp
OTHER_FILES += droid-vibrator.json
-DEFINES += 'DROID_VIBRATOR_SETTINGS=\'\"$$[QT_INSTALL_PLUGINS]/feedback/droid-vibrator-device.ini\"\''
-
-native_vibrator {
- SOURCES += vibratorimplementation_native.cpp
-} else {
- CONFIG += link_pkgconfig
- PKGCONFIG += android-headers libhardware libvibrator
- SOURCES += vibratorimplementation_hal.cpp
-}
+CONFIG += link_pkgconfig
+PKGCONFIG += android-headers libhardware libvibrator
+DEFINES += 'DROID_VIBRATOR_SETTINGS=\'\"$$[QT_INSTALL_PLUGINS]/feedback/droid-vibrator.ini\"\''
+
+settings.files = droid-vibrator.ini
+settings.path = $$[QT_INSTALL_PLUGINS]/feedback
+INSTALLS += settings
target.path = $$[QT_INSTALL_PLUGINS]/feedback
INSTALLS += target
@@ -30,4 +28,4 @@
# also enable profile detection. libprofile-qt5 is a bit broken, work around it here.
QT += dbus
QMAKE_CXXFLAGS += -I/usr/include/profile-qt5
-LIBS += -lprofile-qt5
+QMAKE_LFLAGS += -lprofile-qt5
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-feedback-haptics-droid-vibrator-0.0.5.tar.bz2/qfeedback.cpp
^
|
@@ -49,6 +49,8 @@
#include <QtCore/QSettings>
#include <QtCore/QLoggingCategory>
+#include <hardware_legacy/vibrator.h>
+
Q_LOGGING_CATEGORY(qtFeedbackDroidVibrator, "qt.Feedback.DroidVibrator")
QFeedbackDroidVibrator::QFeedbackDroidVibrator(QObject *parent)
@@ -62,14 +64,9 @@
, m_actuator(createFeedbackActuator(this, 2))
, m_activeEffect(Q_NULLPTR)
, m_actuatorEnabled(true)
- , m_vibrator()
{
qCDebug(qtFeedbackDroidVibrator) << "Initializing plugin";
- if (!m_vibrator.init()) {
- qCCritical(qtFeedbackDroidVibrator) << "Unable to open vibrator device";
- }
-
// Defaults
m_durations[QFeedbackEffect::Press] = 20;
m_durations[QFeedbackEffect::Release] = 18;
@@ -173,7 +170,7 @@
case QFeedbackEffect::Disappear:
case QFeedbackEffect::Move:
qCDebug(qtFeedbackDroidVibrator) << "Playing effect #" << effect << "(" << m_durations[effect] << "ms)";
- m_vibrator.on(m_durations[effect]);
+ vibrator_on(m_durations[effect]);
return true;
default:
qCDebug(qtFeedbackDroidVibrator) << "Unknown or undefined effect #" << effect;
@@ -273,7 +270,7 @@
m_activeEffect = const_cast<QFeedbackHapticsEffect*>(effect);
m_stateChangeTimerId = QObject::startTimer(m_activeEffect->duration());
qCDebug(qtFeedbackDroidVibrator) << "Playing custom effect due to state change (" << m_activeEffect->duration() << "ms)";
- m_vibrator.on(m_activeEffect->duration());
+ vibrator_on(m_activeEffect->duration());
}
}
@@ -281,7 +278,7 @@
{
if (m_activeEffect == effect) {
qCDebug(qtFeedbackDroidVibrator) << "Stopping custom effect due to state change";
- m_vibrator.off();
+ vibrator_off();
killTimer(m_stateChangeTimerId);
m_activeEffect = 0;
m_stateChangeTimerId = 0;
|
[-]
[+]
|
Changed |
_service:tar_git:qt5-feedback-haptics-droid-vibrator-0.0.5.tar.bz2/qfeedback.h
^
|
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014,2018 Jolla Ltd.
+** Copyright (C) 2014 Jolla Ltd.
** Contact: Thomas Perl <thomas.perl@jolla.com>
**
** This file is part of the QtFeedback Droid Vibrator Plugin.
@@ -49,8 +49,6 @@
#include <profile.h>
-#include "vibratorimplementation.h"
-
Q_DECLARE_LOGGING_CATEGORY(qtFeedbackDroidVibrator)
QT_BEGIN_HEADER
@@ -97,7 +95,6 @@
QFeedbackHapticsEffect *m_activeEffect;
bool m_actuatorEnabled;
int m_stateChangeTimerId;
- VibratorImplementation m_vibrator;
};
QT_END_HEADER
|
[-]
[+]
|
Deleted |
_service:tar_git:qt5-feedback-haptics-droid-vibrator-0.1.1.tar.bz2/vibratorimplementation.h
^
|
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Jolla Ltd.
-** Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
-**
-** This file is part of the QtFeedback Droid Vibrator Plugin.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef VIBRATOR_IMPLEMENTATION_H
-#define VIBRATOR_IMPLEMENTATION_H
-
-#include <cstdint>
-
-struct VibratorImplementationPrivate;
-
-class VibratorImplementation {
-public:
- VibratorImplementation();
- ~VibratorImplementation();
-
- bool init();
- void on(uint32_t duration_ms);
- void off();
-
-private:
- VibratorImplementationPrivate* const d_ptr;
-};
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:qt5-feedback-haptics-droid-vibrator-0.1.1.tar.bz2/vibratorimplementation_hal.cpp
^
|
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Jolla Ltd.
-** Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
-**
-** This file is part of the QtFeedback Droid Vibrator Plugin.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "vibratorimplementation.h"
-
-#include <android-version.h>
-#if ANDROID_VERSION_MAJOR >= 7
-#include <hardware/vibrator.h>
-#else
-#include <hardware_legacy/vibrator.h>
-#endif
-
-struct VibratorImplementationPrivate {
-#if ANDROID_VERSION_MAJOR >= 7
- vibrator_device_t *dev;
-#endif
-};
-
-VibratorImplementation::VibratorImplementation()
-#if ANDROID_VERSION_MAJOR >= 7
- : d_ptr(new VibratorImplementationPrivate())
-{
- d_ptr->dev = 0;
-}
-#else
- : d_ptr(0)
-{
-}
-#endif
-
-VibratorImplementation::~VibratorImplementation()
-{
-#if ANDROID_VERSION_MAJOR >= 7
- if (d_ptr->dev) {
- d_ptr->dev->common.close(reinterpret_cast<hw_device_t *>(d_ptr->dev));
- }
-
- delete d_ptr;
-#endif
-}
-
-bool VibratorImplementation::init()
-{
-#if ANDROID_VERSION_MAJOR >= 7
- struct hw_module_t *hwmod = 0;
-
- hw_get_module(VIBRATOR_HARDWARE_MODULE_ID, (const hw_module_t **)(&hwmod));
-
- if (!hwmod || vibrator_open(hwmod, &d_ptr->dev) < 0) {
- return false;
- }
-#endif
-
- return true;
-}
-
-void VibratorImplementation::on(uint32_t duration_ms)
-{
-#if ANDROID_VERSION_MAJOR >= 7
- if (d_ptr->dev) {
- d_ptr->dev->vibrator_on(d_ptr->dev, duration_ms);
- }
-#else
- vibrator_on(duration_ms);
-#endif
-}
-
-void VibratorImplementation::off()
-{
-#if ANDROID_VERSION_MAJOR >= 7
- if (d_ptr->dev) {
- d_ptr->dev->vibrator_off(d_ptr->dev);
- }
-#else
- vibrator_off();
-#endif
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:qt5-feedback-haptics-droid-vibrator-0.1.1.tar.bz2/vibratorimplementation_native.cpp
^
|
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Jolla Ltd.
-** Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
-**
-** This file is part of the QtFeedback Droid Vibrator Plugin.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "vibratorimplementation.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <cstdio>
-
-#define DEFAULT_NATIVE_FILE_PATH "/sys/class/timed_output/vibrator/enable"
-
-struct VibratorImplementationPrivate {
- void vibrator_write(uint32_t value);
- int fd;
-};
-
-VibratorImplementation::VibratorImplementation()
- : d_ptr(new VibratorImplementationPrivate())
-{
- d_ptr->fd = -1;
-}
-
-VibratorImplementation::~VibratorImplementation()
-{
- if (d_ptr->fd > 0) {
- close(d_ptr->fd);
- }
-
- delete d_ptr;
-}
-
-bool VibratorImplementation::init()
-{
- if (d_ptr->fd > 0) {
- return true;
- }
-
- if ((d_ptr->fd = open(DEFAULT_NATIVE_FILE_PATH, O_WRONLY)) < 0) {
- return false;
- }
-
- return true;
-}
-
-void VibratorImplementation::on(uint32_t duration_ms)
-{
- d_ptr->vibrator_write(duration_ms);
-}
-
-void VibratorImplementation::off()
-{
- d_ptr->vibrator_write(0);
-}
-
-void VibratorImplementationPrivate::vibrator_write(uint32_t value)
-{
- char value_str[12]; /* fits UINT32_MAX value with newline */
- int length;
-
- if (fd < 0) {
- return;
- }
-
- length = snprintf(value_str, sizeof(value_str), "%u\n", value);
- write(fd, value_str, length);
-}
|