Skip to content

Commit

Permalink
TRANSITION_TIME fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hfedcba committed Aug 1, 2016
1 parent 651018c commit d530ea8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions misc/Device Description Files/LCT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@
<key>on</key>
<parameterId>STATE</parameterId>
</element>
<element>
<key>bri</key>
<parameterId>BRIGHTNESS</parameterId>
</element>
</jsonPayload>
</packet>
<packet id="FAST_STATE_SET">
Expand All @@ -282,6 +286,10 @@
<key>on</key>
<parameterId>STATE</parameterId>
</element>
<element>
<key>bri</key>
<parameterId>BRIGHTNESS</parameterId>
</element>
</jsonPayload>
</packet>
<packet id="XY_SET">
Expand Down
8 changes: 8 additions & 0 deletions misc/Device Description Files/LWB.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
<key>on</key>
<parameterId>STATE</parameterId>
</element>
<element>
<key>bri</key>
<parameterId>BRIGHTNESS</parameterId>
</element>
</jsonPayload>
</packet>
<packet id="FAST_STATE_SET">
Expand All @@ -130,6 +134,10 @@
<key>on</key>
<parameterId>STATE</parameterId>
</element>
<element>
<key>bri</key>
<parameterId>BRIGHTNESS</parameterId>
</element>
</jsonPayload>
</packet>
</packets>
Expand Down
11 changes: 11 additions & 0 deletions src/PhilipsHuePeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,12 @@ void PhilipsHuePeer::packetReceived(std::shared_ptr<PhilipsHuePacket> packet)
rpcValues[*j].reset(new std::vector<PVariable>());
}

if(!_state && (i->first == "BRIGHTNESS" || i->first == "FAST_BRIGHTNESS"))
{
GD::out.printInfo("Info: Ignoring BRIGHTNESS.");
continue;
}

parameter->data = i->second.value;
if(parameter->databaseID > 0) saveParameter(parameter->databaseID, parameter->data);
else saveParameter(0, ParameterGroup::Type::Enum::variables, *j, i->first, parameter->data);
Expand Down Expand Up @@ -439,6 +445,8 @@ void PhilipsHuePeer::packetReceived(std::shared_ptr<PhilipsHuePacket> packet)

valueKeys[*j]->push_back(i->first);
rpcValues[*j]->push_back(parameter->rpcParameter->convertFromPacket(i->second.value, true));

if(i->first == "STATE" || i->first == "FAST_STATE") _state = rpcValues[*j]->back()->booleanValue;
}
}
}
Expand Down Expand Up @@ -879,6 +887,8 @@ PVariable PhilipsHuePeer::setValue(BaseLib::PRpcClientInfo clientInfo, uint32_t
return PVariable(new Variable(VariableType::tVoid));
}

if(valueKey == "STATE" || valueKey == "FAST_STATE") _state = value->booleanValue;

if(rpcParameter->physical->operationType == IPhysical::OperationType::Enum::store)
{
rpcParameter->convertToPacket(value, parameter->data);
Expand Down Expand Up @@ -959,6 +969,7 @@ PVariable PhilipsHuePeer::setValue(BaseLib::PRpcClientInfo clientInfo, uint32_t
}

std::shared_ptr<PhilipsHueCentral> central = std::dynamic_pointer_cast<PhilipsHueCentral>(getCentral());
json->print(false, true);
std::shared_ptr<PhilipsHuePacket> packet(new PhilipsHuePacket(central->getAddress(), _address, frame->type, json));
if(central) central->sendPacket(_physicalInterface, packet);
}
Expand Down
1 change: 1 addition & 0 deletions src/PhilipsHuePeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class PhilipsHuePeer : public BaseLib::Systems::Peer
std::shared_ptr<BaseLib::RPC::RPCEncoder> _binaryEncoder;
std::shared_ptr<BaseLib::RPC::RPCDecoder> _binaryDecoder;

bool _state = false;
BaseLib::Math::Triangle _rgbGamut;
double _gamma = 2.2;
BaseLib::Math::Matrix3x3 _rgbXyzConversionMatrix;
Expand Down

0 comments on commit d530ea8

Please sign in to comment.