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
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2023-08-12 12:26:05 +01:00
|
|
|
return QLatin1String("/modules/kdeconnect/devices/%1/remotecontrol").arg(device()->id());
|
2015-07-22 02:19:29 +01:00
|
|
|
}
|
|
|
|
|
2023-07-26 09:15:11 +01:00
|
|
|
#include "moc_remotecontrolplugin.cpp"
|
2015-07-22 02:19:29 +01:00
|
|
|
#include "remotecontrolplugin.moc"
|