mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Implemented set transform for the json server
This commit is contained in:
@@ -145,6 +145,45 @@ void Hyperion::setColors(int priority, std::vector<RgbColor>& ledColors, const i
|
||||
}
|
||||
}
|
||||
|
||||
void Hyperion::setTransform(Hyperion::Transform transform, Hyperion::Color color, double value)
|
||||
{
|
||||
// select the transform of the requested color
|
||||
ColorTransform * t = nullptr;
|
||||
switch (color)
|
||||
{
|
||||
case RED:
|
||||
t = _redTransform;
|
||||
break;
|
||||
case GREEN:
|
||||
t = _greenTransform;
|
||||
break;
|
||||
case BLUE:
|
||||
t = _blueTransform;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
|
||||
// set transform value
|
||||
switch (transform)
|
||||
{
|
||||
case THRESHOLD:
|
||||
t->setThreshold(value);
|
||||
break;
|
||||
case GAMMA:
|
||||
t->setGamma(value);
|
||||
break;
|
||||
case BLACKLEVEL:
|
||||
t->setBlacklevel(value);
|
||||
break;
|
||||
case WHITELEVEL:
|
||||
t->setWhitelevel(value);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Hyperion::clear(int priority)
|
||||
{
|
||||
if (_muxer.hasPriority(priority))
|
||||
|
@@ -175,7 +175,41 @@ void JsonClientConnection::handleClearallCommand(const Json::Value &)
|
||||
|
||||
void JsonClientConnection::handleTransformCommand(const Json::Value &message)
|
||||
{
|
||||
handleNotImplemented();
|
||||
const Json::Value & transform = message["transform"];
|
||||
|
||||
if (transform.isMember("threshold"))
|
||||
{
|
||||
const Json::Value & threshold = transform["threshold"];
|
||||
_hyperion->setTransform(Hyperion::THRESHOLD, Hyperion::RED, threshold[0u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::THRESHOLD, Hyperion::GREEN, threshold[1u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::THRESHOLD, Hyperion::BLUE, threshold[2u].asDouble());
|
||||
}
|
||||
|
||||
if (transform.isMember("gamma"))
|
||||
{
|
||||
const Json::Value & threshold = transform["gamma"];
|
||||
_hyperion->setTransform(Hyperion::GAMMA, Hyperion::RED, threshold[0u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::GAMMA, Hyperion::GREEN, threshold[1u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::GAMMA, Hyperion::BLUE, threshold[2u].asDouble());
|
||||
}
|
||||
|
||||
if (transform.isMember("blacklevel"))
|
||||
{
|
||||
const Json::Value & threshold = transform["blacklevel"];
|
||||
_hyperion->setTransform(Hyperion::BLACKLEVEL, Hyperion::RED, threshold[0u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::BLACKLEVEL, Hyperion::GREEN, threshold[1u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::BLACKLEVEL, Hyperion::BLUE, threshold[2u].asDouble());
|
||||
}
|
||||
|
||||
if (transform.isMember("whitelevel"))
|
||||
{
|
||||
const Json::Value & threshold = transform["whitelevel"];
|
||||
_hyperion->setTransform(Hyperion::WHITELEVEL, Hyperion::RED, threshold[0u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::WHITELEVEL, Hyperion::GREEN, threshold[1u].asDouble());
|
||||
_hyperion->setTransform(Hyperion::WHITELEVEL, Hyperion::BLUE, threshold[2u].asDouble());
|
||||
}
|
||||
|
||||
sendSuccessReply();
|
||||
}
|
||||
|
||||
void JsonClientConnection::handleNotImplemented()
|
||||
|
Reference in New Issue
Block a user