Commit 081db8f2 authored by golgoj4's avatar golgoj4

refs #2366 - adds hue lux bulb, fixes some initialization issues for the bulb...

refs #2366 - adds hue lux bulb, fixes some initialization issues for the bulb device data, adds const for the default color.
parent b45284ae
......@@ -538,7 +538,7 @@ void HueController::CreateChildren()
if(hueBulbs.at(n)->getController()->getIpAddress() == p.at(0)&& hueBulbs.at(n)->id()==lightID ){
hueBulbs.at(n)->setLinuxmceId(linuxmceID);
hueBulbs.at(n)->setBrightness(0);
hueBulbs.at(n)->setPowerOn(true);
hueBulbs.at(n)->setPowerOn(false);
qDebug() << "Linked existing light with linuxmce db. " << hueBulbs.at(n)->displayName();
}
}
......@@ -546,10 +546,6 @@ void HueController::CreateChildren()
}
for (int n = 0; n < hueBulbs.size(); n++){
hueBulbs.at(n)->setPowerOn(true);
}
pCommand->m_pParent = this;
pCommand->CreateChildren();
m_mapCommandImpl_Children[pDeviceData_Impl_Child->m_dwPK_Device] = pCommand;
......
......@@ -50,9 +50,11 @@ SOURCES += ../Main.cpp \
huecontrollerhardware.cpp \
huebulb.cpp \
../huecommand.cpp \
abstractwirelessbulb.cpp
abstractwirelessbulb.cpp \
hueluxbulb.cpp
HEADERS += ../../PlutoUtils/ThreadedClass.h \
HEADERS += \
../../PlutoUtils/ThreadedClass.h \
../../PlutoUtils/MultiThreadIncludes.h \
../../PlutoUtils/StringUtils.h \
../../PlutoUtils/CommonIncludes.h \
......@@ -77,4 +79,5 @@ HEADERS += ../../PlutoUtils/ThreadedClass.h \
huecontrollerhardware.h \
huebulb.h \
../huecommand.h \
abstractwirelessbulb.h
abstractwirelessbulb.h \
hueluxbulb.h
......@@ -7,11 +7,11 @@
AbstractWirelessBulb::AbstractWirelessBulb(HueControllerHardware *p_controller, QObject *parent) :
QObject(parent),
mp_controller(p_controller),
m_CurrentLevel(0.0)
m_CurrentLevel(0.0),
m_powerOn(false),
m_brightness(0)
{
setPowerOn(false);
setBrightness(0);
qDebug() << Q_FUNC_INFO << "ctor";
qDebug() << Q_FUNC_INFO << "ctor";
if(mp_controller){
qDebug() << Q_FUNC_INFO << "contoller IP::" << mp_controller->getIpAddress();
} else {
......
......@@ -123,6 +123,7 @@ public slots:
void setController(HueControllerHardware * c);
virtual void proccessStateInformation(QVariantMap d)=0;
virtual void resetColor() { setColor(QColor("#90C638")); }
private:
......@@ -155,7 +156,6 @@ private:
HueControllerHardware *mp_controller;
QMap<QString, int> deviceMap;
};
......
......@@ -5,7 +5,7 @@
HueBulb::HueBulb(HueControllerHardware *hw)
{
setController(hw);
setPowerOn(false);
setBrightness(0);
}
......@@ -20,7 +20,7 @@ void HueBulb::proccessStateInformation(QVariantMap d)
setOnline(stateInfo["reachable"].toBool());
setPowerOn(stateInfo["on"].toBool());
setAlert(stateInfo["alert"].toString());
setAlert(stateInfo["effect"].toString());
setEffect(stateInfo["effect"].toString());
setSoftwareVersion(d["swversion"].toString());
setLightModel(d["modelid"].toString());
setLightType(d["type"].toString());
......
......@@ -31,6 +31,7 @@ public:
explicit HueBulb(HueControllerHardware *hw);
HueBulb(){}
const QString resetColor="#90C638";
signals:
public slots:
......
#include "hueluxbulb.h"
#include <QDebug>
#include <QVariant>
HueLuxBulb::HueLuxBulb(HueControllerHardware *hw)
{
setController(hw);
setBrightness(0);
}
void HueLuxBulb::proccessStateInformation(QVariantMap d)
{
QVariantMap stateInfo = d["state"].toMap();
setDisplayName(d["name"].toString());
setBrightness(stateInfo["bri"].toDouble());
setCurrentLevel(stateInfo["bri"].toUInt()/2.55);
setOnline(stateInfo["reachable"].toBool());
setPowerOn(stateInfo["on"].toBool());
setAlert(stateInfo["alert"].toString());
setEffect(stateInfo["effect"].toString());
setSoftwareVersion(d["swversion"].toString());
setLightModel(d["modelid"].toString());
setLightType(d["type"].toString());
}
#ifndef HUELUXBULB_H
#define HUELUXBULB_H
#include <QObject>
#include <QMap>
#include "abstractwirelessbulb.h"
class QVariant;
class HueLuxBulb : public AbstractWirelessBulb
{
Q_OBJECT
public:
explicit HueLuxBulb(HueControllerHardware *hw);
HueLuxBulb(){}
signals:
public slots:
void proccessStateInformation(QVariantMap d);
};
#endif // HUELUXBULB_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment