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 <QDBusConnection>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <QDebug>
|
2015-07-22 02:19:29 +01:00
|
|
|
#include <QPoint>
|
|
|
|
|
2020-05-26 17:55:47 +01:00
|
|
|
#include "plugin_remotecontrol_debug.h"
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <core/device.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
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
RemoteControlPlugin::RemoteControlPlugin(QObject *parent, const QVariantList &args)
|
2015-07-22 02:19:29 +01:00
|
|
|
: KdeConnectPlugin(parent, args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoteControlPlugin::~RemoteControlPlugin()
|
2022-09-10 22:23:52 +01:00
|
|
|
{
|
|
|
|
}
|
2015-07-22 02:19:29 +01:00
|
|
|
|
|
|
|
void RemoteControlPlugin::moveCursor(const QPoint &p)
|
|
|
|
{
|
2022-09-10 22:23:52 +01:00
|
|
|
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {{QStringLiteral("dx"), p.x()}, {QStringLiteral("dy"), p.y()}});
|
2018-03-04 19:48:51 +00:00
|
|
|
sendPacket(np);
|
2015-07-22 02:19:29 +01:00
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void RemoteControlPlugin::sendCommand(const QVariantMap &body)
|
2015-07-22 02:19:29 +01:00
|
|
|
{
|
2022-09-10 22:23:52 +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"
|