Merge branch 'master' into refactor/led_device

This commit is contained in:
Murat Seker
2020-08-23 21:02:25 +02:00
committed by GitHub
272 changed files with 1711 additions and 1738 deletions

View File

@@ -46,14 +46,14 @@ public:
/// @param localConnection Is this a local network connection? Use utils/NetOrigin to check that
/// @param parent Parent QObject
///
API(Logger *log, const bool &localConnection, QObject *parent);
API(Logger *log, bool localConnection, QObject *parent);
protected:
///
/// @brief Initialize the API
/// This call is REQUIRED!
///
void init(void);
void init();
///
/// @brief Set a single color
@@ -62,7 +62,7 @@ protected:
/// @param[in] timeout_ms The time the leds are set to the given color [ms]
/// @param[in] origin The setter
///
void setColor(const int &priority, const std::vector<uint8_t> &ledColors, const int &timeout_ms = -1, const QString &origin = "API", const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setColor(int priority, const std::vector<uint8_t> &ledColors, int timeout_ms = -1, const QString &origin = "API", hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set a image
@@ -72,7 +72,7 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// @return True on success
///
bool setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
bool setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Clear a priority in the Muxer, if -1 all priorities are cleared
@@ -81,7 +81,7 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// @return True on success
///
bool clearPriority(const int &priority, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
bool clearPriority(int priority, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set a new component state
@@ -91,21 +91,21 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// @ return True on success
///
bool setComponentState(const QString &comp, bool &compState, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
bool setComponentState(const QString &comp, bool &compState, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set a ledToImageMapping type
/// @param type mapping type string
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setLedMappingType(const int &type, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setLedMappingType(int type, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set the 2D/3D modes type
/// @param mode The VideoMode
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setVideoMode(const VideoMode &mode, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setVideoMode(VideoMode mode, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set an effect
@@ -113,21 +113,21 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// REQUIRED dat fields: effectName, priority, duration, origin
///
void setEffect(const EffectCmdData &dat, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setEffect(const EffectCmdData &dat, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set source auto select enabled or disabled
/// @param sate The new state
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setSourceAutoSelect(const bool state, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setSourceAutoSelect(bool state, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set the visible priority to given priority
/// @param priority The priority to set
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setVisiblePriority(const int &priority, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setVisiblePriority(int priority, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Register a input or update the meta data of a previous register call
@@ -138,21 +138,21 @@ protected:
/// @param[in] owner Specific owner string, might be empty
/// @param[in] callerComp The component that call this (e.g. PROTO/FLAT)
///
void registerInput(const int &priority, const hyperion::Components &component, const QString &origin, const QString &owner, const hyperion::Components &callerComp);
void registerInput(int priority, hyperion::Components component, const QString &origin, const QString &owner, hyperion::Components callerComp);
///
/// @brief Revoke a registerInput() call by priority. We maintain all registered priorities in this scope
/// ATTENTION: This is MANDATORY if you change (priority change) or stop(clear/timeout) DURING lifetime. If this class destructs it's not needed
/// @param priority The priority to unregister
///
void unregisterInput(const int &priority);
void unregisterInput(int priority);
///
/// @brief Handle the instance switching
/// @param inst The requested instance
/// @return True on success else false
///
bool setHyperionInstance(const quint8 &inst);
bool setHyperionInstance(quint8 inst);
///
/// @brief Get all contrable components and their state
@@ -169,19 +169,19 @@ protected:
/// @brief Get all instances data
/// @return The instance data
///
QVector<QVariantMap> getAllInstanceData(void);
QVector<QVariantMap> getAllInstanceData();
///
/// @brief Start instance
/// @param index The instance index
///
void startInstance(const quint8 &index);
void startInstance(quint8 index);
///
/// @brief Stop instance
/// @param index The instance index
///
void stopInstance(const quint8 &index);
void stopInstance(quint8 index);
//////////////////////////////////
/// AUTH / ADMINISTRATION METHODS
@@ -193,7 +193,7 @@ protected:
/// @param replyMsg The reply Msg
/// @return False with reply
///
bool deleteInstance(const quint8 &index, QString &replyMsg);
bool deleteInstance(quint8 index, QString &replyMsg);
///
/// @brief Create instance. Requires ADMIN ACCESS
@@ -208,7 +208,7 @@ protected:
/// @param name With given name
/// @return False with reply
///
QString setInstanceName(const quint8 &index, const QString &name);
QString setInstanceName(quint8 index, const QString &name);
///
/// @brief Delete an effect. Requires ADMIN ACCESS
@@ -292,7 +292,7 @@ protected:
/// @param id The id fo the request
/// @param accept True when it should be accepted, else false
/// @return True on success
bool handlePendingTokenRequest(const QString &id, const bool accept);
bool handlePendingTokenRequest(const QString &id, bool accept);
///
/// @brief Get the current List of Tokens. Requires ADMIN ACCESS
@@ -379,7 +379,7 @@ signals:
/// @param comment The comment that was part of the request
/// @param id The id that was part of the request
///
void onTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id);
void onTokenResponse(bool success, const QString &token, const QString &comment, const QString &id);
private slots:
///
@@ -396,7 +396,7 @@ private slots:
/// @param comment The comment that was part of the request
/// @param id The id that was part of the request
///
void checkTokenResponse(const bool &success, QObject *caller, const QString &token, const QString &comment, const QString &id);
void checkTokenResponse(bool success, QObject *caller, const QString &token, const QString &comment, const QString &id);
private:
void stopDataConnectionss();

View File

@@ -30,7 +30,7 @@ public:
/// @param localConnection True when the sender has origin home network
/// @param noListener if true, this instance won't listen for hyperion push events
///
JsonAPI(QString peerAddress, Logger *log, const bool &localConnection, QObject *parent, bool noListener = false);
JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject *parent, bool noListener = false);
///
/// Handle an incoming JSON message
@@ -42,7 +42,7 @@ public:
///
/// @brief Initialization steps
///
void initialize(void);
void initialize();
public slots:
///
@@ -77,7 +77,7 @@ private slots:
/// @param comment The comment that was part of the request
/// @param id The id that was part of the request
///
void handleTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id);
void handleTokenResponse(bool success, const QString &token, const QString &comment, const QString &id);
///
/// @brief Handle whenever the state of a instance (HyperionIManager) changes according to enum instanceState
@@ -85,7 +85,7 @@ private slots:
/// @param instance The index of instance
/// @param name The name of the instance, just available with H_CREATED
///
void handleInstanceStateChange(const InstanceState &state, const quint8 &instance, const QString &name = QString());
void handleInstanceStateChange(InstanceState state, quint8 instance, const QString &name = QString());
signals:
///
@@ -131,151 +131,151 @@ private:
/// @param forced indicate if it was a forced switch by system
/// @return true on success. false if not found
///
bool handleInstanceSwitch(const quint8 &instance = 0, const bool &forced = false);
bool handleInstanceSwitch(quint8 instance = 0, bool forced = false);
///
/// Handle an incoming JSON Color message
///
/// @param message the incoming message
///
void handleColorCommand(const QJsonObject &message, const QString &command, const int tan);
void handleColorCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Image message
///
/// @param message the incoming message
///
void handleImageCommand(const QJsonObject &message, const QString &command, const int tan);
void handleImageCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Effect message
///
/// @param message the incoming message
///
void handleEffectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleEffectCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Effect message (Write JSON Effect)
///
/// @param message the incoming message
///
void handleCreateEffectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleCreateEffectCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Effect message (Delete JSON Effect)
///
/// @param message the incoming message
///
void handleDeleteEffectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleDeleteEffectCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON System info message
///
/// @param message the incoming message
///
void handleSysInfoCommand(const QJsonObject &message, const QString &command, const int tan);
void handleSysInfoCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Server info message
///
/// @param message the incoming message
///
void handleServerInfoCommand(const QJsonObject &message, const QString &command, const int tan);
void handleServerInfoCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Clear message
///
/// @param message the incoming message
///
void handleClearCommand(const QJsonObject &message, const QString &command, const int tan);
void handleClearCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Clearall message
///
/// @param message the incoming message
///
void handleClearallCommand(const QJsonObject &message, const QString &command, const int tan);
void handleClearallCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Adjustment message
///
/// @param message the incoming message
///
void handleAdjustmentCommand(const QJsonObject &message, const QString &command, const int tan);
void handleAdjustmentCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON SourceSelect message
///
/// @param message the incoming message
///
void handleSourceSelectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleSourceSelectCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON GetConfig message and check subcommand
///
/// @param message the incoming message
///
void handleConfigCommand(const QJsonObject &message, const QString &command, const int tan);
void handleConfigCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON GetSchema message from handleConfigCommand()
///
/// @param message the incoming message
///
void handleSchemaGetCommand(const QJsonObject &message, const QString &command, const int tan);
void handleSchemaGetCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON SetConfig message from handleConfigCommand()
///
/// @param message the incoming message
///
void handleConfigSetCommand(const QJsonObject &message, const QString &command, const int tan);
void handleConfigSetCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Component State message
///
/// @param message the incoming message
///
void handleComponentStateCommand(const QJsonObject &message, const QString &command, const int tan);
void handleComponentStateCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Led Colors message
///
/// @param message the incoming message
///
void handleLedColorsCommand(const QJsonObject &message, const QString &command, const int tan);
void handleLedColorsCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Logging message
///
/// @param message the incoming message
///
void handleLoggingCommand(const QJsonObject &message, const QString &command, const int tan);
void handleLoggingCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Processing message
///
/// @param message the incoming message
///
void handleProcessingCommand(const QJsonObject &message, const QString &command, const int tan);
void handleProcessingCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON VideoMode message
///
/// @param message the incoming message
///
void handleVideoModeCommand(const QJsonObject &message, const QString &command, const int tan);
void handleVideoModeCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON plugin message
///
/// @param message the incoming message
///
void handleAuthorizeCommand(const QJsonObject &message, const QString &command, const int tan);
void handleAuthorizeCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON instance message
///
/// @param message the incoming message
///
void handleInstanceCommand(const QJsonObject &message, const QString &command, const int tan);
void handleInstanceCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Led Device message
///
/// @param message the incoming message
///
void handleLedDeviceCommand(const QJsonObject &message, const QString &command, const int tan);
void handleLedDeviceCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON message of unknown type
@@ -285,22 +285,22 @@ private:
///
/// Send a standard reply indicating success
///
void sendSuccessReply(const QString &command = "", const int tan = 0);
void sendSuccessReply(const QString &command = "", int tan = 0);
///
/// Send a standard reply indicating success with data
///
void sendSuccessDataReply(const QJsonDocument &doc, const QString &command = "", const int &tan = 0);
void sendSuccessDataReply(const QJsonDocument &doc, const QString &command = "", int tan = 0);
///
/// Send an error message back to the client
///
/// @param error String describing the error
///
void sendErrorReply(const QString &error, const QString &command = "", const int tan = 0);
void sendErrorReply(const QString &error, const QString &command = "", int tan = 0);
///
/// @brief Kill all signal/slot connections to stop possible data emitter
///
void stopDataConnections(void);
void stopDataConnections();
};

View File

@@ -35,7 +35,7 @@ public:
/// @param unsubscribe Revert subscription
/// @return True on success, false if not found
///
bool subscribeFor(const QString& cmd, const bool & unsubscribe = false);
bool subscribeFor(const QString& cmd, bool unsubscribe = false);
///
/// @brief Get all possible commands to subscribe for
@@ -52,7 +52,7 @@ public:
///
/// @brief Reset subscriptions, disconnect all signals
///
void resetSubscriptions(void);
void resetSubscriptions();
///
/// @brief Re-apply all current subs to a new Hyperion instance, the connections to the old instance will be dropped
@@ -70,7 +70,7 @@ private slots:
///
/// @brief handle component state changes
///
void handleComponentState(const hyperion::Components comp, const bool state);
void handleComponentState(hyperion::Components comp, bool state);
#ifdef ENABLE_AVAHI
///
/// @brief handle emits from bonjour wrapper
@@ -86,7 +86,7 @@ private slots:
///
/// @brief Handle imageToLedsMapping updates
///
void handleImageToLedsMappingChange(const int& mappingType);
void handleImageToLedsMappingChange(int mappingType);
///
/// @brief Handle the adjustment update
@@ -97,7 +97,7 @@ private slots:
/// @brief Handle video mode change
/// @param mode The new videoMode
///
void handleVideoModeChange(const VideoMode& mode);
void handleVideoModeChange(VideoMode mode);
///
/// @brief Handle effect list change
@@ -109,14 +109,14 @@ private slots:
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
void handleSettingsChange(const settings::type& type, const QJsonDocument& data);
void handleSettingsChange(settings::type type, const QJsonDocument& data);
///
/// @brief Handle led config specific updates (required for led color streaming with positional display)
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
void handleLedsConfigChange(const settings::type& type, const QJsonDocument& data);
void handleLedsConfigChange(settings::type type, const QJsonDocument& data);
///
/// @brief Handle Hyperion instance manager change

View File

@@ -24,7 +24,7 @@ namespace hyperion
Q_OBJECT
public:
BlackBorderProcessor(Hyperion* hyperion, QObject* parent);
~BlackBorderProcessor();
~BlackBorderProcessor() override;
///
/// Return the current (detected) border
/// @return The current border
@@ -48,7 +48,7 @@ namespace hyperion
/// It's not possible to enable bb from this method, if the user requsted a disable!
/// @param disable The new state
///
void setHardDisable(const bool& disable);
void setHardDisable(bool disable);
///
/// Processes the image. This performs detecion of black-border on the given image and
@@ -99,12 +99,12 @@ namespace hyperion
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
///
/// @brief Handle component state changes, it's not possible for BB to be enabled, when a hardDisable is active
///
void handleCompStateChangeRequest(const hyperion::Components component, bool enable);
void handleCompStateChangeRequest(hyperion::Components component, bool enable);
private:
/// Hyperion instance

View File

@@ -32,7 +32,7 @@ public:
/// @param port port number on which to start listening for connections
///
BoblightServer(Hyperion* hyperion, const QJsonDocument& config);
~BoblightServer();
~BoblightServer() override;
///
/// @return the port number on which this TCP listens for incoming connections
@@ -41,7 +41,7 @@ public:
/// @return true if server is active (bind to a port)
///
bool active();
bool active() const;
public slots:
///
@@ -54,14 +54,14 @@ public slots:
///
void stop();
void compStateChangeRequest(const hyperion::Components component, bool enable);
void compStateChangeRequest(hyperion::Components component, bool enable);
///
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
private slots:
///

View File

@@ -44,7 +44,7 @@ class BonjourServiceBrowser : public QObject
Q_OBJECT
public:
BonjourServiceBrowser(QObject *parent = 0);
~BonjourServiceBrowser();
~BonjourServiceBrowser() override;
void browseForServiceType(const QString &serviceType);
inline QList<BonjourRecord> currentRecords() const { return bonjourRecords; }
inline QString serviceType() const { return browsingType; }

View File

@@ -45,13 +45,13 @@ class BonjourServiceRegister : public QObject
Q_OBJECT
public:
BonjourServiceRegister(QObject *parent = 0);
~BonjourServiceRegister();
~BonjourServiceRegister() override;
void registerService(const QString& service, const int& port);
void registerService(const BonjourRecord &record, quint16 servicePort, std::vector<std::pair<std::string, std::string>> txt = std::vector<std::pair<std::string, std::string>>());
inline BonjourRecord registeredRecord() const {return finalRecord; }
void registerService(const QString& service, int port);
void registerService(const BonjourRecord &record, quint16 servicePort, const std::vector<std::pair<std::string, std::string>>& txt = {});
inline BonjourRecord registeredRecord() const { return finalRecord; }
const quint16 & getPort() { return _port; };
quint16 getPort() const { return _port; }
signals:
void error(DNSServiceErrorType error);
@@ -69,8 +69,8 @@ private:
QSocketNotifier *bonjourSocket;
BonjourRecord finalRecord;
// current port
quint16 _port = 0;
// current port
quint16 _port = 0;
};
#endif // BONJOURSERVICEREGISTER_H

View File

@@ -44,8 +44,8 @@ class BonjourServiceResolver : public QObject
{
Q_OBJECT
public:
BonjourServiceResolver(QObject *parent);
~BonjourServiceResolver();
BonjourServiceResolver(QObject *parent);
~BonjourServiceResolver() override;
bool resolveBonjourRecord(const BonjourRecord &record);

View File

@@ -12,6 +12,7 @@ class ColorOption: public Option
{
protected:
QColor _color;
public:
ColorOption(const QString &name,
const QString &description = QString(),
@@ -31,9 +32,8 @@ public:
: Option(other)
{}
virtual bool validate(Parser & parser, QString & value) override;
QColor getColor(Parser &parser)
{ return _color; }
bool validate(Parser & parser, QString & value) override;
QColor getColor(Parser &parser) const { return _color; }
};
}

View File

@@ -12,6 +12,7 @@ class ColorsOption: public Option
{
protected:
QList<QColor> _colors;
public:
ColorsOption(const QString &name,
const QString &description = QString(),
@@ -20,6 +21,7 @@ public:
)
: Option(name, description, valueName, defaultValue)
{}
ColorsOption(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString(),
@@ -27,13 +29,13 @@ public:
)
: Option(names, description, valueName, defaultValue)
{}
ColorsOption(const QCommandLineOption &other)
: Option(other)
{}
virtual bool validate(Parser & parser, QString & value) override;
QList<QColor> &getColors(Parser &parser)
{ return _colors; }
QList<QColor> getColors(Parser &parser) const { return _colors; }
};
}

View File

@@ -12,6 +12,7 @@ class ImageOption: public Option
{
protected:
QImage _image;
public:
ImageOption(const QString &name,
const QString &description = QString(),
@@ -20,6 +21,7 @@ public:
)
: Option(name, description, valueName, defaultValue)
{}
ImageOption(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString(),
@@ -27,13 +29,13 @@ public:
)
: Option(names, description, valueName, defaultValue)
{}
ImageOption(const QCommandLineOption &other)
: Option(other)
{}
virtual bool validate(Parser & parser, QString & value) override;
QImage &getImage(Parser &parser)
{ return _image; }
bool validate(Parser & parser, QString & value) override;
QImage& getImage(Parser &parser) { return _image; }
};
}

View File

@@ -12,6 +12,7 @@ class IntOption: public ValidatorOption
{
protected:
int _int;
public:
IntOption(const QString &name,
const QString &description = QString(),
@@ -19,18 +20,26 @@ public:
const QString &defaultValue = QString(),
int minimum = std::numeric_limits<int>::min(), int maximum = std::numeric_limits<int>::max())
: ValidatorOption(name, description, valueName, defaultValue)
{ setValidator(new QIntValidator(minimum, maximum)); }
{
setValidator(new QIntValidator(minimum, maximum));
}
IntOption(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString(),
const QString &defaultValue = QString(),
int minimum = std::numeric_limits<int>::min(), int maximum = std::numeric_limits<int>::max())
: ValidatorOption(names, description, valueName, defaultValue)
{ setValidator(new QIntValidator(minimum, maximum)); }
{
setValidator(new QIntValidator(minimum, maximum));
}
IntOption(const QCommandLineOption &other,
int minimum = std::numeric_limits<int>::min(), int maximum = std::numeric_limits<int>::max())
: ValidatorOption(other)
{ setValidator(new QIntValidator(minimum, maximum)); }
{
setValidator(new QIntValidator(minimum, maximum));
}
int getInt(Parser &parser, bool *ok = 0, int base = 10);
int *getIntPtr(Parser &parser, bool *ok = 0, int base = 10);

View File

@@ -26,13 +26,12 @@ public:
);
Option(const QCommandLineOption &other);
virtual ~Option() = default;
virtual bool validate(Parser &parser, QString &value);
QString name();
QString getError();
QString value(Parser &parser);
const char* getCString(Parser &parser);
QString name() const;
QString getError() const;
QString value(Parser &parser) const;
const char* getCString(Parser &parser) const;
protected:
QString _error;

View File

@@ -93,76 +93,108 @@ public:
return *option;
}
Parser(QString description=QString())
Parser(const QString& description = QString())
{
if(description.size())setApplicationDescription(description);
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
{ return _parser.applicationDescription(); }
void clearPositionalArguments()
{ _parser.clearPositionalArguments(); }
QString helpText() const
{ return _parser.helpText(); }
bool isSet(const QString &name) const
{ return _parser.isSet(name); }
bool isSet(const Option &option) const
{ return _parser.isSet(option); }
bool isSet(const Option *option) const
{ return _parser.isSet(*option); }
QStringList optionNames() const
{ return _parser.optionNames(); }
QStringList positionalArguments() const
{ return _parser.positionalArguments(); }
void setApplicationDescription(const QString &description)
{ _parser.setApplicationDescription(description); }
void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode)
{ _parser.setSingleDashWordOptionMode(singleDashWordOptionMode); }
void showHelp(int exitCode = 0)
{ _parser.showHelp(exitCode); }
QStringList unknownOptionNames() const
{ return _parser.unknownOptionNames(); }
QString value(const QString &optionName) const
{ return _parser.value(optionName); }
QString value(const Option &option) const
{ return _parser.value(option); }
QStringList values(const QString &optionName) const
{ return _parser.values(optionName); }
QStringList values(const Option &option) const
{ return _parser.values(option); }
QString applicationDescription() const
{
return _parser.applicationDescription();
}
void clearPositionalArguments()
{
_parser.clearPositionalArguments();
}
QString helpText() const
{
return _parser.helpText();
}
bool isSet(const QString &name) const
{
return _parser.isSet(name);
}
bool isSet(const Option &option) const
{
return _parser.isSet(option);
}
bool isSet(const Option *option) const
{
return _parser.isSet(*option);
}
QStringList optionNames() const
{
return _parser.optionNames();
}
QStringList positionalArguments() const
{
return _parser.positionalArguments();
}
void setApplicationDescription(const QString &description)
{
_parser.setApplicationDescription(description);
}
void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode)
{
_parser.setSingleDashWordOptionMode(singleDashWordOptionMode);
}
void showHelp(int exitCode = 0)
{
_parser.showHelp(exitCode);
}
QStringList unknownOptionNames() const
{
return _parser.unknownOptionNames();
}
QString value(const QString &optionName) const
{
return _parser.value(optionName);
}
QString value(const Option &option) const
{
return _parser.value(option);
}
QStringList values(const QString &optionName) const
{
return _parser.values(optionName);
}
QStringList values(const Option &option) const
{
return _parser.values(option);
}
};
}

View File

@@ -17,12 +17,14 @@ public:
const QString &defaultValue = QString())
: ValidatorOption(name, description, valueName, defaultValue)
{}
RegularExpressionOption(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString(),
const QString &defaultValue = QString())
: ValidatorOption(names, description, valueName, defaultValue)
{}
RegularExpressionOption(const QCommandLineOption &other)
: ValidatorOption(other)
{}
@@ -33,18 +35,26 @@ public:
const QString &defaultValue = QString(),
const QRegularExpression &expression = QRegularExpression())
: ValidatorOption(name, description, valueName, defaultValue)
{ setValidator(new QRegularExpressionValidator(expression)); }
{
setValidator(new QRegularExpressionValidator(expression));
}
RegularExpressionOption(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString(),
const QString &defaultValue = QString(),
const QRegularExpression &expression = QRegularExpression())
: ValidatorOption(names, description, valueName, defaultValue)
{ setValidator(new QRegularExpressionValidator(expression)); }
{
setValidator(new QRegularExpressionValidator(expression));
}
RegularExpressionOption(const QCommandLineOption &other,
const QRegularExpression &expression = QRegularExpression())
: ValidatorOption(other)
{ setValidator(new QRegularExpressionValidator(expression)); }
{
setValidator(new QRegularExpressionValidator(expression));
}
RegularExpressionOption(const QString &name,
const QString &description = QString(),
@@ -52,18 +62,26 @@ public:
const QString &defaultValue = QString(),
const QString &expression = QString())
: ValidatorOption(name, description, valueName, defaultValue)
{ setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); }
{
setValidator(new QRegularExpressionValidator(QRegularExpression(expression)));
}
RegularExpressionOption(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString(),
const QString &defaultValue = QString(),
const QString &expression = QString())
: ValidatorOption(names, description, valueName, defaultValue)
{ setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); }
{
setValidator(new QRegularExpressionValidator(QRegularExpression(expression)));
}
RegularExpressionOption(const QCommandLineOption &other,
const QString &expression = QString())
: ValidatorOption(other)
{ setValidator(new QRegularExpressionValidator(QRegularExpression(expression))); }
{
setValidator(new QRegularExpressionValidator(QRegularExpression(expression)));
}
};
}

View File

@@ -30,8 +30,6 @@ public:
: Option(other), _switches(switches)
{}
virtual ~SwitchOption() {}
const QMap<QString, T> &getSwitches() const { return _switches; }
virtual bool validate(Parser &parser, QString &switch_) override { return hasSwitch(switch_); }
bool hasSwitch(const QString &switch_) { return _switches.contains(switch_.toLower()); }

View File

@@ -13,6 +13,7 @@ class ValidatorOption: public Option
protected:
const QValidator *validator;
virtual void setValidator(const QValidator *validator);
public:
ValidatorOption(const QString &name,
const QString &description = QString(),
@@ -21,6 +22,7 @@ public:
const QValidator *validator = nullptr)
: Option(name, description, valueName, defaultValue), validator(validator)
{}
ValidatorOption(const QStringList &names,
const QString &description = QString(),
const QString &valueName = QString(),
@@ -28,6 +30,7 @@ public:
const QValidator *validator = nullptr)
: Option(names, description, valueName, defaultValue), validator(validator)
{}
ValidatorOption(const QCommandLineOption &other,
const QValidator *validator = nullptr)
: Option(other), validator(validator)

View File

@@ -29,7 +29,6 @@ public:
// create table columns
createTable(QStringList()<<"user TEXT"<<"password BLOB"<<"token BLOB"<<"salt BLOB"<<"comment TEXT"<<"id TEXT"<<"created_at TEXT"<<"last_use TEXT");
};
~AuthTable(){};
///
/// @brief Create a user record, if called on a existing user the auth is recreated

View File

@@ -27,7 +27,7 @@ class DBManager : public QObject
public:
DBManager(QObject* parent = nullptr);
~DBManager();
~DBManager() override;
/// set root path
void setRootPath(const QString& rootPath);

View File

@@ -27,9 +27,7 @@ public:
// start/create the first Hyperion instance index 0
createInstance();
};
~InstanceTable(){};
///
/// @brief Create a new Hyperion instance entry, the name needs to be unique
@@ -71,7 +69,7 @@ public:
/// @param inst The id that has been assigned
/// @return True on success else false
///
inline bool deleteInstance(const quint8& inst)
inline bool deleteInstance(quint8 inst)
{
VectorPair cond;
cond.append(CPair("instance",inst));
@@ -91,7 +89,7 @@ public:
/// @param name The new name of the instance
/// @return True on success else false (instance not found)
///
inline bool saveName(const quint8& inst, const QString& name)
inline bool saveName(quint8 inst, const QString& name)
{
VectorPair fcond;
fcond.append(CPair("friendly_name",name));
@@ -119,7 +117,7 @@ public:
/// @param justEnabled return just enabled instances if true
/// @return The found instances
///
inline QVector<QVariantMap> getAllInstances(const bool& justEnabled = false)
inline QVector<QVariantMap> getAllInstances(bool justEnabled = false)
{
QVector<QVariantMap> results;
getRecords(results, QStringList(), QStringList() << "instance ASC");
@@ -143,7 +141,7 @@ public:
/// @param[in] user The user id
/// @return true on success else false
///
inline bool instanceExist(const quint8& inst)
inline bool instanceExist(quint8 inst)
{
VectorPair cond;
cond.append(CPair("instance",inst));
@@ -155,7 +153,7 @@ public:
/// @param index The index to search for
/// @return The name of this index, may return NOT FOUND if not found
///
inline const QString getNamebyIndex(const quint8 index)
inline const QString getNamebyIndex(quint8 index)
{
QVariantMap results;
VectorPair cond;
@@ -170,7 +168,7 @@ public:
/// @brief Update 'last_use' timestamp
/// @param inst The instance to update
///
inline void setLastUse(const quint8& inst)
inline void setLastUse(quint8 inst)
{
VectorPair cond;
cond.append(CPair("instance", inst));
@@ -184,7 +182,7 @@ public:
/// @param inst The instance to update
/// @param newState True when enabled else false
///
inline void setEnable(const quint8& inst, const bool& newState)
inline void setEnable(quint8 inst, bool newState)
{
VectorPair cond;
cond.append(CPair("instance", inst));
@@ -198,7 +196,7 @@ public:
/// @param inst The instance to get
/// @return True when enabled else false
///
inline bool isEnabled(const quint8& inst)
inline bool isEnabled(quint8 inst)
{
VectorPair cond;
cond.append(CPair("instance", inst));

View File

@@ -23,13 +23,12 @@ public:
setTable("meta");
createTable(QStringList()<<"uuid TEXT"<<"created_at TEXT");
};
~MetaTable(){};
///
/// @brief Get the uuid, if the uuid is not set it will be created
/// @return The uuid
///
inline const QString getUUID()
inline QString getUUID() const
{
QVector<QVariantMap> results;
getRecords(results, QStringList() << "uuid");

View File

@@ -15,7 +15,7 @@ class SettingsTable : public DBManager
public:
/// construct wrapper with settings table
SettingsTable(const quint8& instance, QObject* parent = nullptr)
SettingsTable(quint8 instance, QObject* parent = nullptr)
: DBManager(parent)
, _hyperion_inst(instance)
{
@@ -23,7 +23,6 @@ public:
// create table columns
createTable(QStringList()<<"type TEXT"<<"config TEXT"<<"hyperion_inst INTEGER"<<"updated_at TEXT");
};
~SettingsTable(){};
///
/// @brief Create or update a settings record

View File

@@ -38,23 +38,23 @@ public:
, const QJsonObject &args = QJsonObject()
, const QString &imageData = ""
);
virtual ~Effect();
~Effect() override;
virtual void run();
void run() override;
int getPriority() const { return _priority; };
int getPriority() const { return _priority; }
///
/// @brief Set manual interuption to true,
/// Note: DO NOT USE QThread::interuption!
///
void requestInterruption() { _interupt = true; };
void requestInterruption() { _interupt = true; }
///
/// @brief Check if the interuption flag has been set
/// @return The flag state
///
bool isInterruptionRequested() { return _interupt; };
bool isInterruptionRequested() { return _interupt; }
QString getScript() const { return _script; }
QString getName() const { return _name; }
@@ -64,8 +64,8 @@ public:
QJsonObject getArgs() const { return _args; }
signals:
void setInput(const int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms, const bool &clearEffect);
void setInputImage(const int priority, const Image<ColorRgb> &image, const int timeout_ms, const bool &clearEffect);
void setInput(int priority, const std::vector<ColorRgb> &ledColors, int timeout_ms, bool clearEffect);
void setInputImage(int priority, const Image<ColorRgb> &image, int timeout_ms, bool clearEffect);
private:

View File

@@ -27,17 +27,17 @@ class EffectEngine : public QObject
public:
EffectEngine(Hyperion * hyperion);
virtual ~EffectEngine();
~EffectEngine() override;
const std::list<EffectDefinition> & getEffects() const { return _availableEffects; };
std::list<EffectDefinition> getEffects() const { return _availableEffects; }
const std::list<ActiveEffectDefinition> & getActiveEffects();
std::list<ActiveEffectDefinition> getActiveEffects() const;
///
/// Get available schemas from EffectFileHandler
/// @return all schemas
///
const std::list<EffectSchema> & getEffectSchemas();
std::list<EffectSchema> getEffectSchemas() const;
///
/// @brief Save an effect with EffectFileHandler
@@ -115,8 +115,6 @@ private:
std::list<Effect *> _activeEffects;
std::list<ActiveEffectDefinition> _availableActiveEffects;
std::list<ActiveEffectDefinition> _cachedActiveEffects;
Logger * _log;

View File

@@ -20,12 +20,12 @@ public:
///
/// @brief Get all available effects
///
const std::list<EffectDefinition> & getEffects() const { return _availableEffects; };
std::list<EffectDefinition> getEffects() const { return _availableEffects; }
///
/// @brief Get all available schemas
///
const std::list<EffectSchema> & getEffectSchemas() { return _effectSchemas; };
std::list<EffectSchema> getEffectSchemas() const { return _effectSchemas; }
///
/// @brief Save an effect
@@ -47,7 +47,7 @@ public slots:
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
signals:
///

View File

@@ -35,15 +35,15 @@ public:
/// @param address The address of the Hyperion server (for example "192.168.0.32:19444)
/// @param skipReply If true skip reply
///
FlatBufferConnection(const QString& origin, const QString & address, const int& priority, const bool& skipReply);
FlatBufferConnection(const QString& origin, const QString & address, int priority, bool skipReply);
///
/// @brief Destructor
///
~FlatBufferConnection();
~FlatBufferConnection() override;
/// @brief Do not read reply messages from Hyperion if set to true
void setSkipReply(const bool& skip);
void setSkipReply(bool skip);
///
/// @brief Register a new priority with given origin
@@ -100,7 +100,7 @@ signals:
///
/// @brief emits when a new videoMode was requested from flatbuf client
///
void setVideoMode(const VideoMode videoMode);
void setVideoMode(VideoMode videoMode);
private:

View File

@@ -21,7 +21,7 @@ class FlatBufferServer : public QObject
Q_OBJECT
public:
FlatBufferServer(const QJsonDocument& config, QObject* parent = nullptr);
~FlatBufferServer();
~FlatBufferServer() override;
public slots:
///
@@ -29,7 +29,7 @@ public slots:
/// @param type The type from enum
/// @param config The configuration
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
void initServer();

View File

@@ -17,7 +17,7 @@ public:
/// @param[in] width The width of the captured screenshot
/// @param[in] height The heigth of the captured screenshot
///
AmlogicGrabber(const unsigned width, const unsigned height);
AmlogicGrabber(unsigned width, unsigned height);
~AmlogicGrabber() override;
///

View File

@@ -18,7 +18,7 @@ public:
/// @param[in] grabWidth The width of the grabbed image [pixels]
/// @param[in] grabHeight The height of the grabbed images [pixels]
///
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight);
AmlogicWrapper(unsigned grabWidth, unsigned grabHeight);
public slots:
///

View File

@@ -26,7 +26,7 @@ public:
/// @param[in] width The width of the captured screenshot
/// @param[in] height The heigth of the captured screenshot
///
DispmanxFrameGrabber(const unsigned width, const unsigned height);
DispmanxFrameGrabber(unsigned width, unsigned height);
~DispmanxFrameGrabber() override;
@@ -50,7 +50,7 @@ private:
///
/// @param vc_flags The snapshot grabbing mask
///
void setFlags(const int vc_flags);
void setFlags(int vc_flags);
///
/// @brief free _vc_resource and captureBuffer

View File

@@ -20,7 +20,7 @@ public:
/// @param[in] grabHeight The height of the grabbed images [pixels]
/// @param[in] updateRate_Hz The image grab rate [Hz]
///
DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz);
DispmanxWrapper(unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz);
public slots:
///

View File

@@ -17,7 +17,7 @@ public:
/// @param[in] width The width of the captured screenshot
/// @param[in] height The heigth of the captured screenshot
///
FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height);
FramebufferFrameGrabber(const QString & device, unsigned width, unsigned height);
///
/// Captures a single snapshot of the display and writes the data to the given image. The

View File

@@ -20,7 +20,7 @@ public:
/// @param[in] grabHeight The height of the grabbed images [pixels]
/// @param[in] updateRate_Hz The image grab rate [Hz]
///
FramebufferWrapper(const QString & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz);
FramebufferWrapper(const QString & device, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz);
public slots:
///

View File

@@ -24,7 +24,7 @@ public:
/// @param[in] width The width of the captured screenshot
/// @param[in] height The heigth of the captured screenshot
///
OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height);
OsxFrameGrabber(unsigned display, unsigned width, unsigned height);
~OsxFrameGrabber() override;
///

View File

@@ -20,7 +20,7 @@ public:
/// @param[in] grabHeight The height of the grabbed images [pixels]
/// @param[in] updateRate_Hz The image grab rate [Hz]
///
OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz);
OsxWrapper(unsigned display, unsigned grabWidth, unsigned grabHeight, unsigned updateRate_Hz);
public slots:
///

View File

@@ -75,7 +75,7 @@ private:
///
/// @brief Is called whenever we need new screen dimension calculations based on window geometry
///
int updateScreenDimensions(const bool& force);
int updateScreenDimensions(bool force);
///
/// @brief free the _screen pointer

View File

@@ -19,7 +19,7 @@ public:
/// @param[in] pixelDecimation Decimation factor for image [pixels]
/// @param[in] updateRate_Hz The image grab rate [Hz]
///
QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, const unsigned updateRate_Hz);
QtWrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, int display, unsigned updateRate_Hz);
public slots:
///

View File

@@ -62,13 +62,13 @@ public:
);
~V4L2Grabber() override;
QRectF getSignalDetectionOffset()
QRectF getSignalDetectionOffset() const
{
return QRectF(_x_frac_min, _y_frac_min, _x_frac_max, _y_frac_max);
}
bool getSignalDetectionEnabled() { return _signalDetectionEnabled; }
bool getCecDetectionEnabled() { return _cecDetectionEnabled; }
bool getSignalDetectionEnabled() const { return _signalDetectionEnabled; }
bool getCecDetectionEnabled() const { return _cecDetectionEnabled; }
int grabFrame(Image<ColorRgb> &);
@@ -128,27 +128,27 @@ public:
///
/// @brief overwrite Grabber.h implementation
///
QStringList getV4L2devices() override;
QStringList getV4L2devices() const override;
///
/// @brief overwrite Grabber.h implementation
///
QString getV4L2deviceName(QString devicePath) override;
QString getV4L2deviceName(const QString& devicePath) const override;
///
/// @brief overwrite Grabber.h implementation
///
QMultiMap<QString, int> getV4L2deviceInputs(QString devicePath) override;
QMultiMap<QString, int> getV4L2deviceInputs(const QString& devicePath) const override;
///
/// @brief overwrite Grabber.h implementation
///
QStringList getResolutions(QString devicePath) override;
QStringList getResolutions(const QString& devicePath) const override;
///
/// @brief overwrite Grabber.h implementation
///
QStringList getFramerates(QString devicePath) override;
QStringList getFramerates(const QString& devicePath) const override;
public slots:
@@ -169,6 +169,7 @@ private:
void getV4Ldevices();
bool init();
void uninit();
bool open_device();
@@ -250,12 +251,13 @@ private:
private:
QString _deviceName;
std::map<QString, QString> _v4lDevices;
QMap<QString, V4L2Grabber::DeviceProperties> _deviceProperties;
VideoStandard _videoStandard;
io_method _ioMethod;
int _fileDescriptor;
std::vector<buffer> _buffers;
std::map<QString, QString> _v4lDevices;
QMap<QString, V4L2Grabber::DeviceProperties> _deviceProperties;
VideoStandard _videoStandard;
io_method _ioMethod;
int _fileDescriptor;
std::vector<buffer> _buffers;
PixelFormat _pixelFormat;
int _pixelDecimation;

View File

@@ -18,8 +18,8 @@ public:
int pixelDecimation );
~V4L2Wrapper() override;
bool getSignalDetectionEnable();
bool getCecDetectionEnable();
bool getSignalDetectionEnable() const;
bool getCecDetectionEnable() const;
public slots:
bool start() override;
@@ -30,9 +30,9 @@ public slots:
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
void setSignalDetectionEnable(bool enable);
void setCecDetectionEnable(bool enable);
void setDeviceVideoStandard(QString device, VideoStandard videoStandard);
void setDeviceVideoStandard(const QString& device, VideoStandard videoStandard);
void handleCecEvent(CECEvent event);
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config) override;
void handleSettingsUpdate(settings::type type, const QJsonDocument& config) override;
private slots:
void newFrame(const Image<ColorRgb> & image);

View File

@@ -10,20 +10,20 @@ enum class VideoStandard {
NO_CHANGE
};
inline VideoStandard parseVideoStandard(QString videoStandard)
inline VideoStandard parseVideoStandard(const QString& videoStandard)
{
// convert to lower case
videoStandard = videoStandard.toLower();
QString standard = videoStandard.toLower();
if (videoStandard == "pal")
if (standard == "pal")
{
return VideoStandard::PAL;
}
else if (videoStandard == "ntsc")
else if (standard == "ntsc")
{
return VideoStandard::NTSC;
}
else if (videoStandard == "secam")
else if (standard == "secam")
{
return VideoStandard::SECAM;
}

View File

@@ -24,7 +24,7 @@ public:
/// @param[in] grabHeight The height of the grabbed images [pixels]
/// @param[in] updateRate_Hz The image grab rate [Hz]
///
X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, const unsigned updateRate_Hz);
X11Wrapper(int cropLeft, int cropRight, int cropTop, int cropBottom, int pixelDecimation, unsigned updateRate_Hz);
///
/// Destructor of this framebuffer frame grabber. Releases any claimed resources.

View File

@@ -38,25 +38,25 @@ public:
/// @brief Get the unique id (imported from removed class 'Stats')
/// @return The unique id
///
const QString &getID() { return _uuid; };
QString getID() const { return _uuid; }
///
/// @brief Check authorization is required according to the user setting
/// @return True if authorization required else false
///
const bool &isAuthRequired() { return _authRequired; };
bool isAuthRequired() const { return _authRequired; }
///
/// @brief Check if authorization is required for local network connections
/// @return True if authorization required else false
///
const bool &isLocalAuthRequired() { return _localAuthRequired; };
bool isLocalAuthRequired() const { return _localAuthRequired; }
///
/// @brief Check if authorization is required for local network connections for admin access
/// @return True if authorization required else false
///
const bool &isLocalAdminAuthRequired() { return _localAdminAuthRequired; };
bool isLocalAdminAuthRequired() const { return _localAdminAuthRequired; }
///
/// @brief Reset Hyperion user
@@ -68,18 +68,18 @@ public:
/// @brief Check if user auth is temporary blocked due to failed attempts
/// @return True on blocked and no further Auth requests will be accepted
///
bool isUserAuthBlocked() { return (_userAuthAttempts.length() >= 10); };
bool isUserAuthBlocked() const { return (_userAuthAttempts.length() >= 10); }
///
/// @brief Check if token auth is temporary blocked due to failed attempts
/// @return True on blocked and no further Auth requests will be accepted
///
bool isTokenAuthBlocked() { return (_tokenAuthAttempts.length() >= 25); };
bool isTokenAuthBlocked() const { return (_tokenAuthAttempts.length() >= 25); }
/// Pointer of this instance
static AuthManager *manager;
/// Get Pointer of this instance
static AuthManager *getInstance() { return manager; };
static AuthManager *getInstance() { return manager; }
public slots:
@@ -158,32 +158,32 @@ public slots:
/// @param id The id of the request
/// @param accept The accept or deny the request
///
void handlePendingTokenRequest(const QString &id, const bool &accept);
void handlePendingTokenRequest(const QString &id, bool accept);
///
/// @brief Get pending requests
/// @return All pending requests
///
QVector<AuthManager::AuthDefinition> getPendingRequests();
QVector<AuthManager::AuthDefinition> getPendingRequests() const;
///
/// @brief Get the current valid token for user. Make sure this call is allowed!
/// @param usr the defined user
/// @return The token
///
const QString getUserToken(const QString &usr = "Hyperion");
QString getUserToken(const QString &usr = "Hyperion") const;
///
/// @brief Get all available token entries
///
QVector<AuthManager::AuthDefinition> getTokenList();
QVector<AuthManager::AuthDefinition> getTokenList() const;
///
/// @brief Handle settings update from Hyperion Settingsmanager emit
/// @param type settings type from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type &type, const QJsonDocument &config);
void handleSettingsUpdate(settings::type type, const QJsonDocument &config);
signals:
///
@@ -201,7 +201,7 @@ signals:
/// @param comment The comment that was part of the request
/// @param id The id that was part of the request
///
void tokenResponse(const bool &success, QObject *caller, const QString &token, const QString &comment, const QString &id);
void tokenResponse(bool success, QObject *caller, const QString &token, const QString &comment, const QString &id);
///
/// @brief Emits whenever the token list changes
@@ -214,7 +214,7 @@ private:
/// @brief Increment counter for token/user auth
/// @param user If true we increment USER auth instead of token
///
void setAuthBlock(const bool &user = false);
void setAuthBlock(bool user = false);
/// Database interface for auth table
AuthTable *_authTable;

View File

@@ -29,7 +29,7 @@ private slots:
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
void handleSettingsUpdate(settings::type type, const QJsonDocument& config)
{
if(type == settings::BGEFFECT)
{

View File

@@ -18,8 +18,8 @@ class CaptureCont : public QObject
public:
CaptureCont(Hyperion* hyperion);
void setSystemCaptureEnable(const bool& enable);
void setV4LCaptureEnable(const bool& enable);
void setSystemCaptureEnable(bool enable);
void setV4LCaptureEnable(bool enable);
private slots:
///
@@ -27,14 +27,14 @@ private slots:
/// @param component The component from enum
/// @param enable The new state
///
void handleCompStateChangeRequest(const hyperion::Components component, bool enable);
void handleCompStateChangeRequest(hyperion::Components component, bool enable);
///
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
///
/// @brief forward system image

View File

@@ -20,17 +20,17 @@ class ComponentRegister : public QObject
public:
ComponentRegister(Hyperion* hyperion);
~ComponentRegister();
~ComponentRegister() override;
///
/// @brief Check if a component is currently enabled
/// @param comp The component from enum
/// @return True if component is running else false. Not found is -1
///
int isComponentEnabled(const hyperion::Components& comp) const;
int isComponentEnabled(hyperion::Components comp) const;
/// contains all components and their state
std::map<hyperion::Components, bool> getRegister() const { return _componentStates; };
std::map<hyperion::Components, bool> getRegister() const { return _componentStates; }
signals:
///
@@ -38,7 +38,7 @@ signals:
/// @param comp The component
/// @param state The new state of the component
///
void updatedComponentState(const hyperion::Components comp, const bool state);
void updatedComponentState(hyperion::Components comp, bool state);
public slots:
///
@@ -46,13 +46,13 @@ public slots:
/// @param comp The component
/// @param state The new state of the component
///
void setNewComponentState(const hyperion::Components comp, const bool activated);
void setNewComponentState(hyperion::Components comp, bool activated);
private slots:
///
/// @brief Handle COMP_ALL changes from Hyperion->compStateChangeRequest
///
void handleCompStateChangeRequest(const hyperion::Components comps, const bool activated);
void handleCompStateChangeRequest(hyperion::Components comps, bool activated);
private:
/// Hyperion instance

View File

@@ -22,7 +22,7 @@ class Grabber : public QObject
Q_OBJECT
public:
Grabber(QString grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0);
Grabber(const QString& grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0);
///
/// Set the video mode (2D/3D)
@@ -119,35 +119,35 @@ public:
/// @brief Get a list of all available V4L devices
/// @return List of all available V4L devices on success else empty List
///
virtual QStringList getV4L2devices() { return QStringList(); }
virtual QStringList getV4L2devices() const { return QStringList(); }
///
/// @brief Get the V4L device name
/// @param devicePath The device path
/// @return The name of the V4L device on success else empty String
///
virtual QString getV4L2deviceName(QString devicePath) { return QString(); }
virtual QString getV4L2deviceName(const QString& /*devicePath*/) const { return QString(); }
///
/// @brief Get a name/index pair of supported device inputs
/// @param devicePath The device path
/// @return multi pair of name/index on success else empty pair
///
virtual QMultiMap<QString, int> getV4L2deviceInputs(QString devicePath) { return QMultiMap<QString, int>(); }
virtual QMultiMap<QString, int> getV4L2deviceInputs(const QString& /*devicePath*/) const { return QMultiMap<QString, int>(); }
///
/// @brief Get a list of supported device resolutions
/// @param devicePath The device path
/// @return List of resolutions on success else empty List
///
virtual QStringList getResolutions(QString devicePath) { return QStringList(); }
virtual QStringList getResolutions(const QString& /*devicePath*/) const { return QStringList(); }
///
/// @brief Get a list of supported device framerates
/// @param devicePath The device path
/// @return List of framerates on success else empty List
///
virtual QStringList getFramerates(QString devicePath) { return QStringList(); }
virtual QStringList getFramerates(const QString& devicePath) const { return QStringList(); }
protected:
ImageResampler _imageResampler;

View File

@@ -29,9 +29,9 @@ class GrabberWrapper : public QObject
{
Q_OBJECT
public:
GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz = 0);
GrabberWrapper(const QString& grabberName, Grabber * ggrabber, unsigned width, unsigned height, unsigned updateRate_Hz = 0);
virtual ~GrabberWrapper();
~GrabberWrapper() override;
static GrabberWrapper* instance;
static GrabberWrapper* getInstance(){ return instance; }
@@ -60,35 +60,35 @@ public:
/// @brief Get a list of all available V4L devices
/// @return List of all available V4L devices on success else empty List
///
virtual QStringList getV4L2devices();
virtual QStringList getV4L2devices() const;
///
/// @brief Get the V4L device name
/// @param devicePath The device path
/// @return The name of the V4L device on success else empty String
///
virtual QString getV4L2deviceName(QString devicePath);
virtual QString getV4L2deviceName(const QString& devicePath) const;
///
/// @brief Get a name/index pair of supported device inputs
/// @param devicePath The device path
/// @return multi pair of name/index on success else empty pair
///
virtual QMultiMap<QString, int> getV4L2deviceInputs(QString devicePath);
virtual QMultiMap<QString, int> getV4L2deviceInputs(const QString& devicePath) const;
///
/// @brief Get a list of supported device resolutions
/// @param devicePath The device path
/// @return List of resolutions on success else empty List
///
virtual QStringList getResolutions(QString devicePath);
virtual QStringList getResolutions(const QString& devicePath) const;
///
/// @brief Get a list of supported device framerates
/// @param devicePath The device path
/// @return List of framerates on success else empty List
///
virtual QStringList getFramerates(QString devicePath);
virtual QStringList getFramerates(const QString& devicePath) const;
static QStringList availableGrabbers();
@@ -122,7 +122,7 @@ public slots:
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
virtual void setVideoMode(const VideoMode& videoMode);
virtual void setVideoMode(VideoMode videoMode);
///
/// Set the crop values
@@ -138,7 +138,7 @@ public slots:
/// @param type settingyType from enum
/// @param config configuration object
///
virtual void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
virtual void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
signals:
///
@@ -149,7 +149,7 @@ signals:
private slots:
/// @brief Handle a source request event from Hyperion.
/// Will start and stop grabber based on active listeners count
void handleSourceRequest(const hyperion::Components& component, const int hyperionInd, const bool listen);
void handleSourceRequest(hyperion::Components component, int hyperionInd, bool listen);
///
/// @brief Update Update capture rate

View File

@@ -120,7 +120,7 @@ public slots:
/// @param[in] owner Specific owner string, might be empty
/// @param[in] smooth_cfg The smooth id to use
///
void registerInput(const int priority, const hyperion::Components& component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = 0);
void registerInput(int priority, hyperion::Components component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = 0);
///
/// @brief Update the current color of a priority (prev registered with registerInput())
@@ -131,7 +131,7 @@ public slots:
/// @param clearEffect Should be true when NOT called from an effect
/// @return True on success, false when priority is not found
///
bool setInput(const int priority, const std::vector<ColorRgb>& ledColors, const int timeout_ms = -1, const bool& clearEffect = true);
bool setInput(int priority, const std::vector<ColorRgb>& ledColors, int timeout_ms = -1, bool clearEffect = true);
///
/// @brief Update the current image of a priority (prev registered with registerInput())
@@ -142,7 +142,7 @@ public slots:
/// @param clearEffect Should be true when NOT called from an effect
/// @return True on success, false when priority is not found
///
bool setInputImage(const int priority, const Image<ColorRgb>& image, const int64_t timeout_ms = -1, const bool& clearEffect = true);
bool setInputImage(int priority, const Image<ColorRgb>& image, int64_t timeout_ms = -1, bool clearEffect = true);
///
/// Writes a single color to all the leds for the given time and priority
@@ -155,20 +155,20 @@ public slots:
/// @param[in] origin The setter
/// @param clearEffect Should be true when NOT called from an effect
///
void setColor(const int priority, const std::vector<ColorRgb> &ledColors, const int timeout_ms = -1, const QString& origin = "System" ,bool clearEffects = true);
void setColor(int priority, const std::vector<ColorRgb> &ledColors, int timeout_ms = -1, const QString& origin = "System" ,bool clearEffects = true);
///
/// @brief Set the given priority to inactive
/// @param priority The priority
/// @return True on success false if not found
///
bool setInputInactive(const quint8& priority);
bool setInputInactive(quint8 priority);
///
/// Returns the list with unique adjustment identifiers
/// @return The list with adjustment identifiers
///
const QStringList & getAdjustmentIds() const;
QStringList getAdjustmentIds() const;
///
/// Returns the ColorAdjustment with the given identifier
@@ -187,7 +187,7 @@ public slots:
/// @param[in] forceClearAll Force the clear
/// @return True on success else false (not found)
///
bool clear(const int priority, bool forceClearAll=false);
bool clear(int priority, bool forceClearAll=false);
/// #############
// EFFECTENGINE
@@ -233,15 +233,15 @@ public slots:
/// Get the list of available effects
/// @return The list of available effects
const std::list<EffectDefinition> &getEffects() const;
std::list<EffectDefinition> getEffects() const;
/// Get the list of active effects
/// @return The list of active effects
const std::list<ActiveEffectDefinition> &getActiveEffects() const;
std::list<ActiveEffectDefinition> getActiveEffects() const;
/// Get the list of available effect schema files
/// @return The list of available effect schema files
const std::list<EffectSchema> &getEffectSchemas() const;
std::list<EffectSchema> getEffectSchemas() const;
/// #############
/// PRIORITYMUXER
@@ -255,18 +255,18 @@ public slots:
/// @brief enable/disable automatic/priorized source selection
/// @param state The new state
///
void setSourceAutoSelect(const bool state);
void setSourceAutoSelect(bool state);
///
/// @brief set current input source to visible
/// @param priority the priority channel which should be vidible
/// @return true if success, false on error
///
bool setVisiblePriority(const int& priority);
bool setVisiblePriority(int priority);
/// gets current state of automatic/priorized source selection
/// @return the state
bool sourceAutoSelectEnabled();
bool sourceAutoSelectEnabled() const;
///
/// Returns the current priority
@@ -280,7 +280,7 @@ public slots:
///
/// @return bool
///
bool isCurrentPriority(const int priority) const;
bool isCurrentPriority(int priority) const;
///
/// Returns a list of all registered priorities
@@ -296,7 +296,7 @@ public slots:
///
/// @return The information of the given, a not found priority will return lowest priority as fallback
///
InputInfo getPriorityInfo(const int priority) const;
InputInfo getPriorityInfo(int priority) const;
/// #############
/// SETTINGSMANAGER
@@ -305,11 +305,11 @@ public slots:
/// @param type The settingsType from enum
/// @return Data Document
///
QJsonDocument getSetting(const settings::type& type) const;
QJsonDocument getSetting(settings::type type) const;
/// gets the current json config object from SettingsManager
/// @return json config
const QJsonObject& getQJsonConfig() const;
QJsonObject getQJsonConfig() const;
///
/// @brief Save a complete json config
@@ -317,7 +317,7 @@ public slots:
/// @param correct If true will correct json against schema before save
/// @return True on success else false
///
bool saveSettings(QJsonObject config, const bool& correct = false);
bool saveSettings(const QJsonObject& config, bool correct = false);
/// ############
/// COMPONENTREGISTER
@@ -332,7 +332,7 @@ public slots:
/// @param[in] component The component from enum
/// @param[in] state The state of the component [true | false]
///
void setNewComponentState(const hyperion::Components& component, const bool& state);
void setNewComponentState(hyperion::Components component, bool state);
///
/// @brief Get a list of all contrable components and their current state
@@ -345,16 +345,16 @@ public slots:
/// @param The component to test
/// @return Component state
///
int isComponentEnabled(const hyperion::Components& comp);
int isComponentEnabled(hyperion::Components comp) const;
/// sets the methode how image is maped to leds at ImageProcessor
void setLedMappingType(const int& mappingType);
void setLedMappingType(int mappingType);
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode& mode);
void setVideoMode(VideoMode mode);
///
/// @brief Init after thread start
@@ -383,13 +383,13 @@ signals:
/// @param component The component from enum
/// @param enabled The new state of the component
///
void compStateChangeRequest(const hyperion::Components component, bool enabled);
void compStateChangeRequest(hyperion::Components component, bool enabled);
///
/// @brief Emits whenever the imageToLedsMapping has changed
/// @param mappingType The new mapping type
///
void imageToLedsMappingChanged(const int& mappingType);
void imageToLedsMappingChanged(int mappingType);
///
/// @brief Emits whenever the visible priority delivers a image which is applied in update()
@@ -402,27 +402,27 @@ signals:
void forwardJsonMessage(QJsonObject);
/// Signal which is emitted, when a new system proto image should be forwarded
void forwardSystemProtoMessage(const QString, const Image<ColorRgb>);
void forwardSystemProtoMessage(const QString&, const Image<ColorRgb>&);
/// Signal which is emitted, when a new V4l proto image should be forwarded
void forwardV4lProtoMessage(const QString, const Image<ColorRgb>);
void forwardV4lProtoMessage(const QString&, const Image<ColorRgb>&);
///
/// @brief Is emitted from clients who request a videoMode change
///
void videoMode(const VideoMode& mode);
void videoMode(VideoMode mode);
///
/// @brief A new videoMode was requested (called from Daemon!)
///
void newVideoMode(const VideoMode& mode);
void newVideoMode(VideoMode mode);
///
/// @brief Emits whenever a config part changed. SIGNAL PIPE helper for SettingsManager -> HyperionDaemon
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
void settingsChanged(const settings::type& type, const QJsonDocument& data);
void settingsChanged(settings::type type, const QJsonDocument& data);
///
/// @brief Emits whenever the adjustments have been updated
@@ -459,19 +459,19 @@ private slots:
/// @brief Handle whenever the visible component changed
/// @param comp The new component
///
void handleVisibleComponentChanged(const hyperion::Components& comp);
void handleVisibleComponentChanged(hyperion::Components comp);
///
/// @brief Apply settings updates for LEDS and COLOR
/// @param type The type from enum
/// @param config The configuration
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
///
/// @brief Apply new videoMode from Daemon to _currVideoMode
///
void handleNewVideoMode(const VideoMode& mode) { _currVideoMode = mode; }
void handleNewVideoMode(VideoMode mode) { _currVideoMode = mode; }
private:
friend class HyperionDaemon;
@@ -481,7 +481,7 @@ private:
/// @brief Constructs the Hyperion instance, just accessible for HyperionIManager
/// @param instance The instance index
///
Hyperion(const quint8& instance);
Hyperion(quint8 instance);
/// instance index
const quint8 _instIndex;

View File

@@ -38,19 +38,19 @@ public slots:
/// @param inst The instance to check
/// @return True when running else false
///
bool IsInstanceRunning(const quint8& inst) { return _runningInstances.contains(inst); }
bool IsInstanceRunning(quint8 inst) const { return _runningInstances.contains(inst); }
///
/// @brief Get a Hyperion instance by index
/// @param intance the index
/// @return Hyperion instance, if index is not found returns instance 0
///
Hyperion* getHyperionInstance(const quint8& instance = 0);
Hyperion* getHyperionInstance(quint8 instance = 0);
///
/// @brief Get instance data of all instaces in db + running state
///
const QVector<QVariantMap> getInstanceData();
QVector<QVariantMap> getInstanceData() const;
///
/// @brief Start a Hyperion instance
@@ -58,20 +58,20 @@ public slots:
/// @param block If true return when thread has been started
/// @return Return true on success, false if not found in db
///
bool startInstance(const quint8& inst, const bool& block = false);
bool startInstance(quint8 inst, bool block = false);
///
/// @brief Stop a Hyperion instance
/// @param instance Instance index
/// @return Return true on success, false if not found in db
///
bool stopInstance(const quint8& inst);
bool stopInstance(quint8 inst);
///
/// @brief Toggle the state of all Hyperion instances
/// @param pause If true all instances toggle to pause, else to resume
///
void toggleStateAllInstances(const bool& pause = false);
void toggleStateAllInstances(bool pause = false);
///
/// @brief Create a new Hyperion instance entry in db
@@ -79,14 +79,14 @@ public slots:
/// @param start If true it will be started after creation (async)
/// @return Return true on success false if name is already in use or a db error occurred
///
bool createInstance(const QString& name, const bool& start = false);
bool createInstance(const QString& name, bool start = false);
///
/// @brief Delete Hyperion instance entry in db. Cleanup also all associated table data for this instance
/// @param inst The instance index
/// @return Return true on success, false if not found or not allowed
///
bool deleteInstance(const quint8& inst);
bool deleteInstance(quint8 inst);
///
/// @brief Assign a new name to the given instance
@@ -94,7 +94,7 @@ public slots:
/// @param name The instance name index
/// @return Return true on success, false if not found
///
bool saveName(const quint8& inst, const QString& name);
bool saveName(quint8 inst, const QString& name);
signals:
///
@@ -103,7 +103,7 @@ signals:
/// @param instance The index of instance
/// @param name The name of the instance, just available with H_CREATED
///
void instanceStateChanged(const InstanceState& state, const quint8& instance, const QString& name = QString());
void instanceStateChanged(InstanceState state, quint8 instance, const QString& name = QString());
///
/// @brief Emits whenever something changes, the lazy version of instanceStateChanged (- H_ON_STOP) + saveName() emit
@@ -118,7 +118,7 @@ signals:
///
/// @brief PIPE videoMode back to Hyperion
///
void newVideoMode(const VideoMode& mode);
void newVideoMode(VideoMode mode);
///////////////////////////////////////
/// FROM HYPERION TO HYPERIONDAEMON ///
@@ -127,17 +127,17 @@ signals:
///
/// @brief PIPE settings events from Hyperion
///
void settingsChanged(const settings::type& type, const QJsonDocument& data);
void settingsChanged(settings::type type, const QJsonDocument& data);
///
/// @brief PIPE videoMode request changes from Hyperion to HyperionDaemon
///
void requestVideoMode(const VideoMode& mode);
void requestVideoMode(VideoMode mode);
///
/// @brief PIPE component state changes from Hyperion to HyperionDaemon
///
void compStateChangeRequest(const hyperion::Components component, bool enable);
void compStateChangeRequest(hyperion::Components component, bool enable);
private slots:
///
@@ -172,7 +172,7 @@ private:
/// @brief check if a instance is allowed for management. Instance 0 represents the root instance
/// @apram inst The instance to check
///
bool isInstAllowed(const quint8& inst) { return (inst > 0); }
bool isInstAllowed(quint8 inst) const { return (inst > 0); }
private:
Logger* _log;

View File

@@ -36,7 +36,7 @@ public:
///
ImageProcessor(const LedString& ledString, Hyperion* hyperion);
~ImageProcessor();
~ImageProcessor() override;
///
/// Specifies the width and height of 'incomming' images. This will resize the buffer-image to
@@ -46,7 +46,7 @@ public:
/// @param[in] width The new width of the buffer-image
/// @param[in] height The new height of the buffer-image
///
void setSize(const unsigned width, const unsigned height);
void setSize(unsigned width, unsigned height);
///
/// @brief Update the led string (eg on settings change)
@@ -54,15 +54,15 @@ public:
void setLedString(const LedString& ledString);
/// Returns starte of black border detector
bool blackBorderDetectorEnabled();
bool blackBorderDetectorEnabled() const;
/// Returns the current _userMappingType, this may not be the current applied type!
const int & getUserLedMappingType() { return _userMappingType; };
int getUserLedMappingType() const { return _userMappingType; }
/// Returns the current _mappingType
const int & ledMappingType() { return _mappingType; };
int ledMappingType() const { return _mappingType; }
static int mappingTypeToInt(QString mappingType);
static int mappingTypeToInt(const QString& mappingType);
static QString mappingTypeToStr(int mappingType);
///
@@ -215,7 +215,7 @@ private:
}
private slots:
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
private:
Logger * _log;

View File

@@ -57,8 +57,8 @@ namespace hyperion
///
unsigned height() const;
unsigned horizontalBorder() const { return _horizontalBorder; };
unsigned verticalBorder() const { return _verticalBorder; };
unsigned horizontalBorder() const { return _horizontalBorder; }
unsigned verticalBorder() const { return _verticalBorder; }
///
/// Determines the mean color for each led using the mapping the image given

View File

@@ -20,7 +20,7 @@ enum class ColorOrder
ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR
};
inline QString colorOrderToString(const ColorOrder colorOrder)
inline QString colorOrderToString(ColorOrder colorOrder)
{
switch (colorOrder)
{

View File

@@ -34,10 +34,10 @@ class MessageForwarder : public QObject
Q_OBJECT
public:
MessageForwarder(Hyperion* hyperion);
~MessageForwarder();
~MessageForwarder() override;
void addJsonSlave(QString slave);
void addFlatbufferSlave(QString slave);
void addJsonSlave(const QString& slave);
void addFlatbufferSlave(const QString& slave);
private slots:
///
@@ -45,20 +45,20 @@ private slots:
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type &type, const QJsonDocument &config);
void handleSettingsUpdate(settings::type type, const QJsonDocument &config);
///
/// @brief Handle component state change MessageForwarder
/// @param component The component from enum
/// @param enable The new state
///
void handleCompStateChangeRequest(const hyperion::Components component, bool enable);
void handleCompStateChangeRequest(hyperion::Components component, bool enable);
///
/// @brief Handle priority updates from Priority Muxer
/// @param priority The new visible priority
///
void handlePriorityChanges(const quint8 &priority);
void handlePriorityChanges(quint8 priority);
///
/// @brief Forward message to all json slaves

View File

@@ -16,7 +16,7 @@
class MultiColorAdjustment
{
public:
MultiColorAdjustment(const unsigned ledCnt);
MultiColorAdjustment(unsigned ledCnt);
~MultiColorAdjustment();
/**
@@ -26,7 +26,7 @@ public:
*/
void addAdjustment(ColorAdjustment * adjustment);
void setAdjustmentForLed(const QString& id, const unsigned startLed, unsigned endLed);
void setAdjustmentForLed(const QString& id, unsigned startLed, unsigned endLed);
bool verifyAdjustments() const;
@@ -36,7 +36,7 @@ public:
/// Returns the identifier of all the unique ColorAdjustment
///
/// @return The list with unique id's of the ColorAdjustment
const QStringList & getAdjustmentIds();
QStringList getAdjustmentIds() const;
///
/// Returns the pointer to the ColorAdjustment with the given id

View File

@@ -68,20 +68,20 @@ public:
///
/// Destructor
///
~PriorityMuxer();
~PriorityMuxer() override;
///
/// @brief Start/Stop the PriorityMuxer update timer; On disabled no priority and timeout updates will be performend
/// @param enable The new state
///
void setEnable(const bool& enable);
void setEnable(bool enable);
/// @brief Enable or disable auto source selection
/// @param enable True if it should be enabled else false
/// @param update True to update _currentPriority - INTERNAL usage.
/// @return True if changed has been applied, false if the state is unchanged
///
bool setSourceAutoSelectEnabled(const bool& enabel, const bool& update = true);
bool setSourceAutoSelectEnabled(bool enabel, bool update = true);
///
/// @brief Get the state of source auto selection
@@ -94,13 +94,13 @@ public:
/// @param priority The
/// @return True on success, false if priority not found
///
bool setPriority(const uint8_t priority);
bool setPriority(uint8_t priority);
///
/// @brief Update all ledColos with min length of >= 1 to fit the new led length
/// @param[in] ledCount The count of leds
///
void updateLedColorsLength(const int& ledCount);
void updateLedColorsLength(int ledCount);
///
/// Returns the current priority
@@ -114,7 +114,7 @@ public:
/// @param priority The priority channel
/// @return True if the priority channel exists else false
///
bool hasPriority(const int priority) const;
bool hasPriority(int priority) const;
///
/// Returns the number of active priorities
@@ -131,7 +131,7 @@ public:
///
/// @return The information for the specified priority channel
///
const InputInfo getInputInfo(const int priority) const;
InputInfo getInputInfo(int priority) 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()
@@ -142,7 +142,7 @@ public:
/// @param[in] owner Speicifc owner string, might be empty
/// @param[in] smooth_cfg The smooth id to use
///
void registerInput(const int priority, const hyperion::Components& component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = SMOOTHING_MODE_DEFAULT);
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())
@@ -151,7 +151,7 @@ public:
/// @param timeout_ms The new timeout (defaults to -1 endless)
/// @return True on success, false when priority is not found
///
bool setInput(const int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms = -1);
bool setInput(int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms = -1);
///
/// @brief Update the current image of a priority (prev registered with registerInput())
@@ -160,14 +160,14 @@ public:
/// @param timeout_ms The new timeout (defaults to -1 endless)
/// @return True on success, false when priority is not found
///
bool setInputImage(const int priority, const Image<ColorRgb>& image, int64_t timeout_ms = -1);
bool setInputImage(int priority, const Image<ColorRgb>& image, int64_t timeout_ms = -1);
///
/// @brief Set the given priority to inactive
/// @param priority The priority
/// @return True on success false if not found
///
bool setInputInactive(const quint8& priority);
bool setInputInactive(quint8 priority);
///
/// Clears the specified priority channel and update _currentPriority on success
@@ -175,7 +175,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(const uint8_t priority);
bool clearInput(uint8_t priority);
///
/// Clears all priority channels
@@ -185,7 +185,7 @@ public:
///
/// @brief Queue a manual push where muxer doesn't recognize them (e.g. continous single color pushes)
///
void queuePush(void){ emit timeRunner(); };
void queuePush() { emit timeRunner(); }
signals:
///
@@ -198,38 +198,38 @@ signals:
/// @param priority The priority which has changed
/// @param state If true it was added else it was removed!
///
void priorityChanged(const quint8& priority, const bool& state);
void priorityChanged(quint8 priority, bool state);
///
/// @brief Emits whenever the visible priority has changed
/// @param priority The new visible priority
///
void visiblePriorityChanged(const quint8& priority);
void visiblePriorityChanged(quint8 priority);
///
/// @brief Emits whenever the current visible component changed
/// @param comp The new component
///
void visibleComponentChanged(const hyperion::Components& comp);
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(const quint8& priority, const bool& state);
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(const bool& state);
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
///
void prioritiesChanged(void);
void prioritiesChanged();
///
/// internal used signal to resolve treading issues with timer
@@ -246,14 +246,14 @@ private slots:
/// Updates the current time. Channels with a configured time out will be checked and cleared if
/// required.
///
void setCurrentTime(void);
void setCurrentTime();
private:
///
/// @brief Get the component of the given priority
/// @return The component
///
hyperion::Components getComponentOfPriority(const int& priority);
hyperion::Components getComponentOfPriority(int priority) const;
/// Logger instance
Logger* _log;

View File

@@ -21,7 +21,7 @@ public:
/// @params instance Instance index of HyperionInstanceManager
/// @params parent The parent hyperion instance
///
SettingsManager(const quint8& instance, QObject* parent = nullptr);
SettingsManager(quint8 instance, QObject* parent = nullptr);
///
/// @brief Save a complete json config
@@ -29,20 +29,20 @@ public:
/// @param correct If true will correct json against schema before save
/// @return True on success else false
///
bool saveSettings(QJsonObject config, const bool& correct = false);
bool saveSettings(QJsonObject config, bool correct = false);
///
/// @brief get a single setting json from config
/// @param type The settings::type from enum
/// @return The requested json data as QJsonDocument
///
const QJsonDocument getSetting(const settings::type& type);
QJsonDocument getSetting(settings::type type) const;
///
/// @brief get the full settings object of this instance (with global settings)
/// @return The requested json
///
const QJsonObject & getSettings() { return _qconfig; };
const QJsonObject & getSettings() const { return _qconfig; };
signals:
///
@@ -50,7 +50,7 @@ signals:
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
void settingsChanged(const settings::type& type, const QJsonDocument& data);
void settingsChanged(settings::type type, const QJsonDocument& data);
private:
///

View File

@@ -29,7 +29,7 @@ public:
/// @param The configuration
///
JsonServer(const QJsonDocument& config);
~JsonServer();
~JsonServer() override;
///
/// @return the port number on which this TCP listens for incoming connections
@@ -46,7 +46,7 @@ private slots:
///
/// Slot which is called when a client closes a connection
///
void closedConnection(void);
void closedConnection();
public slots:
///
@@ -54,7 +54,7 @@ public slots:
/// @param type settings type from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
private:
/// The TCP server object

View File

@@ -1,8 +1,8 @@
#ifndef LEDEVICEFACTORY_H
#define LEDEVICEFACTORY_H
// LedDevice includes
#include <leddevice/LedDevice.h>
class LedDevice;
class QJsonObject;
///
/// The LedDeviceFactory is responsible for constructing 'LedDevices'
@@ -10,7 +10,6 @@
class LedDeviceFactory
{
public:
///
/// Constructs a LedDevice based on the given configuration
///

View File

@@ -33,7 +33,7 @@ public:
/// @brief Get all available device schemas
/// @return device schemas
///
static const QJsonObject getLedDeviceSchemas();
static QJsonObject getLedDeviceSchemas();
///
/// @brief add all device constructors to the map
@@ -50,22 +50,22 @@ public:
/// @brief Get the current latch time of the ledDevice
/// @ return latch time in ms
///
int getLatchTime();
int getLatchTime() const;
///
/// @brief Get the current active ledDevice type
///
QString getActiveDeviceType();
QString getActiveDeviceType() const;
///
/// @brief Return the last enable state
///
bool enabled();
bool enabled() const;
///
/// @brief Get the current colorOrder from device
///
QString getColorOrder();
QString getColorOrder() const;
///
/// @brief Get the number of LEDs from device
@@ -78,7 +78,7 @@ public slots:
/// @param component The comp from enum
/// @param state The new state
///
void handleComponentState(const hyperion::Components component, const bool state);
void handleComponentState(hyperion::Components component, bool state);
signals:
///

View File

@@ -30,7 +30,7 @@ public slots:
/// @param type The type from enum
/// @param config The configuration
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
void initServer();

View File

@@ -7,7 +7,7 @@ class PythonInit
{
private:
friend class HyperionDaemon;
PythonInit();
~PythonInit();
};

View File

@@ -58,7 +58,7 @@ public:
/// @param timeout_ms The timeout in ms
/// @return The address+port of web-server or empty if timed out
///
const QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", const int &timeout_ms = 3000);
QString getFirstService(const searchType &type = searchType::STY_WEBSERVER,const QString &st = "urn:hyperion-project.org:device:basic:1", int timeout_ms = 3000);
///
/// @brief Discover services via ssdp.
@@ -89,13 +89,6 @@ public:
///
int discoverServices(const QString &searchTarget="ssdp:all", const QString &key="LOCATION");
///
/// @brief Get services discovered during discoverServices()
///
/// @return Map of discovered services
///
const QMap<QString, SSDPService> getServicesDiscovered () { return _services; }
///
/// @brief Get services discovered during discoverServices().
///
@@ -122,7 +115,7 @@ public:
///
/// @return Discovered services as JSON-document
///
QJsonArray getServicesDiscoveredJson();
QJsonArray getServicesDiscoveredJson() const;
///
/// @brief Set the ssdp discovery address (HOST)

View File

@@ -16,11 +16,12 @@ class QNetworkConfigurationManager;
/// UPnP 1.0: spec: http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.0.pdf
///
class SSDPHandler : public SSDPServer{
class SSDPHandler : public SSDPServer
{
Q_OBJECT
public:
SSDPHandler(WebServer* webserver, const quint16& flatBufPort, const quint16& jsonServerPort, const QString &name, QObject * parent = nullptr);
~SSDPHandler();
SSDPHandler(WebServer* webserver, quint16 flatBufPort, quint16 jsonServerPort, const QString &name, QObject * parent = nullptr);
~SSDPHandler() override;
///
/// @brief Sends BYE BYE and stop server
@@ -37,14 +38,14 @@ public slots:
/// @brief get state changes from webserver
/// @param newState true for started and false for stopped
///
void handleWebServerStateChange(const bool newState);
void handleWebServerStateChange(bool newState);
///
/// @brief Handle settings update from Hyperion Settingsmanager emit
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
private:
///
@@ -72,7 +73,7 @@ private:
/// @brief Send alive/byebye message based on _deviceList
/// @param alive When true send alive, else byebye
///
void sendAnnounceList(const bool alive);
void sendAnnounceList(bool alive);
private slots:
///
@@ -82,7 +83,7 @@ private slots:
/// @param address The ip of the caller
/// @param port The port of the caller
///
void handleMSearchRequest(const QString& target, const QString& mx, const QString address, const quint16 & port);
void handleMSearchRequest(const QString& target, const QString& mx, const QString address, quint16 port);
///
/// @brief Handle changes in the network configuration

View File

@@ -7,7 +7,8 @@ class QUdpSocket;
///
/// @brief The SSDP Server sends and receives (parses) SSDP requests
///
class SSDPServer : public QObject {
class SSDPServer : public QObject
{
Q_OBJECT
public:
@@ -17,7 +18,7 @@ public:
/// @param parent The parent object
///
SSDPServer(QObject* parent = nullptr);
virtual ~SSDPServer();
~SSDPServer() override;
///
/// @brief Prepare server after thread start
@@ -41,7 +42,7 @@ public:
/// @param senderIp Ip address of the sender
/// @param senderPort The port of the sender
///
void sendMSearchResponse(const QString& st, const QString& senderIp, const quint16& senderPort);
void sendMSearchResponse(const QString& st, const QString& senderIp, quint16 senderPort);
///
/// @brief Send ByeBye notification (on SSDP stop) (repeated 3 times)
@@ -76,22 +77,22 @@ public:
///
/// @brief set new flatbuffer server port
///
void setFlatBufPort(const quint16& port) { _fbsPort = QString::number(port); };
void setFlatBufPort(quint16 port) { _fbsPort = QString::number(port); };
///
/// @brief Get current flatbuffer server port
///
quint16 getFlatBufPort() { return _fbsPort.toInt(); };
quint16 getFlatBufPort() const { return _fbsPort.toInt(); };
///
/// @brief set new jsonserver server port
///
void setJsonServerPort(const quint16& port) { _jssPort = QString::number(port); };
void setJsonServerPort(quint16 port) { _jssPort = QString::number(port); };
///
/// @brief get new jsonserver server port
///
quint16 getJsonServerPort() { return _jssPort.toInt(); };
quint16 getJsonServerPort() const { return _jssPort.toInt(); };
///
/// @brief set new hyperion name
@@ -101,7 +102,7 @@ public:
///
/// @brief get hyperion name
///
QString getHyperionName() { return _name; };
QString getHyperionName() const { return _name; };
signals:
@@ -112,7 +113,7 @@ 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, const quint16 & port);
void msearchRequestReceived(const QString& target, const QString& mx, const QString address, quint16 port);
private:
Logger* _log;

View File

@@ -6,7 +6,6 @@
struct ColorArgb
{
/// The alpha mask channel
uint8_t alpha;
@@ -18,20 +17,19 @@ struct ColorArgb
uint8_t blue;
/// 'Black' RgbColor (255, 0, 0, 0)
static ColorArgb BLACK;
static const ColorArgb BLACK;
/// 'Red' RgbColor (255, 255, 0, 0)
static ColorArgb RED;
static const ColorArgb RED;
/// 'Green' RgbColor (255, 0, 255, 0)
static ColorArgb GREEN;
static const ColorArgb GREEN;
/// 'Blue' RgbColor (255, 0, 0, 255)
static ColorArgb BLUE;
static const ColorArgb BLUE;
/// 'Yellow' RgbColor (255, 255, 255, 0)
static ColorArgb YELLOW;
static const ColorArgb YELLOW;
/// 'White' RgbColor (255, 255, 255, 255)
static ColorArgb WHITE;
static const ColorArgb WHITE;
};
/// Assert to ensure that the size of the structure is 'only' 3 bytes
static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB");
@@ -44,6 +42,12 @@ static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB");
///
inline std::ostream& operator<<(std::ostream& os, const ColorArgb& color)
{
os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
os << "{"
<< color.alpha << ","
<< color.red << ","
<< color.green << ","
<< color.blue
<< "}";
return os;
}

View File

@@ -17,18 +17,19 @@ struct ColorBgr
/// The red color channel
uint8_t red;
/// 'Black' RgbColor (0, 0, 0)
static ColorBgr BLACK;
static const ColorBgr BLACK;
/// 'Red' RgbColor (255, 0, 0)
static ColorBgr RED;
static const ColorBgr RED;
/// 'Green' RgbColor (0, 255, 0)
static ColorBgr GREEN;
static const ColorBgr GREEN;
/// 'Blue' RgbColor (0, 0, 255)
static ColorBgr BLUE;
static const ColorBgr BLUE;
/// 'Yellow' RgbColor (255, 255, 0)
static ColorBgr YELLOW;
static const ColorBgr YELLOW;
/// 'White' RgbColor (255, 255, 255)
static ColorBgr WHITE;
static const ColorBgr WHITE;
};
/// Assert to ensure that the size of the structure is 'only' 3 bytes
@@ -43,19 +44,33 @@ static_assert(sizeof(ColorBgr) == 3, "Incorrect size of ColorBgr");
///
inline std::ostream& operator<<(std::ostream& os, const ColorBgr& color)
{
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
os << "{"
<< color.red << ","
<< color.green << ","
<< color.blue
<< "}";
return os;
}
/// Compare operator to check if a color is 'equal' to another color
inline bool operator==(const ColorBgr & lhs, const ColorBgr & rhs)
{
return (lhs.red == rhs.red) &&
(lhs.green == rhs.green) &&
(lhs.blue == rhs.blue);
}
/// Compare operator to check if a color is 'smaller' than another color
inline bool operator<(const ColorBgr & lhs, const ColorBgr & rhs)
{
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue);
return (lhs.red < rhs.red) &&
(lhs.green < rhs.green) &&
(lhs.blue < rhs.blue);
}
/// Compare operator to check if a color is 'smaller' than or 'equal' to another color
inline bool operator<=(const ColorBgr & lhs, const ColorBgr & rhs)
{
return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue);
return lhs < rhs || lhs == rhs;
}

View File

@@ -20,17 +20,17 @@ struct ColorRgb
uint8_t blue;
/// 'Black' RgbColor (0, 0, 0)
static ColorRgb BLACK;
static const ColorRgb BLACK;
/// 'Red' RgbColor (255, 0, 0)
static ColorRgb RED;
static const ColorRgb RED;
/// 'Green' RgbColor (0, 255, 0)
static ColorRgb GREEN;
static const ColorRgb GREEN;
/// 'Blue' RgbColor (0, 0, 255)
static ColorRgb BLUE;
static const ColorRgb BLUE;
/// 'Yellow' RgbColor (255, 255, 0)
static ColorRgb YELLOW;
static const ColorRgb YELLOW;
/// 'White' RgbColor (255, 255, 255)
static ColorRgb WHITE;
static const ColorRgb WHITE;
};
/// Assert to ensure that the size of the structure is 'only' 3 bytes
@@ -45,7 +45,12 @@ static_assert(sizeof(ColorRgb) == 3, "Incorrect size of ColorRgb");
///
inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
{
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
os << "{"
<< color.red << ","
<< color.green << ","
<< color.blue
<< "}";
return os;
}
@@ -58,30 +63,51 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
///
inline QTextStream& operator<<(QTextStream &os, const ColorRgb& color)
{
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
os << "{"
<< color.red << ","
<< color.green << ","
<< color.blue
<< "}";
return os;
}
/// Compare operator to check if a color is 'equal' to another color
inline bool operator==(const ColorRgb & lhs, const ColorRgb & rhs)
{
return lhs.red == rhs.red &&
lhs.green == rhs.green &&
lhs.blue == rhs.blue;
}
/// Compare operator to check if a color is 'smaller' than another color
inline bool operator<(const ColorRgb & lhs, const ColorRgb & rhs)
{
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue);
return lhs.red < rhs.red &&
lhs.green < rhs.green &&
lhs.blue < rhs.blue;
}
/// Compare operator to check if a color is 'not equal' to another color
inline bool operator!=(const ColorRgb & lhs, const ColorRgb & rhs)
{
return !(lhs == 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.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue);
return lhs < rhs || lhs == rhs;
}
/// Compare operator to check if a color is 'greater' to another color
inline bool operator>(const ColorRgb & lhs, const ColorRgb & rhs)
{
return (lhs.red > rhs.red) && (lhs.green > rhs.green) && (lhs.blue > rhs.blue);
return !(lhs < rhs) && lhs != rhs;
}
/// 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.red >= rhs.red) && (lhs.green >= rhs.green) && (lhs.blue >= rhs.blue);
return lhs > rhs || lhs == rhs;
}

View File

@@ -6,7 +6,6 @@
struct ColorRgba
{
/// The red color channel
uint8_t red;
/// The green color channel
@@ -18,20 +17,19 @@ struct ColorRgba
uint8_t alpha;
/// 'Black' RgbColor (0, 0, 0, 255)
static ColorRgba BLACK;
static const ColorRgba BLACK;
/// 'Red' RgbColor (255, 0, 0, 255)
static ColorRgba RED;
static const ColorRgba RED;
/// 'Green' RgbColor (0, 255, 0, 255)
static ColorRgba GREEN;
static const ColorRgba GREEN;
/// 'Blue' RgbColor (0, 0, 255, 255)
static ColorRgba BLUE;
static const ColorRgba BLUE;
/// 'Yellow' RgbColor (255, 255, 0, 255)
static ColorRgba YELLOW;
static const ColorRgba YELLOW;
/// 'White' RgbColor (255, 255, 255, 255
static ColorRgba WHITE;
static const ColorRgba WHITE;
};
/// Assert to ensure that the size of the structure is 'only' 3 bytes
static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB");
@@ -44,6 +42,12 @@ static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB");
///
inline std::ostream& operator<<(std::ostream& os, const ColorRgba& color)
{
os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
os << "{"
<< color.alpha << ","
<< color.red << ","
<< color.green << ","
<< color.blue
<< "}";
return os;
}

View File

@@ -20,17 +20,17 @@ struct ColorRgbw
uint8_t white;
/// 'Black' RgbColor (0, 0, 0, 0)
static ColorRgbw BLACK;
static const ColorRgbw BLACK;
/// 'Red' RgbColor (255, 0, 0, 0)
static ColorRgbw RED;
static const ColorRgbw RED;
/// 'Green' RgbColor (0, 255, 0, 0)
static ColorRgbw GREEN;
static const ColorRgbw GREEN;
/// 'Blue' RgbColor (0, 0, 255, 0)
static ColorRgbw BLUE;
static const ColorRgbw BLUE;
/// 'Yellow' RgbColor (255, 255, 0, 0)
static ColorRgbw YELLOW;
static const ColorRgbw YELLOW;
/// 'White' RgbColor (0, 0, 0, 255)
static ColorRgbw WHITE;
static const ColorRgbw WHITE;
};
/// Assert to ensure that the size of the structure is 'only' 4 bytes
@@ -45,19 +45,36 @@ static_assert(sizeof(ColorRgbw) == 4, "Incorrect size of ColorRgbw");
///
inline std::ostream& operator<<(std::ostream& os, const ColorRgbw& color)
{
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "," << unsigned(color.white) << "}";
os << "{"
<< color.red << ","
<< color.green << ","
<< color.blue << ","
<< color.white <<
"}";
return os;
}
/// Compare operator to check if a color is 'equal' than another color
inline bool operator==(const ColorRgbw & lhs, const ColorRgbw & rhs)
{
return lhs.red == rhs.red &&
lhs.green == rhs.green &&
lhs.blue == rhs.blue &&
lhs.white == rhs.white;
}
/// Compare operator to check if a color is 'smaller' than another color
inline bool operator<(const ColorRgbw & lhs, const ColorRgbw & rhs)
{
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue) && (lhs.white < rhs.white);
return lhs.red < rhs.red &&
lhs.green < rhs.green &&
lhs.blue < rhs.blue &&
lhs.white < rhs.white;
}
/// Compare operator to check if a color is 'smaller' than or 'equal' to another color
inline bool operator<=(const ColorRgbw & lhs, const ColorRgbw & rhs)
{
return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue) && (lhs.white < rhs.white);
return lhs < rhs || lhs == rhs;
}

View File

@@ -65,4 +65,15 @@ public:
/// number and scaled between 0 and 360
///
static void hsv2rgb(uint16_t hue, uint8_t saturation, uint8_t value, uint8_t & red, uint8_t & green, uint8_t & blue);
///
/// Translates a YUV (luminance, chrominance, chrominance) color to an RGB (red, green, blue) color
///
/// @param[in] y The luminance YUV-component
/// @param[in] u The chrominance YUV-component
/// @param[in] v The chrominance YUV-component
/// @param[out] red The red RGB-component
/// @param[out] green The green RGB-component
/// @param[out] blue The blue RGB-component
static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b);
};

View File

@@ -67,22 +67,22 @@ inline const char* componentToIdString(Components c)
}
}
inline Components stringToComponent(QString component)
inline Components stringToComponent(const QString& component)
{
component = component.toUpper();
if (component == "ALL") return COMP_ALL;
if (component == "SMOOTHING") return COMP_SMOOTHING;
if (component == "BLACKBORDER") return COMP_BLACKBORDER;
if (component == "FORWARDER") return COMP_FORWARDER;
if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
if (component == "GRABBER") return COMP_GRABBER;
if (component == "V4L") return COMP_V4L;
if (component == "COLOR") return COMP_COLOR;
if (component == "EFFECT") return COMP_EFFECT;
if (component == "IMAGE") return COMP_IMAGE;
if (component == "LEDDEVICE") return COMP_LEDDEVICE;
if (component == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
if (component == "PROTOSERVER") return COMP_PROTOSERVER;
const QString cmp = component.toUpper();
if (cmp == "ALL") return COMP_ALL;
if (cmp == "SMOOTHING") return COMP_SMOOTHING;
if (cmp == "BLACKBORDER") return COMP_BLACKBORDER;
if (cmp == "FORWARDER") return COMP_FORWARDER;
if (cmp == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
if (cmp == "GRABBER") return COMP_GRABBER;
if (cmp == "V4L") return COMP_V4L;
if (cmp == "COLOR") return COMP_COLOR;
if (cmp == "EFFECT") return COMP_EFFECT;
if (cmp == "IMAGE") return COMP_IMAGE;
if (cmp == "LEDDEVICE") return COMP_LEDDEVICE;
if (cmp == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
if (cmp == "PROTOSERVER") return COMP_PROTOSERVER;
return COMP_INVALID;
}

View File

@@ -10,8 +10,8 @@
namespace FileUtils {
QString getBaseName(QString sourceFile);
QString getDirName(QString sourceFile);
QString getBaseName(const QString& sourceFile);
QString getDirName(const QString& sourceFile);
///
/// @brief remove directory recursive given by path

View File

@@ -20,6 +20,7 @@ public:
static GlobalSignals instance;
return & instance;
}
private:
GlobalSignals() = default;
@@ -54,7 +55,7 @@ signals:
/// @param[in] owner Specific owner string, might be empty
/// @param[in] smooth_cfg The smooth id to use
///
void registerGlobalInput(const int priority, const hyperion::Components& component, const QString& origin = "External", const QString& owner = "", unsigned smooth_cfg = 0);
void registerGlobalInput(int priority, hyperion::Components component, const QString& origin = "External", const QString& owner = "", unsigned smooth_cfg = 0);
///
/// @brief PIPE the clear command for the global priority channel over HyperionDaemon to Hyperion class
@@ -70,7 +71,7 @@ signals:
/// @param[in] timeout_ms The timeout in milliseconds
/// @param clearEffect Should be true when NOT called from an effect
///
void setGlobalImage(const int priority, const Image<ColorRgb>& image, const int timeout_ms, const bool& clearEffect = true);
void setGlobalImage(int priority, const Image<ColorRgb>& image, int timeout_ms, bool clearEffect = true);
///
/// @brief PIPE external color message over HyperionDaemon to Hyperion class
@@ -80,7 +81,7 @@ signals:
/// @param[in] origin The setter
/// @param clearEffect Should be true when NOT called from an effect
///
void setGlobalColor(const int priority, const std::vector<ColorRgb> &ledColor, const int timeout_ms, const QString& origin = "External" ,bool clearEffects = true);
void setGlobalColor(int priority, const std::vector<ColorRgb> &ledColor, int timeout_ms, const QString& origin = "External" ,bool clearEffects = true);
///////////////////////////////////////
//////////// FROM HYPERION ////////////
@@ -98,6 +99,6 @@ signals:
/// @param hyperionInd The Hyperion instance index as identifier
/// @param listen True when listening, else false
///
void requestSource(const hyperion::Components& component, const int hyperionInd, const bool listen);
void requestSource(hyperion::Components component, int hyperionInd, bool listen);
};

View File

@@ -15,7 +15,7 @@ public:
{
}
Image(const unsigned width, const unsigned height) :
Image(unsigned width, unsigned height) :
Image(width, height, Pixel_T())
{
@@ -28,7 +28,7 @@ public:
/// @param height The height of the image
/// @param background The color of the image
///
Image(const unsigned width, const unsigned height, const Pixel_T background) :
Image(unsigned width, unsigned height, const Pixel_T background) :
_d_ptr(new ImageData<Pixel_T>(width, height, background))
{
}
@@ -93,12 +93,12 @@ public:
return _d_ptr->height();
}
uint8_t red(const unsigned pixel) const
uint8_t red(unsigned pixel) const
{
return _d_ptr->red(pixel);
}
uint8_t green(const unsigned pixel) const
uint8_t green(unsigned pixel) const
{
return _d_ptr->green(pixel);
}
@@ -111,7 +111,7 @@ public:
///
/// @return const reference to specified pixel
///
uint8_t blue(const unsigned pixel) const
uint8_t blue(unsigned pixel) const
{
return _d_ptr->blue(pixel);
}
@@ -121,7 +121,7 @@ public:
///
/// @param x The x index
/// @param y The y index
const Pixel_T& operator()(const unsigned x, const unsigned y) const
const Pixel_T& operator()(unsigned x, unsigned y) const
{
return _d_ptr->operator()(x, y);
}
@@ -129,7 +129,7 @@ public:
///
/// @return reference to specified pixel
///
Pixel_T& operator()(const unsigned x, const unsigned y)
Pixel_T& operator()(unsigned x, unsigned y)
{
return _d_ptr->operator()(x, y);
}
@@ -137,7 +137,7 @@ public:
/// Resize the image
/// @param width The width of the image
/// @param height The height of the image
void resize(const unsigned width, const unsigned height)
void resize(unsigned width, unsigned height)
{
_d_ptr->resize(width, height);
}
@@ -198,7 +198,7 @@ private:
///
/// @return The index into the underlying data-vector
///
inline unsigned toIndex(const unsigned x, const unsigned y) const
inline unsigned toIndex(unsigned x, unsigned y) const
{
return _d_ptr->toIndex(x, y);
}

View File

@@ -24,7 +24,7 @@ class ImageData : public QSharedData
public:
typedef Pixel_T pixel_type;
ImageData(const unsigned width, const unsigned height, const Pixel_T background) :
ImageData(unsigned width, unsigned height, const Pixel_T background) :
_width(width),
_height(height),
_pixels(new Pixel_T[width * height + 1])
@@ -84,32 +84,32 @@ public:
return _height;
}
uint8_t red(const unsigned pixel) const
uint8_t red(unsigned pixel) const
{
return (_pixels + pixel)->red;
}
uint8_t green(const unsigned pixel) const
uint8_t green(unsigned pixel) const
{
return (_pixels + pixel)->green;
}
uint8_t blue(const unsigned pixel) const
uint8_t blue(unsigned pixel) const
{
return (_pixels + pixel)->blue;
}
const Pixel_T& operator()(const unsigned x, const unsigned y) const
const Pixel_T& operator()(unsigned x, unsigned y) const
{
return _pixels[toIndex(x,y)];
}
Pixel_T& operator()(const unsigned x, const unsigned y)
Pixel_T& operator()(unsigned x, unsigned y)
{
return _pixels[toIndex(x,y)];
}
void resize(const unsigned width, const unsigned height)
void resize(unsigned width, unsigned height)
{
if (width == _width && height == _height)
return;
@@ -167,7 +167,7 @@ public:
}
private:
inline unsigned toIndex(const unsigned x, const unsigned y) const
inline unsigned toIndex(unsigned x, unsigned y) const
{
return y * _width + x;
}

View File

@@ -12,22 +12,11 @@ public:
~ImageResampler();
void setHorizontalPixelDecimation(int decimator);
void setVerticalPixelDecimation(int decimator);
void setCropping(int cropLeft,
int cropRight,
int cropTop,
int cropBottom);
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
void setVideoMode(VideoMode mode);
void processImage(const uint8_t * data, int width, int height, int lineLength, PixelFormat pixelFormat, Image<ColorRgb> & outputImage) const;
private:
static inline uint8_t clamp(int x);
static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b);
private:
int _horizontalDecimation;
int _verticalDecimation;
@@ -37,3 +26,4 @@ private:
int _cropBottom;
VideoMode _videoMode;
};

View File

@@ -5,7 +5,7 @@
#include <QJsonObject>
#include <utils/Logger.h>
namespace JsonUtils{
namespace JsonUtils {
///
/// @brief read a json file and get the parsed result on success
/// @param[in] path The file path to read

View File

@@ -67,7 +67,7 @@ public:
void Message(LogLevel level, const char* sourceFile, const char* func, unsigned int line, const char* fmt, ...);
void setMinLevel(LogLevel level) { _minLevel = static_cast<int>(level); }
LogLevel getMinLevel() { return static_cast<LogLevel>(int(_minLevel)); }
LogLevel getMinLevel() const { return static_cast<LogLevel>(int(_minLevel)); }
QString getName() const { return _name; }
QString getAppName() const { return _appname; }
@@ -76,7 +76,7 @@ signals:
protected:
Logger(const QString & name="", LogLevel minLevel = INFO);
~Logger();
~Logger() override;
private:
void write(const Logger::T_LOG_MESSAGE & message);

View File

@@ -42,7 +42,7 @@ private slots:
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
private:
Logger* _log;

View File

@@ -18,37 +18,37 @@ enum class PixelFormat {
NO_CHANGE
};
inline PixelFormat parsePixelFormat(QString pixelFormat)
inline PixelFormat parsePixelFormat(const QString& pixelFormat)
{
// convert to lower case
pixelFormat = pixelFormat.toLower();
QString format = pixelFormat.toLower();
if (pixelFormat.compare("yuyv") )
if (format.compare("yuyv") )
{
return PixelFormat::YUYV;
}
else if (pixelFormat.compare("uyvy") )
else if (format.compare("uyvy") )
{
return PixelFormat::UYVY;
}
else if (pixelFormat.compare("bgr16") )
else if (format.compare("bgr16") )
{
return PixelFormat::BGR16;
}
else if (pixelFormat.compare("bgr24") )
else if (format.compare("bgr24") )
{
return PixelFormat::BGR24;
}
else if (pixelFormat.compare("rgb32") )
else if (format.compare("rgb32") )
{
return PixelFormat::RGB32;
}
else if (pixelFormat.compare("bgr32") )
else if (format.compare("bgr32") )
{
return PixelFormat::BGR32;
}
#ifdef HAVE_JPEG_DECODER
else if (pixelFormat.compare("mjpeg") )
else if (format.compare("mjpeg") )
{
return PixelFormat::MJPEG;
}

View File

@@ -30,15 +30,14 @@ For more profiler function see the macros listed below
#define PROFILER_TIMER_GET(stopWatchName) Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__);
#define PROFILER_TIMER_GET_IF(condition, stopWatchName) { if (condition) {Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__);} }
class Profiler
{
public:
Profiler(const char* sourceFile, const char* func, unsigned int line);
~Profiler();
static void TimerStart(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
static void TimerGetTime(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
static void TimerStart(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line);
static void TimerGetTime(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line);
private:
static void initLogger();

View File

@@ -14,7 +14,6 @@ namespace RGBW {
WHITE_OFF
};
WhiteAlgorithm stringToWhiteAlgorithm(QString str);
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm);
WhiteAlgorithm stringToWhiteAlgorithm(const QString& str);
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, WhiteAlgorithm algorithm);
}

View File

@@ -5,7 +5,6 @@
class SysInfo : public QObject
{
public:
struct HyperionSysInfo
{

View File

@@ -12,16 +12,16 @@ enum class VideoMode
VIDEO_3DTAB
};
inline VideoMode parse3DMode(QString videoMode)
inline VideoMode parse3DMode(const QString& videoMode)
{
// convert to upper case
videoMode = videoMode.toUpper();
const QString vm = videoMode.toUpper();
if (videoMode == "3DTAB")
if (vm == "3DTAB")
{
return VideoMode::VIDEO_3DTAB;
}
else if (videoMode == "3DSBS")
else if (vm == "3DSBS")
{
return VideoMode::VIDEO_3DSBS;
}

View File

@@ -71,7 +71,7 @@ namespace hyperion {
return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, brightness, brightnessComp);
}
RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, const int defaultR, const int defaultG, const int defaultB)
RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, int defaultR, int defaultG, int defaultB)
{
const QJsonArray& channelConfig = colorConfig[channelName].toArray();
return RgbChannelAdjustment(
@@ -101,7 +101,7 @@ namespace hyperion {
return adjustment;
}
MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const QJsonObject & colorConfig)
MultiColorAdjustment * createLedColorsAdjustment(unsigned ledCnt, const QJsonObject & colorConfig)
{
// Create the result, the transforms are added to this
MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt);

View File

@@ -57,7 +57,7 @@ public:
///
/// @return A list of error messages
///
const QStringList & getMessages() const;
QStringList getMessages() const;
private:
///

View File

@@ -19,14 +19,14 @@ public:
{
if (path.first() == "[root]")
path.removeFirst();
for (QStringList::iterator it = path.begin(); it != path.end(); ++it)
{
QString current = *it;
if (current.left(1) == ".")
*it = current.mid(1, current.size()-1);
}
if (!value.isEmpty())
modifyValue(value, result, path, newValue, propertyName);
else if (newValue != QJsonValue::Null && !propertyName.isEmpty())
@@ -78,17 +78,17 @@ private:
{
QJsonObject result;
QJsonObject obj = schema.toObject();
if (obj.find("type") != obj.end() && obj.find("type").value().isString())
{
QJsonValue ret = QJsonValue::Null;
if (obj.find("type").value().toString() == "object" && ( obj.find("required").value().toBool() || ignoreRequired ) )
ret = createValue(obj["properties"], ignoreRequired);
else if (obj.find("type").value().toString() == "array" && ( obj.find("required").value().toBool() || ignoreRequired ) )
{
QJsonArray array;
if (obj.find("default") != obj.end())
ret = obj.find("default").value();
else
@@ -103,7 +103,7 @@ private:
else if ( obj.find("required").value().toBool() || ignoreRequired )
if (obj.find("default") != obj.end())
ret = obj.find("default").value();
return ret;
}
else
@@ -133,7 +133,7 @@ private:
{
QJsonValue retEmpty;
retEmpty = createValue(attributeValue.toObject()["items"], ignoreRequired);
if (!retEmpty.toObject().isEmpty())
array.append(retEmpty);
result[attribute] = array;
@@ -234,7 +234,7 @@ private:
subValue = newValue;
else
continue;
if (!subValue.toObject().isEmpty())
json_array.append(subValue);
else if (newValue != QJsonValue::Null && arrayLevel != -1)

View File

@@ -37,7 +37,7 @@ namespace settings {
/// @param type The settings::type from enum
/// @return The settings type as string
///
inline QString typeToString(const type& type)
inline QString typeToString(type type)
{
switch (type)
{

View File

@@ -28,11 +28,12 @@ openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
-subj /CN=hyperion-project.org
*/
class WebServer : public QObject {
class WebServer : public QObject
{
Q_OBJECT
public:
WebServer (const QJsonDocument& config, const bool& useSsl, QObject * parent = 0);
WebServer (const QJsonDocument& config, bool useSsl, QObject * parent = 0);
~WebServer () override;
@@ -44,12 +45,12 @@ signals:
/// @emits whenever server is started or stopped (to sync with SSDPHandler)
/// @param newState True when started, false when stopped
///
void stateChange(const bool newState);
void stateChange(bool newState);
///
/// @brief Emits whenever the port changes (doesn't compare prev <> now)
///
void portChanged(const quint16& port);
void portChanged(quint16 port);
public slots:
///
@@ -57,7 +58,7 @@ public slots:
///
void initServer();
void onServerStopped (void);
void onServerStopped ();
void onServerStarted (quint16 port);
void onServerError (QString msg);
@@ -66,7 +67,7 @@ public slots:
/// @param type settingyType from enum
/// @param config configuration object
///
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
///
/// @brief Set a new description, if empty the description is NotFound for clients