kdeconnect-kde/core/kdeconnectplugin.h

62 lines
1.6 KiB
C
Raw Normal View History

2013-06-06 04:57:06 +01:00
/**
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
2013-06-06 04:57:06 +01:00
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
2013-06-06 04:57:06 +01:00
*/
2013-08-13 04:14:46 +01:00
#ifndef KDECONNECTPLUGIN_H
#define KDECONNECTPLUGIN_H
2013-06-06 04:57:06 +01:00
#include <QObject>
#include <QVariantList>
2020-03-08 12:22:54 +00:00
#include <kcoreaddons_version.h>
2013-06-06 04:57:06 +01:00
#include "device.h"
#include "kdeconnectcore_export.h"
#include "kdeconnectpluginconfig.h"
#include "networkpacket.h"
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 44, 0)
#define K_PLUGIN_CLASS_WITH_JSON(classname, jsonFile) K_PLUGIN_FACTORY_WITH_JSON(classname##Factory, jsonFile, registerPlugin<classname>();)
2020-03-01 20:00:40 +00:00
#endif
struct KdeConnectPluginPrivate;
class KDECONNECTCORE_EXPORT KdeConnectPlugin : public QObject
2013-06-06 04:57:06 +01:00
{
Q_OBJECT
public:
KdeConnectPlugin(QObject *parent, const QVariantList &args);
~KdeConnectPlugin() override;
const Device *device();
Device const *device() const;
2013-06-06 04:57:06 +01:00
bool sendPacket(NetworkPacket &np) const;
KdeConnectPluginConfig *config() const;
virtual QString dbusPath() const;
QString iconName() const;
2013-06-06 04:57:06 +01:00
public Q_SLOTS:
/**
* Returns true if it has handled the packet in some way
* device.sendPacket can be used to send an answer back to the device
*/
virtual bool receivePacket(const NetworkPacket &np) = 0;
/**
* This method will be called when a device is connected to this computer.
* The plugin could be loaded already, but there is no guarantee we will be able to reach the device until this is called.
*/
virtual void connected() = 0;
private:
QScopedPointer<KdeConnectPluginPrivate> d;
2013-06-06 04:57:06 +01:00
};
#endif