mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 22:33:08 +00:00
This is an initial port to feedbackd for the haptics plugin. This implementation is a simple port to have the motor enabled for a certain duration. We will eventually want to use feedbackd events to trigger these instead. Related MR for qtfeedback: https://invent.kde.org/jbbgameich/ktactilefeedback/-/merge_requests/2 https://invent.kde.org/teams/plasma-mobile/issues/-/issues/10
37 lines
823 B
C++
37 lines
823 B
C++
// SPDX-FileCopyrightText: 2025 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QDBusArgument>
|
|
#include <QList>
|
|
|
|
class VibrationEvent
|
|
{
|
|
public:
|
|
double amplitude;
|
|
quint32 duration;
|
|
};
|
|
|
|
using VibrationEventList = QList<VibrationEvent>;
|
|
|
|
Q_DECLARE_METATYPE(VibrationEvent)
|
|
Q_DECLARE_METATYPE(VibrationEventList)
|
|
|
|
inline QDBusArgument &operator<<(QDBusArgument &argument, const VibrationEvent &e)
|
|
{
|
|
argument.beginStructure();
|
|
argument << e.amplitude;
|
|
argument << e.duration;
|
|
argument.endStructure();
|
|
return argument;
|
|
}
|
|
|
|
inline const QDBusArgument &operator>>(const QDBusArgument &argument, VibrationEvent &e)
|
|
{
|
|
argument.beginStructure();
|
|
argument >> e.amplitude;
|
|
argument >> e.duration;
|
|
argument.endStructure();
|
|
return argument;
|
|
}
|