mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge branch 'master' into Razer_Chroma_Support
This commit is contained in:
@@ -231,7 +231,7 @@ protected:
|
||||
/// @brief Save settings object. Requires ADMIN ACCESS
|
||||
/// @param data The data object
|
||||
///
|
||||
void saveSettings(const QJsonObject &data);
|
||||
bool saveSettings(const QJsonObject &data);
|
||||
|
||||
///
|
||||
/// @brief Test if we are authorized to use the interface
|
||||
|
@@ -11,7 +11,7 @@ namespace hyperion
|
||||
///
|
||||
struct BlackBorder
|
||||
{
|
||||
/// Falg indicating if the border is unknown
|
||||
/// Flag indicating if the border is unknown
|
||||
bool unknown;
|
||||
|
||||
/// The size of the detected horizontal border
|
||||
@@ -48,7 +48,7 @@ namespace hyperion
|
||||
public:
|
||||
///
|
||||
/// Constructs a black-border detector
|
||||
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
|
||||
/// @param[in] threshold The threshold which the black-border detector should use
|
||||
///
|
||||
BlackBorderDetector(double threshold);
|
||||
|
||||
@@ -67,9 +67,9 @@ namespace hyperion
|
||||
template <typename Pixel_T>
|
||||
BlackBorder process(const Image<Pixel_T> & image) const
|
||||
{
|
||||
// test center and 33%, 66% of width/heigth
|
||||
// test centre and 33%, 66% of width/height
|
||||
// 33 and 66 will check left and top
|
||||
// center will check right and bottom sids
|
||||
// centre will check right and bottom sides
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
int width33percent = width / 3;
|
||||
@@ -234,11 +234,54 @@ namespace hyperion
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// letterbox detection mode (5lines top-bottom only detection)
|
||||
template <typename Pixel_T>
|
||||
BlackBorder process_letterbox(const Image<Pixel_T> & image) const
|
||||
{
|
||||
// test center and 25%, 75% of width
|
||||
// 25 and 75 will check both top and bottom
|
||||
// center will only check top (minimise false detection of captions)
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
int width25percent = width / 4;
|
||||
int height33percent = height / 3;
|
||||
int width75percent = width25percent * 3;
|
||||
int xCenter = width / 2;
|
||||
|
||||
|
||||
int firstNonBlackYPixelIndex = -1;
|
||||
|
||||
height--; // remove 1 pixel to get end pixel index
|
||||
|
||||
// find first Y pixel of the image
|
||||
for (int y = 0; y < height33percent; ++y)
|
||||
{
|
||||
if (!isBlack(image(xCenter, y))
|
||||
|| !isBlack(image(width25percent, y))
|
||||
|| !isBlack(image(width75percent, y))
|
||||
|| !isBlack(image(width25percent, (height - y)))
|
||||
|| !isBlack(image(width75percent, (height - y))))
|
||||
{
|
||||
firstNonBlackYPixelIndex = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Construct result
|
||||
BlackBorder detectedBorder;
|
||||
detectedBorder.unknown = firstNonBlackYPixelIndex == -1;
|
||||
detectedBorder.horizontalSize = firstNonBlackYPixelIndex;
|
||||
detectedBorder.verticalSize = 0;
|
||||
return detectedBorder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
///
|
||||
/// Checks if a given color is considered black and therefor could be part of the border.
|
||||
/// Checks if a given color is considered black and therefore could be part of the border.
|
||||
///
|
||||
/// @param[in] color The color to check
|
||||
///
|
||||
@@ -252,7 +295,7 @@ namespace hyperion
|
||||
}
|
||||
|
||||
private:
|
||||
/// Threshold for the blackborder detector [0 .. 255]
|
||||
/// Threshold for the black-border detector [0 .. 255]
|
||||
const uint8_t _blackborderThreshold;
|
||||
|
||||
};
|
||||
|
@@ -44,14 +44,14 @@ namespace hyperion
|
||||
void setEnabled(bool enable);
|
||||
|
||||
///
|
||||
/// Sets the _hardDisabled state, if True prevents the enable from COMP_BLACKBORDER state emit (mimiks wrong state to external!)
|
||||
/// It's not possible to enable bb from this method, if the user requsted a disable!
|
||||
/// Sets the _hardDisabled state, if True prevents the enable from COMP_BLACKBORDER state emit (mimics wrong state to external!)
|
||||
/// It's not possible to enable black-border detection from this method, if the user requested a disable!
|
||||
/// @param disable The new state
|
||||
///
|
||||
void setHardDisable(bool disable);
|
||||
|
||||
///
|
||||
/// Processes the image. This performs detecion of black-border on the given image and
|
||||
/// Processes the image. This performs detection of black-border on the given image and
|
||||
/// updates the current border accordingly. If the current border is updated the method call
|
||||
/// will return true else false
|
||||
///
|
||||
@@ -64,10 +64,11 @@ namespace hyperion
|
||||
{
|
||||
// get the border for the single image
|
||||
BlackBorder imageBorder;
|
||||
imageBorder.horizontalSize = 0;
|
||||
imageBorder.verticalSize = 0;
|
||||
|
||||
if (!enabled())
|
||||
{
|
||||
imageBorder.horizontalSize = 0;
|
||||
imageBorder.verticalSize = 0;
|
||||
imageBorder.unknown=true;
|
||||
_currentBorder = imageBorder;
|
||||
return true;
|
||||
@@ -79,6 +80,8 @@ namespace hyperion
|
||||
imageBorder = _detector->process_classic(image);
|
||||
} else if (_detectionMode == "osd") {
|
||||
imageBorder = _detector->process_osd(image);
|
||||
} else if (_detectionMode == "letterbox") {
|
||||
imageBorder = _detector->process_letterbox(image);
|
||||
}
|
||||
// add blur to the border
|
||||
if (imageBorder.horizontalSize > 0)
|
||||
@@ -96,7 +99,7 @@ namespace hyperion
|
||||
private slots:
|
||||
///
|
||||
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
|
||||
/// @param type settingyType from enum
|
||||
/// @param type settingType from enum
|
||||
/// @param config configuration object
|
||||
///
|
||||
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
|
||||
@@ -119,7 +122,7 @@ namespace hyperion
|
||||
///
|
||||
bool updateBorder(const BlackBorder & newDetectedBorder);
|
||||
|
||||
/// flag for blackborder detector usage
|
||||
/// flag for black-border detector usage
|
||||
bool _enabled;
|
||||
|
||||
/// The number of unknown-borders detected before it becomes the current border
|
||||
@@ -131,13 +134,13 @@ namespace hyperion
|
||||
// The number of frames that are "ignored" before a new border gets set as _previousDetectedBorder
|
||||
unsigned _maxInconsistentCnt;
|
||||
|
||||
/// The number of pixels to increase a detected border for removing blury pixels
|
||||
/// The number of pixels to increase a detected border for removing blurry pixels
|
||||
unsigned _blurRemoveCnt;
|
||||
|
||||
/// The border detection mode
|
||||
QString _detectionMode;
|
||||
|
||||
/// The blackborder detector
|
||||
/// The black-border detector
|
||||
BlackBorderDetector* _detector;
|
||||
|
||||
/// The current detected border
|
||||
@@ -146,9 +149,9 @@ namespace hyperion
|
||||
/// The border detected in the previous frame
|
||||
BlackBorder _previousDetectedBorder;
|
||||
|
||||
/// The number of frame the previous detected border matched the incomming border
|
||||
/// The number of frame the previous detected border matched the incoming border
|
||||
unsigned _consistentCnt;
|
||||
/// The number of frame the previous detected border NOT matched the incomming border
|
||||
/// The number of frame the previous detected border NOT matched the incoming border
|
||||
unsigned _inconsistentCnt;
|
||||
/// old threshold
|
||||
double _oldThreshold;
|
||||
|
@@ -19,7 +19,7 @@ private:
|
||||
/// @brief Browse for hyperion services in bonjour, constructed from HyperionDaemon
|
||||
/// Searching for hyperion http service by default
|
||||
///
|
||||
BonjourBrowserWrapper(QObject * parent = 0);
|
||||
BonjourBrowserWrapper(QObject * parent = nullptr);
|
||||
|
||||
public:
|
||||
|
||||
@@ -30,36 +30,36 @@ public:
|
||||
///
|
||||
/// @brief Get all available sessions
|
||||
///
|
||||
QMap<QString,BonjourRecord> getAllServices() { return _hyperionSessions; };
|
||||
QMap<QString, BonjourRecord> getAllServices() { return _hyperionSessions; }
|
||||
|
||||
static BonjourBrowserWrapper* instance;
|
||||
static BonjourBrowserWrapper* getInstance(){ return instance; };
|
||||
static BonjourBrowserWrapper *getInstance() { return instance; }
|
||||
|
||||
signals:
|
||||
///
|
||||
/// @brief Emits whenever a change happend
|
||||
///
|
||||
void browserChange(const QMap<QString,BonjourRecord>& bRegisters);
|
||||
void browserChange( const QMap<QString, BonjourRecord> &bRegisters );
|
||||
|
||||
private:
|
||||
/// map of service names and browsers
|
||||
QMap< QString, BonjourServiceBrowser* > _browsedServices;
|
||||
QMap<QString, BonjourServiceBrowser *> _browsedServices;
|
||||
/// Resolver
|
||||
BonjourServiceResolver* _bonjourResolver;
|
||||
BonjourServiceResolver *_bonjourResolver;
|
||||
|
||||
// contains all current active service sessions
|
||||
QMap<QString,BonjourRecord> _hyperionSessions;
|
||||
QMap<QString, BonjourRecord> _hyperionSessions;
|
||||
|
||||
QString _bonjourCurrentServiceToResolve;
|
||||
QString _bonjourCurrentServiceToResolve;
|
||||
/// timer to resolve changes
|
||||
QTimer* _timerBonjourResolver;
|
||||
QTimer *_timerBonjourResolver;
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// @brief is called whenever a BonjourServiceBrowser emits change
|
||||
void currentBonjourRecordsChanged(const QList<BonjourRecord> &list);
|
||||
void currentBonjourRecordsChanged( const QList<BonjourRecord> &list );
|
||||
/// @brief new record resolved
|
||||
void bonjourRecordResolved(const QHostInfo &hostInfo, int port);
|
||||
void bonjourRecordResolved( const QHostInfo &hostInfo, int port );
|
||||
|
||||
///
|
||||
/// @brief timer slot which updates regularly entries
|
||||
|
@@ -33,6 +33,8 @@ public:
|
||||
QString value(Parser &parser) const;
|
||||
const char* getCString(Parser &parser) const;
|
||||
|
||||
virtual ~Option();
|
||||
|
||||
protected:
|
||||
QString _error;
|
||||
};
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#include "ColorOption.h"
|
||||
#include "ColorsOption.h"
|
||||
#include "DoubleOption.h"
|
||||
@@ -24,8 +23,8 @@ protected:
|
||||
/* No public inheritance because we need to modify a few methods */
|
||||
QCommandLineParser _parser;
|
||||
|
||||
QStringList _getNames(const char shortOption, const QString longOption);
|
||||
QString _getDescription(const QString description, const QString default_=QString());
|
||||
QStringList _getNames(const char shortOption, const QString& longOption);
|
||||
QString _getDescription(const QString& description, const QString& default_=QString());
|
||||
|
||||
public:
|
||||
~Parser() override;
|
||||
@@ -97,24 +96,24 @@ public:
|
||||
{
|
||||
if(description.size())
|
||||
setApplicationDescription(description);
|
||||
};
|
||||
}
|
||||
|
||||
QCommandLineOption addHelpOption()
|
||||
{
|
||||
return _parser.addHelpOption();
|
||||
};
|
||||
}
|
||||
|
||||
bool addOption(Option &option);
|
||||
bool addOption(Option *option);
|
||||
void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString())
|
||||
{
|
||||
_parser.addPositionalArgument(name, description, syntax);
|
||||
};
|
||||
}
|
||||
|
||||
QCommandLineOption addVersionOption()
|
||||
{
|
||||
return _parser.addVersionOption();
|
||||
};
|
||||
}
|
||||
|
||||
QString applicationDescription() const
|
||||
{
|
||||
@@ -166,7 +165,7 @@ public:
|
||||
_parser.setSingleDashWordOptionMode(singleDashWordOptionMode);
|
||||
}
|
||||
|
||||
void showHelp(int exitCode = 0)
|
||||
[[ noreturn ]] void showHelp(int exitCode = 0)
|
||||
{
|
||||
_parser.showHelp(exitCode);
|
||||
}
|
||||
|
@@ -16,9 +16,10 @@ class AuthTable : public DBManager
|
||||
|
||||
public:
|
||||
/// construct wrapper with auth table
|
||||
AuthTable(const QString& rootPath = "", QObject* parent = nullptr)
|
||||
AuthTable(const QString& rootPath = "", QObject* parent = nullptr, bool readonlyMode = false)
|
||||
: DBManager(parent)
|
||||
{
|
||||
setReadonlyMode(readonlyMode);
|
||||
if(!rootPath.isEmpty()){
|
||||
// Init Hyperion database usage
|
||||
setRootPath(rootPath);
|
||||
|
@@ -119,6 +119,13 @@ public:
|
||||
///
|
||||
bool deleteTable(const QString& table) const;
|
||||
|
||||
///
|
||||
/// @brief Sets a table in read-only mode.
|
||||
/// Updates will not written to the table
|
||||
/// @param[in] readOnly True read-only, false - read/write
|
||||
///
|
||||
void setReadonlyMode(bool readOnly) { _readonlyMode = readOnly; };
|
||||
|
||||
private:
|
||||
|
||||
Logger* _log;
|
||||
@@ -127,6 +134,8 @@ private:
|
||||
/// table in database
|
||||
QString _table;
|
||||
|
||||
bool _readonlyMode;
|
||||
|
||||
/// addBindValue to query given by QVariantList
|
||||
void doAddBindValue(QSqlQuery& query, const QVariantList& variants) const;
|
||||
};
|
||||
|
@@ -14,9 +14,11 @@ class InstanceTable : public DBManager
|
||||
{
|
||||
|
||||
public:
|
||||
InstanceTable(const QString& rootPath, QObject* parent = nullptr)
|
||||
InstanceTable(const QString& rootPath, QObject* parent = nullptr, bool readonlyMode = false)
|
||||
: DBManager(parent)
|
||||
{
|
||||
|
||||
setReadonlyMode(readonlyMode);
|
||||
// Init Hyperion database usage
|
||||
setRootPath(rootPath);
|
||||
setDatabaseName("hyperion");
|
||||
|
@@ -17,9 +17,11 @@ class MetaTable : public DBManager
|
||||
|
||||
public:
|
||||
/// construct wrapper with plugins table and columns
|
||||
MetaTable(QObject* parent = nullptr)
|
||||
MetaTable(QObject* parent = nullptr, bool readonlyMode = false)
|
||||
: DBManager(parent)
|
||||
{
|
||||
setReadonlyMode(readonlyMode);
|
||||
|
||||
setTable("meta");
|
||||
createTable(QStringList()<<"uuid TEXT"<<"created_at TEXT");
|
||||
};
|
||||
|
@@ -1,11 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// Python includes
|
||||
// collide of qt slots macro
|
||||
#undef slots
|
||||
#include "Python.h"
|
||||
#define slots
|
||||
|
||||
// Qt includes
|
||||
#include <QThread>
|
||||
#include <QJsonObject>
|
||||
@@ -44,13 +38,13 @@ public:
|
||||
int getPriority() const { return _priority; }
|
||||
|
||||
///
|
||||
/// @brief Set manual interuption to true,
|
||||
/// Note: DO NOT USE QThread::interuption!
|
||||
/// @brief Set manual interruption to true,
|
||||
/// Note: DO NOT USE QThread::interruption!
|
||||
///
|
||||
void requestInterruption() { _interupt = true; }
|
||||
|
||||
///
|
||||
/// @brief Check if the interuption flag has been set
|
||||
/// @brief Check if the interruption flag has been set
|
||||
/// @return The flag state
|
||||
///
|
||||
bool isInterruptionRequested() { return _interupt; }
|
||||
@@ -88,7 +82,7 @@ private:
|
||||
QVector<ColorRgb> _colors;
|
||||
|
||||
Logger *_log;
|
||||
// Reflects whenever this effects should interupt (timeout or external request)
|
||||
// Reflects whenever this effects should interrupt (timeout or external request)
|
||||
std::atomic<bool> _interupt {};
|
||||
|
||||
QSize _imageSize;
|
||||
|
@@ -15,7 +15,7 @@ private:
|
||||
|
||||
public:
|
||||
static EffectFileHandler* efhInstance;
|
||||
static EffectFileHandler* getInstance() { return efhInstance; };
|
||||
static EffectFileHandler* getInstance() { return efhInstance; }
|
||||
|
||||
///
|
||||
/// @brief Get all available effects
|
||||
|
79
include/grabber/DirectXGrabber.h
Normal file
79
include/grabber/DirectXGrabber.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
// DirectX 9 header
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
|
||||
// Hyperion-utils includes
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
|
||||
///
|
||||
/// @brief The DirectX9 capture implementation
|
||||
///
|
||||
class DirectXGrabber : public Grabber
|
||||
{
|
||||
public:
|
||||
|
||||
DirectXGrabber(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display);
|
||||
|
||||
virtual ~DirectXGrabber();
|
||||
|
||||
///
|
||||
/// Captures a single snapshot of the display and writes the data to the given image. The
|
||||
/// provided image should have the same dimensions as the configured values (_width and
|
||||
/// _height)
|
||||
///
|
||||
/// @param[out] image The snapped screenshot
|
||||
///
|
||||
virtual int grabFrame(Image<ColorRgb> & image);
|
||||
|
||||
///
|
||||
/// @brief Set a new video mode
|
||||
///
|
||||
virtual void setVideoMode(VideoMode mode);
|
||||
|
||||
///
|
||||
/// @brief Apply new width/height values, overwrite Grabber.h implementation
|
||||
///
|
||||
virtual bool setWidthHeight(int width, int height) { return true; };
|
||||
|
||||
///
|
||||
/// @brief Apply new pixelDecimation
|
||||
///
|
||||
virtual void setPixelDecimation(int pixelDecimation);
|
||||
|
||||
///
|
||||
/// Set the crop values
|
||||
/// @param cropLeft Left pixel crop
|
||||
/// @param cropRight Right pixel crop
|
||||
/// @param cropTop Top pixel crop
|
||||
/// @param cropBottom Bottom pixel crop
|
||||
///
|
||||
virtual void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
|
||||
|
||||
private:
|
||||
///
|
||||
/// @brief Setup a new capture display, will free the previous one
|
||||
/// @return True on success, false if no display is found
|
||||
///
|
||||
bool setupDisplay();
|
||||
|
||||
///
|
||||
/// @brief free the _screen pointer
|
||||
///
|
||||
void freeResources();
|
||||
|
||||
private:
|
||||
int _pixelDecimation;
|
||||
unsigned _displayWidth;
|
||||
unsigned _displayHeight;
|
||||
RECT* _srcRect;
|
||||
|
||||
IDirect3D9* _d3d9;
|
||||
IDirect3DDevice9* _device;
|
||||
IDirect3DSurface9* _surface;
|
||||
IDirect3DSurface9* _surfaceDest;
|
||||
};
|
36
include/grabber/DirectXWrapper.h
Normal file
36
include/grabber/DirectXWrapper.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <hyperion/GrabberWrapper.h>
|
||||
#include <grabber/DirectXGrabber.h>
|
||||
|
||||
class DirectXWrapper: public GrabberWrapper
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs the DirectX grabber with a specified grab size and update rate.
|
||||
///
|
||||
/// @param[in] cropLeft Remove from left [pixels]
|
||||
/// @param[in] cropRight Remove from right [pixels]
|
||||
/// @param[in] cropTop Remove from top [pixels]
|
||||
/// @param[in] cropBottom Remove from bottom [pixels]
|
||||
/// @param[in] pixelDecimation Decimation factor for image [pixels]
|
||||
/// @param[in] display The display used[index]
|
||||
/// @param[in] updateRate_Hz The image grab rate [Hz]
|
||||
///
|
||||
DirectXWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, const unsigned updateRate_Hz);
|
||||
|
||||
///
|
||||
/// Destructor of this DirectX grabber. Releases any claimed resources.
|
||||
///
|
||||
virtual ~DirectXWrapper() {};
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// Performs a single frame grab and computes the led-colors
|
||||
///
|
||||
virtual void action();
|
||||
|
||||
private:
|
||||
/// The actual grabber
|
||||
DirectXGrabber _grabber;
|
||||
};
|
@@ -37,7 +37,7 @@ public:
|
||||
///
|
||||
/// @brief Apply new width/height values, overwrite Grabber.h implementation as qt doesn't use width/height, just pixelDecimation to calc dimensions
|
||||
///
|
||||
bool setWidthHeight(int width, int height) override { return true; };
|
||||
bool setWidthHeight(int width, int height) override { return true; }
|
||||
|
||||
///
|
||||
/// @brief Apply new pixelDecimation
|
||||
|
@@ -45,7 +45,7 @@ public:
|
||||
///
|
||||
/// @brief Apply new width/height values, overwrite Grabber.h implementation as X11 doesn't use width/height, just pixelDecimation to calc dimensions
|
||||
///
|
||||
bool setWidthHeight(int width, int height) override { return true; };
|
||||
bool setWidthHeight(int width, int height) override { return true; }
|
||||
|
||||
///
|
||||
/// @brief Apply new pixelDecimation
|
||||
|
@@ -15,7 +15,7 @@ public:
|
||||
~XcbWrapper() override;
|
||||
|
||||
public slots:
|
||||
virtual void action();
|
||||
void action() override;
|
||||
|
||||
private:
|
||||
XcbGrabber _grabber;
|
||||
|
@@ -21,7 +21,7 @@ class AuthManager : public QObject
|
||||
private:
|
||||
friend class HyperionDaemon;
|
||||
/// constructor is private, can be called from HyperionDaemon
|
||||
AuthManager(QObject *parent = 0);
|
||||
AuthManager(QObject *parent = nullptr, bool readonlyMode = false);
|
||||
|
||||
public:
|
||||
struct AuthDefinition
|
||||
|
@@ -19,14 +19,14 @@ public:
|
||||
// listen for config changes
|
||||
connect(_hyperion, &Hyperion::settingsChanged, this, &BGEffectHandler::handleSettingsUpdate);
|
||||
|
||||
// init
|
||||
// initialization
|
||||
handleSettingsUpdate(settings::BGEFFECT, _hyperion->getSetting(settings::BGEFFECT));
|
||||
};
|
||||
}
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
|
||||
/// @param type settingyType from enum
|
||||
/// @param type settingType from enum
|
||||
/// @param config configuration object
|
||||
///
|
||||
void handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
@@ -36,7 +36,7 @@ private slots:
|
||||
const QJsonObject& BGEffectConfig = config.object();
|
||||
|
||||
#define BGCONFIG_ARRAY bgColorConfig.toArray()
|
||||
// clear bg prioritiy
|
||||
// clear background priority
|
||||
_hyperion->clear(254);
|
||||
// initial background effect/color
|
||||
if (BGEffectConfig["enable"].toBool(true))
|
||||
@@ -48,24 +48,24 @@ private slots:
|
||||
{
|
||||
std::vector<ColorRgb> bg_color = {
|
||||
ColorRgb {
|
||||
(uint8_t)BGCONFIG_ARRAY.at(0).toInt(0),
|
||||
(uint8_t)BGCONFIG_ARRAY.at(1).toInt(0),
|
||||
(uint8_t)BGCONFIG_ARRAY.at(2).toInt(0)
|
||||
static_cast<uint8_t>(BGCONFIG_ARRAY.at(0).toInt(0)),
|
||||
static_cast<uint8_t>(BGCONFIG_ARRAY.at(1).toInt(0)),
|
||||
static_cast<uint8_t>(BGCONFIG_ARRAY.at(2).toInt(0))
|
||||
}
|
||||
};
|
||||
_hyperion->setColor(254, bg_color);
|
||||
Info(Logger::getInstance("HYPERION"),"Inital background color set (%d %d %d)",bg_color.at(0).red, bg_color.at(0).green, bg_color.at(0).blue);
|
||||
Info(Logger::getInstance("HYPERION"),"Initial background color set (%d %d %d)",bg_color.at(0).red, bg_color.at(0).green, bg_color.at(0).blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
int result = _hyperion->setEffect(bgEffectConfig, 254);
|
||||
Info(Logger::getInstance("HYPERION"),"Inital background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ? "started" : "failed"));
|
||||
Info(Logger::getInstance("HYPERION"),"Initial background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ? "started" : "failed"));
|
||||
}
|
||||
}
|
||||
|
||||
#undef BGCONFIG_ARRAY
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
/// Hyperion instance pointer
|
||||
|
@@ -37,12 +37,12 @@ public:
|
||||
static GrabberWrapper* getInstance(){ return instance; }
|
||||
|
||||
///
|
||||
/// Starts the grabber wich produces led values with the specified update rate
|
||||
/// Starts the grabber which produces led values with the specified update rate
|
||||
///
|
||||
virtual bool start();
|
||||
|
||||
///
|
||||
/// Starts maybe the grabber wich produces led values with the specified update rate
|
||||
/// Starts maybe the grabber which produces led values with the specified update rate
|
||||
///
|
||||
virtual void tryStart();
|
||||
|
||||
@@ -90,6 +90,12 @@ public:
|
||||
///
|
||||
virtual QStringList getFramerates(const QString& devicePath) const;
|
||||
|
||||
///
|
||||
/// @brief Get active grabber name
|
||||
/// @return Active grabber name
|
||||
///
|
||||
virtual QString getActive() const;
|
||||
|
||||
static QStringList availableGrabbers();
|
||||
|
||||
public:
|
||||
|
@@ -98,6 +98,8 @@ public:
|
||||
///
|
||||
QString getActiveDeviceType() const;
|
||||
|
||||
bool getReadOnlyMode() {return _readOnlyMode; };
|
||||
|
||||
public slots:
|
||||
|
||||
///
|
||||
@@ -109,7 +111,7 @@ public slots:
|
||||
///
|
||||
/// Returns the number of attached leds
|
||||
///
|
||||
unsigned getLedCount() const;
|
||||
int getLedCount() const;
|
||||
|
||||
///
|
||||
/// @brief Register a new input by priority, the priority is not active (timeout -100 isn't muxer recognized) until you start to update the data with setInput()
|
||||
@@ -296,7 +298,7 @@ public slots:
|
||||
///
|
||||
/// @return The information of the given, a not found priority will return lowest priority as fallback
|
||||
///
|
||||
InputInfo getPriorityInfo(int priority) const;
|
||||
PriorityMuxer::InputInfo getPriorityInfo(int priority) const;
|
||||
|
||||
/// #############
|
||||
/// SETTINGSMANAGER
|
||||
@@ -484,7 +486,7 @@ private:
|
||||
/// @brief Constructs the Hyperion instance, just accessible for HyperionIManager
|
||||
/// @param instance The instance index
|
||||
///
|
||||
Hyperion(quint8 instance);
|
||||
Hyperion(quint8 instance, bool readonlyMode = false);
|
||||
|
||||
/// instance index
|
||||
const quint8 _instIndex;
|
||||
@@ -525,7 +527,7 @@ private:
|
||||
Logger * _log;
|
||||
|
||||
/// count of hardware leds
|
||||
unsigned _hwLedCount;
|
||||
int _hwLedCount;
|
||||
|
||||
QSize _ledGridSize;
|
||||
|
||||
@@ -541,4 +543,6 @@ private:
|
||||
|
||||
/// Boblight instance
|
||||
BoblightServer* _boblightServer;
|
||||
|
||||
bool _readOnlyMode;
|
||||
};
|
||||
|
@@ -169,7 +169,7 @@ private:
|
||||
/// @brief Construct the Manager
|
||||
/// @param The root path of all userdata
|
||||
///
|
||||
HyperionIManager(const QString& rootPath, QObject* parent = nullptr);
|
||||
HyperionIManager(const QString& rootPath, QObject* parent = nullptr, bool readonlyMode = false);
|
||||
|
||||
///
|
||||
/// @brief Start all instances that are marked as enabled in db. Non blocking
|
||||
@@ -193,6 +193,9 @@ private:
|
||||
const QString _rootPath;
|
||||
QMap<quint8, Hyperion*> _runningInstances;
|
||||
QList<quint8> _startQueue;
|
||||
|
||||
bool _readonlyMode;
|
||||
|
||||
/// All pending requests
|
||||
QMap<quint8, PendingRequests> _pendingRequests;
|
||||
};
|
||||
|
@@ -19,9 +19,9 @@
|
||||
class Hyperion;
|
||||
|
||||
///
|
||||
/// The ImageProcessor translates an RGB-image to RGB-values for the leds. The processing is
|
||||
/// The ImageProcessor translates an RGB-image to RGB-values for the LEDs. The processing is
|
||||
/// performed in two steps. First the average color per led-region is computed. Second a
|
||||
/// color-tranform is applied based on a gamma-correction.
|
||||
/// color-transform is applied based on a gamma-correction.
|
||||
///
|
||||
class ImageProcessor : public QObject
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
~ImageProcessor() override;
|
||||
|
||||
///
|
||||
/// Specifies the width and height of 'incomming' images. This will resize the buffer-image to
|
||||
/// Specifies the width and height of 'incoming' images. This will resize the buffer-image to
|
||||
/// match the given size.
|
||||
/// NB All earlier obtained references will be invalid.
|
||||
///
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
///
|
||||
void setLedString(const LedString& ledString);
|
||||
|
||||
/// Returns starte of black border detector
|
||||
/// Returns state of black border detector
|
||||
bool blackBorderDetectorEnabled() const;
|
||||
|
||||
/// Returns the current _userMappingType, this may not be the current applied type!
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
static QString mappingTypeToStr(int mappingType);
|
||||
|
||||
///
|
||||
/// @brief Set the Hyperion::update() requestes led mapping type. This type is used in favour of type set with setLedMappingType.
|
||||
/// @brief Set the Hyperion::update() request LED mapping type. This type is used in favour of type set with setLedMappingType.
|
||||
/// If you don't want to force a mapType set this to -1 (user choice will be set)
|
||||
/// @param mapType The new mapping type
|
||||
///
|
||||
@@ -85,7 +85,7 @@ public slots:
|
||||
|
||||
public:
|
||||
///
|
||||
/// Specifies the width and height of 'incomming' images. This will resize the buffer-image to
|
||||
/// Specifies the width and height of 'incoming' images. This will resize the buffer-image to
|
||||
/// match the given size.
|
||||
/// NB All earlier obtained references will be invalid.
|
||||
///
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
// Check black border detection
|
||||
verifyBorder(image);
|
||||
|
||||
// Create a result vector and call the 'in place' functionl
|
||||
// Create a result vector and call the 'in place' function
|
||||
switch (_mappingType)
|
||||
{
|
||||
case 1: colors = _imageToLeds->getUniLedColor(image); break;
|
||||
@@ -225,7 +225,7 @@ private:
|
||||
/// The processor for black border detection
|
||||
hyperion::BlackBorderProcessor * _borderProcessor;
|
||||
|
||||
/// The mapping of image-pixels to leds
|
||||
/// The mapping of image-pixels to LEDs
|
||||
hyperion::ImageToLedsMap* _imageToLeds;
|
||||
|
||||
/// Type of image 2 led mapping
|
||||
|
@@ -175,7 +175,7 @@ namespace hyperion
|
||||
return ColorRgb::BLACK;
|
||||
}
|
||||
|
||||
// Accumulate the sum of each seperate color channel
|
||||
// Accumulate the sum of each separate color channel
|
||||
uint_fast32_t cummRed = 0;
|
||||
uint_fast32_t cummGreen = 0;
|
||||
uint_fast32_t cummBlue = 0;
|
||||
@@ -209,7 +209,7 @@ namespace hyperion
|
||||
template <typename Pixel_T>
|
||||
ColorRgb calcMeanColor(const Image<Pixel_T> & image) const
|
||||
{
|
||||
// Accumulate the sum of each seperate color channel
|
||||
// Accumulate the sum of each separate color channel
|
||||
uint_fast32_t cummRed = 0;
|
||||
uint_fast32_t cummGreen = 0;
|
||||
uint_fast32_t cummBlue = 0;
|
||||
|
@@ -107,16 +107,6 @@ struct Led
|
||||
class LedString
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs the LedString with no leds
|
||||
///
|
||||
LedString();
|
||||
|
||||
///
|
||||
/// Destructor of this LedString
|
||||
///
|
||||
~LedString();
|
||||
|
||||
///
|
||||
/// Returns the led specifications
|
||||
///
|
||||
|
@@ -11,22 +11,22 @@
|
||||
|
||||
///
|
||||
/// The LedColorTransform is responsible for performing color transformation from 'raw' colors
|
||||
/// received as input to colors mapped to match the color-properties of the leds.
|
||||
/// received as input to colors mapped to match the color-properties of the LEDs.
|
||||
///
|
||||
class MultiColorAdjustment
|
||||
{
|
||||
public:
|
||||
MultiColorAdjustment(unsigned ledCnt);
|
||||
MultiColorAdjustment(int ledCnt);
|
||||
~MultiColorAdjustment();
|
||||
|
||||
/**
|
||||
* Adds a new ColorAdjustment to this MultiColorTransform
|
||||
*
|
||||
* @param adjustment The new ColorAdjustment (ownership is transfered)
|
||||
* @param adjustment The new ColorAdjustment (ownership is transferred)
|
||||
*/
|
||||
void addAdjustment(ColorAdjustment * adjustment);
|
||||
|
||||
void setAdjustmentForLed(const QString& id, unsigned startLed, unsigned endLed);
|
||||
void setAdjustmentForLed(const QString& id, int startLed, int endLed);
|
||||
|
||||
bool verifyAdjustments() const;
|
||||
|
||||
|
@@ -58,10 +58,10 @@ public:
|
||||
const static int LOWEST_PRIORITY;
|
||||
|
||||
///
|
||||
/// Constructs the PriorityMuxer for the given number of leds (used to switch to black when
|
||||
/// Constructs the PriorityMuxer for the given number of LEDs (used to switch to black when
|
||||
/// there are no priority channels
|
||||
///
|
||||
/// @param ledCount The number of leds
|
||||
/// @param ledCount The number of LEDs
|
||||
///
|
||||
PriorityMuxer(int ledCount, QObject * parent);
|
||||
|
||||
@@ -87,18 +87,18 @@ public:
|
||||
/// @brief Get the state of source auto selection
|
||||
/// @return True if enabled, else false
|
||||
///
|
||||
bool isSourceAutoSelectEnabled() const { return _sourceAutoSelectEnabled; };
|
||||
bool isSourceAutoSelectEnabled() const { return _sourceAutoSelectEnabled; }
|
||||
|
||||
///
|
||||
/// @brief Overwrite current lowest piority with manual selection; On success disables aito selection
|
||||
/// @brief Overwrite current lowest priority with manual selection; On success disables auto selection
|
||||
/// @param priority The
|
||||
/// @return True on success, false if priority not found
|
||||
///
|
||||
bool setPriority(uint8_t priority);
|
||||
bool setPriority(int priority);
|
||||
|
||||
///
|
||||
/// @brief Update all ledColos with min length of >= 1 to fit the new led length
|
||||
/// @param[in] ledCount The count of leds
|
||||
/// @brief Update all LED-Colors with min length of >= 1 to fit the new led length
|
||||
/// @param[in] ledCount The count of LEDs
|
||||
///
|
||||
void updateLedColorsLength(int ledCount);
|
||||
|
||||
@@ -146,13 +146,13 @@ public:
|
||||
/// @param[in] priority The priority of the channel
|
||||
/// @param[in] component The component of the channel
|
||||
/// @param[in] origin Who set the channel (CustomString@IP)
|
||||
/// @param[in] owner Speicifc owner string, might be empty
|
||||
/// @param[in] owner Specific owner string, might be empty
|
||||
/// @param[in] smooth_cfg The smooth id to use
|
||||
///
|
||||
void registerInput(int priority, hyperion::Components component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = SMOOTHING_MODE_DEFAULT);
|
||||
|
||||
///
|
||||
/// @brief Update the current color of a priority (prev registered with registerInput())
|
||||
/// @brief Update the current color of a priority (previous registered with registerInput())
|
||||
/// @param priority The priority to update
|
||||
/// @param ledColors The colors
|
||||
/// @param timeout_ms The new timeout (defaults to -1 endless)
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
/// @param priority The priority
|
||||
/// @return True on success false if not found
|
||||
///
|
||||
bool setInputInactive(quint8 priority);
|
||||
bool setInputInactive(int priority);
|
||||
|
||||
///
|
||||
/// Clears the specified priority channel and update _currentPriority on success
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
/// @param[in] priority The priority of the channel to clear
|
||||
/// @return True if priority has been cleared else false (not found)
|
||||
///
|
||||
bool clearInput(uint8_t priority);
|
||||
bool clearInput(int priority);
|
||||
|
||||
///
|
||||
/// Clears all priority channels
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
void clearAll(bool forceClearAll=false);
|
||||
|
||||
///
|
||||
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continous single color pushes)
|
||||
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continuous single color pushes)
|
||||
///
|
||||
void queuePush() { emit timeRunner(); }
|
||||
|
||||
@@ -212,19 +212,6 @@ signals:
|
||||
///
|
||||
void visibleComponentChanged(hyperion::Components comp);
|
||||
|
||||
///
|
||||
/// @brief Emits whenever a priority changes active state
|
||||
/// @param priority The priority who changed the active state
|
||||
/// @param state The new state, state true = active else false
|
||||
///
|
||||
void activeStateChanged(quint8 priority, bool state);
|
||||
|
||||
///
|
||||
/// @brief Emits whenever the auto selection state has been changed
|
||||
/// @param state The new state of auto selection; True enabled else false
|
||||
///
|
||||
void autoSelectChanged(bool state);
|
||||
|
||||
///
|
||||
/// @brief Emits whenever something changes which influences the priorities listing
|
||||
/// Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1
|
||||
|
@@ -3,14 +3,14 @@
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/settings.h>
|
||||
|
||||
// qt incl
|
||||
// qt includes
|
||||
#include <QJsonObject>
|
||||
|
||||
class Hyperion;
|
||||
class SettingsTable;
|
||||
|
||||
///
|
||||
/// @brief Manage the settings read write from/to config file, on settings changed will emit a signal to update components accordingly
|
||||
/// @brief Manage the settings read write from/to configuration file, on settings changed will emit a signal to update components accordingly
|
||||
///
|
||||
class SettingsManager : public QObject
|
||||
{
|
||||
@@ -21,10 +21,10 @@ public:
|
||||
/// @params instance Instance index of HyperionInstanceManager
|
||||
/// @params parent The parent hyperion instance
|
||||
///
|
||||
SettingsManager(quint8 instance, QObject* parent = nullptr);
|
||||
SettingsManager(quint8 instance, QObject* parent = nullptr, bool readonlyMode = false);
|
||||
|
||||
///
|
||||
/// @brief Save a complete json config
|
||||
/// @brief Save a complete json configuration
|
||||
/// @param config The entire config object
|
||||
/// @param correct If true will correct json against schema before save
|
||||
/// @return True on success else false
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
bool saveSettings(QJsonObject config, bool correct = false);
|
||||
|
||||
///
|
||||
/// @brief get a single setting json from config
|
||||
/// @brief get a single setting json from configuration
|
||||
/// @param type The settings::type from enum
|
||||
/// @return The requested json data as QJsonDocument
|
||||
///
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
/// @brief get the full settings object of this instance (with global settings)
|
||||
/// @return The requested json
|
||||
///
|
||||
const QJsonObject & getSettings() const { return _qconfig; };
|
||||
const QJsonObject & getSettings() const { return _qconfig; }
|
||||
|
||||
signals:
|
||||
///
|
||||
/// @brief Emits whenever a config part changed.
|
||||
/// @brief Emits whenever a configuration part changed.
|
||||
/// @param type The settings type from enum
|
||||
/// @param data The data as QJsonDocument
|
||||
///
|
||||
@@ -54,7 +54,7 @@ signals:
|
||||
|
||||
private:
|
||||
///
|
||||
/// @brief Add possile migrations steps for config here
|
||||
/// @brief Add possible migrations steps for configuration here
|
||||
/// @param config The configuration object
|
||||
/// @return True when a migration has been triggered
|
||||
///
|
||||
@@ -73,6 +73,8 @@ private:
|
||||
/// the schema
|
||||
static QJsonObject schemaJson;
|
||||
|
||||
/// the current config of this instance
|
||||
/// the current configuration of this instance
|
||||
QJsonObject _qconfig;
|
||||
|
||||
bool _readonlyMode;
|
||||
};
|
||||
|
@@ -60,9 +60,9 @@ public:
|
||||
///
|
||||
/// @brief Set the number of LEDs supported by the device.
|
||||
///
|
||||
/// @param[in] ledCount Number of device LEDs
|
||||
/// @param[in] ledCount Number of device LEDs, 0 = unknown number
|
||||
///
|
||||
void setLedCount(unsigned int ledCount);
|
||||
void setLedCount(int ledCount);
|
||||
|
||||
///
|
||||
/// @brief Set a device's latch time.
|
||||
@@ -87,9 +87,11 @@ public:
|
||||
/// @brief Discover devices of this type available (for configuration).
|
||||
/// @note Mainly used for network devices. Allows to find devices, e.g. via ssdp, mDNS or cloud ways.
|
||||
///
|
||||
/// @param[in] params Parameters used to overwrite discovery default behaviour
|
||||
///
|
||||
/// @return A JSON structure holding a list of devices found
|
||||
///
|
||||
virtual QJsonObject discover();
|
||||
virtual QJsonObject discover(const QJsonObject& params);
|
||||
|
||||
///
|
||||
/// @brief Discover first device of this type available (for configuration).
|
||||
@@ -116,7 +118,7 @@ public:
|
||||
///
|
||||
/// @param[in] params Parameters to address device
|
||||
///
|
||||
virtual void identify(const QJsonObject& params) {}
|
||||
virtual void identify(const QJsonObject& /*params*/) {}
|
||||
|
||||
///
|
||||
/// @brief Check, if device is properly initialised
|
||||
@@ -191,9 +193,9 @@ public slots:
|
||||
///
|
||||
/// @brief Get the number of LEDs supported by the device.
|
||||
///
|
||||
/// @return Number of device's LEDs
|
||||
/// @return Number of device's LEDs, 0 = unknown number
|
||||
///
|
||||
unsigned int getLedCount() const { return _ledCount; }
|
||||
int getLedCount() const { return _ledCount; }
|
||||
|
||||
///
|
||||
/// @brief Get the current active LED-device type.
|
||||
@@ -348,7 +350,15 @@ protected:
|
||||
/// @param size of the array
|
||||
/// @param number Number of array items to be converted.
|
||||
/// @return array as string of hex values
|
||||
QString uint8_t_to_hex_string(const uint8_t * data, const qint64 size, qint64 number = -1) const;
|
||||
QString uint8_t_to_hex_string(const uint8_t * data, const int size, int number = -1) const;
|
||||
|
||||
///
|
||||
/// @brief Converts a ByteArray to hex string.
|
||||
///
|
||||
/// @param data ByteArray
|
||||
/// @param number Number of array items to be converted.
|
||||
/// @return array as string of hex values
|
||||
QString toHex(const QByteArray& data, int number = -1) const;
|
||||
|
||||
/// Current device's type
|
||||
QString _activeDeviceType;
|
||||
@@ -368,17 +378,17 @@ protected:
|
||||
|
||||
// Device configuration parameters
|
||||
|
||||
/// Number of hardware LEDs supported by device.
|
||||
unsigned int _ledCount;
|
||||
unsigned int _ledRGBCount;
|
||||
unsigned int _ledRGBWCount;
|
||||
|
||||
/// Refresh interval in milliseconds
|
||||
int _refreshTimerInterval_ms;
|
||||
|
||||
/// Time a device requires mandatorily between two writes (in milliseconds)
|
||||
int _latchTime_ms;
|
||||
|
||||
/// Number of hardware LEDs supported by device.
|
||||
uint _ledCount;
|
||||
uint _ledRGBCount;
|
||||
uint _ledRGBWCount;
|
||||
|
||||
/// Does the device allow restoring the original state?
|
||||
bool _isRestoreOrigState;
|
||||
|
||||
|
@@ -66,65 +66,62 @@ public:
|
||||
/// @brief Overwrite description address
|
||||
/// @param addr new address
|
||||
///
|
||||
void setDescriptionAddress(const QString& addr) { _descAddress = addr; };
|
||||
void setDescriptionAddress( const QString &addr ) { _descAddress = addr; }
|
||||
|
||||
///
|
||||
/// @brief Set uuid
|
||||
/// @param uuid The uuid
|
||||
///
|
||||
void setUuid(const QString& uuid) { _uuid = uuid; };
|
||||
void setUuid( const QString &uuid ) { _uuid = uuid; }
|
||||
|
||||
///
|
||||
/// @brief set new flatbuffer server port
|
||||
///
|
||||
void setFlatBufPort(quint16 port) { _fbsPort = QString::number(port); };
|
||||
void setFlatBufPort( quint16 port ){_fbsPort = QString::number( port ); }
|
||||
|
||||
///
|
||||
/// @brief Get current flatbuffer server port
|
||||
///
|
||||
quint16 getFlatBufPort() const { return _fbsPort.toInt(); };
|
||||
|
||||
quint16 getFlatBufPort() const
|
||||
{
|
||||
return _fbsPort.toInt();
|
||||
}
|
||||
///
|
||||
/// @brief set new protobuf server port
|
||||
///
|
||||
void setProtoBufPort(quint16 port) { _pbsPort = QString::number(port); };
|
||||
void setProtoBufPort( quint16 port ) { _pbsPort = QString::number( port ); }
|
||||
|
||||
///
|
||||
/// @brief Get current protobuf server port
|
||||
///
|
||||
quint16 getProtoBufPort() const { return _pbsPort.toInt(); };
|
||||
|
||||
quint16 getProtoBufPort() const { return _pbsPort.toInt(); }
|
||||
///
|
||||
/// @brief set new json server port
|
||||
///
|
||||
void setJsonServerPort(quint16 port) { _jssPort = QString::number(port); };
|
||||
|
||||
void setJsonServerPort( quint16 port ) { _jssPort = QString::number( port ); }
|
||||
///
|
||||
/// @brief get new json server port
|
||||
///
|
||||
quint16 getJsonServerPort() const { return _jssPort.toInt(); };
|
||||
|
||||
quint16 getJsonServerPort() const { return _jssPort.toInt(); }
|
||||
///
|
||||
/// @brief set new ssl server port
|
||||
///
|
||||
void setSSLServerPort(quint16 port) { _sslPort = QString::number(port); };
|
||||
|
||||
void setSSLServerPort( quint16 port ) { _sslPort = QString::number( port ); }
|
||||
///
|
||||
/// @brief get new ssl server port
|
||||
///
|
||||
quint16 getSSLServerPort() const { return _sslPort.toInt(); };
|
||||
quint16 getSSLServerPort() const { return _sslPort.toInt(); }
|
||||
|
||||
///
|
||||
/// @brief set new hyperion name
|
||||
///
|
||||
void setHyperionName(const QString &name) { _name = name; };
|
||||
void setHyperionName( const QString &name ) { _name = name; }
|
||||
|
||||
///
|
||||
/// @brief get hyperion name
|
||||
///
|
||||
QString getHyperionName() const { return _name; };
|
||||
|
||||
|
||||
QString getHyperionName() const { return _name; }
|
||||
|
||||
signals:
|
||||
///
|
||||
/// @brief Emits whenever a new SSDP search "man : ssdp:discover" is received along with the service type
|
||||
@@ -133,23 +130,18 @@ signals:
|
||||
/// @param address The ip of the caller
|
||||
/// @param port The port of the caller
|
||||
///
|
||||
void msearchRequestReceived(const QString& target, const QString& mx, const QString address, quint16 port);
|
||||
void msearchRequestReceived( const QString &target,
|
||||
const QString &mx,
|
||||
const QString address,
|
||||
quint16 port );
|
||||
|
||||
private:
|
||||
Logger* _log;
|
||||
QUdpSocket* _udpSocket;
|
||||
Logger *_log;
|
||||
QUdpSocket *_udpSocket;
|
||||
|
||||
QString _serverHeader,
|
||||
_uuid,
|
||||
_fbsPort,
|
||||
_pbsPort,
|
||||
_jssPort,
|
||||
_sslPort,
|
||||
_name,
|
||||
_descAddress;
|
||||
bool _running;
|
||||
QString _serverHeader, _uuid, _fbsPort, _pbsPort, _jssPort, _sslPort, _name, _descAddress;
|
||||
bool _running;
|
||||
|
||||
private slots:
|
||||
void readPendingDatagrams();
|
||||
|
||||
};
|
||||
|
@@ -97,17 +97,23 @@ inline bool operator!=(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
/// Compare operator to check if a color is 'smaller' than or 'equal' to another color
|
||||
inline bool operator<=(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return lhs < rhs || lhs == rhs;
|
||||
return lhs.red <= rhs.red &&
|
||||
lhs.green <= rhs.green &&
|
||||
lhs.blue <= rhs.blue;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'greater' to another color
|
||||
inline bool operator>(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return !(lhs < rhs) && lhs != rhs;
|
||||
return lhs.red > rhs.red &&
|
||||
lhs.green > rhs.green &&
|
||||
lhs.blue > rhs.blue;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'greater' than or 'equal' to another color
|
||||
inline bool operator>=(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return lhs > rhs || lhs == rhs;
|
||||
return lhs.red >= rhs.red &&
|
||||
lhs.green >= rhs.green &&
|
||||
lhs.blue >= rhs.blue;
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ public:
|
||||
_height(other._height),
|
||||
_pixels(new Pixel_T[other._width * other._height + 1])
|
||||
{
|
||||
memcpy(_pixels, other._pixels, (long) other._width * other._height * sizeof(Pixel_T));
|
||||
memcpy(_pixels, other._pixels, static_cast<ulong>(other._width) * static_cast<ulong>(other._height) * sizeof(Pixel_T));
|
||||
}
|
||||
|
||||
ImageData& operator=(ImageData rhs)
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
|
||||
ssize_t size() const
|
||||
{
|
||||
return (ssize_t) _width * _height * sizeof(Pixel_T);
|
||||
return static_cast<ssize_t>(_width) * static_cast<ssize_t>(_height) * sizeof(Pixel_T);
|
||||
}
|
||||
|
||||
void clear()
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
_pixels = new Pixel_T[2];
|
||||
}
|
||||
|
||||
memset(_pixels, 0, (unsigned long) _width * _height * sizeof(Pixel_T));
|
||||
memset(_pixels, 0, static_cast<unsigned long>(_width) * static_cast<unsigned long>(_height) * sizeof(Pixel_T));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -16,7 +16,7 @@ class NetOrigin : public QObject
|
||||
Q_OBJECT
|
||||
private:
|
||||
friend class HyperionDaemon;
|
||||
NetOrigin(QObject* parent = 0, Logger* log = Logger::getInstance("NETWORK"));
|
||||
NetOrigin(QObject* parent = nullptr, Logger* log = Logger::getInstance("NETWORK"));
|
||||
|
||||
public:
|
||||
///
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
///
|
||||
bool isLocalAddress(const QHostAddress& address, const QHostAddress& local) const;
|
||||
|
||||
static NetOrigin* getInstance(){ return instance; };
|
||||
static NetOrigin* instance;
|
||||
static NetOrigin *getInstance() { return instance; }
|
||||
static NetOrigin *instance;
|
||||
|
||||
private slots:
|
||||
///
|
||||
|
@@ -19,9 +19,6 @@ public:
|
||||
/// @param adjustB
|
||||
RgbChannelAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB, QString channelName="");
|
||||
|
||||
/// Destructor
|
||||
~RgbChannelAdjustment();
|
||||
|
||||
///
|
||||
/// Transform the given array value
|
||||
///
|
||||
|
@@ -11,18 +11,25 @@ public:
|
||||
QString kernelType;
|
||||
QString kernelVersion;
|
||||
QString architecture;
|
||||
QString cpuModelName;
|
||||
QString cpuModelType;
|
||||
QString cpuRevision;
|
||||
QString cpuHardware;
|
||||
QString wordSize;
|
||||
QString productType;
|
||||
QString productVersion;
|
||||
QString prettyName;
|
||||
QString hostName;
|
||||
QString domainName;
|
||||
QString qtVersion;
|
||||
QString pyVersion;
|
||||
};
|
||||
|
||||
static HyperionSysInfo get();
|
||||
|
||||
private:
|
||||
SysInfo();
|
||||
void getCPUInfo();
|
||||
|
||||
static SysInfo* _instance;
|
||||
|
||||
|
@@ -36,9 +36,9 @@ namespace hyperion {
|
||||
{
|
||||
std::vector<ColorRgb> fg_color = {
|
||||
ColorRgb {
|
||||
(uint8_t)FGCONFIG_ARRAY.at(0).toInt(0),
|
||||
(uint8_t)FGCONFIG_ARRAY.at(1).toInt(0),
|
||||
(uint8_t)FGCONFIG_ARRAY.at(2).toInt(0)
|
||||
static_cast<uint8_t>(FGCONFIG_ARRAY.at(0).toInt(0)),
|
||||
static_cast<uint8_t>(FGCONFIG_ARRAY.at(1).toInt(0)),
|
||||
static_cast<uint8_t>(FGCONFIG_ARRAY.at(2).toInt(0))
|
||||
}
|
||||
};
|
||||
hyperion->setColor(FG_PRIORITY, fg_color, fg_duration_ms);
|
||||
@@ -62,22 +62,22 @@ namespace hyperion {
|
||||
{
|
||||
const double backlightThreshold = colorConfig["backlightThreshold"].toDouble(0.0);
|
||||
const bool backlightColored = colorConfig["backlightColored"].toBool(false);
|
||||
const double brightness = colorConfig["brightness"].toInt(100);
|
||||
const double brightnessComp = colorConfig["brightnessCompensation"].toInt(100);
|
||||
const int brightness = colorConfig["brightness"].toInt(100);
|
||||
const int brightnessComp = colorConfig["brightnessCompensation"].toInt(100);
|
||||
const double gammaR = colorConfig["gammaRed"].toDouble(1.0);
|
||||
const double gammaG = colorConfig["gammaGreen"].toDouble(1.0);
|
||||
const double gammaB = colorConfig["gammaBlue"].toDouble(1.0);
|
||||
|
||||
return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, brightness, brightnessComp);
|
||||
return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, static_cast<uint8_t>(brightness), static_cast<uint8_t>(brightnessComp));
|
||||
}
|
||||
|
||||
RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, int defaultR, int defaultG, int defaultB)
|
||||
{
|
||||
const QJsonArray& channelConfig = colorConfig[channelName].toArray();
|
||||
return RgbChannelAdjustment(
|
||||
channelConfig[0].toInt(defaultR),
|
||||
channelConfig[1].toInt(defaultG),
|
||||
channelConfig[2].toInt(defaultB),
|
||||
static_cast<uint8_t>(channelConfig[0].toInt(defaultR)),
|
||||
static_cast<uint8_t>(channelConfig[1].toInt(defaultG)),
|
||||
static_cast<uint8_t>(channelConfig[2].toInt(defaultB)),
|
||||
"ChannelAdjust_" + channelName.toUpper()
|
||||
);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace hyperion {
|
||||
return adjustment;
|
||||
}
|
||||
|
||||
MultiColorAdjustment * createLedColorsAdjustment(unsigned ledCnt, const QJsonObject & colorConfig)
|
||||
MultiColorAdjustment * createLedColorsAdjustment(int ledCnt, const QJsonObject & colorConfig)
|
||||
{
|
||||
// Create the result, the transforms are added to this
|
||||
MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt);
|
||||
@@ -233,7 +233,7 @@ namespace hyperion {
|
||||
std::sort(midPointsY.begin(), midPointsY.end());
|
||||
midPointsY.erase(std::unique(midPointsY.begin(), midPointsY.end()), midPointsY.end());
|
||||
|
||||
QSize gridSize( midPointsX.size(), midPointsY.size() );
|
||||
QSize gridSize( static_cast<int>(midPointsX.size()), static_cast<int>(midPointsY.size()) );
|
||||
|
||||
// Correct the grid in case it is malformed in width vs height
|
||||
// Expected is at least 50% of width <-> height
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
{
|
||||
case QJsonValue::Array:
|
||||
{
|
||||
for (const QJsonValue &v : value.toArray())
|
||||
for (const QJsonValueRef v : value.toArray())
|
||||
{
|
||||
ret = getDefaultValue(v);
|
||||
if (!ret.isEmpty())
|
||||
|
@@ -33,7 +33,7 @@ class WebServer : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WebServer (const QJsonDocument& config, bool useSsl, QObject * parent = 0);
|
||||
WebServer (const QJsonDocument& config, bool useSsl, QObject * parent = nullptr);
|
||||
|
||||
~WebServer () override;
|
||||
|
||||
|
Reference in New Issue
Block a user