mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
sourceOff feature + small json refactoring (#151)
* add --sourceOff to hyperion-remote - this will select "off" source and set all leds to black refactor new json stuff make schema checker not so strict, do not require values that have defaults (not finished yet) initialEffect config: effect is always an array, regardless if it is a color or an effect name * make off source visible in active priority list * transform initialeffect to qjson (except part of effect-args, this needs effectengine transformed to qjson) * remove unneeded comment * add web ui for source selection. call http://hyperion_host:8099/select/index.html current example needed json server on port 19444
This commit is contained in:
@@ -557,6 +557,8 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile)
|
||||
, _hwLedCount(_ledString.leds().size())
|
||||
, _sourceAutoSelectEnabled(true)
|
||||
{
|
||||
registerPriority("Off", PriorityMuxer::LOWEST_PRIORITY);
|
||||
|
||||
if (!_raw2ledAdjustment->verifyAdjustments())
|
||||
{
|
||||
throw std::runtime_error("Color adjustment incorrectly set");
|
||||
@@ -679,14 +681,15 @@ void Hyperion::setComponentState(const Components component, const bool state)
|
||||
break;
|
||||
case KODICHECKER:
|
||||
{
|
||||
KODIVideoChecker* _kodiVideoChecker = KODIVideoChecker::getInstance();
|
||||
if (_kodiVideoChecker != nullptr)
|
||||
state ? _kodiVideoChecker->start() : _kodiVideoChecker->stop();
|
||||
KODIVideoChecker* kodiVideoChecker = KODIVideoChecker::getInstance();
|
||||
if (kodiVideoChecker != nullptr)
|
||||
state ? kodiVideoChecker->start() : kodiVideoChecker->stop();
|
||||
else
|
||||
Debug(_log, "Can't get instance from: '%s'", componentToString(component));
|
||||
break;
|
||||
}
|
||||
case FORWARDER:
|
||||
//_messageForwarder
|
||||
break;
|
||||
case UDPLISTENER:
|
||||
break;
|
||||
|
@@ -14,6 +14,8 @@ PriorityMuxer::PriorityMuxer(int ledCount)
|
||||
_lowestPriorityInfo.priority = LOWEST_PRIORITY;
|
||||
_lowestPriorityInfo.timeoutTime_ms = -1;
|
||||
_lowestPriorityInfo.ledColors = std::vector<ColorRgb>(ledCount, {0, 0, 0});
|
||||
|
||||
_activeInputs[_currentPriority] = _lowestPriorityInfo;
|
||||
}
|
||||
|
||||
PriorityMuxer::~PriorityMuxer()
|
||||
@@ -33,21 +35,15 @@ QList<int> PriorityMuxer::getPriorities() const
|
||||
|
||||
bool PriorityMuxer::hasPriority(const int priority) const
|
||||
{
|
||||
return _activeInputs.contains(priority);
|
||||
return (priority == LOWEST_PRIORITY) ? true : _activeInputs.contains(priority);
|
||||
}
|
||||
|
||||
const PriorityMuxer::InputInfo& PriorityMuxer::getInputInfo(const int priority) const
|
||||
{
|
||||
if (priority == LOWEST_PRIORITY)
|
||||
{
|
||||
return _lowestPriorityInfo;
|
||||
}
|
||||
|
||||
auto elemIt = _activeInputs.find(priority);
|
||||
if (elemIt == _activeInputs.end())
|
||||
{
|
||||
std::cout << "error " << priority << std::endl;
|
||||
throw std::runtime_error("HYPERION (prioritymux) ERROR: no such priority");
|
||||
throw std::runtime_error("HYPERION (prioritymuxer) ERROR: no such priority");
|
||||
}
|
||||
return elemIt.value();
|
||||
}
|
||||
@@ -64,14 +60,10 @@ void PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& le
|
||||
|
||||
void PriorityMuxer::clearInput(const int priority)
|
||||
{
|
||||
_activeInputs.remove(priority);
|
||||
if (_currentPriority == priority)
|
||||
if (priority < LOWEST_PRIORITY)
|
||||
{
|
||||
if (_activeInputs.empty())
|
||||
{
|
||||
_currentPriority = LOWEST_PRIORITY;
|
||||
}
|
||||
else
|
||||
_activeInputs.remove(priority);
|
||||
if (_currentPriority == priority)
|
||||
{
|
||||
QList<int> keys = _activeInputs.keys();
|
||||
_currentPriority = *std::min_element(keys.begin(), keys.end());
|
||||
@@ -83,6 +75,7 @@ void PriorityMuxer::clearAll()
|
||||
{
|
||||
_activeInputs.clear();
|
||||
_currentPriority = LOWEST_PRIORITY;
|
||||
_activeInputs[_currentPriority] = _lowestPriorityInfo;
|
||||
}
|
||||
|
||||
void PriorityMuxer::setCurrentTime(const int64_t& now)
|
||||
|
@@ -6,13 +6,11 @@
|
||||
"logger" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : true,
|
||||
"properties" :
|
||||
{
|
||||
"level" :
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : true
|
||||
"enum" : ["silent", "warn", "verbose", "debug"]
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
@@ -50,7 +48,7 @@
|
||||
"required" : false
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
"additionalProperties" : true
|
||||
},
|
||||
"color" :
|
||||
{
|
||||
@@ -364,44 +362,37 @@
|
||||
"smoothing":
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : true,
|
||||
"properties" :
|
||||
{
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"type" :
|
||||
{
|
||||
"enum" : ["none", "linear"],
|
||||
"required" : true
|
||||
"enum" : ["linear"]
|
||||
},
|
||||
"time_ms" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : false,
|
||||
"minimum" : 25,
|
||||
"maximum": 600
|
||||
},
|
||||
"updateFrequency" :
|
||||
{
|
||||
"type" : "number",
|
||||
"required" : false,
|
||||
"minimum" : 1.000,
|
||||
"maximum": 100.000
|
||||
},
|
||||
"updateDelay" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : false,
|
||||
"minimum" : 0,
|
||||
"maximum": 2048
|
||||
},
|
||||
"continuousOutput" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : false
|
||||
"type" : "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
@@ -503,88 +494,120 @@
|
||||
"framegrabber" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : false,
|
||||
"properties" :
|
||||
{
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"type" :
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : true
|
||||
"type" : "string"
|
||||
},
|
||||
"width" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : false
|
||||
"type" : "integer"
|
||||
},
|
||||
"height" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : false
|
||||
"type" : "integer"
|
||||
},
|
||||
"frequency_Hz" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : true
|
||||
"minimum" : 0
|
||||
},
|
||||
"priority" :
|
||||
{
|
||||
"type" : "integer"
|
||||
},
|
||||
"cropLeft" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : true
|
||||
"minimum" : 0
|
||||
},
|
||||
"cropRight" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
"cropTop" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
"cropBottom" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
"useXGetImage" :
|
||||
{
|
||||
"type" : "boolean"
|
||||
},
|
||||
"horizontalPixelDecimation" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
"verticalPixelDecimation" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
},
|
||||
"device" :
|
||||
{
|
||||
"type" : "string"
|
||||
},
|
||||
"display" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"minimum" : 0
|
||||
}
|
||||
},
|
||||
"additionalProperties" : true
|
||||
"additionalProperties" : false
|
||||
},
|
||||
"blackborderdetector" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : true,
|
||||
"properties" :
|
||||
{
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"threshold" :
|
||||
{
|
||||
"type" : "number",
|
||||
"required" : true,
|
||||
"minimum" : 0.0,
|
||||
"maximum" : 1.0
|
||||
},
|
||||
"unknownFrameCnt" :
|
||||
{
|
||||
"type" : "number",
|
||||
"required" : false,
|
||||
"minimum" : 0
|
||||
},
|
||||
"borderFrameCnt" :
|
||||
{
|
||||
"type" : "number",
|
||||
"required" : false,
|
||||
"minimum" : 0
|
||||
},
|
||||
"maxInconsistentCnt" :
|
||||
{
|
||||
"type" : "number",
|
||||
"required" : false,
|
||||
"minimum" : 0
|
||||
},
|
||||
"blurRemoveCnt" :
|
||||
{
|
||||
"type" : "number",
|
||||
"required" : false,
|
||||
"minimum" : 0
|
||||
},
|
||||
"mode" :
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : true
|
||||
"type" :
|
||||
{
|
||||
"enum" : ["default", "classic", "osd"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
@@ -592,58 +615,47 @@
|
||||
"kodiVideoChecker" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : true,
|
||||
"properties" :
|
||||
{
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"kodiAddress" :
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : true
|
||||
"type" : "string"
|
||||
},
|
||||
"kodiTcpPort" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : true
|
||||
"type" : "integer"
|
||||
},
|
||||
"grabVideo" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"grabPictures" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"grabAudio" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"grabMenu" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"grabPause" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"grabScreensaver" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"enable3DDetection" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
@@ -651,34 +663,28 @@
|
||||
"initialEffect" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : false,
|
||||
"properties" :
|
||||
{
|
||||
"background-effect" :
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : false
|
||||
"type" : "array"
|
||||
},
|
||||
"background-effect-args" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : false
|
||||
"type" : "object"
|
||||
},
|
||||
"foreground-effect" :
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : false
|
||||
"type" : "array"
|
||||
},
|
||||
"foreground-effect-args" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : false
|
||||
"type" : "object"
|
||||
},
|
||||
"foreground-duration_ms" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : false
|
||||
}
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
},
|
||||
@@ -741,13 +747,11 @@
|
||||
"boblightServer" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : true,
|
||||
"properties" :
|
||||
{
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"port" :
|
||||
{
|
||||
@@ -758,8 +762,7 @@
|
||||
},
|
||||
"priority" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : true
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
@@ -767,13 +770,11 @@
|
||||
"udpListener" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : true,
|
||||
"properties" :
|
||||
{
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
},
|
||||
"address" :
|
||||
{
|
||||
@@ -783,24 +784,20 @@
|
||||
"port" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : true,
|
||||
"minimum" : 0,
|
||||
"maximum" : 65535
|
||||
},
|
||||
"priority" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : true
|
||||
"type" : "integer"
|
||||
},
|
||||
"timeout" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : true
|
||||
"type" : "integer"
|
||||
},
|
||||
"shared" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"required" : true
|
||||
"type" : "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
@@ -832,13 +829,11 @@
|
||||
"effects" :
|
||||
{
|
||||
"type" : "object",
|
||||
"required" : false,
|
||||
"properties" :
|
||||
{
|
||||
"paths" :
|
||||
{
|
||||
"type" : "array",
|
||||
"required" : false
|
||||
"type" : "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
@@ -906,8 +901,7 @@
|
||||
},
|
||||
"endOfJson" :
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : false
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QCryptographicHash>
|
||||
#include <QHostInfo>
|
||||
#include <QString>
|
||||
|
||||
// hyperion util includes
|
||||
#include <hyperion/ImageProcessorFactory.h>
|
||||
@@ -820,7 +821,7 @@ void JsonClientConnection::handleConfigGetCommand(const Json::Value &)
|
||||
void JsonClientConnection::handleComponentStateCommand(const Json::Value& message)
|
||||
{
|
||||
const Json::Value & componentState = message["componentstate"];
|
||||
std::string component = componentState.get("component", "").asString();
|
||||
QString component = QString::fromStdString(componentState.get("component", "").asString()).toUpper();
|
||||
|
||||
if (component == "SMOOTHING")
|
||||
_hyperion->setComponentState((Components)0, componentState.get("state", true).asBool());
|
||||
|
Reference in New Issue
Block a user