mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Webui: view led configuration + lights (#223)
* make hyperion websocket api event based * implement new websocket handling for generalconf * migrate all webui stuff to new event based websocket api some cleanup ... now all html templates are in content refactoring of web stuff * add hyperionport to global start impl. removing advanced key * separate dashboard serverinfo is updated every 3 seconds automatily add input selection cleanup and remove not needed stuff * prepare infrastructure for server sided file execution * webui minor fixes * fix compile * implement led layout view with live colors * live led vies * fix general conf unrigister ledcolors request, when not on leds.html * fix compiler warning * prepare realtime ledview and enhance ui
This commit is contained in:
@@ -273,6 +273,8 @@ void JsonClientConnection::handleMessage(const std::string &messageString)
|
||||
handleConfigCommand(message, command, tan);
|
||||
else if (command == "componentstate")
|
||||
handleComponentStateCommand(message, command, tan);
|
||||
else if (command == "ledcolors")
|
||||
handleLedColorsCommand(message, command, tan);
|
||||
else
|
||||
handleNotImplemented();
|
||||
}
|
||||
@@ -975,6 +977,31 @@ void JsonClientConnection::handleComponentStateCommand(const Json::Value& messag
|
||||
}
|
||||
}
|
||||
|
||||
void JsonClientConnection::handleLedColorsCommand(const Json::Value&, const std::string &command, const int tan)
|
||||
{
|
||||
// create result
|
||||
Json::Value result;
|
||||
result["success"] = true;
|
||||
result["command"] = command;
|
||||
result["tan"] = tan;
|
||||
Json::Value & leds = result["result"] = Json::Value(Json::arrayValue);
|
||||
|
||||
const PriorityMuxer::InputInfo & priorityInfo = _hyperion->getPriorityInfo(_hyperion->getCurrentPriority());
|
||||
std::vector<ColorRgb> ledBuffer = priorityInfo.ledColors;
|
||||
|
||||
for (ColorRgb& color : ledBuffer)
|
||||
{
|
||||
int idx = leds.size();
|
||||
Json::Value & item = leds[idx];
|
||||
item["index"] = idx;
|
||||
item["red"] = color.red;
|
||||
item["green"] = color.green;
|
||||
item["blue"] = color.blue;
|
||||
}
|
||||
// send the result
|
||||
sendMessage(result);
|
||||
}
|
||||
|
||||
void JsonClientConnection::handleNotImplemented()
|
||||
{
|
||||
sendErrorReply("Command not implemented");
|
||||
|
@@ -169,6 +169,12 @@ private:
|
||||
///
|
||||
void handleComponentStateCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||
|
||||
/// Handle an incoming JSON Led Colors message
|
||||
///
|
||||
/// @param message the incoming message
|
||||
///
|
||||
void handleLedColorsCommand(const Json::Value &, const std::string &command, const int tan);
|
||||
|
||||
///
|
||||
/// Handle an incoming JSON message of unknown type
|
||||
///
|
||||
@@ -222,7 +228,6 @@ private:
|
||||
///
|
||||
bool checkJson(const Json::Value & message, const QString &schemaResource, std::string & errors, bool ignoreRequired = false);
|
||||
|
||||
private:
|
||||
/// The TCP-Socket that is connected tot the Json-client
|
||||
QTcpSocket * _socket;
|
||||
|
||||
@@ -243,4 +248,8 @@ private:
|
||||
|
||||
/// Flag if forwarder is enabled
|
||||
bool _forwarder_enabled;
|
||||
|
||||
///
|
||||
QTimer _timer_ledcolors;
|
||||
|
||||
};
|
||||
|
@@ -14,5 +14,6 @@
|
||||
<file alias="schema-sourceselect">schema/schema-sourceselect.json</file>
|
||||
<file alias="schema-config">schema/schema-config.json</file>
|
||||
<file alias="schema-componentstate">schema/schema-componentstate.json</file>
|
||||
<file alias="schema-ledcolors">schema/schema-ledcolors.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
27
libsrc/jsonserver/schema/schema-ledcolors.json
Normal file
27
libsrc/jsonserver/schema/schema-ledcolors.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"type":"object",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"command": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["ledcolors"]
|
||||
},
|
||||
"tan" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"subcommand": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["ledstream_stop","ledstream_start","testled","imagestream_start","imagestream_stop"]
|
||||
},
|
||||
"oneshot": {
|
||||
"type" : "bool"
|
||||
},
|
||||
"interval": {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
|
||||
"additionalProperties": false
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
"command": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform", "correction", "temperature", "adjustment", "sourceselect", "config", "componentstate"]
|
||||
"enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform", "correction", "temperature", "adjustment", "sourceselect", "config", "componentstate", "ledcolors"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user