mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Cleanup
This commit is contained in:
parent
fda061bc87
commit
0a2961a3b4
@ -12,7 +12,6 @@
|
||||
#include <QSize>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QMap>
|
||||
|
||||
// Hyperion includes
|
||||
#include <utils/Components.h>
|
||||
|
@ -1,14 +1,9 @@
|
||||
// project includes
|
||||
#include <api/JsonAPI.h>
|
||||
|
||||
// stl includes
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
// Qt includes
|
||||
#include <QResource>
|
||||
#include <QDateTime>
|
||||
#include <QCryptographicHash>
|
||||
#include <QImage>
|
||||
#include <QBuffer>
|
||||
#include <QByteArray>
|
||||
@ -18,7 +13,6 @@
|
||||
|
||||
// hyperion includes
|
||||
#include <leddevice/LedDeviceWrapper.h>
|
||||
|
||||
#include <leddevice/LedDevice.h>
|
||||
#include <leddevice/LedDeviceFactory.h>
|
||||
|
||||
@ -49,33 +43,13 @@ using namespace hyperion;
|
||||
|
||||
JsonAPI::JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject *parent, bool noListener)
|
||||
: API(log, localConnection, parent)
|
||||
/* , _authManager(AuthManager::getInstance()) // moved to API
|
||||
, _authorized(false)
|
||||
, _adminAuthorized(false)
|
||||
, _apiAuthRequired(_authManager->isAuthRequired())
|
||||
, _noListener(noListener)
|
||||
, _peerAddress(peerAddress)
|
||||
, _log(log) // moved to API
|
||||
, _localConnection(localConnection)
|
||||
, _instanceManager(HyperionIManager::getInstance())
|
||||
, _hyperion(nullptr) // moved
|
||||
, _jsonCB(new JsonCB(this))
|
||||
, _streaming_logging_activated(false)
|
||||
, _ledStreamTimer(new QTimer(this)) */
|
||||
{
|
||||
//_authManager = AuthManager::getInstance(); // moved to API init
|
||||
//_authorized = false; // moved INIT api
|
||||
//_adminAuthorized = false; // moved INIT api
|
||||
//_apiAuthRequired = _authManager->isAuthRequired();
|
||||
_noListener = noListener;
|
||||
_peerAddress = peerAddress;
|
||||
//_log = log; // moved to API
|
||||
// _localConnection = localConnection; moved init ti api
|
||||
//_instanceManager = HyperionIManager::getInstance();
|
||||
//_hyperion = nullptr; // moved
|
||||
_jsonCB = new JsonCB(this);
|
||||
_streaming_logging_activated = false;
|
||||
_ledStreamTimer = new QTimer(this);
|
||||
|
||||
Q_INIT_RESOURCE(JSONRPC_schemas);
|
||||
}
|
||||
|
||||
@ -199,7 +173,7 @@ proceed:
|
||||
else if (command == "leddevice")
|
||||
handleLedDeviceCommand(message, command, tan);
|
||||
|
||||
// BEGIN | The following commands are derecated but used to ensure backward compatibility with hyperion Classic remote control
|
||||
// BEGIN | The following commands are deprecated but used to ensure backward compatibility with hyperion Classic remote control
|
||||
else if (command == "clearall")
|
||||
handleClearallCommand(message, command, tan);
|
||||
else if (command == "transform" || command == "correction" || command == "temperature")
|
||||
@ -330,7 +304,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
|
||||
activePriorities.removeAll(255);
|
||||
int currentPriority = _hyperion->getCurrentPriority();
|
||||
|
||||
foreach (int priority, activePriorities)
|
||||
for(int priority : activePriorities)
|
||||
{
|
||||
const Hyperion::InputInfo &priorityInfo = _hyperion->getPriorityInfo(priority);
|
||||
QJsonObject item;
|
||||
|
@ -1,17 +1,6 @@
|
||||
// stl includes
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cmath>
|
||||
|
||||
// Qt includes
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <Qt>
|
||||
#include <QLinearGradient>
|
||||
#include <QConicalGradient>
|
||||
#include <QRadialGradient>
|
||||
#include <QRect>
|
||||
#include <QImageReader>
|
||||
#include <QResource>
|
||||
|
||||
// effect engin eincludes
|
||||
@ -20,11 +9,8 @@
|
||||
#include <utils/Logger.h>
|
||||
#include <hyperion/Hyperion.h>
|
||||
|
||||
// python utils/ global mainthread
|
||||
// python utils
|
||||
#include <python/PythonProgram.h>
|
||||
#include <python/PythonUtils.h>
|
||||
//impl
|
||||
PyThreadState* mainThreadState;
|
||||
|
||||
Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &script, const QString &name, const QJsonObject &args, const QString &imageData)
|
||||
: QThread()
|
||||
@ -100,19 +86,13 @@ void Effect::run()
|
||||
|
||||
// Run the effect script
|
||||
QFile file (_script);
|
||||
QByteArray python_code;
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
python_code = file.readAll();
|
||||
program.execute(file.readAll());
|
||||
}
|
||||
else
|
||||
{
|
||||
Error(_log, "Unable to open script file %s.", QSTRING_CSTR(_script));
|
||||
}
|
||||
file.close();
|
||||
|
||||
if (!python_code.isEmpty())
|
||||
{
|
||||
program.execute(python_code);
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
// Qt includes
|
||||
#include <QResource>
|
||||
#include <QMetaType>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
|
||||
// hyperion util includes
|
||||
#include <utils/jsonschema/QJsonSchemaChecker.h>
|
||||
|
@ -53,7 +53,7 @@ LedDeviceLightpackHidapi::~LedDeviceLightpackHidapi()
|
||||
_deviceHandle = nullptr;
|
||||
}
|
||||
|
||||
// TODO: Should be called to avoid memory loss, but only at the end of the application
|
||||
// TODO: Should be called to avoid memory leak, but only at the end of the application
|
||||
//hid_exit();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include <QThread>
|
||||
|
||||
PyThreadState* mainThreadState;
|
||||
|
||||
PythonProgram::PythonProgram(const QString & name, Logger * log) :
|
||||
_name(name), _log(log), _tstate(nullptr)
|
||||
{
|
||||
|
@ -27,9 +27,9 @@ static const QString UPNP_ALIVE_MESSAGE = "NOTIFY * HTTP/1.1\r\n"
|
||||
"NTS: ssdp:alive\r\n"
|
||||
"SERVER: %4\r\n"
|
||||
"USN: uuid:%5\r\n"
|
||||
"HYPERION-FBS-PORT: %6\r\n"
|
||||
"HYPERION-JSS-PORT: %7\r\n"
|
||||
"HYPERION-NAME: %8\r\n"
|
||||
"HYPERION-FBS-PORT: %6\r\n"
|
||||
"HYPERION-JSS-PORT: %7\r\n"
|
||||
"HYPERION-NAME: %8\r\n"
|
||||
"\r\n";
|
||||
|
||||
// Implement ssdp:update as per spec 1.1, section 1.2.4
|
||||
@ -45,7 +45,7 @@ static const QString UPNP_UPDATE_MESSAGE = "NOTIFY * HTTP/1.1\r\n"
|
||||
/* "CONFIGID.UPNP.ORG: %4\r\n"
|
||||
UPNP spec = 1.1 "NEXTBOOTID.UPNP.ORG: %5\r\n"
|
||||
"SEARCHPORT.UPNP.ORG: %6\r\n"
|
||||
*/ "\r\n";
|
||||
*/ "\r\n";
|
||||
|
||||
// TODO: Add this two fields commented below in the BYEBYE MESSAGE
|
||||
// as per upnp spec 1.1, section 1.2.2 and 1.2.3.
|
||||
@ -72,9 +72,9 @@ static const QString UPNP_MSEARCH_RESPONSE = "HTTP/1.1 200 OK\r\n"
|
||||
"SERVER: %4\r\n"
|
||||
"ST: %5\r\n"
|
||||
"USN: uuid:%6\r\n"
|
||||
"HYPERION-FBS-PORT: %7\r\n"
|
||||
"HYPERION-JSS-PORT: %8\r\n"
|
||||
"HYPERION-NAME: %9\r\n"
|
||||
"HYPERION-FBS-PORT: %7\r\n"
|
||||
"HYPERION-JSS-PORT: %8\r\n"
|
||||
"HYPERION-NAME: %9\r\n"
|
||||
"\r\n";
|
||||
|
||||
SSDPServer::SSDPServer(QObject * parent)
|
||||
@ -99,7 +99,8 @@ void SSDPServer::initServer()
|
||||
SysInfo::HyperionSysInfo data = SysInfo::get();
|
||||
|
||||
// create SERVER String
|
||||
_serverHeader = data.prettyName+"/"+data.productVersion+" UPnP/1.0 Hyperion/"+QString(HYPERION_VERSION);
|
||||
_serverHeader = QString("%1/%2 UPnP/1.0 Hyperion/%3")
|
||||
.arg(data.prettyName, data.productVersion, HYPERION_VERSION);
|
||||
|
||||
connect(_udpSocket, &QUdpSocket::readyRead, this, &SSDPServer::readPendingDatagrams);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user