mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Make origin in schema-image optional (#610)
* Make origin in schema-image optional ... like in `color` and `effect` schemes. * use origin if available
This commit is contained in:
parent
beb9454a1f
commit
fe12b36fce
@ -18,7 +18,9 @@
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
"minLength" : 4,
|
||||
"maxLength" : 20,
|
||||
"required": false
|
||||
},
|
||||
"duration": {
|
||||
"type": "integer",
|
||||
|
@ -210,7 +210,7 @@ void JsonAPI::handleColorCommand(const QJsonObject& message, const QString& comm
|
||||
// extract parameters
|
||||
int priority = message["priority"].toInt();
|
||||
int duration = message["duration"].toInt(-1);
|
||||
const QString origin = message["origin"].toString("Empty") + "@"+_peerAddress;
|
||||
const QString origin = message["origin"].toString("JsonRpc") + "@"+_peerAddress;
|
||||
|
||||
const QJsonArray & jsonColor = message["color"].toArray();
|
||||
const ColorRgb color = {uint8_t(jsonColor.at(0).toInt()),uint8_t(jsonColor.at(1).toInt()),uint8_t(jsonColor.at(2).toInt())};
|
||||
@ -228,6 +228,7 @@ void JsonAPI::handleImageCommand(const QJsonObject& message, const QString& comm
|
||||
|
||||
// extract parameters
|
||||
int priority = message["priority"].toInt();
|
||||
const QString origin = message["origin"].toString("JsonRpc") + "@"+_peerAddress;
|
||||
int duration = message["duration"].toInt(-1);
|
||||
int width = message["imagewidth"].toInt();
|
||||
int height = message["imageheight"].toInt();
|
||||
@ -244,7 +245,7 @@ void JsonAPI::handleImageCommand(const QJsonObject& message, const QString& comm
|
||||
Image<ColorRgb> image(width, height);
|
||||
memcpy(image.memptr(), data.data(), data.size());
|
||||
|
||||
_hyperion->registerInput(priority, hyperion::COMP_IMAGE, "JsonRpc@"+_peerAddress);
|
||||
_hyperion->registerInput(priority, hyperion::COMP_IMAGE, origin);
|
||||
_hyperion->setInputImage(priority, image, duration);
|
||||
|
||||
// send reply
|
||||
@ -259,7 +260,7 @@ void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &com
|
||||
int priority = message["priority"].toInt();
|
||||
int duration = message["duration"].toInt(-1);
|
||||
QString pythonScript = message["pythonScript"].toString();
|
||||
QString origin = message["origin"].toString("Empty") + "@"+_peerAddress;
|
||||
QString origin = message["origin"].toString("JsonRpc") + "@"+_peerAddress;
|
||||
const QJsonObject & effect = message["effect"].toObject();
|
||||
const QString & effectName = effect["name"].toString();
|
||||
const QString & data = message["imageData"].toString("").toUtf8();
|
||||
|
Loading…
Reference in New Issue
Block a user