Commit 3eafde53 authored by Langston Ball's avatar Langston Ball

Merge branch 'master' of git.linuxmce.org:linuxmce/linuxmce

Conflicts:
	src/pluto_main/Define_Criteria.h
parents c6fffac6 61ba0e32
This diff is collapsed.
......@@ -255,6 +255,11 @@ private:
static const char renameLight[]; /*!< Rename the light \note put */
static const char setLightState[]; /*!< Set properties on the light */
QStringList m_extendedColorLightModels;
QStringList m_colorLightModels;
QStringList m_colorTemperatureModels;
QStringList m_dimmableModels;
};
//<-dceag-end-b->
......
......@@ -19,7 +19,7 @@ AbstractWirelessBulb::AbstractWirelessBulb(HueControllerHardware *p_controller,
m_implementsColor(false),
m_implementsColorTemp(false)
{
conversionVar = ceil(65280 / 360);
conversionVar = ceil(65280 / 360);
m_rgbColor.setRgb(0,0,0);
m_hslColor = m_rgbColor.toHsl();
......@@ -87,7 +87,7 @@ double AbstractWirelessBulb::CurrentLevel() const
void AbstractWirelessBulb::setCurrentLevel(double CurrentLevel)
{
if(m_CurrentLevel == CurrentLevel) return;
if(m_CurrentLevel == CurrentLevel) return;
m_CurrentLevel = CurrentLevel;
emit currentLevelChanged();
......@@ -107,9 +107,9 @@ void AbstractWirelessBulb::setPowerOn(bool powerOn)
emit powerOnChanged();
if(linuxmceId()==0)
return;
return;
emit dceMessage(EVENT_Device_OnOff_CONST);
emit dceMessage(EVENT_Device_OnOff_CONST);
}
int AbstractWirelessBulb::bulbType() const
{
......@@ -188,24 +188,15 @@ void AbstractWirelessBulb::proccessStateInformation(QVariantMap d)
setEffect(stateInfo["effect"].toString());
setCurrentLevel(stateInfo["bri"].toUInt()/2.55);
switch (m_deviceTemplate) {
case DEVICETEMPLATE_Hue_Lightbulb_CONST :
setCurrentColor(stateInfo);
setCurrentColorTemp(stateInfo["ct"].toInt());
break;
case DEVICETEMPLATE_Hue_Light_Strips_CONST :
if( this->getImplementsColor() ){
setCurrentColor(stateInfo);
setCurrentColorTemp(stateInfo["ct"].toInt());
break;
case DEVICETEMPLATE_Hue_Lux_Bulb_CONST :
setBrightness(stateInfo["bri"].toDouble());
break;
case DEVICETEMPLATE_Connected_A19_60w_Equivalent_CONST :
}
if(this->getImplementsColorTemp()){
setBrightness(stateInfo["bri"].toDouble());
break;
default:
break;
setCurrentColorTemp(stateInfo["ct"].toInt());
}
}
int AbstractWirelessBulb::getCurrentColorTemp() const
......@@ -216,8 +207,31 @@ int AbstractWirelessBulb::getCurrentColorTemp() const
void AbstractWirelessBulb::setCurrentColorTemp(int value)
{
if(currentColorTemp == value) return;
currentColorTemp = value;
if(getDeviceTemplate() == DEVICETEMPLATE_Hue_White_Ambiance_CONST ){
QVariantMap colorTempBlock;
colorTempBlock["defaultColorTemp"]= defaultColor;
colorTempBlock["alarmColorTemp"] = alertColor;
colorTempBlock["currentColorTemp"] = currentColorTemp;
QJsonObject out;
out.insert("color", QJsonValue::fromVariant(colorTempBlock));
QJsonDocument doc;
doc.setObject(out);
DCE::CMD_Set_Device_Data cmd(
this->linuxmceId(),
4,
this->linuxmceId(),
QString::fromUtf8(doc.toJson()).toStdString().c_str(),
DEVICEDATA_Mapping_CONST );
emit dataEvent(cmd);
}
}
bool AbstractWirelessBulb::getImplementsColorTemp() const
......@@ -278,8 +292,6 @@ void AbstractWirelessBulb::setCurrentColor(const QVariantMap &value)
QJsonDocument doc;
doc.setObject(out);
DCE::CMD_Set_Device_Data cmd(
this->linuxmceId(),
4,
......@@ -299,15 +311,23 @@ void AbstractWirelessBulb::setDeviceTemplate(long deviceTemplate)
{
m_deviceTemplate = deviceTemplate;
switch (m_deviceTemplate) {
case DEVICETEMPLATE_Hue_Lightbulb_CONST :
case DEVICETEMPLATE_Hue_Light_Strips_CONST :
case DEVICETEMPLATE_Hue_Extended_Color_Bulb_CONST :
setImplementsColor(true);
setImplementsColorTemp(true);
case DEVICETEMPLATE_Hue_Color_Light_Bulb_CONST:
setImplementsColor(true);
case DEVICETEMPLATE_Hue_Light_Strips_CONST :
setImplementsColor(true);
if(lightModel()=="LST002"){
setImplementsColorTemp(true);
}
break;
case DEVICETEMPLATE_Hue_Lux_Bulb_CONST :
setImplementsColorTemp(true);
case DEVICETEMPLATE_Hue_White_Ambiance_CONST:
setImplementsColorTemp(true);
break;
default:
setImplementsColor(false);
setImplementsColorTemp(false);
break;
}
}
......@@ -387,7 +407,7 @@ void AbstractWirelessBulb::setUniqueId(const QString &uniqueId)
void AbstractWirelessBulb::setRgb(int r, int g, int b)
{
m_rgbColor = QColor::fromRgb(r,g,b);
emit rgbColorChanged();
emit rgbColorChanged();
}
......
......@@ -185,7 +185,6 @@ private:
QVariantMap alertColor;
QVariantMap defaultColor;
HueControllerHardware *mp_controller;
QMap<QString, int> deviceMap;
......
......@@ -5,6 +5,7 @@
#define CRITERIA_Watching_Media_CONST 2
#define CRITERIA_Stop_Watching_CONST 3
#define CRITERIA_TABLE "Criteria"
#define CRITERIA_PK_CRITERIA_FIELD "PK_Criteria"
#define CRITERIA_PK_CRITERIA_TABLE_FIELD "Criteria.PK_Criteria"
......
......@@ -2086,7 +2086,7 @@
#define DEVICETEMPLATE_3M50_CONST 2254
#define DEVICETEMPLATE_YouTube_Player_CONST 2255
#define DEVICETEMPLATE_Hue_Controller_CONST 2256
#define DEVICETEMPLATE_Hue_Lightbulb_CONST 2257
#define DEVICETEMPLATE_Hue_Extended_Color_Bulb_CONST 2257
#define DEVICETEMPLATE_Cisco_7941_CONST 2258
#define DEVICETEMPLATE_OMX_Player_CONST 2259
#define DEVICETEMPLATE_OMX_Plugin_CONST 2260
......@@ -2182,6 +2182,8 @@
#define DEVICETEMPLATE_Hue_Temperature_Sensor_CONST 2359
#define DEVICETEMPLATE_Connected_A19_60w_Equivalent_CONST 2360
#define DEVICETEMPLATE_Ambient_Light_Sensor_CONST 2361
#define DEVICETEMPLATE_Hue_White_Ambiance_CONST 2362
#define DEVICETEMPLATE_Hue_Color_Light_Bulb_CONST 2363
#define DEVICETEMPLATE_TABLE "DeviceTemplate"
#define DEVICETEMPLATE_PK_DEVICETEMPLATE_FIELD "PK_DeviceTemplate"
......
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