File indexing completed on 2024-04-28 08:49:02

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 KDECONNECTPLUGIN_H
0008 #define KDECONNECTPLUGIN_H
0009 
0010 #include <QObject>
0011 #include <QVariantList>
0012 
0013 #include "device.h"
0014 #include "kdeconnectcore_export.h"
0015 #include "kdeconnectpluginconfig.h"
0016 #include "networkpacket.h"
0017 
0018 struct KdeConnectPluginPrivate;
0019 
0020 class KDECONNECTCORE_EXPORT KdeConnectPlugin : public QObject
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     KdeConnectPlugin(QObject *parent, const QVariantList &args);
0026     ~KdeConnectPlugin() override;
0027 
0028     const Device *device();
0029     Device const *device() const;
0030 
0031     bool sendPacket(NetworkPacket &np) const;
0032 
0033     KdeConnectPluginConfig *config() const;
0034 
0035     virtual QString dbusPath() const;
0036 
0037     QString iconName() const;
0038 
0039     /**
0040      * Returns true if it has handled the packet in some way
0041      * device.sendPacket can be used to send an answer back to the device
0042      */
0043     virtual void receivePacket(const NetworkPacket &np);
0044 
0045     /**
0046      * This method will be called when a device is connected to this computer.
0047      * The plugin could be loaded already, but there is no guarantee we will be able to reach the device until this is called.
0048      */
0049     virtual void connected()
0050     {
0051     }
0052 
0053 private:
0054     const std::unique_ptr<KdeConnectPluginPrivate> d;
0055 };
0056 
0057 #endif