/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2017-2018 Simon Stürz . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef DEVICEPLUGINSNAPD_H #define DEVICEPLUGINSNAPD_H #include "devices/deviceplugin.h" #include "plugintimer.h" #include #include #include #include #include "snapdcontrol.h" class DevicePluginSnapd: public DevicePlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "io.nymea.DevicePlugin" FILE "devicepluginsnapd.json") Q_INTERFACES(DevicePlugin) public: explicit DevicePluginSnapd(); ~DevicePluginSnapd(); void init() override; void startMonitoringAutoDevices() override; void postSetupDevice(Device *device) override; void deviceRemoved(Device *device) override; Device::DeviceSetupStatus setupDevice(Device *device) override; Device::DeviceError executeAction(Device *device, const Action &action) override; private: SnapdControl *m_snapdControl = nullptr; PluginTimer *m_refreshTimer = nullptr; PluginTimer *m_updateTimer = nullptr; bool m_advancedMode = false; int m_refreshTime = 2; // Snap list for faster access (snap id, device) QHash m_snapDevices; private slots: void onPluginConfigurationChanged(const ParamTypeId ¶mTypeId, const QVariant &value); void onRefreshTimer(); void onUpdateTimer(); void onSnapListUpdated(const QVariantList &snapList); }; #endif // DEVICEPLUGINSNAPD_H