2015-07-22 02:19:29 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
|
2015-07-22 02:19:29 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2015-07-22 02:19:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "remotecontrolplugin.h"
|
|
|
|
|
|
|
|
#include <KLocalizedString>
|
|
|
|
#include <KPluginFactory>
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QDBusConnection>
|
|
|
|
#include <QPoint>
|
|
|
|
|
|
|
|
#include <core/device.h>
|
2020-05-26 17:55:47 +01:00
|
|
|
#include "plugin_remotecontrol_debug.h"
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2019-06-12 21:16:54 +01:00
|
|
|
K_PLUGIN_CLASS_WITH_JSON(RemoteControlPlugin, "kdeconnect_remotecontrol.json")
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2017-09-03 20:39:44 +01:00
|
|
|
RemoteControlPlugin::RemoteControlPlugin(QObject* parent, const QVariantList &args)
|
2015-07-22 02:19:29 +01:00
|
|
|
: KdeConnectPlugin(parent, args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoteControlPlugin::~RemoteControlPlugin()
|
|
|
|
{}
|
|
|
|
|
|
|
|
void RemoteControlPlugin::moveCursor(const QPoint &p)
|
|
|
|
{
|
2018-03-04 19:48:51 +00:00
|
|
|
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {
|
2019-06-10 15:40:28 +01:00
|
|
|
{QStringLiteral("dx"), p.x()},
|
|
|
|
{QStringLiteral("dy"), p.y()}
|
2016-06-21 19:07:12 +01:00
|
|
|
});
|
2018-03-04 19:48:51 +00:00
|
|
|
sendPacket(np);
|
2015-07-22 02:19:29 +01:00
|
|
|
}
|
|
|
|
|
2021-07-15 21:19:09 +01:00
|
|
|
void RemoteControlPlugin::sendCommand(const QVariantMap& body)
|
2015-07-22 02:19:29 +01:00
|
|
|
{
|
2021-08-04 18:49:32 +01:00
|
|
|
if (body.isEmpty()) return;
|
2021-07-15 21:19:09 +01:00
|
|
|
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, body);
|
2018-03-04 19:48:51 +00:00
|
|
|
sendPacket(np);
|
2015-07-22 02:19:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString RemoteControlPlugin::dbusPath() const
|
|
|
|
{
|
2019-06-10 15:40:28 +01:00
|
|
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecontrol");
|
2015-07-22 02:19:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "remotecontrolplugin.moc"
|