Bug fixes

Former-commit-id: a6783a75edb83988d1737df3d4a7a14c71ec4223
This commit is contained in:
AEtHeLsYn 2016-03-13 11:59:36 +01:00
parent 84c48b9a0a
commit e4d77660a4
8 changed files with 115 additions and 16 deletions

View File

@ -18,6 +18,7 @@
#include <hyperion/ImageProcessor.h>
#include <hyperion/MessageForwarder.h>
#include <hyperion/ColorTransform.h>
#include <hyperion/ColorCorrection.h>
#include <utils/ColorRgb.h>
// project includes
@ -247,6 +248,10 @@ void JsonClientConnection::handleMessage(const std::string &messageString)
handleClearallCommand(message);
else if (command == "transform")
handleTransformCommand(message);
else if (command == "correction")
handleCorrectionCommand(message);
else if (command == "temperature")
handleTemperatureCommand(message);
else
handleNotImplemented();
}
@ -540,10 +545,10 @@ void JsonClientConnection::handleCorrectionCommand(const Json::Value &message)
const Json::Value & correction = message["correction"];
const std::string correctionId = correction.get("id", _hyperion->getCorrectionIds().front()).asString();
ColorCorrection * colorCorrection = _hyperion->getCorrection(CorrectionId);
ColorCorrection * colorCorrection = _hyperion->getCorrection(correctionId);
if (colorCorrection == nullptr)
{
//sendErrorReply(std::string("Incorrect transform identifier: ") + transformId);
//sendErrorReply(std::string("Incorrect correction identifier: ") + correctionId);
return;
}
@ -573,10 +578,10 @@ void JsonClientConnection::handleTemperatureCommand(const Json::Value &message)
const Json::Value & temperature = message["temperature"];
const std::string tempId = temperature.get("id", _hyperion->getTemperatureIds().front()).asString();
ColorCorrection * colorTemperature = _hyperion->getTemperature(TemperatureId);
ColorCorrection * colorTemperature = _hyperion->getTemperature(tempId);
if (colorTemperature == nullptr)
{
//sendErrorReply(std::string("Incorrect transform identifier: ") + transformId);
//sendErrorReply(std::string("Incorrect temperature identifier: ") + tempId);
return;
}

View File

@ -7,6 +7,8 @@
<file alias="schema-clear">schema/schema-clear.json</file>
<file alias="schema-clearall">schema/schema-clearall.json</file>
<file alias="schema-transform">schema/schema-transform.json</file>
<file alias="schema-correction">schema/schema-correction.json</file>
<file alias="schema-temperature">schema/schema-temperature.json</file>
<file alias="schema-effect">schema/schema-effect.json</file>
</qresource>
</RCC>

View File

@ -0,0 +1,41 @@
{
"type":"object",
"required":true,
"properties":{
"command": {
"type" : "string",
"required" : true,
"enum" : ["correction"]
},
"correction": {
"type": "object",
"required": true,
"properties": {
"id" : {
"type" : "string",
"required" : false
},
"red" : {
"type" : "number",
"required" : false,
"minimum": 0.0,
"maximum": 255.0
},
"green" : {
"type" : "number",
"required" : false,
"minimum": 0.0,
"maximum": 255.0
},
"blue" : {
"type" : "number",
"required" : false,
"minimum": 0.0,
"maximum": 255.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}

View File

@ -0,0 +1,41 @@
{
"type":"object",
"required":true,
"properties":{
"command": {
"type" : "string",
"required" : true,
"enum" : ["temperature"]
},
"temperature": {
"type": "object",
"required": true,
"properties": {
"id" : {
"type" : "string",
"required" : false
},
"red" : {
"type" : "number",
"required" : false,
"minimum": 0.0,
"maximum": 255.0
},
"green" : {
"type" : "number",
"required" : false,
"minimum": 0.0,
"maximum": 255.0
},
"blue" : {
"type" : "number",
"required" : false,
"minimum": 0.0,
"maximum": 255.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}

View File

@ -25,6 +25,16 @@
"required" : false,
"minimum" : 0.0
},
"saturationLGain" : {
"type" : "number",
"required" : false,
"minimum" : 0.0
},
"luminanceGain" : {
"type" : "number",
"required" : false,
"minimum" : 0.0
},
"threshold": {
"type": "array",
"required": false,

View File

@ -5,7 +5,7 @@
"command": {
"type" : "string",
"required" : true,
"enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform"]
"enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform", "correction", "temperature"]
}
}
}

View File

@ -309,7 +309,7 @@ void JsonConnection::setTemperature(std::string * temperatureId, int * red, int
command["command"] = "temperature";
Json::Value & temperature = command["temperature"];
if (correctionId != nullptr)
if (temperatureId != nullptr)
{
temperature["id"] = *temperatureId;
}

View File

@ -69,14 +69,14 @@ int main(int argc, char * argv[])
TransformParameter & argWhitelevel = parameters.add<TransformParameter>('w', "whitelevel", "Set the whitelevel of the leds (requires 3 space seperated values which are normally between 0.0 and 1.0)");
SwitchParameter<> & argPrint = parameters.add<SwitchParameter<> >(0x0, "print" , "Print the json input and output messages on stdout");
SwitchParameter<> & argHelp = parameters.add<SwitchParameter<> >('h', "help" , "Show this help message and exit");
StringParameter & argIdC = parameters.add<StringParameter> ('cq', "qualifier" , "Identifier(qualifier) of the correction to set");
IntParameter & argCorrR = parameters.add<IntParameter> ('cr', "correctionR" , "Specify the red channel correction factor");
IntParameter & argCorrG = parameters.add<IntParameter> ('cg', "correctionG" , "Specify the green channel correction factor");
IntParameter & argCorrB = parameters.add<IntParameter> ('cb', "correctionB" , "Specify the blue channel correction factor");
StringParameter & argIdT = parameters.add<StringParameter> ('tq', "qualifier" , "Identifier(qualifier) of the temperature to set");
IntParameter & argTempR = parameters.add<IntParameter> ('tr', "tempR" , "Specify the red channel temperature factor");
IntParameter & argTempG = parameters.add<IntParameter> ('tg', "tempG" , "Specify the red channel temperature factor");
IntParameter & argTempB = parameters.add<IntParameter> ('tb', "tempB" , "Specify the red channel temperature factor");
StringParameter & argIdC = parameters.add<StringParameter> ('y', "qualifier" , "Identifier(qualifier) of the correction to set");
IntParameter & argCorrR = parameters.add<IntParameter> ('1', "correctionR" , "Specify the red channel correction factor");
IntParameter & argCorrG = parameters.add<IntParameter> ('2', "correctionG" , "Specify the green channel correction factor");
IntParameter & argCorrB = parameters.add<IntParameter> ('3', "correctionB" , "Specify the blue channel correction factor");
StringParameter & argIdT = parameters.add<StringParameter> ('z', "qualifier" , "Identifier(qualifier) of the temperature to set");
IntParameter & argTempR = parameters.add<IntParameter> ('4', "tempR" , "Specify the red channel temperature factor");
IntParameter & argTempG = parameters.add<IntParameter> ('5', "tempG" , "Specify the red channel temperature factor");
IntParameter & argTempB = parameters.add<IntParameter> ('6', "tempB" , "Specify the red channel temperature factor");
// set the default values
argAddress.setDefault(defaultServerAddress.toStdString());
@ -203,7 +203,7 @@ int main(int argc, char * argv[])
argIdC.isSet() ? &transId : nullptr,
argCorrR.isSet() ? &red : nullptr,
argCorrG.isSet() ? &green : nullptr,
argCorrB.isSet() ? &blue : nullptr,
argCorrB.isSet() ? &blue : nullptr);
}
else if (colorTemp)
{
@ -219,7 +219,7 @@ int main(int argc, char * argv[])
argIdC.isSet() ? &transId : nullptr,
argTempR.isSet() ? &red : nullptr,
argTempG.isSet() ? &green : nullptr,
argTempB.isSet() ? &blue : nullptr,
argTempB.isSet() ? &blue : nullptr);
}
}
catch (const std::runtime_error & e)