File indexing completed on 2024-12-08 04:30:46

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 "generated/batteryinterface.h"
0013 #include "generated/bigscreeninterface.h"
0014 #include "generated/connectivityinterface.h"
0015 #include "generated/conversationsinterface.h"
0016 #include "generated/daemoninterface.h"
0017 #include "generated/deviceclipboardinterface.h"
0018 #include "generated/devicefindmyphoneinterface.h"
0019 #include "generated/deviceinterface.h"
0020 #include "generated/devicenotificationsinterface.h"
0021 #include "generated/devicesftpinterface.h"
0022 #include "generated/lockdeviceinterface.h"
0023 #include "generated/mprisremoteinterface.h"
0024 #include "generated/notificationinterface.h"
0025 #include "generated/remotecommandsinterface.h"
0026 #include "generated/remotecontrolinterface.h"
0027 #include "generated/remotekeyboardinterface.h"
0028 #include "generated/remotesystemvolumeinterface.h"
0029 #include "generated/shareinterface.h"
0030 #include "generated/smsinterface.h"
0031 #include "generated/virtualmonitorinterface.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 
0044     static QString activatedService();
0045 
0046 Q_SIGNALS:
0047     void customDevicesChangedProxy();
0048 };
0049 
0050 class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface : public OrgKdeKdeconnectDeviceInterface
0051 {
0052     Q_OBJECT
0053     // Workaround because qdbusxml2cpp is not generating NOTIFY for properties
0054     Q_PROPERTY(bool isReachable READ isReachable NOTIFY reachableChangedProxy)
0055     Q_PROPERTY(bool isPaired READ isPaired NOTIFY pairStateChangedProxy)
0056     Q_PROPERTY(bool isPairRequested READ isPairRequested NOTIFY pairStateChangedProxy)
0057     Q_PROPERTY(bool isPairRequestedByPeer READ isPairRequestedByPeer NOTIFY pairStateChangedProxy)
0058     Q_PROPERTY(int pairState READ pairState NOTIFY pairStateChangedProxy)
0059     Q_PROPERTY(QString name READ name NOTIFY nameChangedProxy)
0060 
0061 public:
0062     explicit DeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0063 
0064     Q_SCRIPTABLE QString id() const;
0065     Q_SCRIPTABLE void pluginCall(const QString &plugin, const QString &method);
0066 
0067 Q_SIGNALS:
0068     void nameChangedProxy(const QString &name);
0069     void pairStateChangedProxy(int pairState);
0070     void reachableChangedProxy(bool reachable);
0071 
0072 private:
0073     const QString m_id;
0074 };
0075 
0076 class KDECONNECTINTERFACES_EXPORT BatteryDbusInterface : public OrgKdeKdeconnectDeviceBatteryInterface
0077 {
0078     Q_OBJECT
0079     Q_PROPERTY(int charge READ charge NOTIFY refreshedProxy)
0080     Q_PROPERTY(bool isCharging READ isCharging NOTIFY refreshedProxy)
0081 public:
0082     explicit BatteryDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0083 
0084 Q_SIGNALS:
0085     void refreshedProxy(bool isCharging, int charge);
0086 };
0087 
0088 class KDECONNECTINTERFACES_EXPORT ConnectivityReportDbusInterface : public OrgKdeKdeconnectDeviceConnectivity_reportInterface
0089 {
0090     Q_OBJECT
0091     Q_PROPERTY(QString cellularNetworkType READ cellularNetworkType NOTIFY refreshedProxy)
0092     Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshedProxy)
0093 public:
0094     explicit ConnectivityReportDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0095 
0096 Q_SIGNALS:
0097     void refreshedProxy(QString cellularNetworkType, int cellularNetworkStrength);
0098 };
0099 
0100 class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface : public OrgKdeKdeconnectDeviceNotificationsInterface
0101 {
0102     Q_OBJECT
0103 public:
0104     explicit DeviceNotificationsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0105 };
0106 
0107 class KDECONNECTINTERFACES_EXPORT NotificationDbusInterface : public OrgKdeKdeconnectDeviceNotificationsNotificationInterface
0108 {
0109     Q_OBJECT
0110 public:
0111     NotificationDbusInterface(const QString &deviceId, const QString &notificationId, QObject *parent = nullptr);
0112 
0113     QString notificationId()
0114     {
0115         return id;
0116     }
0117 
0118 private:
0119     const QString id;
0120 };
0121 
0122 class KDECONNECTINTERFACES_EXPORT DeviceConversationsDbusInterface : public OrgKdeKdeconnectDeviceConversationsInterface
0123 {
0124     Q_OBJECT
0125 public:
0126     explicit DeviceConversationsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0127 };
0128 
0129 class KDECONNECTINTERFACES_EXPORT SftpDbusInterface : public OrgKdeKdeconnectDeviceSftpInterface
0130 {
0131     Q_OBJECT
0132 public:
0133     explicit SftpDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0134 };
0135 
0136 class KDECONNECTINTERFACES_EXPORT MprisDbusInterface : public OrgKdeKdeconnectDeviceMprisremoteInterface
0137 {
0138     Q_OBJECT
0139     // Workaround because qdbusxml2cpp is not generating NOTIFY for properties
0140     Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY propertiesChangedProxy)
0141     Q_PROPERTY(int length READ length NOTIFY propertiesChangedProxy)
0142     Q_PROPERTY(QString title READ title NOTIFY propertiesChangedProxy)
0143     Q_PROPERTY(QString artist READ artist NOTIFY propertiesChangedProxy)
0144     Q_PROPERTY(QString album READ album NOTIFY propertiesChangedProxy)
0145 
0146     Q_PROPERTY(QStringList playerList READ playerList NOTIFY propertiesChangedProxy)
0147     Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY propertiesChangedProxy)
0148     Q_PROPERTY(int position READ position WRITE setPosition NOTIFY propertiesChangedProxy)
0149     Q_PROPERTY(bool canSeek READ canSeek NOTIFY propertiesChangedProxy)
0150 public:
0151     explicit MprisDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0152 
0153 Q_SIGNALS:
0154     void propertiesChangedProxy();
0155 };
0156 
0157 class KDECONNECTINTERFACES_EXPORT RemoteControlDbusInterface : public OrgKdeKdeconnectDeviceRemotecontrolInterface
0158 {
0159     Q_OBJECT
0160 public:
0161     explicit RemoteControlDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0162 };
0163 
0164 class KDECONNECTINTERFACES_EXPORT LockDeviceDbusInterface : public OrgKdeKdeconnectDeviceLockdeviceInterface
0165 {
0166     Q_OBJECT
0167     Q_PROPERTY(bool isLocked READ isLocked WRITE setIsLocked NOTIFY lockedChangedProxy)
0168 public:
0169     explicit LockDeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0170 
0171 Q_SIGNALS:
0172     void lockedChangedProxy(bool isLocked);
0173 };
0174 
0175 class KDECONNECTINTERFACES_EXPORT FindMyPhoneDeviceDbusInterface : public OrgKdeKdeconnectDeviceFindmyphoneInterface
0176 {
0177     Q_OBJECT
0178 public:
0179     explicit FindMyPhoneDeviceDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0180 };
0181 
0182 class KDECONNECTINTERFACES_EXPORT RemoteCommandsDbusInterface : public OrgKdeKdeconnectDeviceRemotecommandsInterface
0183 {
0184     Q_OBJECT
0185     // Workaround because qdbusxml2cpp is not generating CONSTANT for properties and qml complains at runtime
0186     Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
0187 public:
0188     explicit RemoteCommandsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0189 };
0190 
0191 class KDECONNECTINTERFACES_EXPORT RemoteKeyboardDbusInterface : public OrgKdeKdeconnectDeviceRemotekeyboardInterface
0192 {
0193     Q_OBJECT
0194     Q_PROPERTY(bool remoteState READ remoteState NOTIFY remoteStateChangedProxy)
0195 public:
0196     explicit RemoteKeyboardDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0197 Q_SIGNALS:
0198     void remoteStateChangedProxy(bool state);
0199 };
0200 
0201 class KDECONNECTINTERFACES_EXPORT SmsDbusInterface : public OrgKdeKdeconnectDeviceSmsInterface
0202 {
0203     Q_OBJECT
0204 public:
0205     explicit SmsDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0206 };
0207 
0208 class KDECONNECTINTERFACES_EXPORT ShareDbusInterface : public OrgKdeKdeconnectDeviceShareInterface
0209 {
0210     Q_OBJECT
0211 public:
0212     explicit ShareDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0213 };
0214 
0215 class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface : public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
0216 {
0217     Q_OBJECT
0218     // Workaround because qdbusxml2cpp is not generating CONSTANT for properties and qml complains at runtime
0219     Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
0220 public:
0221     explicit RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0222 };
0223 
0224 class KDECONNECTINTERFACES_EXPORT BigscreenDbusInterface : public OrgKdeKdeconnectDeviceBigscreenInterface
0225 {
0226     Q_OBJECT
0227 public:
0228     explicit BigscreenDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0229 };
0230 
0231 class KDECONNECTINTERFACES_EXPORT VirtualmonitorDbusInterface : public OrgKdeKdeconnectDeviceVirtualmonitorInterface
0232 {
0233     Q_OBJECT
0234 public:
0235     explicit VirtualmonitorDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0236 };
0237 
0238 class KDECONNECTINTERFACES_EXPORT ClipboardDbusInterface : public OrgKdeKdeconnectDeviceClipboardInterface
0239 {
0240     Q_OBJECT
0241     Q_PROPERTY(bool isAutoShareDisabled READ isAutoShareDisabled NOTIFY autoShareDisabledChangedProxy)
0242 public:
0243     explicit ClipboardDbusInterface(const QString &deviceId, QObject *parent = nullptr);
0244 Q_SIGNALS:
0245     void autoShareDisabledChangedProxy(bool b);
0246 };
0247 
0248 #endif