Update JsonConnection.cpp

Former-commit-id: 7b748e605939b65f02cb768a924faa48787618c3
This commit is contained in:
AEtHeLsYn 2016-03-11 12:30:32 +01:00
parent 8fce604ccb
commit a5e042225e

View File

@ -192,7 +192,7 @@ void JsonConnection::clearAll()
parseReply(reply);
}
void JsonConnection::setTransform(std::string * transformId, double * saturation, double * value, ColorTransformValues *threshold, ColorTransformValues *gamma, ColorTransformValues *blacklevel, ColorTransformValues *whitelevel)
void JsonConnection::setTransform(std::string * transformId, double * saturation, double * value, double * saturationL, double * luminance, ColorTransformValues *threshold, ColorTransformValues *gamma, ColorTransformValues *blacklevel, ColorTransformValues *whitelevel)
{
std::cout << "Set color transforms" << std::endl;
@ -216,6 +216,15 @@ void JsonConnection::setTransform(std::string * transformId, double * saturation
transform["valueGain"] = *value;
}
if (saturation != nullptr)
{
transform["saturationLGain"] = *saturationL;
}
if (value != nullptr)
{
transform["luminanceGain"] = *luminance;
}
if (threshold != nullptr)
{
Json::Value & v = transform["threshold"];
@ -255,6 +264,78 @@ void JsonConnection::setTransform(std::string * transformId, double * saturation
parseReply(reply);
}
void JsonConnection::setCorrection(std::string * correctionId, int * red, int * green, int * blue)
{
std::cout << "Set color corrections" << std::endl;
// create command
Json::Value command;
command["command"] = "correction";
Json::Value & correction = command["correction"];
if (correctionId != nullptr)
{
correction["id"] = *correctionId;
}
if (red != nullptr)
{
correction["red"] = *red;
}
if (green != nullptr)
{
correction["green"] = *green;
}
if (blue != nullptr)
{
correction["blue"] = *blue;
}
// send command message
Json::Value reply = sendMessage(command);
// parse reply message
parseReply(reply);
}
void JsonConnection::setTemperature(std::string * temperatureId, int * red, int * green, int * blue)
{
std::cout << "Set color temperature corrections" << std::endl;
// create command
Json::Value command;
command["command"] = "temperature";
Json::Value & temperature = command["temperature"];
if (correctionId != nullptr)
{
temperature["id"] = *temperatureId;
}
if (red != nullptr)
{
temperature["red"] = *red;
}
if (green != nullptr)
{
temperature["green"] = *green;
}
if (blue != nullptr)
{
temperature["blue"] = *blue;
}
// send command message
Json::Value reply = sendMessage(command);
// parse reply message
parseReply(reply);
}
Json::Value JsonConnection::sendMessage(const Json::Value & message)
{
// serialize message (FastWriter already appends a newline)