Warning, file /network/kdeconnect-kde/interfaces/dbusinterfaces.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /** 0002 * SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef DBUSINTERFACES_H 0008 #define DBUSINTERFACES_H 0009 0010 #include "kdeconnectinterfaces_export.h" 0011 0012 #include "batteryinterface.h" 0013 #include "bigscreeninterface.h" 0014 #include "connectivityinterface.h" 0015 #include "conversationsinterface.h" 0016 #include "daemoninterface.h" 0017 #include "devicefindmyphoneinterface.h" 0018 #include "deviceinterface.h" 0019 #include "devicenotificationsinterface.h" 0020 #include "devicesftpinterface.h" 0021 #include "lockdeviceinterface.h" 0022 #include "mprisremoteinterface.h" 0023 #include "notificationinterface.h" 0024 #include "remotecommandsinterface.h" 0025 #include "remotecontrolinterface.h" 0026 #include "remotekeyboardinterface.h" 0027 #include "remotesystemvolumeinterface.h" 0028 #include "shareinterface.h" 0029 #include "smsinterface.h" 0030 #include "virtualmonitorinterface.h" 0031 #include "photointerface.h" 0032 0033 /** 0034 * Using these "proxy" classes just in case we need to rename the 0035 * interface, so we can change the class name in a single place. 0036 */ 0037 class KDECONNECTINTERFACES_EXPORT DaemonDbusInterface : public OrgKdeKdeconnectDaemonInterface 0038 { 0039 Q_OBJECT 0040 Q_PROPERTY(QStringList customDevices READ customDevices WRITE setCustomDevices NOTIFY customDevicesChangedProxy) 0041 public: 0042 explicit DaemonDbusInterface(QObject *parent = nullptr); 0043 ~DaemonDbusInterface() override; 0044 0045 static QString activatedService(); 0046 0047 Q_SIGNALS: 0048 void deviceAdded(const QString &id); 0049 void pairingRequestsChangedProxy(); 0050 void customDevicesChangedProxy(); 0051 }; 0052 0053 class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface : public OrgKdeKdeconnectDeviceInterface 0054 { 0055 Q_OBJECT 0056 // TODO: Workaround because OrgKdeKdeconnectDeviceInterface is not generating 0057 // the signals for the properties 0058 Q_PROPERTY(bool isReachable READ isReachable NOTIFY reachableChangedProxy) 0059 Q_PROPERTY(bool isTrusted READ isTrusted NOTIFY trustedChangedProxy) 0060 Q_PROPERTY(QString name READ name NOTIFY nameChangedProxy) 0061 Q_PROPERTY(bool hasPairingRequests READ hasPairingRequests NOTIFY hasPairingRequestsChangedProxy) 0062 0063 public: 0064 explicit DeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0065 ~DeviceDbusInterface() override; 0066 0067 Q_SCRIPTABLE QString id() const; 0068 Q_SCRIPTABLE void pluginCall(const QString &plugin, const QString &method); 0069 0070 Q_SIGNALS: 0071 void nameChangedProxy(const QString &name); 0072 void trustedChangedProxy(bool paired); 0073 void reachableChangedProxy(bool reachable); 0074 void hasPairingRequestsChangedProxy(bool); 0075 0076 private: 0077 const QString m_id; 0078 }; 0079 0080 class KDECONNECTINTERFACES_EXPORT BatteryDbusInterface : public OrgKdeKdeconnectDeviceBatteryInterface 0081 { 0082 Q_OBJECT 0083 Q_PROPERTY(int charge READ charge NOTIFY refreshedProxy) 0084 Q_PROPERTY(bool isCharging READ isCharging NOTIFY refreshedProxy) 0085 public: 0086 explicit BatteryDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0087 ~BatteryDbusInterface() override; 0088 0089 Q_SIGNALS: 0090 void refreshedProxy(bool isCharging, int charge); 0091 }; 0092 0093 class KDECONNECTINTERFACES_EXPORT ConnectivityReportDbusInterface : public OrgKdeKdeconnectDeviceConnectivity_reportInterface 0094 { 0095 Q_OBJECT 0096 Q_PROPERTY(QString cellularNetworkType READ cellularNetworkType NOTIFY refreshedProxy) 0097 Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshedProxy) 0098 public: 0099 explicit ConnectivityReportDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0100 ~ConnectivityReportDbusInterface() override; 0101 0102 Q_SIGNALS: 0103 void refreshedProxy(QString cellularNetworkType, int cellularNetworkStrength); 0104 }; 0105 0106 class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface : public OrgKdeKdeconnectDeviceNotificationsInterface 0107 { 0108 Q_OBJECT 0109 public: 0110 explicit DeviceNotificationsDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0111 ~DeviceNotificationsDbusInterface() override; 0112 }; 0113 0114 class KDECONNECTINTERFACES_EXPORT NotificationDbusInterface : public OrgKdeKdeconnectDeviceNotificationsNotificationInterface 0115 { 0116 Q_OBJECT 0117 public: 0118 NotificationDbusInterface(const QString &deviceId, const QString ¬ificationId, QObject *parent = nullptr); 0119 ~NotificationDbusInterface() override; 0120 0121 QString notificationId() 0122 { 0123 return id; 0124 } 0125 0126 private: 0127 const QString id; 0128 }; 0129 0130 class KDECONNECTINTERFACES_EXPORT DeviceConversationsDbusInterface : public OrgKdeKdeconnectDeviceConversationsInterface 0131 { 0132 Q_OBJECT 0133 public: 0134 explicit DeviceConversationsDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0135 ~DeviceConversationsDbusInterface() override; 0136 }; 0137 0138 class KDECONNECTINTERFACES_EXPORT SftpDbusInterface : public OrgKdeKdeconnectDeviceSftpInterface 0139 { 0140 Q_OBJECT 0141 public: 0142 explicit SftpDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0143 ~SftpDbusInterface() override; 0144 }; 0145 0146 class KDECONNECTINTERFACES_EXPORT MprisDbusInterface : public OrgKdeKdeconnectDeviceMprisremoteInterface 0147 { 0148 Q_OBJECT 0149 // TODO: Workaround because qdbusxml2cpp is not generating 0150 // the signals for the properties 0151 Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY propertiesChangedProxy) 0152 Q_PROPERTY(int length READ length NOTIFY propertiesChangedProxy) 0153 Q_PROPERTY(QString nowPlaying READ nowPlaying NOTIFY propertiesChangedProxy) 0154 Q_PROPERTY(QString title READ title NOTIFY propertiesChangedProxy) 0155 Q_PROPERTY(QString artist READ artist NOTIFY propertiesChangedProxy) 0156 Q_PROPERTY(QString album READ album NOTIFY propertiesChangedProxy) 0157 0158 Q_PROPERTY(QStringList playerList READ playerList NOTIFY propertiesChangedProxy) 0159 Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY propertiesChangedProxy) 0160 Q_PROPERTY(int position READ position WRITE setPosition NOTIFY propertiesChangedProxy) 0161 Q_PROPERTY(bool canSeek READ canSeek NOTIFY propertiesChangedProxy) 0162 public: 0163 explicit MprisDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0164 ~MprisDbusInterface() override; 0165 0166 Q_SIGNALS: 0167 void propertiesChangedProxy(); 0168 }; 0169 0170 class KDECONNECTINTERFACES_EXPORT RemoteControlDbusInterface : public OrgKdeKdeconnectDeviceRemotecontrolInterface 0171 { 0172 Q_OBJECT 0173 public: 0174 explicit RemoteControlDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0175 ~RemoteControlDbusInterface() override; 0176 }; 0177 0178 class KDECONNECTINTERFACES_EXPORT LockDeviceDbusInterface : public OrgKdeKdeconnectDeviceLockdeviceInterface 0179 { 0180 Q_OBJECT 0181 Q_PROPERTY(bool isLocked READ isLocked WRITE setIsLocked NOTIFY lockedChangedProxy) 0182 public: 0183 explicit LockDeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0184 ~LockDeviceDbusInterface() override; 0185 0186 Q_SIGNALS: 0187 void lockedChangedProxy(bool isLocked); 0188 }; 0189 0190 class KDECONNECTINTERFACES_EXPORT FindMyPhoneDeviceDbusInterface : public OrgKdeKdeconnectDeviceFindmyphoneInterface 0191 { 0192 Q_OBJECT 0193 public: 0194 explicit FindMyPhoneDeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0195 ~FindMyPhoneDeviceDbusInterface() override; 0196 }; 0197 0198 class KDECONNECTINTERFACES_EXPORT RemoteCommandsDbusInterface : public OrgKdeKdeconnectDeviceRemotecommandsInterface 0199 { 0200 Q_OBJECT 0201 public: 0202 explicit RemoteCommandsDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0203 ~RemoteCommandsDbusInterface() override; 0204 }; 0205 0206 class KDECONNECTINTERFACES_EXPORT RemoteKeyboardDbusInterface : public OrgKdeKdeconnectDeviceRemotekeyboardInterface 0207 { 0208 Q_OBJECT 0209 Q_PROPERTY(bool remoteState READ remoteState NOTIFY remoteStateChanged) 0210 public: 0211 explicit RemoteKeyboardDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0212 ~RemoteKeyboardDbusInterface() override; 0213 Q_SIGNALS: 0214 void remoteStateChanged(bool state); 0215 }; 0216 0217 class KDECONNECTINTERFACES_EXPORT SmsDbusInterface : public OrgKdeKdeconnectDeviceSmsInterface 0218 { 0219 Q_OBJECT 0220 public: 0221 explicit SmsDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0222 ~SmsDbusInterface() override; 0223 }; 0224 0225 class KDECONNECTINTERFACES_EXPORT ShareDbusInterface : public OrgKdeKdeconnectDeviceShareInterface 0226 { 0227 Q_OBJECT 0228 public: 0229 explicit ShareDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0230 ~ShareDbusInterface() override; 0231 }; 0232 0233 class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface 0234 : public OrgKdeKdeconnectDevicePhotoInterface 0235 { 0236 Q_OBJECT 0237 public: 0238 explicit PhotoDbusInterface(const QString& deviceId, QObject* parent = nullptr); 0239 ~PhotoDbusInterface() override; 0240 }; 0241 0242 class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface 0243 : public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface 0244 { 0245 Q_OBJECT 0246 public: 0247 explicit RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0248 ~RemoteSystemVolumeDbusInterface() override = default; 0249 }; 0250 0251 class KDECONNECTINTERFACES_EXPORT BigscreenDbusInterface : public OrgKdeKdeconnectDeviceBigscreenInterface 0252 { 0253 Q_OBJECT 0254 public: 0255 explicit BigscreenDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0256 ~BigscreenDbusInterface() override; 0257 }; 0258 0259 class KDECONNECTINTERFACES_EXPORT VirtualmonitorDbusInterface : public OrgKdeKdeconnectDeviceVirtualmonitorInterface 0260 { 0261 Q_OBJECT 0262 public: 0263 explicit VirtualmonitorDbusInterface(const QString &deviceId, QObject *parent = nullptr); 0264 ~VirtualmonitorDbusInterface() override; 0265 }; 0266 0267 template<typename T, typename W> 0268 static void setWhenAvailable(const QDBusPendingReply<T> &pending, W func, QObject *parent) 0269 { 0270 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, parent); 0271 QObject::connect(watcher, &QDBusPendingCallWatcher::finished, parent, [func](QDBusPendingCallWatcher *watcher) { 0272 watcher->deleteLater(); 0273 QDBusPendingReply<T> reply = *watcher; 0274 func(reply.value()); 0275 }); 0276 } 0277 0278 #endif