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:
redPanther
2016-08-06 08:28:42 +02:00
committed by GitHub
parent 6b04c1571c
commit 817dabae8c
13 changed files with 269 additions and 177 deletions

View File

@@ -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;

View File

@@ -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)

View File

@@ -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