/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2020 Bernhard Trinnes * * * * This file is part of nymea. * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library 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 * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; If not, see * * . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef NANOLEAF_H #define NANOLEAF_H #include #include #include #include #include #include "network/networkaccessmanager.h" #include "devices/device.h" class Nanoleaf : public QObject { Q_OBJECT public: explicit Nanoleaf(NetworkAccessManager *networkManager, const QHostAddress &address, int port = 16021, QObject *parent = nullptr); void setIpAddress(const QHostAddress &address); QHostAddress ipAddress(); void setPort(int port); int port(); void setAuthToken(const QString &token); QString authToken(); //AUTHORIZATION void addUser(); void deleteUser(); //GET ALL PANEL INFORMATION void getControllerInfo(); //STATES void getPower(); void getHue(); void getBrightness(); void getSaturation(); void getColorTemperature(); void getColorMode(); QUuid setPower(bool power); QUuid setHue(QColor color); QUuid setBrightness(int percentage); QUuid setSaturation(int percentage); QUuid setColorTemperature(int mired); //EFFECTS void getEffects(); void getSelectedEffect(); QUuid setEffect(const QString &effect); //PANEL LAYOUT //IDENTIFY //EXTERNAL CONTROL //RHYTHM private: NetworkAccessManager *m_networkManager = nullptr; QString m_authToken; QHostAddress m_address; int m_port; signals: void connectionChanged(bool connected); void authenticationStatusChanged(bool authenticated); void requestExecuted(QUuid requestId, bool success); void authTokenRecieved(const QString &token); void powerReceived(bool power); void brightnessReceived(int percentage); void colorModeReceived(const QString &colorMode); void hueReceived(int hue); void saturationReceived(int percentage); void effectListReceived(const QStringList &effects); void colorTemperatureReceived(int mired); void selectedEffectReceived(const QString &effect); }; #endif // NANOLEAF_H