mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
i18n corrected
libqt5sql5-sqlite appended to the dependency list lgtm alerts fixed added message forwarder to global settings subscribe type leds-update appended (thanks @Brindosch) Boblight server port check instead of error message Race Condition of different priorities are prevented at startup Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -72,11 +72,11 @@ JsonAPI::JsonAPI(QString peerAddress, Logger* log, const bool& localConnection,
|
||||
// init Hyperion pointer
|
||||
handleInstanceSwitch(0);
|
||||
|
||||
// // notify hyperion about a jsonMessageForward
|
||||
// connect(this, &JsonAPI::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage);
|
||||
// notify hyperion about a jsonMessageForward
|
||||
connect(this, &JsonAPI::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage);
|
||||
}
|
||||
|
||||
const bool JsonAPI::handleInstanceSwitch(const quint8& inst, const bool& forced)
|
||||
bool JsonAPI::handleInstanceSwitch(const quint8& inst, const bool& forced)
|
||||
{
|
||||
// check if we are already on the requested instance
|
||||
if(_hyperion != nullptr && _hyperion->getInstanceIndex() == inst)
|
||||
@@ -1241,7 +1241,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject & message, const QString
|
||||
}
|
||||
}
|
||||
|
||||
const bool JsonAPI::handleHTTPAuth(const QString& command, const int& tan, const QString& token)
|
||||
bool JsonAPI::handleHTTPAuth(const QString& command, const int& tan, const QString& token)
|
||||
{
|
||||
if(_authManager->isTokenAuthorized(token))
|
||||
{
|
||||
|
@@ -35,7 +35,7 @@ JsonCB::JsonCB(Hyperion* hyperion, QObject* parent)
|
||||
, _prioMuxer(_hyperion->getMuxerInstance())
|
||||
{
|
||||
_availableCommands << "components-update" << "sessions-update" << "priorities-update" << "imageToLedMapping-update"
|
||||
<< "adjustment-update" << "videomode-update" << "effects-update" << "settings-update" << "instance-update";
|
||||
<< "adjustment-update" << "videomode-update" << "effects-update" << "settings-update" << "leds-update" << "instance-update";
|
||||
}
|
||||
|
||||
bool JsonCB::subscribeFor(const QString& type)
|
||||
@@ -92,6 +92,13 @@ bool JsonCB::subscribeFor(const QString& type)
|
||||
connect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleSettingsChange, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
if(type == "leds-update")
|
||||
{
|
||||
_subscribedCommands << type;
|
||||
connect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleLedsConfigChange, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
|
||||
if(type == "instance-update")
|
||||
{
|
||||
_subscribedCommands << type;
|
||||
@@ -318,6 +325,16 @@ void JsonCB::handleSettingsChange(const settings::type& type, const QJsonDocumen
|
||||
doCallback("settings-update", QVariant(dat));
|
||||
}
|
||||
|
||||
void JsonCB::handleLedsConfigChange(const settings::type& type, const QJsonDocument& data)
|
||||
{
|
||||
if(type == settings::LEDS)
|
||||
{
|
||||
QJsonObject dat;
|
||||
dat[typeToString(type)] = data.array();
|
||||
doCallback("leds-update", QVariant(dat));
|
||||
}
|
||||
}
|
||||
|
||||
void JsonCB::handleInstanceChange()
|
||||
{
|
||||
QJsonArray arr;
|
||||
|
@@ -7,9 +7,13 @@
|
||||
|
||||
// hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
|
||||
// qt incl
|
||||
#include <QTcpServer>
|
||||
|
||||
// netUtil
|
||||
#include <utils/NetUtils.h>
|
||||
|
||||
using namespace hyperion;
|
||||
|
||||
BoblightServer::BoblightServer(Hyperion* hyperion,const QJsonDocument& config)
|
||||
@@ -42,11 +46,9 @@ void BoblightServer::start()
|
||||
if ( _server->isListening() )
|
||||
return;
|
||||
|
||||
if (!_server->listen(QHostAddress::Any, _port))
|
||||
{
|
||||
Error(_log, "Could not bind to port '%d', please use an available port", _port);
|
||||
return;
|
||||
}
|
||||
if (NetUtils::portAvailable(_port, _log))
|
||||
_server->listen(QHostAddress::Any, _port);
|
||||
|
||||
Info(_log, "Started on port %d", _port);
|
||||
|
||||
_hyperion->getComponentRegister().componentStateChanged(COMP_BOBLIGHTSERVER, _server->isListening());
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Qt includes
|
||||
#include <QRgb>
|
||||
|
||||
// protoserver includes
|
||||
// flatbuffer includes
|
||||
#include <flatbufserver/FlatBufferConnection.h>
|
||||
|
||||
FlatBufferConnection::FlatBufferConnection(const QString& origin, const QString & address, const int& priority, const bool& skipReply)
|
||||
|
@@ -50,7 +50,7 @@ Hyperion::Hyperion(const quint8& instance)
|
||||
, _muxer(_ledString.leds().size())
|
||||
, _raw2ledAdjustment(hyperion::createLedColorsAdjustment(_ledString.leds().size(), getSetting(settings::COLOR).object()))
|
||||
, _effectEngine(nullptr)
|
||||
// , _messageForwarder(new MessageForwarder(this))
|
||||
, _messageForwarder(nullptr)
|
||||
, _log(Logger::getInstance("HYPERION"))
|
||||
, _hwLedCount()
|
||||
, _ledGridSize(hyperion::getLedLayoutGridSize(getSetting(settings::LEDS).array()))
|
||||
@@ -116,6 +116,10 @@ void Hyperion::start()
|
||||
_deviceSmooth = new LinearColorSmoothing(getSetting(settings::SMOOTHING), this);
|
||||
connect(this, &Hyperion::settingsChanged, _deviceSmooth, &LinearColorSmoothing::handleSettingsUpdate);
|
||||
|
||||
// create the message forwarder only on main instance
|
||||
if (_instIndex == 0)
|
||||
_messageForwarder = new MessageForwarder(this);
|
||||
|
||||
// create the effect engine; needs to be initialized after smoothing!
|
||||
_effectEngine = new EffectEngine(this);
|
||||
connect(_effectEngine, &EffectEngine::effectListUpdated, this, &Hyperion::effectListUpdated);
|
||||
@@ -162,7 +166,7 @@ void Hyperion::freeObjects(bool emitCloseSignal)
|
||||
delete _captureCont;
|
||||
delete _effectEngine;
|
||||
delete _raw2ledAdjustment;
|
||||
// delete _messageForwarder;
|
||||
delete _messageForwarder;
|
||||
delete _settingsManager;
|
||||
delete _ledDeviceWrapper;
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ void HyperionIManager::stopAll()
|
||||
}
|
||||
}
|
||||
|
||||
const bool HyperionIManager::startInstance(const quint8& inst, const bool& block)
|
||||
bool HyperionIManager::startInstance(const quint8& inst, const bool& block)
|
||||
{
|
||||
if(_instanceTable->instanceExist(inst))
|
||||
{
|
||||
@@ -102,7 +102,7 @@ const bool HyperionIManager::startInstance(const quint8& inst, const bool& block
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool HyperionIManager::stopInstance(const quint8& inst, const bool& block)
|
||||
bool HyperionIManager::stopInstance(const quint8& inst, const bool& block)
|
||||
{
|
||||
// inst 0 can't be stopped
|
||||
if(!isInstAllowed(inst))
|
||||
@@ -133,7 +133,7 @@ const bool HyperionIManager::stopInstance(const quint8& inst, const bool& block)
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool HyperionIManager::createInstance(const QString& name, const bool& start)
|
||||
bool HyperionIManager::createInstance(const QString& name, const bool& start)
|
||||
{
|
||||
quint8 inst;
|
||||
if(_instanceTable->createInstance(name, inst))
|
||||
@@ -149,7 +149,7 @@ const bool HyperionIManager::createInstance(const QString& name, const bool& sta
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool HyperionIManager::deleteInstance(const quint8& inst)
|
||||
bool HyperionIManager::deleteInstance(const quint8& inst)
|
||||
{
|
||||
// inst 0 can't be deleted
|
||||
if(!isInstAllowed(inst))
|
||||
@@ -169,7 +169,7 @@ const bool HyperionIManager::deleteInstance(const quint8& inst)
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool HyperionIManager::saveName(const quint8& inst, const QString& name)
|
||||
bool HyperionIManager::saveName(const quint8& inst, const QString& name)
|
||||
{
|
||||
if(_instanceTable->saveName(inst, name))
|
||||
{
|
||||
|
@@ -48,7 +48,6 @@ PriorityMuxer::PriorityMuxer(int ledCount)
|
||||
connect(_updateTimer, &QTimer::timeout, this, &PriorityMuxer::setCurrentTime);
|
||||
_updateTimer->setInterval(250);
|
||||
_updateTimer->start();
|
||||
InputInfo ninfo;
|
||||
}
|
||||
|
||||
PriorityMuxer::~PriorityMuxer()
|
||||
@@ -279,7 +278,9 @@ void PriorityMuxer::clearAll(bool forceClearAll)
|
||||
void PriorityMuxer::setCurrentTime(void)
|
||||
{
|
||||
const int64_t now = QDateTime::currentMSecsSinceEpoch();
|
||||
int newPriority = PriorityMuxer::LOWEST_PRIORITY;
|
||||
int newPriority;
|
||||
_activeInputs.contains(140) ? newPriority = 140 : newPriority = PriorityMuxer::LOWEST_PRIORITY;
|
||||
_activeInputs.contains(0) ? newPriority = 0 : newPriority = PriorityMuxer::LOWEST_PRIORITY;
|
||||
|
||||
for (auto infoIt = _activeInputs.begin(); infoIt != _activeInputs.end();)
|
||||
{
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
quint16 getServerPort (void) const;
|
||||
QString getErrorString (void) const;
|
||||
const bool isListening() { return m_sockServer->isListening(); };
|
||||
bool isListening() { return m_sockServer->isListening(); };
|
||||
|
||||
public slots:
|
||||
void start (quint16 port = 0);
|
||||
|
@@ -23,7 +23,7 @@ StaticFileServing::StaticFileServing (QObject * parent)
|
||||
|
||||
StaticFileServing::~StaticFileServing ()
|
||||
{
|
||||
|
||||
delete _mimeDb;
|
||||
}
|
||||
|
||||
void StaticFileServing::setBaseUrl(const QString& url)
|
||||
|
Reference in New Issue
Block a user