Commit 106bcdf8 authored by Langston Ball's avatar Langston Ball

ref #2794 Fix some stupid errors, limit signals, remove qjson depenency

parent 5ce4342a
...@@ -1395,6 +1395,7 @@ void HueController::handleCheckLightInformation(QNetworkReply *reply) ...@@ -1395,6 +1395,7 @@ void HueController::handleCheckLightInformation(QNetworkReply *reply)
QVariantMap p = QJsonDocument::fromJson(rep).object().toVariantMap(); QVariantMap p = QJsonDocument::fromJson(rep).object().toVariantMap();
if(p.isEmpty()){ if(p.isEmpty()){
qDebug() << " Empty Reply !" ; qDebug() << " Empty Reply !" ;
return;
} }
foreach(AbstractWirelessBulb*b, hueBulbs){ foreach(AbstractWirelessBulb*b, hueBulbs){
...@@ -1500,7 +1501,7 @@ void HueController::handleLightEvent(int whichEvent) ...@@ -1500,7 +1501,7 @@ void HueController::handleLightEvent(int whichEvent)
if(whichEvent==EVENT_Device_OnOff_CONST ){ if(whichEvent==EVENT_Device_OnOff_CONST ){
if(b->linuxmceId()==0)return; if(b->linuxmceId()==0)return;
// qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
DCE::Message *m = new DCE::Message ( DCE::Message *m = new DCE::Message (
b->linuxmceId(), b->linuxmceId(),
......
...@@ -15,7 +15,7 @@ INCLUDEPATH += /usr/include/qjson/ \ ...@@ -15,7 +15,7 @@ INCLUDEPATH += /usr/include/qjson/ \
../../ \ ../../ \
../../DCE/ ../../DCE/
LIBS += -lqjson
DESTDIR=../../bin DESTDIR=../../bin
include (../../QtCommonIncludes/PlutoUtils.pri) include (../../QtCommonIncludes/PlutoUtils.pri)
......
...@@ -86,10 +86,11 @@ double AbstractWirelessBulb::CurrentLevel() const ...@@ -86,10 +86,11 @@ double AbstractWirelessBulb::CurrentLevel() const
void AbstractWirelessBulb::setCurrentLevel(double CurrentLevel) void AbstractWirelessBulb::setCurrentLevel(double CurrentLevel)
{ {
if(m_CurrentLevel == CurrentLevel) return; if(m_CurrentLevel == CurrentLevel) return;
m_CurrentLevel = CurrentLevel; m_CurrentLevel = CurrentLevel;
emit currentLevelChanged(); emit currentLevelChanged();
qDebug() << Q_FUNC_INFO;
emit dceMessage(EVENT_State_Changed_CONST); emit dceMessage(EVENT_State_Changed_CONST);
} }
bool AbstractWirelessBulb::powerOn() const bool AbstractWirelessBulb::powerOn() const
...@@ -99,21 +100,15 @@ bool AbstractWirelessBulb::powerOn() const ...@@ -99,21 +100,15 @@ bool AbstractWirelessBulb::powerOn() const
void AbstractWirelessBulb::setPowerOn(bool powerOn) void AbstractWirelessBulb::setPowerOn(bool powerOn)
{ {
if(m_powerOn == powerOn) return;
bool stateChanged=false;
if(m_powerOn != powerOn) stateChanged=true;
m_powerOn = powerOn; m_powerOn = powerOn;
emit powerOnChanged(); emit powerOnChanged();
if(linuxmceId()==0) if(linuxmceId()==0)
return; return;
qDebug() << Q_FUNC_INFO;
if(stateChanged){ emit dceMessage(EVENT_Device_OnOff_CONST);
emit dceMessage(EVENT_Device_OnOff_CONST);
}
} }
int AbstractWirelessBulb::bulbType() const int AbstractWirelessBulb::bulbType() const
{ {
...@@ -198,11 +193,11 @@ void AbstractWirelessBulb::proccessStateInformation(QVariantMap d) ...@@ -198,11 +193,11 @@ void AbstractWirelessBulb::proccessStateInformation(QVariantMap d)
break; break;
case DEVICETEMPLATE_Hue_Light_Strips_CONST : case DEVICETEMPLATE_Hue_Light_Strips_CONST :
setCurrentColor(stateInfo); setCurrentColor(stateInfo);
setCurrentLevel(stateInfo["bri"].toUInt()/2.55);
break; break;
case DEVICETEMPLATE_Hue_Lux_Bulb_CONST : case DEVICETEMPLATE_Hue_Lux_Bulb_CONST :
setCurrentColor(stateInfo); setCurrentColor(stateInfo);
setCurrentLevel(stateInfo["bri"].toUInt()/2.55);
break; break;
case DEVICETEMPLATE_Connected_A19_60w_Equivalent_CONST : case DEVICETEMPLATE_Connected_A19_60w_Equivalent_CONST :
setBrightness(stateInfo["bri"].toDouble()); setBrightness(stateInfo["bri"].toDouble());
...@@ -340,6 +335,7 @@ void AbstractWirelessBulb::setBrightness(const quint8 &brightness) ...@@ -340,6 +335,7 @@ void AbstractWirelessBulb::setBrightness(const quint8 &brightness)
emit dceMessage(EVENT_Brightness_Changed_CONST); emit dceMessage(EVENT_Brightness_Changed_CONST);
emit dceMessage(EVENT_State_Changed_CONST); emit dceMessage(EVENT_State_Changed_CONST);
qDebug() << Q_FUNC_INFO;
} }
QString AbstractWirelessBulb::uniqueId() const QString AbstractWirelessBulb::uniqueId() const
......
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