This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-core/libguh/deviceplugin.h
2014-03-31 21:55:33 +02:00

76 lines
2.6 KiB
C++

/****************************************************************************
* *
* This file is part of guh. *
* *
* Guh 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, version 2 of the License. *
* *
* Guh 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 guh. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
#ifndef DEVICEPLUGIN_H
#define DEVICEPLUGIN_H
#include "devicemanager.h"
#include "deviceclass.h"
#include "event.h"
#include "action.h"
#include <QObject>
class DeviceManager;
class Device;
class DevicePlugin: public QObject
{
Q_OBJECT
public:
DevicePlugin(QObject *parent = 0);
virtual ~DevicePlugin();
virtual void init() {}
virtual QString pluginName() const = 0;
virtual QUuid pluginId() const = 0;
virtual QList<DeviceClass> supportedDevices() const = 0;
virtual DeviceManager::HardwareResources requiredHardware() const = 0;
// Hardware input
virtual void radioData(QList<int> rawData) {Q_UNUSED(rawData)}
virtual void guhTimer() {}
virtual QVariantMap configuration() const;
virtual void setConfiguration(const QVariantMap &configuration);
public slots:
virtual void executeAction(Device *device, const Action &action) {Q_UNUSED(device) Q_UNUSED(action)}
signals:
void emitEvent(const Event &event);
protected:
DeviceManager *deviceManager() const;
void transmitData(QList<int> rawData);
private:
void initPlugin(DeviceManager *deviceManager);
DeviceManager *m_deviceManager;
friend class DeviceManager;
};
Q_DECLARE_INTERFACE(DevicePlugin, "org.guhyourhome.DevicePlugin")
#endif