/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef DEVICEPLUGINPHILIPSHUE_H #define DEVICEPLUGINPHILIPSHUE_H #include "plugin/deviceplugin.h" #include "discovery.h" #include "huebridgeconnection.h" #include "light.h" class QNetworkReply; class DevicePluginPhilipsHue: public DevicePlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "guru.guh.DevicePlugin" FILE "devicepluginphilipshue.json") Q_INTERFACES(DevicePlugin) public: explicit DevicePluginPhilipsHue(); QList supportedVendors() const override; QList supportedDevices() const override; DeviceManager::HardwareResources requiredHardware() const override; bool configureAutoDevice(QList loadedDevices, Device *device) const override; QString pluginName() const override; PluginId pluginId() const override; QList configurationDescription() const override; DeviceManager::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const QList ¶ms) const override; QPair setupDevice(Device *device) override; QPair confirmPairing(const QUuid &pairingTransactionId, const DeviceClassId &deviceClassId, const QList ¶ms) override; public slots: QPair executeAction(Device *device, const Action &action); private slots: void discoveryDone(const QList &bridges); void createUserFinished(int id, const QVariantMap ¶ms); void getLightsFinished(int id, const QVariantMap ¶ms); void getFinished(int id, const QVariantMap ¶ms); void lightStateChanged(); private: QList m_config; Discovery *m_discovery; class PairingInfo { public: QUuid pairingTransactionId; Param ipParam; Param usernameParam; }; QHash m_pairings; HueBridgeConnection *m_bridge; QList m_unconfiguredLights; QHash m_lights; QHash m_asyncSetups; }; #endif // DEVICEPLUGINBOBLIGHT_H