2013-07-03 02:52:44 +01:00
|
|
|
/**
|
2013-06-27 01:13:16 +01:00
|
|
|
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License or (at your option) version 3 or any later version
|
|
|
|
* accepted by the membership of KDE e.V. (or its successor approved
|
|
|
|
* by the membership of KDE e.V.), which shall act as a proxy
|
|
|
|
* defined in Section 14 of version 3 of the license.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2013-07-03 02:52:44 +01:00
|
|
|
#include "dbusinterfaces.h"
|
2013-06-27 01:13:16 +01:00
|
|
|
|
2015-06-25 20:19:23 +01:00
|
|
|
QString DaemonDbusInterface::activatedService() {
|
2016-11-26 14:38:08 +00:00
|
|
|
static const QString service = QStringLiteral("org.kde.kdeconnect");
|
2015-02-24 06:12:45 +00:00
|
|
|
QDBusConnection::sessionBus().interface()->startService(service);
|
2015-09-10 19:20:44 +01:00
|
|
|
if (!QDBusConnection::sessionBus().interface()->isValid()) {
|
|
|
|
qWarning() << "error activating kdeconnectd:" << QDBusConnection::sessionBus().interface()->lastError();
|
|
|
|
}
|
2015-02-24 06:12:45 +00:00
|
|
|
return service;
|
|
|
|
}
|
|
|
|
|
2013-06-27 01:13:16 +01:00
|
|
|
DaemonDbusInterface::DaemonDbusInterface(QObject* parent)
|
2016-11-26 14:38:08 +00:00
|
|
|
: OrgKdeKdeconnectDaemonInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect"), QDBusConnection::sessionBus(), parent)
|
2013-07-03 02:52:44 +01:00
|
|
|
{
|
2017-01-25 00:18:14 +00:00
|
|
|
connect(this, &OrgKdeKdeconnectDaemonInterface::pairingRequestsChanged, this, &DaemonDbusInterface::pairingRequestsChangedProxy);
|
2013-07-03 02:52:44 +01:00
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DaemonDbusInterface::~DaemonDbusInterface()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-07-03 02:52:44 +01:00
|
|
|
DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
|
2015-06-24 19:57:02 +01:00
|
|
|
, m_id(id)
|
2013-06-27 01:13:16 +01:00
|
|
|
{
|
2015-12-01 18:45:14 +00:00
|
|
|
connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy);
|
2016-11-23 16:24:03 +00:00
|
|
|
connect(this, &OrgKdeKdeconnectDeviceInterface::reachableChanged, this, &DeviceDbusInterface::reachableChangedProxy);
|
2016-08-21 12:53:40 +01:00
|
|
|
connect(this, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, &DeviceDbusInterface::nameChangedProxy);
|
2017-01-25 00:18:14 +00:00
|
|
|
connect(this, &OrgKdeKdeconnectDeviceInterface::hasPairingRequestsChanged, this, &DeviceDbusInterface::hasPairingRequestsChangedProxy);
|
2013-08-21 17:25:44 +01:00
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DeviceDbusInterface::~DeviceDbusInterface()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-06-24 19:57:02 +01:00
|
|
|
QString DeviceDbusInterface::id() const
|
|
|
|
{
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
2015-06-13 00:28:36 +01:00
|
|
|
void DeviceDbusInterface::pluginCall(const QString &plugin, const QString &method)
|
|
|
|
{
|
2016-11-26 14:38:08 +00:00
|
|
|
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), "/modules/kdeconnect/devices/"+id()+'/'+plugin, "org.kde.kdeconnect.device."+plugin, method);
|
2015-06-13 00:28:36 +01:00
|
|
|
QDBusConnection::sessionBus().asyncCall(msg);
|
|
|
|
}
|
|
|
|
|
2013-08-21 17:25:44 +01:00
|
|
|
DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DeviceBatteryDbusInterface::~DeviceBatteryDbusInterface()
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
|
2014-01-16 11:13:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-08-21 17:25:44 +01:00
|
|
|
NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId+"/notifications/"+notificationId, QDBusConnection::sessionBus(), parent)
|
2016-04-03 15:48:28 +01:00
|
|
|
, id(notificationId)
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
2014-01-06 20:56:51 +00:00
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
NotificationDbusInterface::~NotificationDbusInterface()
|
2014-01-16 11:13:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-06 20:56:51 +00:00
|
|
|
SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/sftp", QDBusConnection::sessionBus(), parent)
|
2014-01-06 20:56:51 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
SftpDbusInterface::~SftpDbusInterface()
|
2014-01-16 11:13:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2015-06-18 03:01:01 +01:00
|
|
|
|
|
|
|
MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/mprisremote", QDBusConnection::sessionBus(), parent)
|
2015-06-18 03:01:01 +01:00
|
|
|
{
|
|
|
|
connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
MprisDbusInterface::~MprisDbusInterface()
|
|
|
|
{
|
|
|
|
}
|
2015-07-22 02:19:29 +01:00
|
|
|
|
|
|
|
RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent)
|
|
|
|
: OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/remotecontrol", QDBusConnection::sessionBus(), parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoteControlDbusInterface::~RemoteControlDbusInterface()
|
|
|
|
{
|
|
|
|
}
|
2015-07-22 02:37:34 +01:00
|
|
|
|
|
|
|
LockDeviceDbusInterface::LockDeviceDbusInterface(const QString& id, QObject* parent)
|
|
|
|
: OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/lockdevice", QDBusConnection::sessionBus(), parent)
|
|
|
|
{
|
|
|
|
connect(this, &OrgKdeKdeconnectDeviceLockdeviceInterface::lockedChanged, this, &LockDeviceDbusInterface::lockedChangedProxy);
|
|
|
|
Q_ASSERT(isValid());
|
|
|
|
}
|
|
|
|
|
|
|
|
LockDeviceDbusInterface::~LockDeviceDbusInterface()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-09-11 16:51:50 +01:00
|
|
|
FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent):
|
|
|
|
OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/findmyphone", QDBusConnection::sessionBus(), parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FindMyPhoneDeviceDbusInterface::~FindMyPhoneDeviceDbusInterface()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-06-12 19:15:40 +01:00
|
|
|
RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString& deviceId, QObject* parent):
|
|
|
|
OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotecommands", QDBusConnection::sessionBus(), parent)
|
|
|
|
{
|
|
|
|
}
|
2015-09-11 16:51:50 +01:00
|
|
|
|
2016-06-12 19:15:40 +01:00
|
|
|
RemoteCommandsDbusInterface::~RemoteCommandsDbusInterface() = default;
|
2015-09-11 16:51:50 +01:00
|
|
|
|
2017-01-23 08:08:27 +00:00
|
|
|
RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId, QObject* parent):
|
|
|
|
OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/remotekeyboard", QDBusConnection::sessionBus(), parent)
|
|
|
|
{
|
|
|
|
connect(this, &OrgKdeKdeconnectDeviceRemotekeyboardInterface::remoteStateChanged, this, &RemoteKeyboardDbusInterface::remoteStateChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default;
|
|
|
|
|
2015-07-22 02:37:34 +01:00
|
|
|
#include "dbusinterfaces.moc"
|