FIX: [hue] proper save state (#1014)

This commit is contained in:
Chris Browet
2020-11-01 19:14:09 +01:00
committed by GitHub
parent 9e4c7af5e9
commit f7ccf9d0da
3 changed files with 82 additions and 51 deletions

View File

@@ -152,12 +152,11 @@ public:
/// @return the color space of the light determined by the model id reported by the bridge.
CiColorTriangle getColorSpace() const;
void saveOriginalState(const QJsonObject& values);
QString getOriginalState() const;
private:
void saveOriginalState(const QJsonObject& values);
Logger* _log;
/// light id
unsigned int _id;
@@ -200,12 +199,23 @@ public:
bool initRestAPI(const QString &hostname, int port, const QString &token );
///
/// @param route the route of the POST request.
/// @brief Perform a REST-API GET
///
/// @param route the route of the GET request.
///
/// @return the content of the GET request.
///
QJsonDocument get(const QString& route);
///
/// @brief Perform a REST-API POST
///
/// @param route the route of the POST request.
/// @param content the content of the POST request.
///
QJsonDocument post(const QString& route, const QString& content);
QJsonDocument getLightState(unsigned int lightId);
void setLightState(unsigned int lightId = 0, const QString &state = "");
QMap<quint16,QJsonObject> getLightMap() const;
@@ -421,7 +431,7 @@ protected:
///
/// @return True if success
///
//bool switchOn() override;
bool switchOn() override;
///
/// @brief Switch the LEDs off.
@@ -525,7 +535,6 @@ private:
/// The default of the Hue lights is 400 ms, but we may want it snappier.
int _transitionTime;
bool _lightStatesRestored;
bool _isInitLeds;
/// Array of the light ids.