mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
implement origin for effects (#408)
* implement rigin for efx * implement origin for effects and other components add experimental adalight firmware for arduino with upto 5 pwm channels * cleanup * origin ip now with dns lookup * fix compile * move some code
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QIODevice>
|
||||
#include <QDateTime>
|
||||
#include <QHostInfo>
|
||||
|
||||
// hyperion util includes
|
||||
#include <hyperion/ImageProcessorFactory.h>
|
||||
@@ -57,6 +58,7 @@ JsonClientConnection::JsonClientConnection(QTcpSocket *socket)
|
||||
, _forwarder_enabled(true)
|
||||
, _streaming_logging_activated(false)
|
||||
, _image_stream_timeout(0)
|
||||
, _clientAddress(socket->peerAddress())
|
||||
{
|
||||
// connect internal signals and slots
|
||||
connect(_socket, SIGNAL(disconnected()), this, SLOT(socketClosed()));
|
||||
@@ -365,7 +367,7 @@ void JsonClientConnection::handleColorCommand(const QJsonObject& message, const
|
||||
// extract parameters
|
||||
int priority = message["priority"].toInt();
|
||||
int duration = message["duration"].toInt(-1);
|
||||
QString origin = message["origin"].toString();
|
||||
QString origin = message["origin"].toString() + "@"+QHostInfo::fromName(_clientAddress.toString()).hostName();
|
||||
|
||||
std::vector<ColorRgb> colorData(_hyperion->getLedCount());
|
||||
const QJsonArray & jsonColor = message["color"].toArray();
|
||||
@@ -438,18 +440,19 @@ void JsonClientConnection::handleEffectCommand(const QJsonObject& message, const
|
||||
// extract parameters
|
||||
int priority = message["priority"].toInt();
|
||||
int duration = message["duration"].toInt(-1);
|
||||
QString pythonScript = message["pythonScript"].toString("");
|
||||
QString pythonScript = message["pythonScript"].toString();
|
||||
QString origin = message["origin"].toString() + "@"+_clientAddress.toString();
|
||||
const QJsonObject & effect = message["effect"].toObject();
|
||||
const QString & effectName = effect["name"].toString();
|
||||
|
||||
// set output
|
||||
if (effect.contains("args"))
|
||||
{
|
||||
_hyperion->setEffect(effectName, effect["args"].toObject(), priority, duration, pythonScript);
|
||||
_hyperion->setEffect(effectName, effect["args"].toObject(), priority, duration, pythonScript, origin);
|
||||
}
|
||||
else
|
||||
{
|
||||
_hyperion->setEffect(effectName, priority, duration);
|
||||
_hyperion->setEffect(effectName, priority, duration, origin);
|
||||
}
|
||||
|
||||
// send reply
|
||||
@@ -607,7 +610,7 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
||||
{
|
||||
if (entry.second == priority)
|
||||
{
|
||||
item["owner"] = QString::fromStdString(entry.first);
|
||||
item["owner"] = entry.first;
|
||||
priorityRegister.erase(entry.first);
|
||||
break;
|
||||
}
|
||||
@@ -665,7 +668,7 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
||||
item["priority"] = entry.second;
|
||||
item["active"] = false;
|
||||
item["visible"] = false;
|
||||
item["owner"] = QString::fromStdString(entry.first);
|
||||
item["owner"] = entry.first;
|
||||
priorities.append(item);
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QTcpSocket>
|
||||
#include <QMutex>
|
||||
#include <QHostAddress>
|
||||
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
@@ -348,7 +349,10 @@ private:
|
||||
|
||||
/// timeout for live video refresh
|
||||
volatile qint64 _image_stream_timeout;
|
||||
|
||||
|
||||
/// address of client
|
||||
QHostAddress _clientAddress;
|
||||
|
||||
// masks for fields in the basic header
|
||||
static uint8_t const BHB0_OPCODE = 0x0F;
|
||||
static uint8_t const BHB0_RSV3 = 0x10;
|
||||
|
@@ -16,6 +16,10 @@
|
||||
"maximum" : 253,
|
||||
"required": true
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"duration": {
|
||||
"type": "integer",
|
||||
"required": false
|
||||
|
Reference in New Issue
Block a user